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
This commit is contained in:
Ceikry 2022-03-27 04:57:23 +00:00 committed by ceikry
parent 77cccfb764
commit 9c7cb13a06
2 changed files with 8 additions and 12 deletions

View file

@ -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) {

View file

@ -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)
}