forked from MagicBane/Server
Start mobequip refactor
This commit is contained in:
@@ -65,27 +65,9 @@ public class dbContractHandler extends dbHandlerBase {
|
||||
|
||||
int templateID = rs.getInt("itembaseID");
|
||||
|
||||
Item me = new Item(ItemTemplate.templates.get(templateID), Enum.EquipSlotType.NONE, 0);
|
||||
Item me = new Item(templateID);
|
||||
contract.getSellInventory().add(me);
|
||||
|
||||
//handle magic effects
|
||||
|
||||
String prefix = rs.getString("prefix");
|
||||
int pRank = rs.getInt("pRank");
|
||||
|
||||
String suffix = rs.getString("suffix");
|
||||
int sRank = rs.getInt("sRank");
|
||||
|
||||
if (prefix != null) {
|
||||
me.setPrefix(prefix, pRank);
|
||||
me.setIsID(true);
|
||||
}
|
||||
|
||||
if (suffix != null) {
|
||||
me.setSuffix(suffix, sRank);
|
||||
me.setIsID(true);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -209,7 +209,7 @@ public enum BuildingManager {
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(1705032); // Elan Stone
|
||||
|
||||
if (!player.getCharItemManager().hasRoomInventory(template.item_wt))
|
||||
if (!player.charItemManager.hasRoomInventory(template.item_wt))
|
||||
return false;
|
||||
|
||||
if (!Item.MakeItemForPlayer(template.template_id, player, amount))
|
||||
@@ -231,7 +231,7 @@ public enum BuildingManager {
|
||||
|
||||
for (Enum.ResourceType resourceType : EnumSet.allOf(Enum.ResourceType.class)) {
|
||||
|
||||
if (!player.getCharItemManager().hasRoomInventory(resourceType.template.item_wt)) {
|
||||
if (!player.charItemManager.hasRoomInventory(resourceType.template.item_wt)) {
|
||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new GotoObj());
|
||||
DevCmdManager.registerDevCmd(new convertLoc());
|
||||
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
||||
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
||||
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
||||
DevCmdManager.registerDevCmd(new ResetLevelCmd());
|
||||
DevCmdManager.registerDevCmd(new SetNpcNameCmd());
|
||||
|
||||
@@ -39,8 +39,8 @@ public class FinalCombatManager {
|
||||
return;
|
||||
}
|
||||
|
||||
Item mainWeapon = attacker.getCharItemManager().getEquipped().get(Enum.EquipSlotType.RHELD);
|
||||
Item offWeapon = attacker.getCharItemManager().getEquipped().get(Enum.EquipSlotType.LHELD);
|
||||
Item mainWeapon = attacker.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD);
|
||||
Item offWeapon = attacker.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD);
|
||||
if(mainWeapon == null && offWeapon == null){
|
||||
//no weapons equipped, punch with both fists
|
||||
processAttack(attacker,target,Enum.EquipSlotType.RHELD);
|
||||
@@ -71,7 +71,7 @@ public class FinalCombatManager {
|
||||
PlayerBonuses bonus = attacker.getBonuses();
|
||||
float rangeMod = 1.0f;
|
||||
float attackRange = MBServerStatics.NO_WEAPON_RANGE;
|
||||
Item weapon = attacker.getCharItemManager().getEquipped(slot);
|
||||
Item weapon = attacker.charItemManager.getEquipped(slot);
|
||||
if (weapon != null) {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.NONE);
|
||||
@@ -123,7 +123,7 @@ public class FinalCombatManager {
|
||||
if (target.getObjectType() == Enum.GameObjectType.Building)
|
||||
hitChance = 100;
|
||||
|
||||
int passiveAnim = getSwingAnimation(attacker.getCharItemManager().getEquipped().get(slot).template, null, true);
|
||||
int passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
|
||||
|
||||
if(ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
||||
@@ -161,13 +161,13 @@ public class FinalCombatManager {
|
||||
|
||||
//get the damage type
|
||||
Enum.SourceType damageType;
|
||||
if(attacker.getCharItemManager().getEquipped().get(slot) == null) {
|
||||
if(attacker.charItemManager.getEquipped().get(slot) == null) {
|
||||
damageType = Enum.SourceType.CRUSHING;
|
||||
if(attacker.getObjectType().equals(Enum.GameObjectType.Mob))
|
||||
if(((Mob)attacker).isSiege())
|
||||
damageType = Enum.SourceType.SIEGE;
|
||||
}else {
|
||||
damageType = (Enum.SourceType) attacker.getCharItemManager().getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
|
||||
damageType = (Enum.SourceType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
|
||||
}
|
||||
|
||||
//get resists
|
||||
|
||||
@@ -353,7 +353,7 @@ public enum GroupManager {
|
||||
|
||||
if (item.getObjectType() == Enum.GameObjectType.MobLoot) {
|
||||
if (tar.getObjectType() == Enum.GameObjectType.Mob) {
|
||||
((Mob) tar).getCharItemManager().delete(item);
|
||||
((Mob) tar).charItemManager.delete(item);
|
||||
} else
|
||||
item.setNumOfItems(0);
|
||||
} else
|
||||
@@ -363,7 +363,7 @@ public enum GroupManager {
|
||||
|
||||
int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount;
|
||||
if (amt > 0)
|
||||
splitPlayer.getCharItemManager().addGoldToInventory(amt, false);
|
||||
splitPlayer.charItemManager.addGoldToInventory(amt, false);
|
||||
}
|
||||
|
||||
for (PlayerCharacter splitPlayer : playersSplit) {
|
||||
|
||||
@@ -310,7 +310,7 @@ public enum LootManager {
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||
mob.charItemManager.addItemToInventory(goldAmount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public enum LootManager {
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
mob.charItemManager.addItemToInventory(toAdd);
|
||||
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
@@ -336,24 +336,24 @@ public enum LootManager {
|
||||
return; // safehold guards don't drop their equipment
|
||||
//do equipment here
|
||||
int dropCount = 0;
|
||||
if (mob.getEquip() != null)
|
||||
for (Item me : mob.getEquip().values()) {
|
||||
if (mob.charItemManager.equipped.isEmpty() == false)
|
||||
for (Item item : mob.charItemManager.equipped.values()) {
|
||||
|
||||
if (me.getDropChance() == 0)
|
||||
if (item.drop_chance == 0)
|
||||
continue;
|
||||
|
||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
float dropChance = me.getDropChance() * 100;
|
||||
float dropChance = item.drop_chance * 100;
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.template, false);
|
||||
MobLoot ml = new MobLoot(mob, item.template, false);
|
||||
|
||||
if (ml != null && dropCount < 1) {
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent((short) ((short) ml.durabilityCurrent - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
mob.charItemManager.addItemToInventory(ml);
|
||||
dropCount = 1;
|
||||
//break; // Exit on first successful roll.
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public enum LootManager {
|
||||
MobLoot lootItem = new MobLoot(mob, ItemTemplate.templates.get(bse.templateID), true);
|
||||
|
||||
if (lootItem != null)
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
mob.charItemManager.addItemToInventory(lootItem);
|
||||
}
|
||||
|
||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||
@@ -389,7 +389,7 @@ public enum LootManager {
|
||||
|
||||
//get the character item manager
|
||||
|
||||
CharacterItemManager itemMan = playerCharacter.getCharItemManager();
|
||||
CharacterItemManager itemMan = playerCharacter.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
|
||||
@@ -1520,7 +1520,7 @@ public enum PowersManager {
|
||||
|
||||
if (owner.getObjectType().equals(GameObjectType.PlayerCharacter) || owner.getObjectType().equals(GameObjectType.Mob)) {
|
||||
AbstractCharacter acOwner = (AbstractCharacter) owner;
|
||||
CharacterItemManager itemMan = acOwner.getCharItemManager();
|
||||
CharacterItemManager itemMan = acOwner.charItemManager;
|
||||
if (itemMan == null)
|
||||
return true;
|
||||
if (itemMan.inventoryContains(item)) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum TradeManager {
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
source.getCharItemManager().tradeRequest(msg);
|
||||
source.charItemManager.tradeRequest(msg);
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public enum TradeManager {
|
||||
return;
|
||||
|
||||
try {
|
||||
source.getCharItemManager().acceptTradeRequest(msg);
|
||||
source.charItemManager.acceptTradeRequest(msg);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
// TODO Auto-generated catch block
|
||||
@@ -60,7 +60,7 @@ public enum TradeManager {
|
||||
if (source == null || !source.isAlive())
|
||||
return;
|
||||
try {
|
||||
source.getCharItemManager().addItemToTradeWindow(msg);
|
||||
source.charItemManager.addItemToTradeWindow(msg);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -76,7 +76,7 @@ public enum TradeManager {
|
||||
return;
|
||||
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ public enum TradeManager {
|
||||
if (source == null || !source.isAlive())
|
||||
return;
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ public enum TradeManager {
|
||||
if (source == null || !source.isAlive())
|
||||
return;
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return;
|
||||
@@ -137,7 +137,7 @@ public enum TradeManager {
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return;
|
||||
|
||||
@@ -783,7 +783,7 @@ public class MobAI {
|
||||
|
||||
if (!aiAgent.despawned) {
|
||||
|
||||
if (aiAgent.getCharItemManager().getInventoryCount() > 0) {
|
||||
if (aiAgent.charItemManager.getInventoryCount() > 0) {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
|
||||
@@ -199,7 +199,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!NPCVaultBankRangeCheck(player, origin, "bank"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
@@ -256,7 +256,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!NPCVaultBankRangeCheck(player, origin, "bank"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
@@ -400,7 +400,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) {
|
||||
|
||||
CharacterItemManager itemManager = origin.getPlayerCharacter().getCharItemManager();
|
||||
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager;
|
||||
int uuid = msg.getUUID();
|
||||
|
||||
|
||||
@@ -689,9 +689,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
if (!GroupManager.goldSplit(player, item, origin, tar)) {
|
||||
|
||||
if (tar.getCharItemManager() != null) {
|
||||
if (tar.charItemManager != null) {
|
||||
|
||||
itemRet = tar.getCharItemManager().lootItemFromMe(item, player, origin);
|
||||
itemRet = tar.charItemManager.lootItemFromMe(item, player, origin);
|
||||
|
||||
//Take equipment off mob
|
||||
if (tar.getObjectType() == GameObjectType.Mob && itemRet != null) {
|
||||
@@ -699,9 +699,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
if (item != null && item.getObjectType() == GameObjectType.MobLoot) {
|
||||
|
||||
for (Item equip : mobTarget.getEquip().values()) {
|
||||
for (Item equip : mobTarget.charItemManager.equipped.values()) {
|
||||
|
||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.slot);
|
||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.equipSlot);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mobTarget, back, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
|
||||
LootMsg lootMsg = new LootMsg(0, 0, tar.getObjectType().ordinal(), tar.getObjectUUID(), equip);
|
||||
@@ -1037,7 +1037,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemMan = player.getCharItemManager();
|
||||
CharacterItemManager itemMan = player.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
@@ -1058,14 +1058,14 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
int cost = 0;
|
||||
|
||||
|
||||
if (npc.getCharItemManager().getInventoryCount() > 150) {
|
||||
if (npc.charItemManager.getInventoryCount() > 150) {
|
||||
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID == 0) {
|
||||
ArrayList<Item> inv = npc.getInventory();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
try {
|
||||
Item toRemove = inv.get(i);
|
||||
if (toRemove != null)
|
||||
npc.getCharItemManager().delete(toRemove);
|
||||
npc.charItemManager.delete(toRemove);
|
||||
} catch (Exception e) {
|
||||
break;
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
|
||||
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0)
|
||||
if (!npc.getCharItemManager().hasRoomInventory(sell.template.item_wt)) {
|
||||
if (!npc.charItemManager.hasRoomInventory(sell.template.item_wt)) {
|
||||
|
||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||
return;
|
||||
|
||||
@@ -86,12 +86,12 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (contractItem == null)
|
||||
return false;
|
||||
|
||||
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||
if (!player.charItemManager.doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
||||
return false;
|
||||
}
|
||||
|
||||
itemMan = player.getCharItemManager();
|
||||
itemMan = player.charItemManager;
|
||||
|
||||
zone = ZoneManager.findSmallestZone(building.getLoc());
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (origin.buyLock.tryLock()) {
|
||||
|
||||
try {
|
||||
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
||||
CharacterItemManager itemMan = sourcePlayer.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return true;
|
||||
@@ -123,7 +123,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
} else if (buyFromNPCMsg.getItemType() == Enum.GameObjectType.Item.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
CharacterItemManager npcCim = npc.charItemManager;
|
||||
|
||||
if (npcCim == null)
|
||||
return true;
|
||||
@@ -189,7 +189,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
} else if (buyFromNPCMsg.getItemType() == Enum.GameObjectType.MobLoot.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
CharacterItemManager npcCim = npc.charItemManager;
|
||||
|
||||
if (npcCim == null)
|
||||
return true;
|
||||
|
||||
@@ -26,9 +26,7 @@ import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.guild.GuildCreationFinalizeMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
||||
@@ -131,8 +129,8 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
||||
player.setInnerCouncil(true);
|
||||
player.setFullMember(true);
|
||||
player.setGuildTitle(charterType.getNumberOfRanks() - 1);
|
||||
player.getCharItemManager().delete(charter);
|
||||
player.getCharItemManager().updateInventory();
|
||||
player.charItemManager.delete(charter);
|
||||
player.charItemManager.updateInventory();
|
||||
player.incVer();
|
||||
|
||||
DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, newGuild, 2));
|
||||
|
||||
@@ -129,18 +129,18 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
|
||||
if (!vendor.getCharItemManager().hasRoomInventory(targetItem.template.item_wt)) {
|
||||
if (!vendor.charItemManager.hasRoomInventory(targetItem.template.item_wt)) {
|
||||
|
||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||
return;
|
||||
}
|
||||
|
||||
itemMan = origin.getPlayerCharacter().getCharItemManager();
|
||||
itemMan = origin.getPlayerCharacter().charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
|
||||
if (vendor.getCharItemManager().getInventoryWeight() > 500) {
|
||||
if (vendor.charItemManager.getInventoryWeight() > 500) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
origin.getPlayerCharacter().getCharItemManager().updateInventory();
|
||||
origin.getPlayerCharacter().charItemManager.updateInventory();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
} finally {
|
||||
@@ -199,7 +199,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
|
||||
if (!vendor.getCharItemManager().forgeContains(targetItem, vendor))
|
||||
if (!vendor.charItemManager.forgeContains(targetItem, vendor))
|
||||
return;
|
||||
|
||||
boolean worked = DbManager.ItemQueries.UPDATE_FORGE_TO_INVENTORY(targetItem);
|
||||
@@ -213,7 +213,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
targetItem.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
targetItem.setOwner(vendor);
|
||||
vendor.getCharItemManager().addItemToInventory(targetItem);
|
||||
vendor.charItemManager.addItemToInventory(targetItem);
|
||||
|
||||
vendor.removeItemFromForge(targetItem);
|
||||
|
||||
@@ -269,9 +269,9 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
|
||||
if (!vendor.getCharItemManager().doesCharOwnThisItem(targetItem.getObjectUUID()))
|
||||
if (!vendor.charItemManager.doesCharOwnThisItem(targetItem.getObjectUUID()))
|
||||
continue;
|
||||
if (vendor.getCharItemManager().inventoryContains(targetItem) == false)
|
||||
if (vendor.charItemManager.inventoryContains(targetItem) == false)
|
||||
continue;
|
||||
|
||||
itemValue = targetItem.template.item_value;
|
||||
@@ -293,7 +293,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
totalValue += itemValue;
|
||||
long start = System.currentTimeMillis();
|
||||
vendor.getCharItemManager().recycle(targetItem);
|
||||
vendor.charItemManager.recycle(targetItem);
|
||||
long end = System.currentTimeMillis();
|
||||
long timetook = end - start;
|
||||
|
||||
@@ -347,7 +347,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
|
||||
if (!vendor.getCharItemManager().forgeContains(targetItem, vendor))
|
||||
if (!vendor.charItemManager.forgeContains(targetItem, vendor))
|
||||
return;
|
||||
|
||||
// Cannot junk items without a forge!
|
||||
@@ -404,17 +404,17 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
if (vendor.getCharItemManager().inventoryContains(targetItem) == false)
|
||||
if (vendor.charItemManager.inventoryContains(targetItem) == false)
|
||||
return;
|
||||
|
||||
if (player.getCharItemManager().hasRoomInventory(targetItem.template.item_wt) == false)
|
||||
if (player.charItemManager.hasRoomInventory(targetItem.template.item_wt) == false)
|
||||
return;
|
||||
|
||||
player.getCharItemManager().buyFromNPC(targetItem, vendor);
|
||||
player.charItemManager.buyFromNPC(targetItem, vendor);
|
||||
|
||||
}
|
||||
|
||||
player.getCharItemManager().updateInventory();
|
||||
player.charItemManager.updateInventory();
|
||||
|
||||
// Update NPC inventory to client
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
itemMan = player.getCharItemManager();
|
||||
itemMan = player.charItemManager;
|
||||
|
||||
if (itemMan == null) {
|
||||
return true;
|
||||
|
||||
@@ -44,11 +44,11 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
Item item;
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
itemMan = player.getCharItemManager();
|
||||
itemMan = player.charItemManager;
|
||||
|
||||
contract = hireling.contract;
|
||||
|
||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
||||
if (!player.charItemManager.hasRoomInventory((short) 1)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||
return;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
|
||||
|
||||
if (player.getCharItemManager().getTradingWith() != null) {
|
||||
if (player.charItemManager.getTradingWith() != null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Cannot barter and trade with same timings.");
|
||||
return true;
|
||||
}
|
||||
@@ -512,7 +512,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (!building.getHirelings().containsKey(mob))
|
||||
return true;
|
||||
|
||||
if (player.getCharItemManager().getTradingWith() != null) {
|
||||
if (player.charItemManager.getTradingWith() != null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Cannot barter and trade with same timings.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
case WAREHOUSE:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeWarehouse(playerCharacter, origin, msg);
|
||||
break;
|
||||
@@ -396,28 +396,28 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
case BULWARK:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeSiegeEquip(playerCharacter, origin, msg);
|
||||
break;
|
||||
case SPIRE:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeSpire(playerCharacter, origin, msg);
|
||||
break;
|
||||
case SHRINE:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeShrine(playerCharacter, origin, msg);
|
||||
break;
|
||||
case BARRACK:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeBarrack(playerCharacter, origin, msg);
|
||||
break;
|
||||
@@ -433,7 +433,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
default:
|
||||
if (contract == null)
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
if (!playerCharacter.charItemManager.doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
buildingCreated = placeSingleBuilding(playerCharacter, origin, msg);
|
||||
break;
|
||||
@@ -448,8 +448,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Remove the appropriate deed.
|
||||
if (buildingCreated == true)
|
||||
if (contract != null) {
|
||||
playerCharacter.getCharItemManager().delete(contract);
|
||||
playerCharacter.getCharItemManager().updateInventory();
|
||||
playerCharacter.charItemManager.delete(contract);
|
||||
playerCharacter.charItemManager.updateInventory();
|
||||
}
|
||||
|
||||
// Close the window. We're done!
|
||||
@@ -1033,7 +1033,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
|
||||
|
||||
if (player.getCharItemManager().getGoldTrading() > 0) {
|
||||
if (player.charItemManager.getGoldTrading() > 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 195);
|
||||
return false;
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// We need to be able to access how much gold a character is carrying
|
||||
|
||||
itemMan = player.getCharItemManager();
|
||||
itemMan = player.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
} else if (repairMsg.getMsgType() == 0) { //Request RepairObject
|
||||
|
||||
CharacterItemManager itemMan = player.getCharItemManager();
|
||||
CharacterItemManager itemMan = player.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return true;
|
||||
@@ -116,10 +116,10 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.getCharItemManager().getGoldInventory().getNumOfItems() - cost < 0)
|
||||
if (player.charItemManager.getGoldInventory().getNumOfItems() - cost < 0)
|
||||
return true;
|
||||
|
||||
if (player.getCharItemManager().getGoldInventory().getNumOfItems() - cost > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
if (player.charItemManager.getGoldInventory().getNumOfItems() - cost > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
return true;
|
||||
|
||||
if (!itemMan.buyFromNPC(building, cost, cost)) {
|
||||
|
||||
@@ -12,10 +12,7 @@ import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.net.client.msg.TransferGoldToFromBuildingMsg;
|
||||
import engine.net.client.msg.UpdateGoldMsg;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.CharacterItemManager;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/*
|
||||
@@ -71,7 +68,7 @@ public class TransferGoldToFromBuildingMsgHandler extends AbstractClientMsgHandl
|
||||
|
||||
//building.getTimestamps().put(MBServerStatics.STRONGBOX_DELAY_STRING, System.currentTimeMillis() + MBServerStatics.ONE_MINUTE);
|
||||
|
||||
itemMan = player.getCharItemManager();
|
||||
itemMan = player.charItemManager;
|
||||
|
||||
goldItem = itemMan.getGoldInventory();
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ApplyEffectMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.TransferItemFromEquipToInventoryMsg;
|
||||
import engine.objects.CharacterItemManager;
|
||||
import engine.objects.Effect;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHandler {
|
||||
@@ -38,7 +35,7 @@ public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHa
|
||||
|
||||
TransferItemFromEquipToInventoryMsg msg = (TransferItemFromEquipToInventoryMsg) baseMsg;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return true;
|
||||
|
||||
@@ -19,10 +19,7 @@ import engine.net.client.msg.ApplyEffectMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.TransferItemFromEquipToInventoryMsg;
|
||||
import engine.net.client.msg.TransferItemFromInventoryToEquipMsg;
|
||||
import engine.objects.CharacterItemManager;
|
||||
import engine.objects.Effect;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHandler {
|
||||
@@ -36,7 +33,7 @@ public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHa
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
TransferItemFromInventoryToEquipMsg transferMsg = (TransferItemFromInventoryToEquipMsg) baseMsg;
|
||||
CharacterItemManager itemManager = playerCharacter.getCharItemManager();
|
||||
CharacterItemManager itemManager = playerCharacter.charItemManager;
|
||||
|
||||
if (itemManager == null) {
|
||||
forceTransferFromEquipToInventory(transferMsg, origin, "Can't find your item manager");
|
||||
|
||||
@@ -97,7 +97,7 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
ArrayList<Item> sellInventory = null;
|
||||
|
||||
if (npc != null) {
|
||||
man = npc.getCharItemManager();
|
||||
man = npc.charItemManager;
|
||||
Contract contract = npc.getContract();
|
||||
if (player != null) {
|
||||
float barget = player.getBargain();
|
||||
@@ -149,7 +149,7 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
|
||||
for (Item Item : sellInventory) {
|
||||
try {
|
||||
Item.serializeForVendor(Item, writer, sellPercent);
|
||||
Item._serializeForVendor(Item, writer, sellPercent);
|
||||
} catch (SerializationException se) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class LootMsg extends ClientNetMsg {
|
||||
else if (this.Item != null)
|
||||
try {
|
||||
Item._serializeForClientMsg(this.Item, writer, false);
|
||||
} catch (SerializationException e) {
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class RefineMsg extends ClientNetMsg {
|
||||
|
||||
//update player
|
||||
pc.applyBonuses();
|
||||
pc.getCharItemManager().RemoveEquipmentFromLackOfSkill(pc, true);
|
||||
pc.charItemManager.RemoveEquipmentFromLackOfSkill(pc, true);
|
||||
|
||||
//echo refine message back
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ShowBankInventoryMsg extends ClientNetMsg {
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
ArrayList<Item> bank = pc.getCharItemManager().getBank();
|
||||
ArrayList<Item> bank = pc.charItemManager.getBank();
|
||||
|
||||
writer.put((byte) 1); // static value
|
||||
Item.putList(writer, bank, false, pc.getObjectUUID());
|
||||
|
||||
@@ -72,12 +72,12 @@ public class TrainMsg extends ClientNetMsg {
|
||||
|
||||
if (origin.trainLock.tryLock()) {
|
||||
try {
|
||||
Item gold = playerCharacter.getCharItemManager().getGoldInventory();
|
||||
Item gold = playerCharacter.charItemManager.getGoldInventory();
|
||||
|
||||
if (gold == null)
|
||||
return;
|
||||
|
||||
if (!gold.validForInventory(origin, playerCharacter, playerCharacter.getCharItemManager()))
|
||||
if (!gold.validForInventory(origin, playerCharacter, playerCharacter.charItemManager))
|
||||
return;
|
||||
|
||||
boolean canTrain = false;
|
||||
@@ -190,7 +190,7 @@ public class TrainMsg extends ClientNetMsg {
|
||||
float profitCost = cost * npc.getSellPercent(playerCharacter);
|
||||
|
||||
profitCost += .5f;
|
||||
if (profitCost > playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems())
|
||||
if (profitCost > playerCharacter.charItemManager.getGoldInventory().getNumOfItems())
|
||||
return;
|
||||
Building b = npc.getBuilding();
|
||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||
@@ -201,16 +201,16 @@ public class TrainMsg extends ClientNetMsg {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems() - profitCost < 0)
|
||||
if (playerCharacter.charItemManager.getGoldInventory().getNumOfItems() - profitCost < 0)
|
||||
return;
|
||||
|
||||
if (playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems() - profitCost > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
if (playerCharacter.charItemManager.getGoldInventory().getNumOfItems() - profitCost > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
return;
|
||||
|
||||
|
||||
//attempt to train
|
||||
if (sk.train(playerCharacter)) {
|
||||
playerCharacter.getCharItemManager().buyFromNPC(b, (int) profitCost, (int) (profitCost - cost));
|
||||
playerCharacter.charItemManager.buyFromNPC(b, (int) profitCost, (int) (profitCost - cost));
|
||||
|
||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
@@ -253,7 +253,7 @@ public class TrainMsg extends ClientNetMsg {
|
||||
float cost = (int) cp.getTrainingCost(playerCharacter, npc);
|
||||
float profitCost = cost * npc.getSellPercent(playerCharacter);
|
||||
profitCost += .5f;
|
||||
if (profitCost > playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems()) {
|
||||
if (profitCost > playerCharacter.charItemManager.getGoldInventory().getNumOfItems()) {
|
||||
// ChatManager.chatSystemError(pc, "You do not have enough gold to train this skill.");
|
||||
return;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public class TrainMsg extends ClientNetMsg {
|
||||
}
|
||||
if (cp.train(playerCharacter)) {
|
||||
|
||||
if (!playerCharacter.getCharItemManager().buyFromNPC(b, (int) profitCost, (int) (profitCost - cost)))
|
||||
if (!playerCharacter.charItemManager.buyFromNPC(b, (int) profitCost, (int) (profitCost - cost)))
|
||||
ChatManager.chatSystemError(playerCharacter, "Failed to Withdrawl gold from inventory. Contact CCR");
|
||||
|
||||
//train succeeded
|
||||
|
||||
@@ -15,10 +15,7 @@ import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.CharacterItemManager;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
* Update gold in inventory and/or bank
|
||||
@@ -76,7 +73,7 @@ public class UpdateGoldMsg extends ClientNetMsg {
|
||||
public void configure() {
|
||||
|
||||
if (this.looter != null && this.looter.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
itemManager = ((PlayerCharacter) looter).getCharItemManager();
|
||||
itemManager = ((PlayerCharacter) looter).charItemManager;
|
||||
goldInventory = itemManager.getGoldInventory();
|
||||
this.tradeGold = itemManager.getGoldTrading();
|
||||
goldBank = itemManager.getGoldBank();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class UpdateTradeWindowMsg extends ClientNetMsg {
|
||||
|
||||
ArrayList<Item> trading1 = new ArrayList<>();
|
||||
|
||||
for (int itemID : pc1.getCharItemManager().getTrading()) {
|
||||
for (int itemID : pc1.charItemManager.getTrading()) {
|
||||
Item item = Item.getFromCache(itemID);
|
||||
if (item == null)
|
||||
continue;
|
||||
@@ -71,7 +71,7 @@ public class UpdateTradeWindowMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
ArrayList<Item> trading2 = new ArrayList<>();
|
||||
for (int itemID : pc2.getCharItemManager().getTrading()) {
|
||||
for (int itemID : pc2.charItemManager.getTrading()) {
|
||||
Item item = Item.getFromCache(itemID);
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
@@ -607,7 +607,7 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
if (ac == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = playerCharacter.getCharItemManager();
|
||||
CharacterItemManager itemManager = playerCharacter.charItemManager;
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
@@ -660,7 +660,7 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
if (cc == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = playerCharacter.getCharItemManager();
|
||||
CharacterItemManager itemManager = playerCharacter.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
@@ -49,7 +49,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
|
||||
protected CharacterItemManager charItemManager;
|
||||
public CharacterItemManager charItemManager;
|
||||
private final ReentrantReadWriteLock healthLock = new ReentrantReadWriteLock();
|
||||
public short level;
|
||||
public AbstractWorldObject combatTarget;
|
||||
@@ -657,10 +657,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
return this.unusedStatPoints;
|
||||
}
|
||||
|
||||
public final CharacterItemManager getCharItemManager() {
|
||||
return this.charItemManager;
|
||||
}
|
||||
|
||||
public final void setDebug(
|
||||
final int value,
|
||||
final boolean toggle
|
||||
|
||||
@@ -214,16 +214,16 @@ public class Account extends AbstractGameObject {
|
||||
}
|
||||
|
||||
//dupe check
|
||||
if (!item.validForInventory(origin, player, player.getCharItemManager()))
|
||||
if (!item.validForInventory(origin, player, player.charItemManager))
|
||||
return;
|
||||
|
||||
if (item.containerType == Enum.ItemContainerType.INVENTORY && player.getCharItemManager().isVaultOpen()) {
|
||||
if (!player.getCharItemManager().hasRoomVault(item.template.item_wt)) {
|
||||
if (item.containerType == Enum.ItemContainerType.INVENTORY && player.charItemManager.isVaultOpen()) {
|
||||
if (!player.charItemManager.hasRoomVault(item.template.item_wt)) {
|
||||
ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "There is no room in your vault.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getCharItemManager().moveItemToVault(item)) {
|
||||
if (player.charItemManager.moveItemToVault(item)) {
|
||||
this.vault.add(item);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
@@ -245,7 +245,7 @@ public class Account extends AbstractGameObject {
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null) {
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "Can't find your item manager.");
|
||||
@@ -300,7 +300,7 @@ public class Account extends AbstractGameObject {
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
@@ -347,7 +347,7 @@ public class Account extends AbstractGameObject {
|
||||
if (!ClientMessagePump.NPCVaultBankRangeCheck(player, origin, "vault"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
CharacterItemManager itemManager = player.charItemManager;
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
@@ -94,12 +94,12 @@ public class CharacterItemManager {
|
||||
if (template == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemMan = pc.getCharItemManager();
|
||||
CharacterItemManager itemMan = pc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
CharacterItemManager npcCim = npc.charItemManager;
|
||||
|
||||
if (npcCim == null)
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ public class CharacterItemManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.getOwner().getCharItemManager().getGoldTrading() > 0) {
|
||||
if (this.getOwner().charItemManager.getGoldTrading() > 0) {
|
||||
if (this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.getOwner(), 195);
|
||||
return false;
|
||||
@@ -440,8 +440,8 @@ public class CharacterItemManager {
|
||||
|
||||
// TODO uncomment this block after we determine when we
|
||||
// setBankOpen(false) and setVaultOpen(false)
|
||||
CharacterItemManager cim1 = source.getCharItemManager();
|
||||
CharacterItemManager cim2 = target.getCharItemManager();
|
||||
CharacterItemManager cim1 = source.charItemManager;
|
||||
CharacterItemManager cim2 = target.charItemManager;
|
||||
|
||||
if (cim1 == null)
|
||||
return false;
|
||||
@@ -539,7 +539,7 @@ public class CharacterItemManager {
|
||||
return false;
|
||||
|
||||
|
||||
CharacterItemManager toTradeWith = target.getCharItemManager();
|
||||
CharacterItemManager toTradeWith = target.charItemManager;
|
||||
|
||||
if (toTradeWith == null)
|
||||
return false;
|
||||
@@ -603,7 +603,7 @@ public class CharacterItemManager {
|
||||
if (other == null || !other.isAlive())
|
||||
return false;
|
||||
|
||||
CharacterItemManager tradingWith = other.getCharItemManager();
|
||||
CharacterItemManager tradingWith = other.charItemManager;
|
||||
|
||||
if (tradingWith == null)
|
||||
return false;
|
||||
@@ -669,7 +669,7 @@ public class CharacterItemManager {
|
||||
if (other == null || !other.isAlive())
|
||||
return false;
|
||||
|
||||
CharacterItemManager tradingWith = other.getCharItemManager();
|
||||
CharacterItemManager tradingWith = other.charItemManager;
|
||||
|
||||
if (tradingWith == null)
|
||||
return false;
|
||||
@@ -725,7 +725,7 @@ public class CharacterItemManager {
|
||||
if (source == null || !source.isAlive())
|
||||
return false;
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return false;
|
||||
@@ -768,7 +768,7 @@ public class CharacterItemManager {
|
||||
if (other == null || !other.isAlive())
|
||||
return false;
|
||||
|
||||
CharacterItemManager tradingWith = other.getCharItemManager();
|
||||
CharacterItemManager tradingWith = other.charItemManager;
|
||||
|
||||
if (tradingWith == null)
|
||||
return false;
|
||||
@@ -784,7 +784,7 @@ public class CharacterItemManager {
|
||||
CloseTradeWindowMsg ctwm2 = new CloseTradeWindowMsg(other, tradeID);
|
||||
this.commitTrade();
|
||||
this.closeTradeWindow(ctwm1, false);
|
||||
other.getCharItemManager().closeTradeWindow(ctwm2, false);
|
||||
other.charItemManager.closeTradeWindow(ctwm2, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -797,7 +797,7 @@ public class CharacterItemManager {
|
||||
|
||||
if (this.getTradingWith().getPlayerCharacter() == null)
|
||||
return false;
|
||||
CharacterItemManager man2 = this.getTradingWith().getPlayerCharacter().getCharItemManager();
|
||||
CharacterItemManager man2 = this.getTradingWith().getPlayerCharacter().charItemManager;
|
||||
Dispatch dispatch;
|
||||
|
||||
if (man1 == null || man2 == null)
|
||||
@@ -825,7 +825,7 @@ public class CharacterItemManager {
|
||||
if (source == null)
|
||||
return false;
|
||||
|
||||
CharacterItemManager sourceItemMan = source.getCharItemManager();
|
||||
CharacterItemManager sourceItemMan = source.charItemManager;
|
||||
|
||||
if (sourceItemMan == null)
|
||||
return false;
|
||||
@@ -851,7 +851,7 @@ public class CharacterItemManager {
|
||||
sourceItemMan.endTrade();
|
||||
|
||||
|
||||
cc2.getPlayerCharacter().getCharItemManager().closeTradeWindow(msg, false);
|
||||
cc2.getPlayerCharacter().charItemManager.closeTradeWindow(msg, false);
|
||||
|
||||
|
||||
return true;
|
||||
@@ -1149,7 +1149,7 @@ public class CharacterItemManager {
|
||||
if (tar == null)
|
||||
return false;
|
||||
|
||||
CharacterItemManager tarCim = tar.getCharItemManager();
|
||||
CharacterItemManager tarCim = tar.charItemManager;
|
||||
if (tarCim == null)
|
||||
return false;
|
||||
|
||||
@@ -1398,7 +1398,7 @@ public class CharacterItemManager {
|
||||
return false;
|
||||
|
||||
|
||||
if (this.getOwner().getCharItemManager().getGoldTrading() > 0) {
|
||||
if (this.getOwner().charItemManager.getGoldTrading() > 0) {
|
||||
if (this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.getOwner(), 195);
|
||||
return false;
|
||||
@@ -1437,7 +1437,7 @@ public class CharacterItemManager {
|
||||
if (itemToSell == null || npc == null)
|
||||
return false;
|
||||
|
||||
itemMan = npc.getCharItemManager();
|
||||
itemMan = npc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
@@ -1495,7 +1495,7 @@ public class CharacterItemManager {
|
||||
if (purchasedItem == null || npc == null)
|
||||
return false;
|
||||
|
||||
itemMan = npc.getCharItemManager();
|
||||
itemMan = npc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
@@ -1587,7 +1587,7 @@ public class CharacterItemManager {
|
||||
return null;
|
||||
|
||||
// get looters item manager
|
||||
CharacterItemManager looterItems = lootingPlayer.getCharItemManager();
|
||||
CharacterItemManager looterItems = lootingPlayer.charItemManager;
|
||||
|
||||
if (looterItems == null)
|
||||
return null;
|
||||
@@ -2129,7 +2129,7 @@ public class CharacterItemManager {
|
||||
tradeCharacter = this.tradingWith.getPlayerCharacter();
|
||||
|
||||
tradeWeight = this.getCarriedWeight() + itemWeight;
|
||||
tradeWeight = tradeWeight + tradeCharacter.getCharItemManager().getTradingWeight();
|
||||
tradeWeight = tradeWeight + tradeCharacter.charItemManager.getTradingWeight();
|
||||
tradeWeight = tradeWeight - this.getTradingWeight();
|
||||
|
||||
return tradeWeight <= (int) playerCharacter.statStrBase * 3;
|
||||
@@ -2311,7 +2311,7 @@ public class CharacterItemManager {
|
||||
}
|
||||
|
||||
|
||||
CharacterItemManager tradingWith = this.getTradingWith().getPlayerCharacter().getCharItemManager();
|
||||
CharacterItemManager tradingWith = this.getTradingWith().getPlayerCharacter().charItemManager;
|
||||
|
||||
if (tradingWith == null)
|
||||
return false;
|
||||
|
||||
@@ -274,7 +274,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
//TODO transfer items from players inventory and trade window to corpse
|
||||
CharacterItemManager cim = belongsTo.getCharItemManager();
|
||||
CharacterItemManager cim = belongsTo.charItemManager;
|
||||
if (cim != null)
|
||||
cim.transferEntireInventory(this.inventory, this, enterWorld);
|
||||
else
|
||||
@@ -287,7 +287,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
return null;
|
||||
|
||||
//get looters item manager
|
||||
CharacterItemManager looterItems = looter.getCharItemManager();
|
||||
CharacterItemManager looterItems = looter.charItemManager;
|
||||
if (looterItems == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ public class Item extends AbstractWorldObject {
|
||||
|
||||
if (item.getOwner() != null && item.getOwner().getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
PlayerCharacter player = (PlayerCharacter) item.getOwner();
|
||||
int tradingAmount = player.getCharItemManager().getGoldTrading();
|
||||
int tradingAmount = player.charItemManager.getGoldTrading();
|
||||
writer.putInt(item.numberOfItems - tradingAmount);
|
||||
} else
|
||||
writer.putInt(item.numberOfItems); // Amount of gold
|
||||
@@ -334,7 +334,7 @@ public class Item extends AbstractWorldObject {
|
||||
writer.putInt(0); // Pad
|
||||
|
||||
|
||||
writer.putInt(player.getCharItemManager().getGoldTrading()); // Amount of gold
|
||||
writer.putInt(player.charItemManager.getGoldTrading()); // Amount of gold
|
||||
|
||||
|
||||
writer.putInt(0);
|
||||
@@ -347,7 +347,7 @@ public class Item extends AbstractWorldObject {
|
||||
writer.putInt(4); //Non-Magical, grey name
|
||||
writer.putInt(1);
|
||||
writer.putInt(0); // Pad
|
||||
writer.putInt(player.getCharItemManager().getGoldTrading());
|
||||
writer.putInt(player.charItemManager.getGoldTrading());
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.putShort((short) 0);
|
||||
@@ -375,8 +375,8 @@ public class Item extends AbstractWorldObject {
|
||||
if (!itemWorked)
|
||||
return false;
|
||||
|
||||
reciever.getCharItemManager().addItemToInventory(item);
|
||||
reciever.getCharItemManager().updateInventory();
|
||||
reciever.charItemManager.addItemToInventory(item);
|
||||
reciever.charItemManager.updateInventory();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
++serialized;
|
||||
}
|
||||
if (player.getCharItemManager().getGoldTrading() > 0) {
|
||||
if (player.charItemManager.getGoldTrading() > 0) {
|
||||
Item.SerializeTradingGold(player, writer);
|
||||
++serialized;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ItemFactory {
|
||||
return;
|
||||
|
||||
int max = 20;
|
||||
CharacterItemManager itemManager = pc.getCharItemManager();
|
||||
CharacterItemManager itemManager = pc.charItemManager;
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ItemFactory {
|
||||
if (forge == null)
|
||||
return null;
|
||||
|
||||
if (!npc.getCharItemManager().hasRoomInventory(template.item_wt)) {
|
||||
if (!npc.charItemManager.hasRoomInventory(template.item_wt)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 21);
|
||||
return null;
|
||||
@@ -646,7 +646,7 @@ public class ItemFactory {
|
||||
if (template == null)
|
||||
return null;
|
||||
|
||||
if (!vendor.getCharItemManager().hasRoomInventory(template.item_wt)) {
|
||||
if (!vendor.charItemManager.hasRoomInventory(template.item_wt)) {
|
||||
|
||||
if (playerCharacter != null)
|
||||
ChatManager.chatSystemInfo(playerCharacter, vendor.getName() + " " + vendor.getContract().getName() + " Inventory is full.");
|
||||
|
||||
@@ -127,9 +127,10 @@ public class MobBase extends AbstractGameObject {
|
||||
for (BootySetEntry equipmentSetEntry : equipList) {
|
||||
|
||||
Item item = new Item(equipmentSetEntry.templateID);
|
||||
item.objectUUID = MobLoot.lastNegativeID.decrementAndGet();
|
||||
item.drop_chance = equipmentSetEntry.dropChance;
|
||||
|
||||
equip.put(item.slot, Item);
|
||||
item.equipSlot = item.template.item_eq_slots_or.iterator().next();
|
||||
equip.put(item.equipSlot, item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
public final class MobLoot extends Item {
|
||||
|
||||
private static final AtomicInteger LastUsedId = new AtomicInteger(0);
|
||||
public static final AtomicInteger lastNegativeID = new AtomicInteger(0);
|
||||
|
||||
private boolean isDeleted = false;
|
||||
private boolean noSteal;
|
||||
@@ -77,7 +77,7 @@ public final class MobLoot extends Item {
|
||||
* @return Id number
|
||||
*/
|
||||
private static int generateId() {
|
||||
int id = LastUsedId.decrementAndGet();
|
||||
int id = lastNegativeID.decrementAndGet();
|
||||
|
||||
//TODO Add a way to reclaim disposed IDs if this becomes a problem
|
||||
if (id == (-10000))
|
||||
|
||||
@@ -52,7 +52,6 @@ public class NPC extends AbstractCharacter {
|
||||
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
||||
public HashMap<Enum.EquipSlotType, Item> equip = null;
|
||||
public int runeSetID = 0;
|
||||
public int extraRune2 = 0;
|
||||
protected int loadID;
|
||||
@@ -341,11 +340,11 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
// get a copy of the equipped items.
|
||||
|
||||
if (npc.equip != null) {
|
||||
writer.putInt(npc.equip.size());
|
||||
if (npc.charItemManager.equipped.isEmpty() == false) {
|
||||
writer.putInt(npc.charItemManager.equipped.size());
|
||||
|
||||
for (Item me : npc.equip.values())
|
||||
Item.serializeForClientMsg(me, writer);
|
||||
for (Item me : npc.charItemManager.equipped.values())
|
||||
Item._serializeForClientMsg(me, writer);
|
||||
} else
|
||||
writer.putInt(0);
|
||||
|
||||
@@ -913,7 +912,7 @@ public class NPC extends AbstractCharacter {
|
||||
if (equipmentSetID != 0 && LootManager._bootySetMap.get(equipmentSetID) == null)
|
||||
Logger.error("Invalid equipSet: " + equipmentSetID + " contract: " + this.contractUUID + " npc: " + this.getObjectUUID());
|
||||
|
||||
this.equip = loadEquipmentSet(this.equipmentSetID);
|
||||
this.charItemManager.equipped = loadEquipmentSet(this.equipmentSetID);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1241,7 +1240,7 @@ public class NPC extends AbstractCharacter {
|
||||
if (targetItem == null)
|
||||
return false;
|
||||
|
||||
if (!this.getCharItemManager().forgeContains(targetItem, this))
|
||||
if (!this.charItemManager.forgeContains(targetItem, this))
|
||||
return false;
|
||||
|
||||
if (!DbManager.NPCQueries.UPDATE_ITEM_TO_INVENTORY(targetItem.getObjectUUID(), currentID))
|
||||
@@ -1250,7 +1249,7 @@ public class NPC extends AbstractCharacter {
|
||||
targetItem.setIsID(true);
|
||||
|
||||
this.rolling.remove(targetItem);
|
||||
this.getCharItemManager().addItemToInventory(targetItem);
|
||||
this.charItemManager.addItemToInventory(targetItem);
|
||||
|
||||
//remove from client forge window
|
||||
|
||||
@@ -1265,10 +1264,6 @@ public class NPC extends AbstractCharacter {
|
||||
return true;
|
||||
}
|
||||
|
||||
public HashMap<Enum.EquipSlotType, Item> getEquip() {
|
||||
return equip;
|
||||
}
|
||||
|
||||
public int getEquipmentSetID() {
|
||||
return equipmentSetID;
|
||||
}
|
||||
|
||||
@@ -1944,7 +1944,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
Mine.releaseMineClaims(this);
|
||||
|
||||
this.getCharItemManager().closeTradeWindow();
|
||||
this.charItemManager.closeTradeWindow();
|
||||
|
||||
//increment live counter. This is to prevent double kills from casts
|
||||
this.liveCounter++;
|
||||
|
||||
@@ -400,9 +400,9 @@ public class Resists {
|
||||
|
||||
// get resists from equipment
|
||||
if (ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (ac.getCharItemManager() != null && ac.getCharItemManager().getEquipped() != null) {
|
||||
if (ac.charItemManager != null && ac.charItemManager.getEquipped() != null) {
|
||||
float[] phys = {0f, 0f, 0f};
|
||||
ConcurrentHashMap<Enum.EquipSlotType, Item> equip = ac.getCharItemManager().getEquipped();
|
||||
ConcurrentHashMap<Enum.EquipSlotType, Item> equip = ac.charItemManager.getEquipped();
|
||||
|
||||
// get base physical resists
|
||||
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.HELM), phys);
|
||||
|
||||
@@ -253,7 +253,7 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
if (boonItem == null)
|
||||
return false;
|
||||
|
||||
if (!boonOwner.getCharItemManager().doesCharOwnThisItem(boonItem.getObjectUUID()))
|
||||
if (!boonOwner.charItemManager.doesCharOwnThisItem(boonItem.getObjectUUID()))
|
||||
return false;
|
||||
|
||||
for (ShrineType boonShrineType : boonItem.template.item_offering_info.keySet()) {
|
||||
@@ -271,8 +271,8 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
}
|
||||
|
||||
this.favors += amount;
|
||||
boonOwner.getCharItemManager().delete(boonItem);
|
||||
boonOwner.getCharItemManager().updateInventory();
|
||||
boonOwner.charItemManager.delete(boonItem);
|
||||
boonOwner.charItemManager.updateInventory();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Warehouse {
|
||||
return;
|
||||
|
||||
depositAmount = msg.getAmount();
|
||||
CharacterItemManager itemMan = player.getCharItemManager();
|
||||
CharacterItemManager itemMan = player.charItemManager;
|
||||
|
||||
if (!itemMan.doesCharOwnThisItem(resource.getObjectUUID()))
|
||||
return;
|
||||
@@ -250,7 +250,7 @@ public class Warehouse {
|
||||
if (warehouse.resources.get(resourceType) == null)
|
||||
return false;
|
||||
|
||||
CharacterItemManager itemMan = pc.getCharItemManager();
|
||||
CharacterItemManager itemMan = pc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
@@ -465,7 +465,7 @@ public class Warehouse {
|
||||
if (amount <= 0)
|
||||
return false;
|
||||
|
||||
CharacterItemManager itemMan = pc.getCharItemManager();
|
||||
CharacterItemManager itemMan = pc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
@@ -477,10 +477,10 @@ public class Warehouse {
|
||||
}
|
||||
|
||||
if (addToInventory && resourceType.equals(Enum.ResourceType.GOLD)) {
|
||||
if (pc.getCharItemManager().getGoldInventory().getNumOfItems() + amount > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
if (pc.charItemManager.getGoldInventory().getNumOfItems() + amount > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||
return false;
|
||||
|
||||
if (pc.getCharItemManager().getGoldInventory().getNumOfItems() + amount < 0)
|
||||
if (pc.charItemManager.getGoldInventory().getNumOfItems() + amount < 0)
|
||||
return false;
|
||||
}
|
||||
int oldAmount = warehouse.resources.get(resourceType);
|
||||
@@ -551,7 +551,7 @@ public class Warehouse {
|
||||
if (amount <= 0)
|
||||
return false;
|
||||
|
||||
CharacterItemManager itemMan = pc.getCharItemManager();
|
||||
CharacterItemManager itemMan = pc.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
|
||||
@@ -451,8 +451,8 @@ public class EffectsBase {
|
||||
}
|
||||
|
||||
if (awo.getObjectType().equals(GameObjectType.Item)) {
|
||||
if (source.getCharItemManager() != null) {
|
||||
source.getCharItemManager().updateInventory();
|
||||
if (source.charItemManager != null) {
|
||||
source.charItemManager.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SetItemFlagPowerAction extends AbstractPowerAction {
|
||||
item.setIsID(false); //update failed, reset
|
||||
|
||||
//update inventory
|
||||
CharacterItemManager cim = source.getCharItemManager();
|
||||
CharacterItemManager cim = source.charItemManager;
|
||||
if (cim != null)
|
||||
cim.updateInventory();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
return;
|
||||
|
||||
//dupe check, validate player has item
|
||||
if (!tar.validForInventory(ownerPC.getClientConnection(), ownerPC, ownerPC.getCharItemManager()))//pc.getCharItemManager()))
|
||||
if (!tar.validForInventory(ownerPC.getClientConnection(), ownerPC, ownerPC.charItemManager))//pc.getCharItemManager()))
|
||||
return;
|
||||
|
||||
//mark thief and target as player aggressive
|
||||
@@ -154,8 +154,8 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
}
|
||||
|
||||
//attempt transfer item
|
||||
CharacterItemManager myCIM = sourcePlayer.getCharItemManager();
|
||||
CharacterItemManager ownerCIM = ((AbstractCharacter) owner).getCharItemManager();
|
||||
CharacterItemManager myCIM = sourcePlayer.charItemManager;
|
||||
CharacterItemManager ownerCIM = ((AbstractCharacter) owner).charItemManager;
|
||||
if (myCIM == null || ownerCIM == null)
|
||||
return;
|
||||
|
||||
@@ -175,15 +175,15 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
//update thief's inventory
|
||||
if (sourcePlayer.getCharItemManager() != null)
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
if (sourcePlayer.charItemManager != null)
|
||||
sourcePlayer.charItemManager.updateInventory();
|
||||
|
||||
//update victims inventory
|
||||
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter ownerPC = (PlayerCharacter) owner;
|
||||
|
||||
if (ownerPC.getCharItemManager() != null)
|
||||
ownerPC.getCharItemManager().updateInventory();
|
||||
if (ownerPC.charItemManager != null)
|
||||
ownerPC.charItemManager.updateInventory();
|
||||
}
|
||||
|
||||
//TODO if victim is trading, cancel trade window for both people involved in trade
|
||||
|
||||
@@ -559,8 +559,8 @@ public class WorldServer {
|
||||
return;
|
||||
|
||||
//cancel any trade
|
||||
if (playerCharacter.getCharItemManager() != null)
|
||||
playerCharacter.getCharItemManager().endTrade(true);
|
||||
if (playerCharacter.charItemManager != null)
|
||||
playerCharacter.charItemManager.endTrade(true);
|
||||
|
||||
// Release any mine claims
|
||||
|
||||
|
||||
Reference in New Issue
Block a user