mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-02 16:49:03 +00:00
Woodcutting animation fix (#363)
- Shouldn't copy other players anim anymore if more than 1 person is woodcutting closes #173
This commit is contained in:
committed by
Daniel Ginovker
parent
eafe99af0a
commit
e2c675c392
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user