Switch Item.template and MobLoot to CObjectTemplate
Item.template is now the cache template from CObjectTemplate.lookup instead of the legacy DB ItemTemplate, so item.template.cacheTemplate.X becomes item.template.X. MobLoot, LootManager, ItemManager.isTwoHanded/ isShield and CombatManager.getSwingAnimation take a CObjectTemplate. No value changes: every getter already read the cache template through the bridge, and the lookup resolves the same 7586 ids as static_item_templates with the same item_type (offline parity p17.py, 0 differences). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f39e35ac23
commit
6b4e9815e0
38 files changed
+201
-193
No files matched your search
@@ -13,6 +13,7 @@ import engine.mbEnums;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -91,8 +92,8 @@ public enum LootManager {
|
||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||
for (Item item : mob.getInventory()) {
|
||||
|
||||
if ((item.templateID > 2499 && item.templateID <= 3050) || item.template.cacheTemplate.getItemBaseName().toLowerCase().contains("of the gods")) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + item.template.cacheTemplate.getItemBaseName() + ". Are you tough enough to take it?");
|
||||
if ((item.templateID > 2499 && item.templateID <= 3050) || item.template.getItemBaseName().toLowerCase().contains("of the gods")) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + item.template.getItemBaseName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchManager.dispatchMsgToAll(chatMsg);
|
||||
@@ -179,12 +180,12 @@ public enum LootManager {
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
if (ItemTemplate.templates.get(itemUUID).cacheTemplate.getItemType().equals(mbEnums.ItemType.RESOURCE)) {
|
||||
if (CObjectTemplate.lookup(itemUUID).getItemType().equals(mbEnums.ItemType.RESOURCE)) {
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemTemplate.templates.get(itemUUID), amount, false);
|
||||
return new MobLoot(mob, CObjectTemplate.lookup(itemUUID), amount, false);
|
||||
}
|
||||
|
||||
outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false);
|
||||
outItem = new MobLoot(mob, CObjectTemplate.lookup(itemUUID), false);
|
||||
|
||||
if (selectedRow.pModTable != 0)
|
||||
try {
|
||||
@@ -374,7 +375,7 @@ public enum LootManager {
|
||||
if (chanceRoll > bse.dropChance)
|
||||
return;
|
||||
|
||||
MobLoot lootItem = new MobLoot(mob, ItemTemplate.templates.get(bse.templateID), true);
|
||||
MobLoot lootItem = new MobLoot(mob, CObjectTemplate.lookup(bse.templateID), true);
|
||||
|
||||
if (lootItem != null)
|
||||
mob.charItemManager.addItemToInventory(lootItem);
|
||||
@@ -422,14 +423,14 @@ public enum LootManager {
|
||||
|
||||
//create the item from the table, quantity is always 1
|
||||
|
||||
MobLoot winnings = new MobLoot(playerCharacter, ItemTemplate.templates.get(selectedItem.templateID), 1, false);
|
||||
MobLoot winnings = new MobLoot(playerCharacter, CObjectTemplate.lookup(selectedItem.templateID), 1, false);
|
||||
|
||||
if (winnings == null)
|
||||
return;
|
||||
|
||||
//early exit if the inventory of the player will not old the item
|
||||
|
||||
if (itemMan.hasRoomInventory(winnings.template.cacheTemplate.getItemWt()) == false) {
|
||||
if (itemMan.hasRoomInventory(winnings.template.getItemWt()) == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user