Browse Source

Name simplification for collection

combat-2
MagicBot 8 months ago
parent
commit
ac2403362e
  1. 2
      src/engine/Enum.java
  2. 2
      src/engine/db/handlers/dbItemHandler.java
  3. 2
      src/engine/devcmd/cmds/InfoCmd.java
  4. 4
      src/engine/devcmd/cmds/MakeItemCmd.java
  5. 2
      src/engine/devcmd/cmds/PrintBankCmd.java
  6. 2
      src/engine/devcmd/cmds/PrintBonusesCmd.java
  7. 2
      src/engine/devcmd/cmds/PrintInventoryCmd.java
  8. 2
      src/engine/devcmd/cmds/PrintVaultCmd.java
  9. 2
      src/engine/devcmd/cmds/SimulateBootyCmd.java
  10. 2
      src/engine/gameManager/BuildingManager.java
  11. 2
      src/engine/gameManager/ChatManager.java
  12. 6
      src/engine/gameManager/CombatManager.java
  13. 12
      src/engine/gameManager/LootManager.java
  14. 4
      src/engine/net/client/msg/ManageNPCMsg.java
  15. 6
      src/engine/objects/Item.java
  16. 6
      src/engine/objects/ItemBase.java
  17. 8
      src/engine/objects/ItemFactory.java
  18. 2
      src/engine/objects/ItemTemplate.java
  19. 10
      src/engine/objects/MobEquipment.java
  20. 2
      src/engine/objects/MobLoot.java
  21. 6
      src/engine/objects/NPC.java
  22. 6
      src/engine/objects/Warehouse.java

2
src/engine/Enum.java

