Fixed the delay on banking a non stackable item (#341)

Brought back old code as what I previously did affected the time it takes to bank items.
This commit is contained in:
Gptaqbc
2019-12-30 23:25:01 -05:00
committed by Daniel Ginovker
parent 1b5f185944
commit e88c5eaca8
2 changed files with 463 additions and 464 deletions
@@ -511,7 +511,7 @@ public class ItemAssistant {
} else {
c.playerItemsN[i] = GameConstants.MAXITEM_AMOUNT;
}
if (c.getOutStream() != null) {
if (c.getOutStream() != null && c != null) {
c.getOutStream().createFrameVarSizeWord(34);
c.getOutStream().writeWord(3214);
c.getOutStream().writeByte(i);
@@ -526,7 +526,7 @@ public class ItemAssistant {
c.flushOutStream();
}
i = 30;
Weight.updateWeight(c);
Weight.calcWeight(c, item, "additem");
return true;
}
}
@@ -544,8 +544,7 @@ public class ItemAssistant {
}
resetItems(3214);
i = 30;
Weight.updateWeight(c);
Weight.calcWeight(c, item, "additem");
return true;
}
}
@@ -1663,7 +1662,7 @@ public class ItemAssistant {
c.flushOutStream();
c.updateRequired = true;
c.setAppearanceUpdateRequired(true);
Weight.updateWeight(c);
Weight.calcWeight(c, wearID, "deleteitem");
}
}
}
@@ -1800,7 +1799,7 @@ public class ItemAssistant {
if (!CastleWars.deleteCastleWarsItems(c, itemID)) {
return false;
}
if (c.otherBank) {
if (c.otherBank == true) {
c.getPacketSender().closeAllWindows();
c.getPacketSender().sendMessage("You can't bank while viewing someones bank!");
c.otherBank = false;
@@ -2368,7 +2367,7 @@ public class ItemAssistant {
}
}
resetItems(3214);
Weight.updateWeight(c);
Weight.calcWeight(c, id, "deleteitem");
}
public void deleteItem(int id, int slot, int amount) {
@@ -2383,7 +2382,7 @@ public class ItemAssistant {
c.playerItems[slot] = 0;
}
resetItems(3214);
Weight.updateWeight(c);
Weight.calcWeight(c, id, "deleteitem");
}
}
@@ -16,7 +16,7 @@ public class Weight extends ItemDefinitions {
* @param action
* - deleteitem, additem, equip, unequip.
*/
private static void calcWeight(Player c, int item, String action) {
public static void calcWeight(Player c, int item, String action) {
if (action.equalsIgnoreCase("deleteitem")) {
if (getWeight(item) > 99.20) {
c.weight -= getWeight(item) / 100;
@@ -63,7 +63,7 @@ public class Weight extends ItemDefinitions {
else calcWeight(player, element, "addItem");
}
}
}
player.getPacketSender().writeWeight((int) player.weight);
}
}
}