From 9c7cb13a064d7064c994b4c8ff36250b05f0eca9 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sun, 27 Mar 2022 04:57:23 +0000 Subject: [PATCH] Corrected tree felling mechanics (now 1 in 8 chance for a tree to fall per log) Moved the diary check in woodcutting out to the diary events hook Corrected the woodcutting animation to not reset/interrupt itself --- .../gather/woodcutting/WoodcuttingSkillPulse.java | 14 +++++--------- .../entity/player/link/diary/DiaryEventHook.kt | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Server/src/main/java/core/game/node/entity/skill/gather/woodcutting/WoodcuttingSkillPulse.java b/Server/src/main/java/core/game/node/entity/skill/gather/woodcutting/WoodcuttingSkillPulse.java index 83108b8ef..d0c1944b6 100644 --- a/Server/src/main/java/core/game/node/entity/skill/gather/woodcutting/WoodcuttingSkillPulse.java +++ b/Server/src/main/java/core/game/node/entity/skill/gather/woodcutting/WoodcuttingSkillPulse.java @@ -99,7 +99,7 @@ public class WoodcuttingSkillPulse extends Pulse { } public void animate() { - player.animate(SkillingTool.getHatchet(player).getAnimation()); + if(!player.getAnimator().isAnimating()) player.animate(SkillingTool.getHatchet(player).getAnimation()); } public boolean reward() { @@ -169,21 +169,17 @@ public class WoodcuttingSkillPulse extends Pulse { } //transform to depleted version + //OSRS and RS3 Wikis both agree: All trees present in 2009 are a 1/8 fell chance, aside from normal trees/dead trees which are 100% + //OSRS: https://oldschool.runescape.wiki/w/Woodcutting scroll down to the mechanics section + //RS3 : https://runescape.wiki/w/Woodcutting scroll down to the mechanics section, and expand the tree felling chances table if (resource.getRespawnRate() != 0) { - int charge = 1000 / resource.getRewardAmount(); - node.setCharge(node.getCharge() - RandomFunction.random(charge, charge << 2)); - if (node.getCharge() < 1) { - node.setCharge(1000); + if (RandomFunction.roll(8) || resource.identifier == 1 || resource.identifier == 2) { if (resource.isFarming()) { FarmingPatch fPatch = FarmingPatch.forObject(node.asScenery()); if(fPatch != null) { Patch patch = fPatch.getPatchFor(player); patch.setCurrentState(patch.getCurrentState() + 1); } - if(resource.getId() == 8513 && player.getLocation().getRegionId() == 11828){ - //Chop down a yew tree you grew in falador park - player.getAchievementDiaryManager().finishTask(player,DiaryType.FALADOR,2,3); - } return true; } if (resource.getEmptyId() > -1) { diff --git a/Server/src/main/kotlin/rs09/game/node/entity/player/link/diary/DiaryEventHook.kt b/Server/src/main/kotlin/rs09/game/node/entity/player/link/diary/DiaryEventHook.kt index 455ef2620..a88022493 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/player/link/diary/DiaryEventHook.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/player/link/diary/DiaryEventHook.kt @@ -144,14 +144,14 @@ class DiaryEventHook : LoginListener if(getAttribute(entity, "diary:seers:shark-caught", 0) >= 5) finishTask(entity, DiaryType.SEERS_VILLAGE, 2, 7) - if(getAttribute(entity, "diary:seers:shark-cooked", 0) >= 5) - finishTask(entity, DiaryType.SEERS_VILLAGE, 2, 8) if((regionId == 12593 || regionId == 12849) && event.source.name.startsWith("dead", true)) finishTask(entity, DiaryType.LUMBRIDGE, 1, 8) - if(event.source.id == NPCs.FISHING_SPOT_333 && entity.zoneMonitor.isInZone("karamja")) + if(event.source.id == 333 && entity.zoneMonitor.isInZone("karamja")) finishTask(entity, DiaryType.KARAMJA, 0, 6) + if(event.source.id == Scenery.YEW_TREE_8513 && regionId == 11828) + finishTask(entity, DiaryType.FALADOR, 2, 3) if(event.source.id == Scenery.COOKING_RANGE_114 && regionId == 12850) finishTask(entity, DiaryType.LUMBRIDGE, 0, 7) }