Move the remaining legacy item template lookups to CObjectTemplate
Dev commands, BuildingManager, ChatManager, ForgeManager, NPCManager, NPC, Warehouse, WorkOrder and ManageNPCMsg now call CObjectTemplate.lookup instead of ItemTemplate.templates.get. Forge production cost reads getItemResourceCosts(). Only the DB loader and linkCacheTemplates still use the legacy class (removed in Task 1.8). Removes the static_item_templates ParityCheck comparator. Final parity (offline p17.py, 7586 rows): every id has a cache template, 0 item_type differences, 0 item_resource_costs differences (84 ITEMs have costs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b4e9815e0
commit
566870de79
17 files changed
+67
-70
No files matched your search
@@ -14,6 +14,7 @@ import engine.gameManager.DbManager;
|
||||
import engine.mbEnums.ItemType;
|
||||
import engine.mbEnums.OwnerType;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
/**
|
||||
@@ -59,17 +60,17 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
int templateID;
|
||||
ItemTemplate template;
|
||||
CObjectTemplate template;
|
||||
try {
|
||||
templateID = Integer.parseInt(words[0]);
|
||||
template = ItemTemplate.templates.get(templateID);
|
||||
template = CObjectTemplate.lookup(templateID);
|
||||
|
||||
if (template == null) {
|
||||
throwbackError(pc, "No item template with id " + words[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (template.cacheTemplate.getItemType() == ItemType.GOLD) {
|
||||
if (template.getItemType() == ItemType.GOLD) {
|
||||
this.throwbackInfo(pc, "use /addgold to add gold.");
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +132,7 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
}
|
||||
template = ItemTemplate.templates.get(templateID);
|
||||
template = CObjectTemplate.lookup(templateID);
|
||||
|
||||
if (template == null) {
|
||||
throwbackError(pc, "Unable to find template " + templateID);
|
||||
@@ -139,8 +140,8 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
if ((numItems > 1)
|
||||
&& (template.cacheTemplate.getItemType().equals(ItemType.RESOURCE) == false)
|
||||
&& (template.cacheTemplate.getItemType().equals(ItemType.OFFERING)) == false)
|
||||
&& (template.getItemType().equals(ItemType.RESOURCE) == false)
|
||||
&& (template.getItemType().equals(ItemType.OFFERING)) == false)
|
||||
numItems = 1;
|
||||
|
||||
CharacterItemManager cim = pc.charItemManager;
|
||||
@@ -154,7 +155,7 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
|
||||
int weight = template.cacheTemplate.getItemWt();
|
||||
int weight = template.getItemWt();
|
||||
|
||||
if (!cim.hasRoomInventory(weight)) {
|
||||
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
|
||||
|
||||
Reference in new issue
Block a user