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
@@ -22,6 +22,7 @@ import engine.mbEnums.BuildingGroup;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -199,12 +200,12 @@ public enum BuildingManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(1705032); // Elan Stone
|
||||
CObjectTemplate template = CObjectTemplate.lookup(1705032); // Elan Stone
|
||||
|
||||
if (!player.charItemManager.hasRoomInventory(template.cacheTemplate.getItemWt()))
|
||||
if (!player.charItemManager.hasRoomInventory(template.getItemWt()))
|
||||
return false;
|
||||
|
||||
if (!ItemManager.MakeItemForPlayer(template.template_id, player, amount))
|
||||
if (!ItemManager.MakeItemForPlayer(template.getTemplateId(), player, amount))
|
||||
return false;
|
||||
|
||||
shrine.setFavors(0);
|
||||
@@ -218,12 +219,12 @@ public enum BuildingManager {
|
||||
|
||||
for (mbEnums.ResourceType resourceType : EnumSet.allOf(mbEnums.ResourceType.class)) {
|
||||
|
||||
ItemTemplate resourceTemplate = ItemTemplate.templates.get(resourceType.templateID);
|
||||
CObjectTemplate resourceTemplate = CObjectTemplate.lookup(resourceType.templateID);
|
||||
|
||||
if (resourceTemplate == null)
|
||||
continue;
|
||||
|
||||
if (!player.charItemManager.hasRoomInventory(resourceTemplate.cacheTemplate.getItemWt())) {
|
||||
if (!player.charItemManager.hasRoomInventory(resourceTemplate.getItemWt())) {
|
||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
||||
import engine.net.client.msg.chat.*;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.server.world.WorldServer;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -539,8 +540,8 @@ public enum ChatManager {
|
||||
name = amount + " gold ";
|
||||
else {
|
||||
String vowels = "aeiou";
|
||||
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||
String iName = template.cacheTemplate.getItemBaseName();
|
||||
CObjectTemplate template = CObjectTemplate.lookup(item.templateID);
|
||||
String iName = template.getItemBaseName();
|
||||
if (iName.length() > 0)
|
||||
if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0)
|
||||
name = "an " + iName + ' ';
|
||||
|
||||
@@ -15,8 +15,8 @@ import engine.mbEnums;
|
||||
import engine.net.client.msg.ItemProductionMsg;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.ItemTemplate;
|
||||
import engine.objects.NPC;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -225,12 +225,12 @@ public enum ForgeManager implements Runnable {
|
||||
// Calculate production cost for a single run of the workOrder
|
||||
|
||||
HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
|
||||
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||
CObjectTemplate template = CObjectTemplate.lookup(workOrder.templateID);
|
||||
|
||||
// Add gold and resource costs from template
|
||||
|
||||
production_cost.put(mbEnums.ResourceType.GOLD, template.cacheTemplate.getItemValue());
|
||||
production_cost.putAll(template.item_resource_cost);
|
||||
production_cost.put(mbEnums.ResourceType.GOLD, template.getItemValue());
|
||||
production_cost.putAll(template.getItemResourceCosts());
|
||||
|
||||
// Calculate cost of prefix and suffix
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.RuneSkillAdjustEntry;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -545,14 +546,14 @@ public enum NPCManager {
|
||||
|
||||
public static long calcRollingDuration(NPC vendor, int templateID) {
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||
CObjectTemplate template = CObjectTemplate.lookup(templateID);
|
||||
float rollingDuration;
|
||||
|
||||
if (template == null)
|
||||
return 0;
|
||||
|
||||
if (template.cacheTemplate.getItemBaneRank() > 0)
|
||||
return (long) (template.cacheTemplate.getItemBaneRank() * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||
if (template.getItemBaneRank() > 0)
|
||||
return (long) (template.getItemBaneRank() * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||
|
||||
if (vendor.building == null)
|
||||
return 600;
|
||||
|
||||
Reference in new issue
Block a user