forked from MagicBane/Server
Equipment slot refactor started.
This commit is contained in:
@@ -1196,7 +1196,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
hair.ownerID = playerCharacter.getObjectUUID();
|
||||
hair.ownerType = OwnerType.PlayerCharacter;
|
||||
hair.containerType = ItemContainerType.EQUIPPED;
|
||||
hair.equipSlot = (byte) MBServerStatics.SLOT_HAIRSTYLE;
|
||||
hair.equipSlot = EquipSlotType.HAIR;
|
||||
|
||||
|
||||
try {
|
||||
@@ -1208,7 +1208,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (hair == null) {
|
||||
playerCharacter.deactivateCharacter();
|
||||
Logger.info("GameObjectManager failed to create Hair:" + hairStyleID + " in Slot:"
|
||||
+ MBServerStatics.SLOT_HAIRSTYLE);
|
||||
+ EquipSlotType.HAIR);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1219,7 +1219,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
beard.ownerID = playerCharacter.getObjectUUID();
|
||||
beard.ownerType = OwnerType.PlayerCharacter;
|
||||
beard.containerType = ItemContainerType.EQUIPPED;
|
||||
beard.equipSlot = (byte) MBServerStatics.SLOT_BEARDSTYLE;
|
||||
beard.equipSlot = EquipSlotType.BEARD;
|
||||
|
||||
try {
|
||||
beard = DbManager.ItemQueries.PERSIST(beard);
|
||||
@@ -1230,7 +1230,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (beard == null) {
|
||||
playerCharacter.deactivateCharacter();
|
||||
Logger.info("GameObjectManager failed to create Beard:" + beardStyleID + " in Slot:"
|
||||
+ MBServerStatics.SLOT_BEARDSTYLE);
|
||||
+ EquipSlotType.BEARD);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2827,7 +2827,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
//called to verify player has correct item equipped for casting.
|
||||
public boolean validEquip(int slot, String type) {
|
||||
public boolean validEquip(EquipSlotType slot, String type) {
|
||||
|
||||
if (this.charItemManager == null)
|
||||
return false;
|
||||
@@ -3729,14 +3729,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
ConcurrentHashMap<Integer, Item> equipped = this.charItemManager.getEquipped();
|
||||
ConcurrentHashMap<EquipSlotType, Item> equipped = this.charItemManager.getEquipped();
|
||||
float dexPenalty = 0f;
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_HELMET));
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_CHEST));
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_ARMS));
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_GLOVES));
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_LEGGINGS));
|
||||
dexPenalty += getDexPenalty(equipped.get(MBServerStatics.SLOT_FEET));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.HELM));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.CHEST));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.UPARM));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.HANDS));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.LEGS));
|
||||
dexPenalty += getDexPenalty(equipped.get(EquipSlotType.FEET));
|
||||
return (1 - (dexPenalty / 100));
|
||||
}
|
||||
|
||||
@@ -3795,7 +3795,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.defenseRating = 0;
|
||||
return;
|
||||
}
|
||||
ConcurrentHashMap<Integer, Item> equipped = this.charItemManager.getEquipped();
|
||||
ConcurrentHashMap<EquipSlotType, Item> equipped = this.charItemManager.getEquipped();
|
||||
|
||||
// // Reset passives
|
||||
// if (this.bonuses != null) {
|
||||
@@ -3807,8 +3807,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
// this.bonuses.setBool("Dodge", false);
|
||||
// }
|
||||
// calculate atr and damage for each hand
|
||||
calculateAtrDamageForWeapon(equipped.get(MBServerStatics.SLOT_MAINHAND), true, equipped.get(MBServerStatics.SLOT_OFFHAND));
|
||||
calculateAtrDamageForWeapon(equipped.get(MBServerStatics.SLOT_OFFHAND), false, equipped.get(MBServerStatics.SLOT_MAINHAND));
|
||||
calculateAtrDamageForWeapon(equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD));
|
||||
calculateAtrDamageForWeapon(equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD));
|
||||
|
||||
// No Defense while in DeathShroud
|
||||
if (this.effects != null && this.effects.containsKey("DeathShroud"))
|
||||
@@ -3816,13 +3816,13 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
else {
|
||||
// calculate defense for equipment
|
||||
float defense = this.statDexCurrent * 2;
|
||||
defense += getShieldDefense(equipped.get(MBServerStatics.SLOT_OFFHAND));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_HELMET));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_CHEST));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_ARMS));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_GLOVES));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_LEGGINGS));
|
||||
defense += getArmorDefense(equipped.get(MBServerStatics.SLOT_FEET));
|
||||
defense += getShieldDefense(equipped.get(EquipSlotType.LHELD));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.HELM));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.CHEST));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.UPARM));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.HANDS));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.LEGS));
|
||||
defense += getArmorDefense(equipped.get(EquipSlotType.FEET));
|
||||
defense += getWeaponDefense(equipped);
|
||||
|
||||
if (this.bonuses != null) {
|
||||
@@ -3883,7 +3883,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
// get skill percentages and min and max damage for weapons
|
||||
if (noWeapon) {
|
||||
if (mainHand) {
|
||||
Item off = this.charItemManager.getEquipped().get(MBServerStatics.SLOT_OFFHAND);
|
||||
Item off = this.charItemManager.getEquipped().get(EquipSlotType.LHELD);
|
||||
if (off != null && off.getItemBase() != null && off.getItemBase().getType().equals(ItemType.WEAPON))
|
||||
this.rangeHandOne = 10 * (1 + (this.statStrBase / 600)); // Set
|
||||
// to
|
||||
@@ -4114,9 +4114,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
public void setPassives() {
|
||||
if (this.bonuses != null) {
|
||||
ConcurrentHashMap<Integer, Item> equipped = this.charItemManager.getEquipped();
|
||||
Item off = equipped.get(MBServerStatics.SLOT_OFFHAND);
|
||||
Item main = equipped.get(MBServerStatics.SLOT_MAINHAND);
|
||||
ConcurrentHashMap<EquipSlotType, Item> equipped = this.charItemManager.getEquipped();
|
||||
Item off = equipped.get(EquipSlotType.LHELD);
|
||||
Item main = equipped.get(EquipSlotType.RHELD);
|
||||
ItemBase wbMain = null;
|
||||
ItemBase wbOff = null;
|
||||
if (main != null)
|
||||
@@ -4186,14 +4186,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
/**
|
||||
* @ Calculates Defense for weapon
|
||||
*/
|
||||
private float getWeaponDefense(ConcurrentHashMap<Integer, Item> equipped) {
|
||||
Item weapon = equipped.get(MBServerStatics.SLOT_MAINHAND);
|
||||
private float getWeaponDefense(ConcurrentHashMap<EquipSlotType, Item> equipped) {
|
||||
Item weapon = equipped.get(EquipSlotType.RHELD);
|
||||
ItemBase wb = null;
|
||||
CharacterSkill skill, mastery;
|
||||
float val = 0;
|
||||
boolean unarmed = false;
|
||||
if (weapon == null) {
|
||||
weapon = equipped.get(MBServerStatics.SLOT_OFFHAND);
|
||||
weapon = equipped.get(EquipSlotType.LHELD);
|
||||
if (weapon == null || weapon.getItemBase().isShield())
|
||||
unarmed = true;
|
||||
else
|
||||
@@ -4246,7 +4246,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
public void calculateItemBonuses() {
|
||||
if (this.charItemManager == null || this.bonuses == null)
|
||||
return;
|
||||
ConcurrentHashMap<Integer, Item> equipped = this.charItemManager.getEquipped();
|
||||
ConcurrentHashMap<EquipSlotType, Item> equipped = this.charItemManager.getEquipped();
|
||||
for (Item item : equipped.values()) {
|
||||
ItemBase ib = item.getItemBase();
|
||||
if (ib == null)
|
||||
|
||||
Reference in New Issue
Block a user