mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
Some stuff on weight (#323)
* Some stuff on weight Some stuff on weight * Cleaned some code related to trading and fixed most likely the issue where the player stays busy and cant trade till relog Cleaned some code related to trading and fixed most likely the issue where the player stays busy and cant trade till relog
This commit is contained in:
@@ -526,7 +526,7 @@ public class ItemAssistant {
|
||||
c.flushOutStream();
|
||||
}
|
||||
i = 30;
|
||||
Weight.calcWeight(c, item, "additem");
|
||||
Weight.updateWeight(c);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -544,7 +544,8 @@ public class ItemAssistant {
|
||||
}
|
||||
resetItems(3214);
|
||||
i = 30;
|
||||
Weight.calcWeight(c, item, "additem");
|
||||
|
||||
Weight.updateWeight(c);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1662,7 +1663,7 @@ public class ItemAssistant {
|
||||
c.flushOutStream();
|
||||
c.updateRequired = true;
|
||||
c.setAppearanceUpdateRequired(true);
|
||||
Weight.calcWeight(c, wearID, "deleteitem");
|
||||
Weight.updateWeight(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2367,7 +2368,7 @@ public class ItemAssistant {
|
||||
}
|
||||
}
|
||||
resetItems(3214);
|
||||
Weight.calcWeight(c, id, "deleteitem");
|
||||
Weight.updateWeight(c);
|
||||
}
|
||||
|
||||
public void deleteItem(int id, int slot, int amount) {
|
||||
@@ -2382,7 +2383,7 @@ public class ItemAssistant {
|
||||
c.playerItems[slot] = 0;
|
||||
}
|
||||
resetItems(3214);
|
||||
Weight.calcWeight(c, id, "deleteitem");
|
||||
Weight.updateWeight(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,8 +230,8 @@ public class ItemDefinitions {
|
||||
if (id >= 0 && id < definitions.length)
|
||||
return definitions[id].weight;
|
||||
|
||||
System.out.println("WARNING: id " + id + " doesn't have a definition!");
|
||||
return 0.0;
|
||||
System.out.println("WARNING: id " + id + " doesn't have a definition! 2.147kg is used as weight.");
|
||||
return 2.147;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Weight extends ItemDefinitions {
|
||||
* @param action
|
||||
* - deleteitem, additem, equip, unequip.
|
||||
*/
|
||||
public static void calcWeight(Player c, int item, String action) {
|
||||
private 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);
|
||||
}
|
||||
player.getPacketSender().writeWeight((int) player.weight);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user