Browse Source

Inline templateID

combat-2
MagicBot 8 months ago
parent
commit
e5622a47c0
  1. 2
      src/engine/db/handlers/dbItemHandler.java
  2. 2
      src/engine/devcmd/cmds/InfoCmd.java
  3. 2
      src/engine/devcmd/cmds/PrintBankCmd.java
  4. 2
      src/engine/devcmd/cmds/PrintBonusesCmd.java
  5. 2
      src/engine/devcmd/cmds/PrintVaultCmd.java
  6. 2
      src/engine/gameManager/ChatManager.java
  7. 8
      src/engine/gameManager/LootManager.java
  8. 4
      src/engine/net/client/msg/ItemProductionMsg.java
  9. 4
      src/engine/net/client/msg/ManageNPCMsg.java
  10. 4
      src/engine/objects/Item.java
  11. 16
      src/engine/objects/ItemFactory.java
  12. 2
      src/engine/objects/Warehouse.java

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

@ -62,7 +62,7 @@ public class dbItemHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) { PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) {
preparedStatement.setInt(1, toAdd.ownerID); preparedStatement.setInt(1, toAdd.ownerID);
preparedStatement.setInt(2, toAdd.getTemplateID()); preparedStatement.setInt(2, toAdd.templateID);
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); preparedStatement.setInt(3, (byte) toAdd.chargesRemaining);
preparedStatement.setInt(4, (short) toAdd.combat_health_current); preparedStatement.setInt(4, (short) toAdd.combat_health_current);

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

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

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

