Files
Server/src/engine/devcmd/cmds/PrintEquipCmd.java
T
MagicBotandClaude Opus 5.5 6b4e9815e0 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>
2026-10-20 07:55:28 -04:00

105 lines
4.0 KiB
Java

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2026
// https://www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.*;
import java.util.concurrent.ConcurrentHashMap;
public class PrintEquipCmd extends AbstractDevCmd {
public PrintEquipCmd() {
super("printequip");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
//Get name and type
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
}
type = "NPC";
}
if (tar.getObjectType() == GameObjectType.Mob) {
Mob tarMob = (Mob) tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (mbEnums.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
Item equip = tarMob.charItemManager.equipped.get(slot);
throwbackInfo(pc, equip.templateID + " : " + equip.template.getItemBaseName() + ", slot: " + slot);
}
return;
}
if (tar.getObjectType() == GameObjectType.NPC) {
NPC tarMob = (NPC) tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (mbEnums.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
Item equip = tarMob.charItemManager.equipped.get(slot);
throwbackInfo(pc, equip.templateID + " : " + equip.template.getItemBaseName() + ", slot: " + slot);
}
return;
}
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
ConcurrentHashMap<mbEnums.EquipSlotType, Item> list = cim.getEquipped();
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (mbEnums.EquipSlotType slot : list.keySet()) {
Item item = list.get(slot);
throwbackInfo(pc, " " + item.template.getItemBaseName() + ", slot: " + slot);
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current equipment";
}
@Override
protected String _getUsageString() {
return "' /printequip'";
}
}