@ -2694,7 +2694,7 @@ public class Enum { @@ -2694,7 +2694,7 @@ public class Enum {
ResourceType(int templateID, int hash, int deposit_limit, int mine_production) {
this.templateID = templateID;
this.template = ItemTemplate.itemTemplates.get(this.templateID);
this.template = ItemTemplate.templates.get(this.templateID);
this.hash = hash;
this.deposit_limit = deposit_limit;
this.mine_production = mine_production;

2
src/engine/db/handlers/dbItemHandler.java

@ -180,7 +180,7 @@ public class dbItemHandler extends dbHandlerBase { @@ -180,7 +180,7 @@ public class dbItemHandler extends dbHandlerBase {
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template"));
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
itemTemplate.template_id = templateID;
ItemTemplate.itemTemplates.put(templateID, itemTemplate);
ItemTemplate.templates.put(templateID, itemTemplate);
}
} catch (Exception e) {

2
src/engine/devcmd/cmds/InfoCmd.java

@ -505,7 +505,7 @@ public class InfoCmd extends AbstractDevCmd { @@ -505,7 +505,7 @@ public class InfoCmd extends AbstractDevCmd {
case Item: //intentional passthrough
case MobLoot:
Item item = (Item) target;
ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID());
output += StringUtils.addWS("ItemBase: " + template.template_id, 20);
output += "Weight: " + template.item_wt;
output += newline;

4
src/engine/devcmd/cmds/MakeItemCmd.java

@ -62,7 +62,7 @@ public class MakeItemCmd extends AbstractDevCmd { @@ -62,7 +62,7 @@ public class MakeItemCmd extends AbstractDevCmd {
ItemTemplate template;
try {
templateID = Integer.parseInt(words[0]);
template = ItemTemplate.itemTemplates.get(words[0].toLowerCase());
template = ItemTemplate.templates.get(words[0].toLowerCase());
if (template == null) {
throwbackError(pc, "Supplied type " + words[0]
@ -132,7 +132,7 @@ public class MakeItemCmd extends AbstractDevCmd { @@ -132,7 +132,7 @@ public class MakeItemCmd extends AbstractDevCmd {
return;
}
}
template = ItemTemplate.itemTemplates.get(templateID);
template = ItemTemplate.templates.get(templateID);
if (template == null) {
throwbackError(pc, "Unable to find template " + templateID);

2
src/engine/devcmd/cmds/PrintBankCmd.java

@ -52,7 +52,7 @@ public class PrintBankCmd extends AbstractDevCmd { @@ -52,7 +52,7 @@ public class PrintBankCmd extends AbstractDevCmd {
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID());
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems());
}

2
src/engine/devcmd/cmds/PrintBonusesCmd.java

@ -33,7 +33,7 @@ public class PrintBonusesCmd extends AbstractDevCmd { @@ -33,7 +33,7 @@ public class PrintBonusesCmd extends AbstractDevCmd {
if (target instanceof Item) {
type = "Item";
tar = (Item) target;
ItemTemplate template = ItemTemplate.itemTemplates.get(((Item) tar).getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(((Item) tar).getTemplateID());
name = template.item_base_name;
} else if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;

2
src/engine/devcmd/cmds/PrintInventoryCmd.java

@ -75,7 +75,7 @@ public class PrintInventoryCmd extends AbstractDevCmd { @@ -75,7 +75,7 @@ public class PrintInventoryCmd extends AbstractDevCmd {
int goldCount = 0;
for (Item item : inventory) {
ItemTemplate template = ItemTemplate.itemTemplates.get(item.templateID);
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
if (item.template.item_type.equals(ItemType.GOLD) == false) {

2
src/engine/devcmd/cmds/PrintVaultCmd.java

@ -50,7 +50,7 @@ public class PrintVaultCmd extends AbstractDevCmd { @@ -50,7 +50,7 @@ public class PrintVaultCmd extends AbstractDevCmd {
ArrayList<Item> list = cim.getVault();
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID());
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldVault();

2
src/engine/devcmd/cmds/SimulateBootyCmd.java

@ -34,7 +34,7 @@ public class SimulateBootyCmd extends AbstractDevCmd { @@ -34,7 +34,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
if (mob.bootySet != 0) {
for (BootySetEntry entry : LootManager._bootySetMap.get(mob.bootySet)) {
ItemTemplate template = ItemTemplate.itemTemplates.get(entry.templateID);
ItemTemplate template = ItemTemplate.templates.get(entry.templateID);
if (template != null)
output += "[" + entry.bootyType + "] " + template.item_base_name + " [Chance] " + entry.dropChance + newline;

2
src/engine/gameManager/BuildingManager.java

@ -207,7 +207,7 @@ public enum BuildingManager { @@ -207,7 +207,7 @@ public enum BuildingManager {
return false;
}
ItemTemplate template = ItemTemplate.itemTemplates.get(1705032); // Elan Stone
ItemTemplate template = ItemTemplate.templates.get(1705032); // Elan Stone
if (!player.getCharItemManager().hasRoomInventory(template.item_wt))
return false;

2
src/engine/gameManager/ChatManager.java

@ -612,7 +612,7 @@ public enum ChatManager { @@ -612,7 +612,7 @@ public enum ChatManager {
name = amount + " gold ";
else {
String vowels = "aeiou";
ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID());
String iName = template.item_base_name;
if (iName.length() > 0)
if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0)

6
src/engine/gameManager/CombatManager.java

@ -595,7 +595,7 @@ public enum CombatManager { @@ -595,7 +595,7 @@ public enum CombatManager {
// Apply Weapon power effect if any. don't try to apply twice if
// dual wielding. Perform after passive test for sync purposes.
ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID());
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) {
@ -813,7 +813,7 @@ public enum CombatManager { @@ -813,7 +813,7 @@ public enum CombatManager {
// Apply Weapon power effect if any.
// don't try to apply twice if dual wielding.
ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID());
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) {
dpj = ((PlayerCharacter) attacker).getWeaponPower();
@ -982,7 +982,7 @@ public enum CombatManager { @@ -982,7 +982,7 @@ public enum CombatManager {
if (wb == null)
return 75;
ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID());
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
if (mainHand) {
if (template.weapon_attack_anim_right.size() > 0) {

12
src/engine/gameManager/LootManager.java

@ -87,7 +87,7 @@ public enum LootManager { @@ -87,7 +87,7 @@ public enum LootManager {
if (ib == null)
break;
ItemTemplate template = ItemTemplate.itemTemplates.get(it.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(it.getTemplateID());
if (ib.isDiscRune() || template.item_base_name.toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + template.item_base_name + ". Are you tough enough to take it?");
@ -175,12 +175,12 @@ public enum LootManager { @@ -175,12 +175,12 @@ public enum LootManager {
if (itemUUID == 0)
return null;
if (ItemTemplate.itemTemplates.get(itemUUID).item_type.equals(Enum.ItemType.RESOURCE)) {
if (ItemTemplate.templates.get(itemUUID).item_type.equals(Enum.ItemType.RESOURCE)) {
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemTemplate.itemTemplates.get(itemUUID), amount, false);
return new MobLoot(mob, ItemTemplate.templates.get(itemUUID), amount, false);
}
outItem = new MobLoot(mob, ItemTemplate.itemTemplates.get(itemUUID), false);
outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false);
if(selectedRow.pModTable != 0){
try {
@ -369,7 +369,7 @@ public enum LootManager { @@ -369,7 +369,7 @@ public enum LootManager {
if (chanceRoll > bse.dropChance)
return;
MobLoot lootItem = new MobLoot(mob, ItemTemplate.itemTemplates.get(bse.templateID), true);
MobLoot lootItem = new MobLoot(mob, ItemTemplate.templates.get(bse.templateID), true);
if (lootItem != null)
mob.getCharItemManager().addItemToInventory(lootItem);
@ -417,7 +417,7 @@ public enum LootManager { @@ -417,7 +417,7 @@ public enum LootManager {
//create the item from the table, quantity is always 1
MobLoot winnings = new MobLoot(playerCharacter, ItemTemplate.itemTemplates.get(selectedItem.cacheID), 1, false);
MobLoot winnings = new MobLoot(playerCharacter, ItemTemplate.templates.get(selectedItem.cacheID), 1, false);
if (winnings == null)
return;

4
src/engine/net/client/msg/ManageNPCMsg.java

@ -423,7 +423,7 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -423,7 +423,7 @@ public class ManageNPCMsg extends ClientNetMsg {
for (int templateID : rollableSet) {
ItemBase item = ItemBase.getItemBase(templateID);
ItemTemplate template = ItemTemplate.itemTemplates.get(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
writer.put((byte) 1);
writer.putInt(0);
writer.putInt(templateID); //itemID
@ -444,7 +444,7 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -444,7 +444,7 @@ public class ManageNPCMsg extends ClientNetMsg {
for (Item i : itemList) {
ItemBase ib = i.getItemBase();
ItemTemplate template = ItemTemplate.itemTemplates.get(ib);
ItemTemplate template = ItemTemplate.templates.get(ib);
writer.put((byte) 0); // ? Unknown45
writer.putInt(i.getObjectType().ordinal());
writer.putInt(i.getObjectUUID());

6
src/engine/objects/Item.java

@ -68,7 +68,7 @@ public class Item extends AbstractWorldObject { @@ -68,7 +68,7 @@ public class Item extends AbstractWorldObject {
public Item(int templateID) {
super();
this.templateID = templateID;
this.template = ItemTemplate.itemTemplates.get(templateID);
this.template = ItemTemplate.templates.get(templateID);
this.chargesRemaining = this.template.item_initial_charges;
this.durabilityCurrent = this.template.combat_health_full;
this.equipSlot = EquipSlotType.NONE;
@ -85,7 +85,7 @@ public class Item extends AbstractWorldObject { @@ -85,7 +85,7 @@ public class Item extends AbstractWorldObject {
super(rs);
this.templateID = rs.getInt("item_itemBaseID");
this.template = ItemTemplate.itemTemplates.get(this.templateID);
this.template = ItemTemplate.templates.get(this.templateID);
if (this.template == null)
Logger.error("Null template of " + this.templateID)
@ -1012,7 +1012,7 @@ public class Item extends AbstractWorldObject { @@ -1012,7 +1012,7 @@ public class Item extends AbstractWorldObject {
if (this.customName.isEmpty() == false)
return this.customName;
ItemTemplate template = ItemTemplate.itemTemplates.get(this.getTemplateID());
ItemTemplate template = ItemTemplate.templates.get(this.getTemplateID());
return template.item_base_name;
}

6
src/engine/objects/ItemBase.java

@ -57,7 +57,7 @@ public class ItemBase { @@ -57,7 +57,7 @@ public class ItemBase {
this.mastery = rs.getString("mastery");
damageType = Enum.SourceType.valueOf(rs.getString("damageType").toUpperCase());
ItemTemplate template = ItemTemplate.itemTemplates.get(this.getUUID());
ItemTemplate template = ItemTemplate.templates.get(this.getUUID());
if (template == null)
Logger.error(this.getUUID() + " null template");
@ -68,10 +68,10 @@ public class ItemBase { @@ -68,10 +68,10 @@ public class ItemBase {
_itemBaseByUUID.put(itemBase.uuid, itemBase);
if (ItemTemplate.itemTemplates.get(itemBase.uuid).item_type.equals(ItemType.RESOURCE))
if (ItemTemplate.templates.get(itemBase.uuid).item_type.equals(ItemType.RESOURCE))
_resourceList.add(itemBase);
ItemTemplate template = ItemTemplate.itemTemplates.get(itemBase.uuid);
ItemTemplate template = ItemTemplate.templates.get(itemBase.uuid);
if (template == null)
Logger.error("Null template for: " + itemBase.uuid);

8
src/engine/objects/ItemFactory.java

@ -38,7 +38,7 @@ public class ItemFactory { @@ -38,7 +38,7 @@ public class ItemFactory {
int max = 20;
CharacterItemManager itemManager = pc.getCharItemManager();
ItemTemplate template = ItemTemplate.itemTemplates.get(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
if (count > max)
count = max;
@ -86,7 +86,7 @@ public class ItemFactory { @@ -86,7 +86,7 @@ public class ItemFactory {
boolean useWarehouse = false;
ItemTemplate template = ItemTemplate.itemTemplates.get(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
if (template == null)
return null;
@ -641,7 +641,7 @@ public class ItemFactory { @@ -641,7 +641,7 @@ public class ItemFactory {
ModTableEntry suffixEntry = null;
ItemBase ib = ItemBase.getItemBase(itemBaseID);
ItemTemplate template = ItemTemplate.itemTemplates.get(itemBaseID);
ItemTemplate template = ItemTemplate.templates.get(itemBaseID);
if (template == null)
return null;
@ -766,7 +766,7 @@ public class ItemFactory { @@ -766,7 +766,7 @@ public class ItemFactory {
if (npc == null)
return null;
ItemTemplate template = ItemTemplate.itemTemplates.get(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
Building forge = npc.getBuilding();

2
src/engine/objects/ItemTemplate.java

@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; @@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ItemTemplate {
// Global template lookup
public static HashMap<Integer, ItemTemplate> itemTemplates = new HashMap<>();
public static HashMap<Integer, ItemTemplate> templates = new HashMap<>();
public int template_id;

10
src/engine/objects/MobEquipment.java

@ -45,7 +45,7 @@ public class MobEquipment extends AbstractGameObject { @@ -45,7 +45,7 @@ public class MobEquipment extends AbstractGameObject {
super(MobEquipment.getNewID());
this.itemBase = itemBase;
this.templateID = this.itemBase.getUUID();
this.template = ItemTemplate.itemTemplates.get(templateID);
this.template = ItemTemplate.templates.get(templateID);
this.slot = slot;
this.parentID = parentID;
this.enchanted = false;
@ -59,7 +59,7 @@ public class MobEquipment extends AbstractGameObject { @@ -59,7 +59,7 @@ public class MobEquipment extends AbstractGameObject {
public MobEquipment(int itemBaseID, float dropChance) {
super(MobEquipment.getNewID());
this.itemBase = ItemBase.getItemBase(itemBaseID);
this.template = ItemTemplate.itemTemplates.get(itemBaseID);
this.template = ItemTemplate.templates.get(itemBaseID);
Enum.EquipSlotType equipSlot = template.item_eq_slots_and.iterator().next();
@ -184,17 +184,17 @@ public class MobEquipment extends AbstractGameObject { @@ -184,17 +184,17 @@ public class MobEquipment extends AbstractGameObject {
if (mobEquipment.itemBase == null)
name = eb.getName();
else
name = eb.getName() + ' ' + ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name;
name = eb.getName() + ' ' + ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name;
} else if (eb.isSuffix()) {
if (mobEquipment.itemBase == null)
name = eb.getName();
else
name = ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name + ' ' + eb.getName();
name = ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name + ' ' + eb.getName();
} else {
if (mobEquipment.itemBase == null)
name = "";
else
name = ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name;
name = ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name;
}
writer.putInt(eb.getToken());

2
src/engine/objects/MobLoot.java

@ -38,7 +38,7 @@ public final class MobLoot extends Item { @@ -38,7 +38,7 @@ public final class MobLoot extends Item {
}
public MobLoot(AbstractCharacter mob, int qtyOfGold) {
this(mob, ItemTemplate.itemTemplates.get(Enum.ResourceType.GOLD.templateID), qtyOfGold, false);
this(mob, ItemTemplate.templates.get(Enum.ResourceType.GOLD.templateID), qtyOfGold, false);
}
public MobLoot(AbstractCharacter mob, ItemTemplate template, int quantity, boolean noSteal) {

6
src/engine/objects/NPC.java

@ -920,7 +920,7 @@ public class NPC extends AbstractCharacter { @@ -920,7 +920,7 @@ public class NPC extends AbstractCharacter {
DbManager.NPCQueries.LOAD_ALL_ITEMS_TO_PRODUCE(this);
for (ProducedItem producedItem : this.forgedItems) {
MobLoot ml = new MobLoot(this, ItemTemplate.itemTemplates.get(producedItem.getItemBaseID()), false);
MobLoot ml = new MobLoot(this, ItemTemplate.templates.get(producedItem.getItemBaseID()), false);
DbManager.NPCQueries.UPDATE_ITEM_ID(producedItem.getID(), currentID, ml.getObjectUUID());
@ -1070,7 +1070,7 @@ public class NPC extends AbstractCharacter { @@ -1070,7 +1070,7 @@ public class NPC extends AbstractCharacter {
ItemBase itemBase;
for (Integer itemID : fullItemList) {
itemBase = ItemBase.getItemBase(itemID);
boolean exclude = itemBase.getPercentRequired() == 0 && ItemTemplate.itemTemplates.get(itemID).item_type == ItemType.WEAPON;
boolean exclude = itemBase.getPercentRequired() == 0 && ItemTemplate.templates.get(itemID).item_type == ItemType.WEAPON;
if (itemBase.getPercentRequired() <= maxSkill && !exclude)
filteredItemList.add(itemID);
}
@ -1095,7 +1095,7 @@ public class NPC extends AbstractCharacter { @@ -1095,7 +1095,7 @@ public class NPC extends AbstractCharacter {
if (ib == null)
return 0;
if (ItemTemplate.itemTemplates.get(itemID).item_type == ItemType.SCROLL)
if (ItemTemplate.templates.get(itemID).item_type == ItemType.SCROLL)
return this.getRank() * 60 * 60 * 3;
float time;

6
src/engine/objects/Warehouse.java

@ -294,7 +294,7 @@ public class Warehouse extends AbstractWorldObject { @@ -294,7 +294,7 @@ public class Warehouse extends AbstractWorldObject {
if (resource.template.item_type.equals(Enum.ItemType.GOLD))
resourceType = Enum.ResourceType.GOLD;
else
resourceType = Enum.ResourceType.valueOf(ItemTemplate.itemTemplates.get(resource.getTemplateID()).item_base_name.toUpperCase());
resourceType = Enum.ResourceType.valueOf(ItemTemplate.templates.get(resource.getTemplateID()).item_base_name.toUpperCase());
if (transaction)
AddTransactionToWarehouse(warehouse, pc.getObjectType(), pc.getObjectUUID(), Enum.TransactionType.DEPOSIT, resourceType, amount);
@ -596,7 +596,7 @@ public class Warehouse extends AbstractWorldObject { @@ -596,7 +596,7 @@ public class Warehouse extends AbstractWorldObject {
if (pc == null)
return false;
ItemTemplate template = ItemTemplate.itemTemplates.get(resourceType.templateID);
ItemTemplate template = ItemTemplate.templates.get(resourceType.templateID);
if (warehouse.resources.get(resourceType) == null)
return false;
@ -678,7 +678,7 @@ public class Warehouse extends AbstractWorldObject { @@ -678,7 +678,7 @@ public class Warehouse extends AbstractWorldObject {
if (pc == null)
return false;
ItemTemplate template = ItemTemplate.itemTemplates.get(resourceType);
ItemTemplate template = ItemTemplate.templates.get(resourceType);
if (template == null)
return false;

Loading…
Cancel
Save