Can anyone help me with this? I having problem with npc drop on slayer tower.
When 1 player standing on slayer tower height 1 (Floor 2) and 2nd player standing on height 2 (Floor 3). The 1st player killing npc. like 30 sec player 2 height 2(Floor 3) receive a player 1 height 1 (Floor 2) drop.
Here is my drop method on NpcHandler.java
Code:
public void dropItems(int i) {
Player c = (Player)PlayerHandler.players[npcs[i].killedBy];
if(c != null) {
Godwars.giveKillcount(c, npcs[i].npcType);
if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
c.getVariables().magePoints += 1;
if (NPCDrops.constantDrops.get(npcs[i].npcType) != null) {
for (final int item : NPCDrops.constantDrops
.get(npcs[i].npcType)) {
ItemHandler.createGroundItem(c, item, npcs[i].absX,
npcs[i].absY, npcs[i].heightLevel, 1, c.playerId);
}
}
if (NPCDrops.dropRarity.get(npcs[i].npcType) != null) {
try {
int random = Misc.random(NPCDrops.rareDrops.get(npcs[i].npcType).length-1);
int item = 0;
int amount = 0;
if (rareDrops(i)) {
item = NPCDrops.rareDrops.get(npcs[i].npcType)[random][0];
amount = NPCDrops.rareDrops.get(npcs[i].npcType)[random][1];
} else {
random = Misc.random(NPCDrops.normalDrops
.get(npcs[i].npcType).length-1);
item = NPCDrops.normalDrops.get(npcs[i].npcType)[random][0];
amount = NPCDrops.normalDrops.get(npcs[i].npcType)[random][1];
}
if (c.getVariables().clanId > -1
&& c.getShops().getItemShopValue(item) * amount > 5000) {
if (GameEngine.clanChat.clans[c.getVariables().clanId].lootshare == 1 || GameEngine.clanChat.clans[c.getVariables().clanId].lootshare == 2) {
GameEngine.clanChat.handleShare(c, item, amount,
npcs[i].absX, npcs[i].absY, npcs[i].heightLevel, GameEngine.clanChat.clans[c.getVariables().clanId].lootshare == 1 ? false : true);
return;
}
}
ItemHandler.createGroundItem(c, item, npcs[i].absX,
npcs[i].absY, npcs[i].heightLevel, amount, c.playerId);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Code:
public static void createGroundItem(Player c, int itemId, int itemX, int itemY, int height, int itemAmount, int playerId) {
if(c == null)
return;
if(GameEngine.playerHandler.players[playerId] == null)
return;
if(itemId > 0) {
if (itemId >= 2412 && itemId <= 2414) {
c.sendMessage("The item vanishes as it touches the ground.");
return;
}
if (itemId == 10033 || itemId == 10034) {
return;
}
if (itemId > 4705 && itemId < 4760) {
for (int[] brokenBarrow : brokenBarrows) {
if (brokenBarrow[0] == itemId) {
itemId = brokenBarrow[1];
break;
}
}
}
Region r = Region.getRegion(itemX, itemY);
if(r == null)
return;
GroundItem item = new GroundItem(itemId, itemX, itemY, height, itemAmount, c.playerId, (c.party != null && c.party.floor != null) ? 0 : HIDE_TICKS, GameEngine.playerHandler.players[playerId].playerName, (c.party != null && c.party.floor != null) ? true : false);
createGroundItem(c, item, r);
r.startItemProcess();
}
}