More ordinal refactor
This commit is contained in:
@@ -1750,7 +1750,7 @@ public class CharacterItemManager {
|
||||
return equipped.containsValue(i);
|
||||
}
|
||||
|
||||
public synchronized Item getItemFromEquipped(int slot) {
|
||||
public synchronized Item getItemFromEquipped(Enum.EquipSlotType slot) {
|
||||
return equipped.get(slot);
|
||||
}
|
||||
|
||||
@@ -1865,7 +1865,7 @@ public class CharacterItemManager {
|
||||
}
|
||||
|
||||
if (!ItemTemplate.validForSkills(item, pc.getSkills())) {
|
||||
this.forceToInventory(slot.ordinal(), item, pc, initialized);
|
||||
this.forceToInventory(slot, item, pc, initialized);
|
||||
pc.applyBonuses();
|
||||
}
|
||||
}
|
||||
@@ -2266,13 +2266,13 @@ public class CharacterItemManager {
|
||||
|
||||
}
|
||||
|
||||
public void forceToInventory(int slot, Item item, PlayerCharacter pc, boolean initialized) {
|
||||
if (item == null || pc == null)
|
||||
public void forceToInventory(Enum.EquipSlotType slot, Item item, PlayerCharacter player, boolean initialized) {
|
||||
|
||||
if (item == null || player == null)
|
||||
return;
|
||||
|
||||
if (!item.moveItemToInventory(pc)) {
|
||||
//TODO well why did this fail? clean it up
|
||||
}
|
||||
if (!item.moveItemToInventory(player))
|
||||
Logger.error("templateL " + item.template.template_id);
|
||||
|
||||
// remove it from other lists:
|
||||
this.remItemFromLists(item);
|
||||
@@ -2284,9 +2284,10 @@ public class CharacterItemManager {
|
||||
calculateWeights();
|
||||
|
||||
//Update players with unequipped item
|
||||
|
||||
if (initialized) {
|
||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(pc, slot);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, back, engine.Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(player, slot);
|
||||
DispatchMessage.dispatchMsgToInterestArea(player, back, engine.Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user