Anyone
|
Hey guys,
Something probably easy as hell but I can't seem allow players to drop items.
I guess I should fix that, they can drop items but they won't appear for other players.
Here is my dropItem
EDIT: I've replaced my dropitem about 5 times with 5 different ones, and still no difference.
Code:package server.model.players.packets; import server.Config; import server.Server; import server.model.players.Client; import server.model.players.PacketType; import server.model.players.PlayerSave; import server.model.players.Binding; /** * Drop Item **/ public class DropItem implements PacketType { @Override public void processPacket(Client c, int packetType, int packetSize) { int itemId = c.getInStream().readUnsignedWordA(); c.getInStream().readUnsignedByte(); c.getInStream().readUnsignedByte(); int slot = c.getInStream().readUnsignedWordA(); if(c.inTrade) { c.sendMessage("You can't drop items while trading!"); return; } if(c.isDead) { c.sendMessage("You can't drop items when you are dead."); return; } /*if(c.newPlayer()) { c.getTimeLeftForNP(); return; } */ boolean droppable = true; for (int i : Config.UNDROPPABLE_ITEMS) { if (i == itemId) { droppable = false; break; } } boolean destroyable = false; for (int i : Config.DESTROYABLES) { if (i == itemId) { destroyable = true; break; } } if(c.playerItemsN[slot] != 0 && itemId != -1 && c.playerItems[slot] == itemId + 1) { if (destroyable) { c.getPA().destroyInterface(itemId); return; } if(droppable) { for(int i = 0; i < Binding.bindedItem.length; i++) { if (itemId == Binding.bindedItem[i]) { c.droppedItem = itemId; c.getPA().destroyBindInterface(itemId); c.destroy = 1; return; } } if (c.underAttackBy > 0) { if (c.getShops().getItemShopValue(itemId) > 1000) { c.sendMessage("You may not drop items worth more than 1000 while in combat."); return; } } Server.itemHandler.createGroundItem(c, itemId, c.getX(), c.getY(), c.playerItemsN[slot], c.getId()); c.getItems().deleteItem(itemId, slot, c.playerItemsN[slot]); if(Config.SOUND){ c.sendSound(c.getSound().DROPITEM); } PlayerSave.saveGame(c); } else c.sendMessage("This item cannot be dropped."); } c.getPA().closeAllWindows(); } }
Anyone
The reason it doesn't appear for other could be in your createGroundtem maybe?
EDIT: probably something in this is wrong
Code:if (!Item.isStackable(itemId) && itemAmount > 0) { for (int j = 0; j < itemAmount; j++) { c.getItems().createGroundItem(itemId, itemX, itemY, 1); GroundItem item = new GroundItem(itemId, itemX, itemY, 1, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName); addItem(item); } } else { c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount); GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName); addItem(item); }
Check your createGroundItem and send it me.
Double Post - Sorry
Code:public void createGroundItem(Client c, int itemId, int itemX, int itemY, int itemAmount, int playerId) { if(itemId > 0) { if (itemId >= 2412 && itemId <= 2414) { c.sendMessage("The cape vanishes as it touches the ground."); return; } if (itemId > 4705 && itemId < 4760) { for (int j = 0; j < brokenBarrows.length; j++) { if (brokenBarrows[j][0] == itemId) { itemId = brokenBarrows[j][1]; break; } } } if (!server.model.items.Item.itemStackable[itemId] && itemAmount > 0) { for (int j = 0; j < itemAmount; j++) { c.getItems().createGroundItem(itemId, itemX, itemY, 1); GroundItem item = new GroundItem(itemId, itemX, itemY, 1, c.playerId, HIDE_TICKS, Server.playerHandler.players[playerId].playerName); addItem(item); } } else { c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount); GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS, Server.playerHandler.players[playerId].playerName); addItem(item); } } }
Nothing really looks wrong there. Have you made sure that when the item is dropped that it actually creates the ground item?
Hmm wierd, i've just always had myne as where the items disappear and it hasn't really affected me or the players but i suppose it's quite an important feature to add. Maybe it's just not added in Matrix as you can dupe etc via globalitems. If you figure anything out, i'd appreciate if you could send me a quick message so i could get this fixed too.
Thanks.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |