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
|
||||
|
||||
import content.data.Quests
|
||||
import content.data.skill.SkillingTool
|
||||
import content.data.tables.BirdNest
|
||||
import content.global.skill.farming.FarmingPatch.Companion.forObject
|
||||
|
|
@ -72,6 +73,17 @@ class WoodcuttingListener : InteractionListener {
|
|||
|
||||
if (clockReady(player, Clocks.SKILLING)) {
|
||||
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))
|
||||
return delayClock(player, Clocks.SKILLING, 3)
|
||||
|
||||
|
|
@ -115,9 +127,7 @@ class WoodcuttingListener : InteractionListener {
|
|||
player.getSkills().addExperience(Skills.WOODCUTTING, experience, true)
|
||||
|
||||
//send the message for the resource reward
|
||||
if (resource == WoodcuttingNode.DRAMEN_TREE) {
|
||||
player.packetDispatch.sendMessage("You cut a branch from the Dramen tree.")
|
||||
} else if (reward == Items.BARK_3239 && rewardAmount == 0) {
|
||||
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.")
|
||||
} else {
|
||||
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.")
|
||||
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) {
|
||||
player.sendMessage("Your inventory is too full to hold any more " + ItemDefinition.forId(resource.getReward()).name.lowercase(Locale.getDefault()) + ".")
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -162,13 +162,8 @@ public class WoodcuttingSkillPulse extends Pulse {
|
|||
|
||||
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
|
||||
if (resource == WoodcuttingNode.DRAMEN_TREE) {
|
||||
player.getPacketDispatch().sendMessage("You cut a branch from the Dramen tree.");
|
||||
stop();
|
||||
} else {
|
||||
player.getPacketDispatch().sendMessage("You get some " + ItemDefinition.forId(reward).getName().toLowerCase() + ".");
|
||||
}
|
||||
//send the message for the resource reward
|
||||
player.getPacketDispatch().sendMessage("You get some " + ItemDefinition.forId(reward).getName().toLowerCase() + ".");
|
||||
//give the reward
|
||||
player.getInventory().add(new Item(reward, rewardAmount));
|
||||
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
|
||||
|
||||
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.link.quest.Quest
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import content.data.Quests
|
||||
import org.rs09.consts.NPCs
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
/**
|
||||
* LostCity class for the Lost City quest
|
||||
* @author lila
|
||||
* @author Vexia
|
||||
* @author Aero
|
||||
* @author lila, Vexia, Aero, Player Name
|
||||
*/
|
||||
@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?)
|
||||
|
||||
val requirements = arrayListOf<SkillRequirement>()
|
||||
|
|
@ -67,9 +74,45 @@ 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++)
|
||||
}
|
||||
|
||||
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 {
|
||||
requirements.add(SkillRequirement(Skills.WOODCUTTING, 36))
|
||||
requirements.add(SkillRequirement(Skills.CRAFTING, 31))
|
||||
return this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue