Code:
package server.model.players.packets;
import server.model.players.Client;
import server.model.players.PacketType;
/**
* Clicking an item, bury bone, eat food etc
**/
public class ClickItem implements PacketType {
@Override
public void processPacket(Client c, int packetType, int packetSize) {
int itemSlot = c.getInStream().readUnsignedWordA();
int itemId = c.getInStream().readUnsignedWordBigEndian();
if (itemId != c.playerItems[itemSlot] - 1) {
return;
}
if (itemId >= 5509 && itemId <= 5514) {
int pouch = -1;
int a = itemId;
if (a == 5509)
pouch = 0;
if (a == 5510)
pouch = 1;
if (a == 5512)
pouch = 2;
if (a == 5514)
pouch = 3;
c.getPA().fillPouch(pouch);
return;
}
if (c.getHerblore().isUnidHerb(itemId))
c.getHerblore().handleHerbClick(itemId);
if (c.getFood().isFood(itemId))
c.getFood().eat(itemId,itemSlot);
//ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
if (c.getPotions().isPotion(itemId))
c.getPotions().handlePotion(itemId,itemSlot);
if (c.getPrayer().isBone(itemId))
c.getPrayer().buryBone(itemId, itemSlot);
if (itemId == 15272) {
if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.playerLevel[3] > 0) {
c.getCombat().resetPlayerAttack();
c.attackTimer += 2;
c.startAnimation(829);
c.getItems().deleteItem(15272, 1);
if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
c.playerLevel[3] += 23;
if (c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])*1.11 + 1)) {
c.playerLevel[3] = (int)(c.getLevelForXP(c.playerXP[3])*1.11);
}
c.getPA().refreshSkill(3);
c.foodDelay = System.currentTimeMillis();
c.sendMessage("You eat the Rocktail.");
}
c.getPA().refreshSkill(3);
return;
}
}
if (itemId == 952) {
if(c.inArea(3553, 3301, 3561, 3294)) {
c.teleTimer = 3;
c.newLocation = 1;
} else if(c.inArea(3550, 3287, 3557, 3278)) {
c.teleTimer = 3;
c.newLocation = 2;
} else if(c.inArea(3561, 3292, 3568, 3285)) {
c.teleTimer = 3;
c.newLocation = 3;
} else if(c.inArea(3570, 3302, 3579, 3293)) {
c.teleTimer = 3;
c.newLocation = 4;
} else if(c.inArea(3571, 3285, 3582, 3278)) {
c.teleTimer = 3;
c.newLocation = 5;
} else if(c.inArea(3562, 3279, 3569, 3273)) {
c.teleTimer = 3;
c.newLocation = 6;
}
}
}
}