mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Fixed the remaining dramen tree inauthenticity, now provides reward after a single tick of cutting
This commit is contained in:
parent
9a7a885818
commit
78f1c58b4e
4 changed files with 68 additions and 63 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package content.global.skill.gather.woodcutting
|
package content.global.skill.gather.woodcutting
|
||||||
|
|
||||||
|
import content.data.Quests
|
||||||
import content.data.skill.SkillingTool
|
import content.data.skill.SkillingTool
|
||||||
import content.data.tables.BirdNest
|
import content.data.tables.BirdNest
|
||||||
import content.global.skill.farming.FarmingPatch.Companion.forObject
|
import content.global.skill.farming.FarmingPatch.Companion.forObject
|
||||||
|
|
@ -72,6 +73,17 @@ class WoodcuttingListener : InteractionListener {
|
||||||
|
|
||||||
if (clockReady(player, Clocks.SKILLING)) {
|
if (clockReady(player, Clocks.SKILLING)) {
|
||||||
animateWoodcutting(player)
|
animateWoodcutting(player)
|
||||||
|
|
||||||
|
if (resource == WoodcuttingNode.DRAMEN_TREE) {
|
||||||
|
// Reward after one chop and then abort chopping (this is authentic)
|
||||||
|
queueScript(player, 1, QueueStrength.STRONG) {
|
||||||
|
sendMessage(player, "You cut a branch from the Dramen tree.")
|
||||||
|
addItem(player, resource.getReward())
|
||||||
|
return@queueScript clearScripts(player)
|
||||||
|
}
|
||||||
|
return delayClock(player, Clocks.SKILLING, 1)
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkReward(player, resource, tool) && !getAttribute(player, "instachop", false))
|
if (!checkReward(player, resource, tool) && !getAttribute(player, "instachop", false))
|
||||||
return delayClock(player, Clocks.SKILLING, 3)
|
return delayClock(player, Clocks.SKILLING, 3)
|
||||||
|
|
||||||
|
|
@ -115,9 +127,7 @@ class WoodcuttingListener : InteractionListener {
|
||||||
player.getSkills().addExperience(Skills.WOODCUTTING, experience, true)
|
player.getSkills().addExperience(Skills.WOODCUTTING, experience, true)
|
||||||
|
|
||||||
//send the message for the resource reward
|
//send the message for the resource reward
|
||||||
if (resource == WoodcuttingNode.DRAMEN_TREE) {
|
if (reward == Items.BARK_3239 && rewardAmount == 0) {
|
||||||
player.packetDispatch.sendMessage("You cut a branch from the Dramen tree.")
|
|
||||||
} else if (reward == Items.BARK_3239 && rewardAmount == 0) {
|
|
||||||
player.packetDispatch.sendMessage("You chop away some bark, but it falls to pieces before you can pick it up.")
|
player.packetDispatch.sendMessage("You chop away some bark, but it falls to pieces before you can pick it up.")
|
||||||
} else {
|
} else {
|
||||||
player.packetDispatch.sendMessage("You get some " + ItemDefinition.forId(reward).name.lowercase(Locale.getDefault()) + ".")
|
player.packetDispatch.sendMessage("You get some " + ItemDefinition.forId(reward).name.lowercase(Locale.getDefault()) + ".")
|
||||||
|
|
@ -229,6 +239,10 @@ class WoodcuttingListener : InteractionListener {
|
||||||
player.packetDispatch.sendMessage("You do not have an axe to use.")
|
player.packetDispatch.sendMessage("You do not have an axe to use.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (node.id == org.rs09.consts.Scenery.DRAMEN_TREE_1292 && getQuestStage(player, Quests.LOST_CITY) <= 20) {
|
||||||
|
//TODO: find out if there is any authentic message to be shown
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (player.inventory.freeSlots() < 1 && node.isActive) {
|
if (player.inventory.freeSlots() < 1 && node.isActive) {
|
||||||
player.sendMessage("Your inventory is too full to hold any more " + ItemDefinition.forId(resource.getReward()).name.lowercase(Locale.getDefault()) + ".")
|
player.sendMessage("Your inventory is too full to hold any more " + ItemDefinition.forId(resource.getReward()).name.lowercase(Locale.getDefault()) + ".")
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -162,13 +162,8 @@ public class WoodcuttingSkillPulse extends Pulse {
|
||||||
|
|
||||||
player.getSkills().addExperience(Skills.WOODCUTTING, experience, true);
|
player.getSkills().addExperience(Skills.WOODCUTTING, experience, true);
|
||||||
|
|
||||||
//send the message for the resource reward, and in the case of the dramen tree, authentically abort the chopping action
|
//send the message for the resource reward
|
||||||
if (resource == WoodcuttingNode.DRAMEN_TREE) {
|
player.getPacketDispatch().sendMessage("You get some " + ItemDefinition.forId(reward).getName().toLowerCase() + ".");
|
||||||
player.getPacketDispatch().sendMessage("You cut a branch from the Dramen tree.");
|
|
||||||
stop();
|
|
||||||
} else {
|
|
||||||
player.getPacketDispatch().sendMessage("You get some " + ItemDefinition.forId(reward).getName().toLowerCase() + ".");
|
|
||||||
}
|
|
||||||
//give the reward
|
//give the reward
|
||||||
player.getInventory().add(new Item(reward, rewardAmount));
|
player.getInventory().add(new Item(reward, rewardAmount));
|
||||||
player.dispatch(new ResourceProducedEvent(reward, rewardAmount, node, -1));
|
player.dispatch(new ResourceProducedEvent(reward, rewardAmount, node, -1));
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
package content.region.misthalin.lumbridge.quest.lostcity
|
|
||||||
|
|
||||||
import core.game.node.scenery.Scenery
|
|
||||||
import content.data.skill.SkillingTool
|
|
||||||
import content.global.skill.gather.woodcutting.WoodcuttingSkillPulse
|
|
||||||
import core.game.world.map.Location
|
|
||||||
import org.rs09.consts.NPCs
|
|
||||||
import org.rs09.consts.Scenery as Sceneries
|
|
||||||
import core.game.interaction.InteractionListener
|
|
||||||
import core.api.getQuestStage
|
|
||||||
import core.api.sendMessage
|
|
||||||
import core.game.interaction.IntType
|
|
||||||
import content.data.Quests
|
|
||||||
|
|
||||||
class DramenTreeListener : InteractionListener {
|
|
||||||
|
|
||||||
override fun defineListeners() {
|
|
||||||
|
|
||||||
on(Sceneries.DRAMEN_TREE_1292, IntType.SCENERY, "chop down"){ player, node ->
|
|
||||||
val questStage = getQuestStage(player,Quests.LOST_CITY)
|
|
||||||
if (SkillingTool.getHatchet(player) == null) {
|
|
||||||
sendMessage(player,"You do not have an axe which you have the level to use.")
|
|
||||||
return@on true
|
|
||||||
}
|
|
||||||
if (questStage < 20) {
|
|
||||||
return@on true
|
|
||||||
}
|
|
||||||
if (questStage == 20) {
|
|
||||||
if (player.getAttribute("treeSpawned", false)) {
|
|
||||||
return@on true
|
|
||||||
}
|
|
||||||
val spirit = TreeSpiritNPC(NPCs.TREE_SPIRIT_655, Location(2862, 9734, 0))
|
|
||||||
spirit.target = player
|
|
||||||
spirit.init()
|
|
||||||
spirit.attack(player)
|
|
||||||
player.setAttribute("treeSpawned", true)
|
|
||||||
spirit.sendChat("You must defeat me before touching the tree!")
|
|
||||||
return@on true
|
|
||||||
}
|
|
||||||
|
|
||||||
player.pulseManager.run(WoodcuttingSkillPulse(player, node as Scenery))
|
|
||||||
return@on true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,29 @@
|
||||||
package content.region.misthalin.lumbridge.quest.lostcity
|
package content.region.misthalin.lumbridge.quest.lostcity
|
||||||
|
|
||||||
|
import core.api.Event
|
||||||
|
import core.api.LoginListener
|
||||||
|
import core.api.clearScripts
|
||||||
|
import core.api.getQuestStage
|
||||||
|
import core.game.event.EventHook
|
||||||
|
import core.game.event.InteractionEvent
|
||||||
|
import core.game.node.entity.Entity
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.player.link.quest.Quest
|
import core.game.node.entity.player.link.quest.Quest
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
|
import core.game.world.map.Location
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import content.data.Quests
|
import content.data.Quests
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LostCity class for the Lost City quest
|
* LostCity class for the Lost City quest
|
||||||
* @author lila
|
* @author lila, Vexia, Aero, Player Name
|
||||||
* @author Vexia
|
|
||||||
* @author Aero
|
|
||||||
*/
|
*/
|
||||||
@Initializable
|
@Initializable
|
||||||
class LostCity : Quest(Quests.LOST_CITY, 83, 82, 3, 147, 0, 1, 6) {
|
class LostCity : Quest(Quests.LOST_CITY, 83, 82, 3, 147, 0, 1, 6), LoginListener {
|
||||||
|
|
||||||
class SkillRequirement(val skill: Int?, val level: Int?)
|
class SkillRequirement(val skill: Int?, val level: Int?)
|
||||||
|
|
||||||
val requirements = arrayListOf<SkillRequirement>()
|
val requirements = arrayListOf<SkillRequirement>()
|
||||||
|
|
@ -67,6 +74,42 @@ class LostCity : Quest(Quests.LOST_CITY, 83, 82, 3, 147, 0, 1, 6) {
|
||||||
line(player, BLUE + "and be able to defeat a " + RED + "Level 101 Spirit without weapons", line++)
|
line(player, BLUE + "and be able to defeat a " + RED + "Level 101 Spirit without weapons", line++)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val DramenTreeHook = object : EventHook<InteractionEvent> {
|
||||||
|
override fun process(entity: Entity, event: InteractionEvent) {
|
||||||
|
if (event.target.id == Scenery.DRAMEN_TREE_1292 && event.option == "chop down") {
|
||||||
|
val player = entity as Player
|
||||||
|
val questStage = getQuestStage(player, Quests.LOST_CITY)
|
||||||
|
if (questStage == 20) {
|
||||||
|
if (player.getAttribute("treeSpawned", false)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val spirit = TreeSpiritNPC(NPCs.TREE_SPIRIT_655, Location(2862, 9734, 0))
|
||||||
|
spirit.target = player
|
||||||
|
spirit.init()
|
||||||
|
spirit.attack(player)
|
||||||
|
player.setAttribute("treeSpawned", true)
|
||||||
|
spirit.sendChat("You must defeat me before touching the tree!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setStage(player: Player, stage: Int) {
|
||||||
|
super.setStage(player, stage)
|
||||||
|
if (stage <= 20) {
|
||||||
|
player.hook(Event.Interacted, DramenTreeHook)
|
||||||
|
}
|
||||||
|
if (stage == 21) {
|
||||||
|
player.unhook(DramenTreeHook)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun login(player: Player) {
|
||||||
|
if (getQuestStage(player, Quests.LOST_CITY) <= 20) {
|
||||||
|
player.hook(Event.Interacted, DramenTreeHook)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun newInstance(`object`: Any?): Quest {
|
override fun newInstance(`object`: Any?): Quest {
|
||||||
requirements.add(SkillRequirement(Skills.WOODCUTTING, 36))
|
requirements.add(SkillRequirement(Skills.WOODCUTTING, 36))
|
||||||
requirements.add(SkillRequirement(Skills.CRAFTING, 31))
|
requirements.add(SkillRequirement(Skills.CRAFTING, 31))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue