forked from MagicBane/Server
Start mobequip refactor
This commit is contained in:
@@ -699,7 +699,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
if (item != null && item.getObjectType() == GameObjectType.MobLoot) {
|
||||
|
||||
for (MobEquipment equip : mobTarget.getEquip().values()) {
|
||||
for (Item equip : mobTarget.getEquip().values()) {
|
||||
|
||||
TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.slot);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mobTarget, back, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
|
||||
@@ -63,14 +63,14 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
Item buy = null;
|
||||
|
||||
if (buyFromNPCMsg.getItemType() == Enum.GameObjectType.MobEquipment.ordinal()) {
|
||||
if (buyFromNPCMsg.getItemType() == Enum.GameObjectType.Item.ordinal()) {
|
||||
|
||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||
ArrayList<Item> sellInventory = npc.getContract().getSellInventory();
|
||||
|
||||
if (sellInventory == null)
|
||||
return true;
|
||||
|
||||
for (MobEquipment me : sellInventory) {
|
||||
for (Item me : sellInventory) {
|
||||
|
||||
if (me.getObjectUUID() == buyFromNPCMsg.getItemID()) {
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
NPC npc = NPC.getFromCache(npcID);
|
||||
CharacterItemManager man = null;
|
||||
ArrayList<Item> inventory = null;
|
||||
ArrayList<MobEquipment> sellInventory = null;
|
||||
ArrayList<Item> sellInventory = null;
|
||||
|
||||
if (npc != null) {
|
||||
man = npc.getCharItemManager();
|
||||
@@ -147,9 +147,9 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
//add generic sell inventory from contract
|
||||
if (sellInventory != null) {
|
||||
|
||||
for (MobEquipment mobEquipment : sellInventory) {
|
||||
for (Item Item : sellInventory) {
|
||||
try {
|
||||
MobEquipment.serializeForVendor(mobEquipment, writer, sellPercent);
|
||||
Item.serializeForVendor(Item, writer, sellPercent);
|
||||
} catch (SerializationException se) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.MobEquipment;
|
||||
import engine.objects.Item;
|
||||
|
||||
public class LootMsg extends ClientNetMsg {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LootMsg extends ClientNetMsg {
|
||||
private int unknown07;
|
||||
private int unknown08;
|
||||
|
||||
private MobEquipment mobEquipment = null;
|
||||
private Item Item = null;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
@@ -60,28 +60,6 @@ public class LootMsg extends ClientNetMsg {
|
||||
this.unknown08 = 0;
|
||||
}
|
||||
|
||||
//for MobEquipment
|
||||
|
||||
public LootMsg(int sourceType, int sourceID, int targetType, int targetID, MobEquipment mobEquipment) {
|
||||
super(Protocol.MOVEOBJECTTOCONTAINER);
|
||||
this.sourceType1 = sourceType;
|
||||
this.sourceID1 = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.sourceType2 = sourceType;
|
||||
this.sourceID2 = sourceID;
|
||||
this.item = null;
|
||||
this.mobEquipment = mobEquipment;
|
||||
|
||||
this.unknown01 = 0;
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = 0;
|
||||
this.unknown05 = 0;
|
||||
this.unknown07 = 0;
|
||||
this.unknown08 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
@@ -100,9 +78,9 @@ public class LootMsg extends ClientNetMsg {
|
||||
|
||||
if (this.item != null)
|
||||
Item.serializeForClientMsgWithoutSlot(this.item, writer);
|
||||
else if (this.mobEquipment != null)
|
||||
else if (this.Item != null)
|
||||
try {
|
||||
MobEquipment._serializeForClientMsg(this.mobEquipment, writer, false);
|
||||
Item._serializeForClientMsg(this.Item, writer, false);
|
||||
} catch (SerializationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user