Start mobequip refactor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user