forked from MagicBane/Server
More ordinal refactor
This commit is contained in:
@@ -70,7 +70,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
if (ib != null) {
|
if (ib != null) {
|
||||||
|
|
||||||
MobEquipment me = new MobEquipment(ib, 0, 0);
|
MobEquipment me = new MobEquipment(ib, Enum.EquipSlotType.NONE, 0);
|
||||||
contract.getSellInventory().add(me);
|
contract.getSellInventory().add(me);
|
||||||
|
|
||||||
//handle magic effects
|
//handle magic effects
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.Mob) {
|
if (tar.getObjectType() == GameObjectType.Mob) {
|
||||||
Mob tarMob = (Mob) tar;
|
Mob tarMob = (Mob) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (int slot : tarMob.getEquip().keySet()) {
|
for (Enum.EquipSlotType slot : tarMob.getEquip().keySet()) {
|
||||||
MobEquipment equip = tarMob.getEquip().get(slot);
|
MobEquipment equip = tarMob.getEquip().get(slot);
|
||||||
ItemTemplate template = ItemTemplate.itemTemplates.get(equip.getItemBase().getUUID());
|
ItemTemplate template = ItemTemplate.itemTemplates.get(equip.getItemBase().getUUID());
|
||||||
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + template.item_base_name + ", slot: " + slot);
|
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + template.item_base_name + ", slot: " + slot);
|
||||||
@@ -75,7 +75,7 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.NPC) {
|
if (tar.getObjectType() == GameObjectType.NPC) {
|
||||||
NPC tarMob = (NPC) tar;
|
NPC tarMob = (NPC) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (int slot : tarMob.getEquip().keySet()) {
|
for (Enum.EquipSlotType slot : tarMob.getEquip().keySet()) {
|
||||||
MobEquipment equip = tarMob.getEquip().get(slot);
|
MobEquipment equip = tarMob.getEquip().get(slot);
|
||||||
ItemTemplate template = ItemTemplate.itemTemplates.get(equip.getItemBase().getUUID());
|
ItemTemplate template = ItemTemplate.itemTemplates.get(equip.getItemBase().getUUID());
|
||||||
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + template.item_base_name + ", slot: " + slot);
|
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + template.item_base_name + ", slot: " + slot);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
public static ItemBase getWeaponBase(int slot, HashMap<Enum.EquipSlotType, MobEquipment> equip) {
|
||||||
if (equip.containsKey(slot)) {
|
if (equip.containsKey(slot)) {
|
||||||
MobEquipment item = equip.get(slot);
|
MobEquipment item = equip.get(slot);
|
||||||
if (item != null && item.getItemBase() != null) {
|
if (item != null && item.getItemBase() != null) {
|
||||||
@@ -96,7 +97,7 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
out += "Defense: " + tar.getDefenseRating() + newline;
|
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||||
|
|
||||||
//get weapons
|
//get weapons
|
||||||
HashMap<Integer, MobEquipment> equip = tar.getEquip();
|
HashMap<Enum.EquipSlotType, MobEquipment> equip = tar.getEquip();
|
||||||
ItemBase main = null;
|
ItemBase main = null;
|
||||||
|
|
||||||
if (equip != null)
|
if (equip != null)
|
||||||
|
|||||||
@@ -865,10 +865,10 @@ public enum CombatManager {
|
|||||||
if (acItem == null || tarItem == null)
|
if (acItem == null || tarItem == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Item acMain = acItem.getItemFromEquipped(1);
|
Item acMain = acItem.getItemFromEquipped(EquipSlotType.RHELD);
|
||||||
Item acOff = acItem.getItemFromEquipped(2);
|
Item acOff = acItem.getItemFromEquipped(EquipSlotType.LHELD);
|
||||||
Item tarMain = tarItem.getItemFromEquipped(1);
|
Item tarMain = tarItem.getItemFromEquipped(EquipSlotType.RHELD);
|
||||||
Item tarOff = tarItem.getItemFromEquipped(2);
|
Item tarOff = tarItem.getItemFromEquipped(EquipSlotType.LHELD);
|
||||||
|
|
||||||
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
||||||
}
|
}
|
||||||
@@ -886,7 +886,7 @@ public enum CombatManager {
|
|||||||
if (acItem == null || tarItem == null)
|
if (acItem == null || tarItem == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Item tarOff = tarItem.getItemFromEquipped(2);
|
Item tarOff = tarItem.getItemFromEquipped(EquipSlotType.LHELD);
|
||||||
|
|
||||||
if (tarOff == null)
|
if (tarOff == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.net.client;
|
package engine.net.client;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
@@ -164,7 +165,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (itemManager == null)
|
if (itemManager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int slot = msg.getSlotNumber();
|
Enum.EquipSlotType slot = msg.slot;
|
||||||
|
|
||||||
Item i = itemManager.getItemFromEquipped(slot);
|
Item i = itemManager.getItemFromEquipped(slot);
|
||||||
if (i == null)
|
if (i == null)
|
||||||
@@ -754,7 +755,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
for (MobEquipment equip : mobTarget.getEquip().values()) {
|
for (MobEquipment equip : mobTarget.getEquip().values()) {
|
||||||
|
|
||||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.getSlot());
|
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.slot);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(mobTarget, back, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(mobTarget, back, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
|
|
||||||
LootMsg lootMsg = new LootMsg(0, 0, tar.getObjectType().ordinal(), tar.getObjectUUID(), equip);
|
LootMsg lootMsg = new LootMsg(0, 0, tar.getObjectType().ordinal(), tar.getObjectUUID(), equip);
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
int itemUUID = transferMsg.getUUID();
|
int itemUUID = transferMsg.getUUID();
|
||||||
int slotOrdinal = transferMsg.getSlotNumber();
|
Enum.EquipSlotType equipSlot = transferMsg.slot;
|
||||||
Enum.EquipSlotType equipSlot = Enum.EquipSlotType.values()[slotOrdinal];
|
|
||||||
|
|
||||||
Item item = itemManager.getItemByUUID(itemUUID);
|
Item item = itemManager.getItemByUUID(itemUUID);
|
||||||
|
|
||||||
@@ -109,7 +108,7 @@ public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHa
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(player, msg.getSlotNumber());
|
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(player, msg.slot);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, back);
|
Dispatch dispatch = Dispatch.borrow(player, back);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.exception.SerializationException;
|
import engine.exception.SerializationException;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
import engine.net.ByteBufferReader;
|
import engine.net.ByteBufferReader;
|
||||||
@@ -21,16 +22,16 @@ public class TransferItemFromEquipToInventoryMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
private int playerType;
|
private int playerType;
|
||||||
private int playerUUID;
|
private int playerUUID;
|
||||||
private int slotNumber;
|
public Enum.EquipSlotType slot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the general purpose constructor.
|
* This is the general purpose constructor.
|
||||||
*/
|
*/
|
||||||
public TransferItemFromEquipToInventoryMsg(AbstractGameObject ago, int slotNumber) {
|
public TransferItemFromEquipToInventoryMsg(AbstractGameObject ago, Enum.EquipSlotType slot) {
|
||||||
super(Protocol.UNEQUIP);
|
super(Protocol.UNEQUIP);
|
||||||
this.playerType = ago.getObjectType().ordinal();
|
this.playerType = ago.getObjectType().ordinal();
|
||||||
this.playerUUID = ago.getObjectUUID();
|
this.playerUUID = ago.getObjectUUID();
|
||||||
this.slotNumber = slotNumber;
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +51,7 @@ public class TransferItemFromEquipToInventoryMsg extends ClientNetMsg {
|
|||||||
protected void _deserialize(ByteBufferReader reader) {
|
protected void _deserialize(ByteBufferReader reader) {
|
||||||
this.playerType = reader.getInt();
|
this.playerType = reader.getInt();
|
||||||
this.playerUUID = reader.getInt();
|
this.playerUUID = reader.getInt();
|
||||||
this.slotNumber = reader.getInt();
|
this.slot = Enum.EquipSlotType.values()[reader.getInt()];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,16 +61,13 @@ public class TransferItemFromEquipToInventoryMsg extends ClientNetMsg {
|
|||||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||||
writer.putInt(this.playerType);
|
writer.putInt(this.playerType);
|
||||||
writer.putInt(this.playerUUID);
|
writer.putInt(this.playerUUID);
|
||||||
writer.putInt(this.slotNumber);
|
writer.putInt(this.slot.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the slotNumber
|
* @return the slotNumber
|
||||||
*/
|
*/
|
||||||
public int getSlotNumber() {
|
|
||||||
return slotNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPlayerType() {
|
public int getPlayerType() {
|
||||||
return playerType;
|
return playerType;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.exception.SerializationException;
|
import engine.exception.SerializationException;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
import engine.net.ByteBufferReader;
|
import engine.net.ByteBufferReader;
|
||||||
@@ -25,7 +26,8 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
private int itemBase;
|
private int itemBase;
|
||||||
private int type;
|
private int type;
|
||||||
private int objectUUID;
|
private int objectUUID;
|
||||||
private int slotNumber;
|
|
||||||
|
public Enum.EquipSlotType slot;
|
||||||
private int pad2;
|
private int pad2;
|
||||||
private float unknown1, unknown2;
|
private float unknown1, unknown2;
|
||||||
|
|
||||||
@@ -36,11 +38,11 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
super(Protocol.EQUIP);
|
super(Protocol.EQUIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransferItemFromInventoryToEquipMsg(AbstractCharacter source, int slot, int itemBaseID) {
|
public TransferItemFromInventoryToEquipMsg(AbstractCharacter source, Enum.EquipSlotType slot, int itemBaseID) {
|
||||||
super(Protocol.EQUIP);
|
super(Protocol.EQUIP);
|
||||||
this.sourceType = source.getObjectType().ordinal();
|
this.sourceType = source.getObjectType().ordinal();
|
||||||
this.sourceID = source.getObjectUUID();
|
this.sourceID = source.getObjectUUID();
|
||||||
this.slotNumber = slot;
|
this.slot = slot;
|
||||||
this.itemBase = itemBaseID;
|
this.itemBase = itemBaseID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
itemBase = reader.getInt();
|
itemBase = reader.getInt();
|
||||||
type = reader.getInt();
|
type = reader.getInt();
|
||||||
objectUUID = reader.getInt();
|
objectUUID = reader.getInt();
|
||||||
slotNumber = reader.getInt();
|
slot = Enum.EquipSlotType.values()[reader.getInt()];
|
||||||
pad2 = reader.getInt();
|
pad2 = reader.getInt();
|
||||||
unknown1 = reader.getFloat();
|
unknown1 = reader.getFloat();
|
||||||
unknown2 = reader.getFloat();
|
unknown2 = reader.getFloat();
|
||||||
@@ -82,27 +84,12 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
writer.putInt(itemBase);
|
writer.putInt(itemBase);
|
||||||
writer.putInt(type);
|
writer.putInt(type);
|
||||||
writer.putInt(objectUUID);
|
writer.putInt(objectUUID);
|
||||||
writer.putInt(slotNumber);
|
writer.putInt(slot.ordinal());
|
||||||
writer.putInt(pad2);
|
writer.putInt(pad2);
|
||||||
writer.putFloat(unknown1);
|
writer.putFloat(unknown1);
|
||||||
writer.putFloat(unknown1);
|
writer.putFloat(unknown1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the pad1
|
|
||||||
*/
|
|
||||||
public int getPad1() {
|
|
||||||
return pad1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param pad1 the pad1 to set
|
|
||||||
*/
|
|
||||||
public void setPad1(int pad1) {
|
|
||||||
this.pad1 = pad1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the itemBase
|
* @return the itemBase
|
||||||
*/
|
*/
|
||||||
@@ -138,34 +125,6 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
return objectUUID;
|
return objectUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the slotNumber
|
|
||||||
*/
|
|
||||||
public int getSlotNumber() {
|
|
||||||
return slotNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param slotNumber the slotNumber to set
|
|
||||||
*/
|
|
||||||
public void setSlotNumber(int slotNumber) {
|
|
||||||
this.slotNumber = slotNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the pad2
|
|
||||||
*/
|
|
||||||
public int getPad2() {
|
|
||||||
return pad2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param pad2 the pad2 to set
|
|
||||||
*/
|
|
||||||
public void setPad2(int pad2) {
|
|
||||||
this.pad2 = pad2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the unknown1
|
* @return the unknown1
|
||||||
*/
|
*/
|
||||||
@@ -180,20 +139,6 @@ public class TransferItemFromInventoryToEquipMsg extends ClientNetMsg {
|
|||||||
this.unknown1 = unknown1;
|
this.unknown1 = unknown1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the unknown2
|
|
||||||
*/
|
|
||||||
public float getUnknown2() {
|
|
||||||
return unknown2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param unknown2 the unknown2 to set
|
|
||||||
*/
|
|
||||||
public void setUnknown2(float unknown2) {
|
|
||||||
this.unknown2 = unknown2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSourceType() {
|
public int getSourceType() {
|
||||||
return sourceType;
|
return sourceType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1750,7 +1750,7 @@ public class CharacterItemManager {
|
|||||||
return equipped.containsValue(i);
|
return equipped.containsValue(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Item getItemFromEquipped(int slot) {
|
public synchronized Item getItemFromEquipped(Enum.EquipSlotType slot) {
|
||||||
return equipped.get(slot);
|
return equipped.get(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1865,7 +1865,7 @@ public class CharacterItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ItemTemplate.validForSkills(item, pc.getSkills())) {
|
if (!ItemTemplate.validForSkills(item, pc.getSkills())) {
|
||||||
this.forceToInventory(slot.ordinal(), item, pc, initialized);
|
this.forceToInventory(slot, item, pc, initialized);
|
||||||
pc.applyBonuses();
|
pc.applyBonuses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2266,13 +2266,13 @@ public class CharacterItemManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceToInventory(int slot, Item item, PlayerCharacter pc, boolean initialized) {
|
public void forceToInventory(Enum.EquipSlotType slot, Item item, PlayerCharacter player, boolean initialized) {
|
||||||
if (item == null || pc == null)
|
|
||||||
|
if (item == null || player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!item.moveItemToInventory(pc)) {
|
if (!item.moveItemToInventory(player))
|
||||||
//TODO well why did this fail? clean it up
|
Logger.error("templateL " + item.template.template_id);
|
||||||
}
|
|
||||||
|
|
||||||
// remove it from other lists:
|
// remove it from other lists:
|
||||||
this.remItemFromLists(item);
|
this.remItemFromLists(item);
|
||||||
@@ -2284,9 +2284,10 @@ public class CharacterItemManager {
|
|||||||
calculateWeights();
|
calculateWeights();
|
||||||
|
|
||||||
//Update players with unequipped item
|
//Update players with unequipped item
|
||||||
|
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(pc, slot);
|
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(player, slot);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, back, engine.Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchMessage.dispatchMsgToInterestArea(player, back, engine.Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
|||||||
private int currentID;
|
private int currentID;
|
||||||
private long lastAttackTime = 0;
|
private long lastAttackTime = 0;
|
||||||
private int lastMobPowerToken = 0;
|
private int lastMobPowerToken = 0;
|
||||||
public HashMap<Integer, MobEquipment> equip = null;
|
public HashMap<Enum.EquipSlotType, MobEquipment> equip = null;
|
||||||
private DeferredPowerJob weaponPower;
|
private DeferredPowerJob weaponPower;
|
||||||
private DateTime upgradeDateTime = null;
|
private DateTime upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
@@ -1218,7 +1218,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
|||||||
// calculate defense for equipment
|
// calculate defense for equipment
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getWeaponDefense(HashMap<Integer, MobEquipment> equipped) {
|
private float getWeaponDefense(HashMap<Enum.EquipSlotType, MobEquipment> equipped) {
|
||||||
|
|
||||||
MobEquipment weapon = equipped.get(EquipSlotType.RHELD);
|
MobEquipment weapon = equipped.get(EquipSlotType.RHELD);
|
||||||
ItemBase wb = null;
|
ItemBase wb = null;
|
||||||
@@ -1836,7 +1836,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
|||||||
this.lootSync = lootSync;
|
this.lootSync = lootSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, MobEquipment> getEquip() {
|
public HashMap<Enum.EquipSlotType, MobEquipment> getEquip() {
|
||||||
return equip;
|
return equip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ public class MobBase extends AbstractGameObject {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, MobEquipment> loadEquipmentSet(int equipmentSetID) {
|
public static HashMap<Enum.EquipSlotType, MobEquipment> loadEquipmentSet(int equipmentSetID) {
|
||||||
|
|
||||||
ArrayList<BootySetEntry> equipList;
|
ArrayList<BootySetEntry> equipList;
|
||||||
HashMap<Integer, MobEquipment> equip = new HashMap<>();
|
HashMap<Enum.EquipSlotType, MobEquipment> equip = new HashMap<>();
|
||||||
|
|
||||||
if (equipmentSetID == 0)
|
if (equipmentSetID == 0)
|
||||||
return equip;
|
return equip;
|
||||||
@@ -128,13 +128,12 @@ public class MobBase extends AbstractGameObject {
|
|||||||
MobEquipment mobEquipment = new MobEquipment(equipmentSetEntry.itemBase, equipmentSetEntry.dropChance);
|
MobEquipment mobEquipment = new MobEquipment(equipmentSetEntry.itemBase, equipmentSetEntry.dropChance);
|
||||||
ItemBase itemBase = mobEquipment.getItemBase();
|
ItemBase itemBase = mobEquipment.getItemBase();
|
||||||
|
|
||||||
if (itemBase != null) {
|
// if (itemBase.getType().equals(Enum.ItemType.WEAPON))
|
||||||
if (itemBase.getType().equals(Enum.ItemType.WEAPON))
|
// if (mobEquipment.getSlot() == 1 && itemBase.getEquipFlag() == 2)
|
||||||
if (mobEquipment.getSlot() == 1 && itemBase.getEquipFlag() == 2)
|
// mobEquipment.setSlot(2);
|
||||||
mobEquipment.setSlot(2);
|
|
||||||
|
equip.put(mobEquipment.slot, mobEquipment);
|
||||||
|
|
||||||
equip.put(mobEquipment.getSlot(), mobEquipment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return equip;
|
return equip;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class MobEquipment extends AbstractGameObject {
|
|||||||
|
|
||||||
private static AtomicInteger equipCounter = new AtomicInteger(0);
|
private static AtomicInteger equipCounter = new AtomicInteger(0);
|
||||||
private final ItemBase itemBase;
|
private final ItemBase itemBase;
|
||||||
private int slot;
|
public Enum.EquipSlotType slot;
|
||||||
private int parentID;
|
private int parentID;
|
||||||
|
|
||||||
//effects
|
//effects
|
||||||
@@ -41,7 +41,7 @@ public class MobEquipment extends AbstractGameObject {
|
|||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
*/
|
*/
|
||||||
public MobEquipment(ItemBase itemBase, int slot, int parentID) {
|
public MobEquipment(ItemBase itemBase, Enum.EquipSlotType slot, int parentID) {
|
||||||
super(MobEquipment.getNewID());
|
super(MobEquipment.getNewID());
|
||||||
this.itemBase = itemBase;
|
this.itemBase = itemBase;
|
||||||
this.templateID = this.itemBase.getUUID();
|
this.templateID = this.itemBase.getUUID();
|
||||||
@@ -62,7 +62,8 @@ public class MobEquipment extends AbstractGameObject {
|
|||||||
this.template = ItemTemplate.itemTemplates.get(itemBaseID);
|
this.template = ItemTemplate.itemTemplates.get(itemBaseID);
|
||||||
|
|
||||||
Enum.EquipSlotType equipSlot = template.item_eq_slots_and.iterator().next();
|
Enum.EquipSlotType equipSlot = template.item_eq_slots_and.iterator().next();
|
||||||
this.slot = equipSlot.ordinal();
|
|
||||||
|
this.slot = equipSlot;
|
||||||
this.dropChance = dropChance;
|
this.dropChance = dropChance;
|
||||||
|
|
||||||
this.parentID = 0;
|
this.parentID = 0;
|
||||||
@@ -86,7 +87,7 @@ public class MobEquipment extends AbstractGameObject {
|
|||||||
public static void _serializeForClientMsg(MobEquipment mobEquipment, ByteBufferWriter writer, boolean useSlot) throws SerializationException {
|
public static void _serializeForClientMsg(MobEquipment mobEquipment, ByteBufferWriter writer, boolean useSlot) throws SerializationException {
|
||||||
|
|
||||||
if (useSlot)
|
if (useSlot)
|
||||||
writer.putInt(mobEquipment.slot);
|
writer.putInt(mobEquipment.slot.ordinal());
|
||||||
writer.putInt(0); // Pad
|
writer.putInt(0); // Pad
|
||||||
writer.putInt(mobEquipment.itemBase.getUUID());
|
writer.putInt(mobEquipment.itemBase.getUUID());
|
||||||
writer.putInt(mobEquipment.getObjectType().ordinal());
|
writer.putInt(mobEquipment.getObjectType().ordinal());
|
||||||
@@ -209,15 +210,6 @@ public class MobEquipment extends AbstractGameObject {
|
|||||||
public ItemBase getItemBase() {
|
public ItemBase getItemBase() {
|
||||||
return itemBase;
|
return itemBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSlot() {
|
|
||||||
return this.slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSlot(int value) {
|
|
||||||
this.slot = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void setMagicValue() {
|
public final void setMagicValue() {
|
||||||
float value = 1;
|
float value = 1;
|
||||||
if (itemBase != null)
|
if (itemBase != null)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
||||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||||
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
||||||
public HashMap<Integer, MobEquipment> equip = null;
|
public HashMap<Enum.EquipSlotType, MobEquipment> equip = null;
|
||||||
public int runeSetID = 0;
|
public int runeSetID = 0;
|
||||||
public int extraRune2 = 0;
|
public int extraRune2 = 0;
|
||||||
protected int loadID;
|
protected int loadID;
|
||||||
@@ -1265,7 +1265,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, MobEquipment> getEquip() {
|
public HashMap<Enum.EquipSlotType, MobEquipment> getEquip() {
|
||||||
return equip;
|
return equip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user