Start mobequip refactor
This commit is contained in:
@@ -11,9 +11,7 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
@@ -32,7 +30,7 @@ public class AddGoldCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
Item gold = pc.getCharItemManager().getGoldInventory();
|
||||
Item gold = pc.charItemManager.getGoldInventory();
|
||||
int curAmt;
|
||||
if (gold == null)
|
||||
curAmt = 0;
|
||||
@@ -54,13 +52,13 @@ public class AddGoldCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
||||
if (!pc.charItemManager.addGoldToInventory(amt, true)) {
|
||||
throwbackError(pc, "Failed to add gold to inventory");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||
pc.getCharItemManager().updateInventory();
|
||||
pc.charItemManager.updateInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class EnchantCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterItemManager cim = pc.getCharItemManager();
|
||||
CharacterItemManager cim = pc.charItemManager;
|
||||
if (cim == null) {
|
||||
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
||||
return;
|
||||
|
||||
@@ -278,7 +278,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "Account ID: UNKNOWN";
|
||||
|
||||
output += newline;
|
||||
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
|
||||
output += "Inventory Weight:" + (targetPC.charItemManager.getInventoryWeight() + targetPC.charItemManager.getEquipWeight());
|
||||
output += newline;
|
||||
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
|
||||
output += newline;
|
||||
|
||||
@@ -144,7 +144,7 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
&& (template.item_type.equals(ItemType.OFFERING)) == false)
|
||||
numItems = 1;
|
||||
|
||||
CharacterItemManager cim = pc.getCharItemManager();
|
||||
CharacterItemManager cim = pc.charItemManager;
|
||||
|
||||
if (cim == null) {
|
||||
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PrintBankCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||
ArrayList<Item> list = cim.getBank();
|
||||
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
||||
if (tar.getObjectType() == GameObjectType.Mob) {
|
||||
Mob tarMob = (Mob) tar;
|
||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||
for (Enum.EquipSlotType slot : tarMob.getEquip().keySet()) {
|
||||
Item equip = tarMob.getEquip().get(slot);
|
||||
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||
}
|
||||
return;
|
||||
@@ -74,14 +74,14 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
||||
if (tar.getObjectType() == GameObjectType.NPC) {
|
||||
NPC tarMob = (NPC) tar;
|
||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||
for (Enum.EquipSlotType slot : tarMob.getEquip().keySet()) {
|
||||
Item equip = tarMob.getEquip().get(slot);
|
||||
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||
ConcurrentHashMap<Enum.EquipSlotType, Item> list = cim.getEquipped();
|
||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class PrintInventoryCmd extends AbstractDevCmd {
|
||||
}
|
||||
}
|
||||
|
||||
CharacterItemManager cim = tar.getCharItemManager();
|
||||
CharacterItemManager cim = tar.charItemManager;
|
||||
inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
|
||||
gold = cim.getGoldInventory();
|
||||
throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PrintVaultCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
||||
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||
ArrayList<Item> list = cim.getVault();
|
||||
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||
for (Item item : list) {
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
||||
|
||||
public static int lastEquipSetID = 0;
|
||||
|
||||
public SetNpcEquipSetCmd() {
|
||||
super("setEquipSet");
|
||||
this.addCmdString("equipset");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
// Arg Count Check
|
||||
if (words.length != 1) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType() != GameObjectType.NPC) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = (NPC) target;
|
||||
|
||||
if (words[0].equalsIgnoreCase("next")) {
|
||||
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1;
|
||||
else
|
||||
SetNpcEquipSetCmd.lastEquipSetID++;
|
||||
|
||||
boolean complete = false;
|
||||
|
||||
while (complete == false) {
|
||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
||||
|
||||
if (!complete) {
|
||||
SetNpcEquipSetCmd.lastEquipSetID++;
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (complete) {
|
||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
||||
WorldGrid.updateObject(npc);
|
||||
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (words[0].equalsIgnoreCase("last")) {
|
||||
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1222;
|
||||
else
|
||||
SetNpcEquipSetCmd.lastEquipSetID--;
|
||||
|
||||
boolean complete = false;
|
||||
|
||||
while (complete == false) {
|
||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
||||
|
||||
if (!complete) {
|
||||
SetNpcEquipSetCmd.lastEquipSetID--;
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1222;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (complete) {
|
||||
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
|
||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
||||
WorldGrid.updateObject(npc);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int equipSetID = 0;
|
||||
|
||||
try {
|
||||
equipSetID = Integer.parseInt(words[0]);
|
||||
} catch (Exception e) {
|
||||
this.throwbackError(pc, e.getMessage());
|
||||
}
|
||||
|
||||
if (!NPC.UpdateEquipSetID(npc, equipSetID)) {
|
||||
this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID);
|
||||
return;
|
||||
}
|
||||
|
||||
SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
|
||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
||||
WorldGrid.updateObject(npc);
|
||||
|
||||
this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets slot position for an NPC to 'slot'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /changeslot slot'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
|
||||
try {
|
||||
mob.loadInventory();
|
||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
||||
for (Item lootItem : mob.charItemManager.getInventory()) {
|
||||
switch (lootItem.template.item_type) {
|
||||
case EMPLOYMENTCONTRACT: //CONTRACT
|
||||
Contracts.add(lootItem);
|
||||
|
||||
Reference in New Issue
Block a user