From e2c675c392c0421ae45a9fbd8ba012490b03814b Mon Sep 17 00:00:00 2001 From: Mr Extremez Date: Tue, 14 Jan 2020 06:28:34 -0600 Subject: [PATCH] Woodcutting animation fix (#363) - Shouldn't copy other players anim anymore if more than 1 person is woodcutting closes #173 --- .../game/content/skills/core/Woodcutting.java | 20 +++++++++---------- .../src/com/rebotted/game/players/Player.java | 8 ++++---- .../src/com/rebotted/net/PacketSender.java | 2 +- .../rebotted/net/packets/impl/Walking.java | 4 ++-- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/2006Redone Server/src/com/rebotted/game/content/skills/core/Woodcutting.java b/2006Redone Server/src/com/rebotted/game/content/skills/core/Woodcutting.java index d9f55b19..f1522261 100644 --- a/2006Redone Server/src/com/rebotted/game/content/skills/core/Woodcutting.java +++ b/2006Redone Server/src/com/rebotted/game/content/skills/core/Woodcutting.java @@ -100,16 +100,14 @@ public class Woodcutting { { 492, 512, 1353 }, { 492, 514, 1361 }, { 492, 516, 1355 }, { 492, 518, 1357 }, { 492, 520, 1359 }, }; - private static int a = -1; - public static void repeatAnimation(final Player p) { CycleEventHandler.getSingleton().addEvent(p, new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (p.isWoodcutting) { - if ((a >= 0) && (a < Axe_Settings.length)) { + if ((p.axeAnimation >= 0) && (p.axeAnimation < Axe_Settings.length)) { try { - p.startAnimation(Axe_Settings[a][3]); + p.startAnimation(Axe_Settings[p.axeAnimation][3]); } catch (ArrayIndexOutOfBoundsException exception) { System.out.println("LOL this happend again: " + exception); } @@ -243,7 +241,7 @@ public class Woodcutting { return; } int wcLevel = p.playerLevel[8]; - a = -1; + p.axeAnimation = -1; treeData tree = treeData.getTree(objectId); p.turnPlayerTo(x, y); if (tree.getLevelReq() > wcLevel) { @@ -253,11 +251,11 @@ public class Woodcutting { for (int i = 0; i < Axe_Settings.length; i++) { if (p.getItemAssistant().playerHasItem(Axe_Settings[i][0]) || p.playerEquipment[p.playerWeapon] == Axe_Settings[i][0]) { if (Axe_Settings[i][1] <= wcLevel) { - a = i; + p.axeAnimation = i; } } } - if (a == -1) { + if (p.axeAnimation == -1) { p.getPacketSender().sendMessage("You need an axe to cut this tree."); return; } @@ -270,7 +268,7 @@ public class Woodcutting { p.getPacketSender().sendMessage("You are already woodcutting!"); return; } - p.startAnimation(Axe_Settings[a][3]); + p.startAnimation(Axe_Settings[p.axeAnimation][3]); p.isWoodcutting = true; p.getPacketSender().sendSound(SoundList.TREE_CUT_BEGIN, 100, 0); repeatAnimation(p); @@ -292,7 +290,7 @@ public class Woodcutting { @Override public void execute(CycleEventContainer container) { - if (a <= -1) + if (p.axeAnimation <= -1) { container.stop(); return; @@ -306,7 +304,7 @@ public class Woodcutting { return; } if (p.isWoodcutting) { - p.startAnimation(Axe_Settings[a][3]); + p.startAnimation(Axe_Settings[p.axeAnimation][3]); } if (p.getItemAssistant().freeSlots() < 1) { p.getPacketSender().sendMessage("You have ran out of inventory slots."); @@ -346,7 +344,7 @@ public class Woodcutting { p.treeX = 0; p.treeY = 0; } - }, getTimer(tree, a, wcLevel)); + }, getTimer(tree, p.axeAnimation, wcLevel)); } } diff --git a/2006Redone Server/src/com/rebotted/game/players/Player.java b/2006Redone Server/src/com/rebotted/game/players/Player.java index 9dea678a..e38f1f34 100644 --- a/2006Redone Server/src/com/rebotted/game/players/Player.java +++ b/2006Redone Server/src/com/rebotted/game/players/Player.java @@ -76,7 +76,6 @@ import com.rebotted.util.Stream; import com.rebotted.world.ObjectManager; public abstract class Player { - public byte buffer[] = null; public Stream inStream = null, outStream = null; @@ -621,7 +620,8 @@ public abstract class Player { public int packetSize = 0, packetType = -1; - public boolean WildernessWarning = false; + public boolean wildernessWarning = false; + public int axeAnimation = -1; public void antiFirePotion() { CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() { @@ -1742,9 +1742,9 @@ public abstract class Player { return true; } if (absX > 2941 && absX < 3392 && absY > 3518 && absY < 3966 || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366) { - if (!WildernessWarning) { + if (!wildernessWarning) { resetWalkingQueue(); - WildernessWarning = true; + wildernessWarning = true; getPacketSender().sendFrame126("WARNING!", 6940); getPacketSender().showInterface(1908); } diff --git a/2006Redone Server/src/com/rebotted/net/PacketSender.java b/2006Redone Server/src/com/rebotted/net/PacketSender.java index 651ff28b..be9353e7 100644 --- a/2006Redone Server/src/com/rebotted/net/PacketSender.java +++ b/2006Redone Server/src/com/rebotted/net/PacketSender.java @@ -96,7 +96,7 @@ public class PacketSender { player.lastY = player.absY; player.lastH = player.heightLevel; if (player.inWild()) { - player.WildernessWarning = true; + player.wildernessWarning = true; } if (player.splitChat) { player.getPacketSender().sendConfig(502, 1); diff --git a/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java b/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java index 11da38d5..914d9a2d 100644 --- a/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java +++ b/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java @@ -133,9 +133,9 @@ public class Walking implements PacketType { player.mageAllowed = true; } - if (!player.WildernessWarning && player.wildLevel > 0) { + if (!player.wildernessWarning && player.wildLevel > 0) { player.resetWalkingQueue(); - player.WildernessWarning = true; + player.wildernessWarning = true; player.getPacketSender().sendFrame126("WARNING!", 6940); player.getPacketSender().showInterface(1908); }