item_wt refactored to template

This commit is contained in:
2024-03-03 15:06:44 -05:00
parent 58652ee32f
commit 4dc0f52295
12 changed files with 101 additions and 120 deletions
+6 -5
View File
@@ -208,10 +208,9 @@ public enum BuildingManager {
ItemBase elanIB = ItemBase.getItemBase(1705032);
if (elanIB == null)
return false;
ItemTemplate template = ItemTemplate.itemTemplates.get(1705032); // Elan Stone
if (!player.getCharItemManager().hasRoomInventory(elanIB.getWeight()))
if (!player.getCharItemManager().hasRoomInventory(template.item_wt))
return false;
if (!Item.MakeItemForPlayer(elanIB, player, amount))
@@ -227,7 +226,10 @@ public enum BuildingManager {
return false;
for (ItemBase resourceBase : ItemBase.getResourceList()) {
if (!player.getCharItemManager().hasRoomInventory(resourceBase.getWeight())) {
template = ItemTemplate.itemTemplates.get(resourceBase.getUUID());
if (!player.getCharItemManager().hasRoomInventory(template.item_wt)) {
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
return false;
}
@@ -240,7 +242,6 @@ public enum BuildingManager {
continue;
if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true)) {
ItemTemplate template = ItemTemplate.itemTemplates.get(resourceBase.getUUID());
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + template.item_base_name);
}
+3 -3
View File
@@ -359,7 +359,7 @@ public enum CombatManager {
if (wb == null) {
if (abstractCharacter.getStamina() < 1)
attackFailure = true;
} else if (abstractCharacter.getStamina() < wb.getWeight())
} else if (abstractCharacter.getStamina() < weapon.template.item_wt)
attackFailure = true;
//see if attacker is stunned. If so, stop here
@@ -514,7 +514,7 @@ public enum CombatManager {
if (wb == null)
attacker.modifyStamina(-0.5f, attacker, true);
else {
float stam = wb.getWeight() / 3;
float stam = weapon.template.item_wt / 3f;
stam = (stam < 1) ? 1 : stam;
attacker.modifyStamina(-(stam), attacker, true);
}
@@ -1333,7 +1333,7 @@ public enum CombatManager {
if (wb != null)
if (wb.isGlass()) //glass used weighted so fast weapons don't break faster
chance = 9000 / wb.getWeight();
chance = 9000 / weapon.template.item_wt;
//test damaging attackers weapon
+1 -1
View File
@@ -426,7 +426,7 @@ public enum LootManager {
//early exit if the inventory of the player will not old the item
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
if (itemMan.hasRoomInventory(winnings.template.item_wt) == false) {
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
return;
}