Start mobequip refactor

This commit is contained in:
2024-03-18 09:38:33 -04:00
parent 7fa8c3bfff
commit 0590ae64e7
20 changed files with 79 additions and 435 deletions
@@ -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;
}
+4 -26
View File
@@ -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();