@ -52,7 +52,7 @@ public class PrintBankCmd extends AbstractDevCmd {
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')'); throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) { for (Item item : list) {
ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); ItemTemplate template = ItemTemplate.templates.get(item.templateID);
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems()); 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 {
if (target instanceof Item) { if (target instanceof Item) {
type = "Item"; type = "Item";
tar = (Item) target; tar = (Item) target;
ItemTemplate template = ItemTemplate.templates.get(((Item) tar).getTemplateID()); ItemTemplate template = ItemTemplate.templates.get(((Item) tar).templateID);
name = template.item_base_name; name = template.item_base_name;
} else if (target instanceof AbstractCharacter) { } else if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target; tar = (AbstractCharacter) target;

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

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

2
src/engine/gameManager/ChatManager.java

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

8
src/engine/gameManager/LootManager.java

@ -87,9 +87,9 @@ public enum LootManager {
if (ib == null) if (ib == null)
break; break;
ItemTemplate template = ItemTemplate.templates.get(it.getTemplateID()); ItemTemplate template = ItemTemplate.templates.get(it.templateID);
if ((it.getTemplateID() > 2499 && it.templateID <= 3050) || template.item_base_name.toLowerCase().contains("of the gods")) { if ((it.templateID > 2499 && it.templateID <= 3050) || 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?"); 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?");
chatMsg.setMessageType(10); chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
@ -381,8 +381,8 @@ public enum LootManager {
int tableID = 0; int tableID = 0;
if (_bootySetMap.get(gift.getTemplateID()) != null) if (_bootySetMap.get(gift.templateID) != null)
tableID = _bootySetMap.get(gift.getTemplateID()).get(ThreadLocalRandom.current().nextInt(_bootySetMap.get(gift.getTemplateID()).size())).genTable; tableID = _bootySetMap.get(gift.templateID).get(ThreadLocalRandom.current().nextInt(_bootySetMap.get(gift.templateID).size())).genTable;
if (tableID == 0) if (tableID == 0)
return; return;

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

@ -284,7 +284,7 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putInt(0); //items left to produce? writer.putInt(0); //items left to produce?
if (toRoll != null) { if (toRoll != null) {
writer.putInt(toRoll.getTemplateID()); writer.putInt(toRoll.templateID);
writer.putInt(toRoll.getValue()); writer.putInt(toRoll.getValue());
} else { } else {
writer.putInt(0); writer.putInt(0);
@ -301,7 +301,7 @@ public class ItemProductionMsg extends ClientNetMsg {
timeLeft /= 1000; timeLeft /= 1000;
writer.putInt((int) timeLeft); writer.putInt((int) timeLeft);
writer.putInt(vendor.getRollingTimeInSeconds(toRoll.getTemplateID())); writer.putInt(vendor.getRollingTimeInSeconds(toRoll.templateID));
} }
} else { } else {

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

@ -447,14 +447,14 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(item.getObjectUUID()); writer.putInt(item.getObjectUUID());
writer.putInt(0); writer.putInt(0);
writer.putInt(item.getTemplateID()); writer.putInt(item.templateID);
writer.putInt(item.template.item_value); writer.putInt(item.template.item_value);
long timeLife = item.getDateToUpgrade() - System.currentTimeMillis(); long timeLife = item.getDateToUpgrade() - System.currentTimeMillis();
timeLife /= 1000; timeLife /= 1000;
writer.putInt((int) timeLife); writer.putInt((int) timeLife);
writer.putInt(npc.getRollingTimeInSeconds(item.getTemplateID())); writer.putInt(npc.getRollingTimeInSeconds(item.templateID));
writer.putInt(1); writer.putInt(1);
if (item.isComplete()) if (item.isComplete())

4
src/engine/objects/Item.java

@ -656,10 +656,6 @@ public class Item extends AbstractWorldObject {
return 0; return 0;
} }
public int getTemplateID() {
return this.templateID;
}
public int getOwnerID() { public int getOwnerID() {
return ownerID; return ownerID;
} }

16
src/engine/objects/ItemFactory.java

@ -180,7 +180,7 @@ public class ItemFactory {
time *= MBServerStatics.ONE_MINUTE; time *= MBServerStatics.ONE_MINUTE;
if (ml.templateID > 910010 && ml.templateID < 910019) { if (ml.templateID > 910010 && ml.templateID < 910019) {
rank = ml.getTemplateID() - 910010; rank = ml.templateID - 910010;
time = rank * 60 * 60 * 3 * 1000; time = rank * 60 * 60 * 3 * 1000;
} }
@ -201,8 +201,8 @@ public class ItemFactory {
if (pc != null) if (pc != null)
playerID = pc.getObjectUUID(); playerID = pc.getObjectUUID();
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplateID(), dateTime, "", "", "", false, playerID); DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.templateID, dateTime, "", "", "", false, playerID);
ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplateID(), dateTime, false, "", "", "", playerID); ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.templateID, dateTime, false, "", "", "", playerID);
pi.setProducedItemID(ml.getObjectUUID()); pi.setProducedItemID(ml.getObjectUUID());
pi.setAmount(itemsToRoll); pi.setAmount(itemsToRoll);
pi.setRandom(false); pi.setRandom(false);
@ -589,7 +589,7 @@ public class ItemFactory {
time *= MBServerStatics.ONE_MINUTE; time *= MBServerStatics.ONE_MINUTE;
if (ml.templateID > 910010 && ml.templateID < 910019) { if (ml.templateID > 910010 && ml.templateID < 910019) {
rank = ml.getTemplateID() - 910010; rank = ml.templateID - 910010;
time = rank * 60 * 60 * 3 * 1000; time = rank * 60 * 60 * 3 * 1000;
} }
@ -610,8 +610,8 @@ public class ItemFactory {
if (pc != null) if (pc != null)
playerID = pc.getObjectUUID(); playerID = pc.getObjectUUID();
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplateID(), dateTime, prefixString, suffixString, ml.name, false, playerID); DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.templateID, dateTime, prefixString, suffixString, ml.name, false, playerID);
ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.getTemplateID(), dateTime, false, prefixString, suffixString, ml.name, playerID); ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.templateID, dateTime, false, prefixString, suffixString, ml.name, playerID);
pi.setProducedItemID(ml.getObjectUUID()); pi.setProducedItemID(ml.getObjectUUID());
pi.setAmount(itemsToRoll); pi.setAmount(itemsToRoll);
@ -749,9 +749,9 @@ public class ItemFactory {
if (playerCharacter != null) if (playerCharacter != null)
playerID = playerCharacter.getObjectUUID(); playerID = playerCharacter.getObjectUUID();
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getTemplateID(), dateTime, prefix, suffix, toRoll.name, true, playerID); DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.templateID, dateTime, prefix, suffix, toRoll.name, true, playerID);
ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getTemplateID(), dateTime, true, prefix, suffix, toRoll.name, playerID); ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.templateID, dateTime, true, prefix, suffix, toRoll.name, playerID);
pi.setProducedItemID(toRoll.getObjectUUID()); pi.setProducedItemID(toRoll.getObjectUUID());
pi.setAmount(itemsToRoll); pi.setAmount(itemsToRoll);
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()))); ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));

2
src/engine/objects/Warehouse.java

@ -316,7 +316,7 @@ public class Warehouse {
if (resource.template.item_type.equals(Enum.ItemType.GOLD)) if (resource.template.item_type.equals(Enum.ItemType.GOLD))
resourceType = Enum.ResourceType.GOLD; resourceType = Enum.ResourceType.GOLD;
else else
resourceType = Enum.ResourceType.valueOf(ItemTemplate.templates.get(resource.getTemplateID()).item_base_name.toUpperCase()); resourceType = Enum.ResourceType.valueOf(ItemTemplate.templates.get(resource.templateID).item_base_name.toUpperCase());
if (transaction) if (transaction)
AddTransactionToWarehouse(warehouse, pc.getObjectType(), pc.getObjectUUID(), Enum.TransactionType.DEPOSIT, resourceType, amount); AddTransactionToWarehouse(warehouse, pc.getObjectType(), pc.getObjectUUID(), Enum.TransactionType.DEPOSIT, resourceType, amount);

Loading…
Cancel
Save