Browse Source

field is templateID not item uuid.

combat-2
MagicBot 7 months ago
parent
commit
679c7afe0e
  1. 12
      src/engine/net/client/handlers/ItemProductionMsgHandler.java
  2. 48
      src/engine/net/client/msg/ItemProductionMsg.java

12
src/engine/net/client/handlers/ItemProductionMsgHandler.java

@ -463,14 +463,14 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size(); int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size();
if (emptySlots > 0) { if (emptySlots > 0) {
for (int i = 0; i < emptySlots; i++) { for (int i = 0; i < emptySlots; i++) {
vendorNPC.produceItem(player.getObjectUUID(), msg.getTotalProduction(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getItemUUID()); vendorNPC.produceItem(player.getObjectUUID(), msg.getTotalProduction(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getTemplateID());
} }
} }
} else } else
vendorNPC.produceItem(player.getObjectUUID(), msg.getTotalProduction(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getItemUUID()); vendorNPC.produceItem(player.getObjectUUID(), msg.getTotalProduction(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getTemplateID());
break; break;
case ACTION_JUNK: case ACTION_JUNK:
junkItem(msg.getItemUUID(), vendorNPC, origin); junkItem(msg.getTemplateID(), vendorNPC, origin);
break; break;
case ACTION_RECYCLE: case ACTION_RECYCLE:
recycleItem(msg.getItemIDtoTypeMap(), vendorNPC, origin); recycleItem(msg.getItemIDtoTypeMap(), vendorNPC, origin);
@ -480,7 +480,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
break; break;
case ACTION_COMPLETE: case ACTION_COMPLETE:
vendorNPC.completeItem(msg.getItemUUID()); vendorNPC.completeItem(msg.getTemplateID());
// ManageNPCMsg outMsg = new ManageNPCMsg(vendorNPC); // ManageNPCMsg outMsg = new ManageNPCMsg(vendorNPC);
// outMsg.setMessageType(1); // outMsg.setMessageType(1);
@ -491,10 +491,10 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
break; break;
case ACTION_DEPOSIT: case ACTION_DEPOSIT:
depositItem(msg.getItemUUID(), vendorNPC, origin); depositItem(msg.getTemplateID(), vendorNPC, origin);
break; break;
case ACTION_SETPRICE: case ACTION_SETPRICE:
setItemPrice(msg.getItemType(), msg.getItemUUID(), msg.getItemPrice(), vendorNPC, origin); setItemPrice(msg.getItemType(), msg.getTemplateID(), msg.getItemPrice(), vendorNPC, origin);
break; break;
case ACTION_TAKE: case ACTION_TAKE:
takeItem(msg.getItemIDtoTypeMap(), vendorNPC, origin); takeItem(msg.getItemIDtoTypeMap(), vendorNPC, origin);

48
src/engine/net/client/msg/ItemProductionMsg.java

@ -38,7 +38,7 @@ public class ItemProductionMsg extends ClientNetMsg {
private int size; private int size;
private int buildingUUID; private int buildingUUID;
private int unknown01; private int unknown01;
private int itemUUID; private int templateID;
private int itemType; private int itemType;
private int totalProduction; private int totalProduction;
private int unknown03; private int unknown03;
@ -61,7 +61,7 @@ public class ItemProductionMsg extends ClientNetMsg {
this.size = 0; this.size = 0;
this.buildingUUID = 0; this.buildingUUID = 0;
this.unknown01 = 0; this.unknown01 = 0;
this.itemUUID = 0; this.templateID = 0;
this.totalProduction = 0; this.totalProduction = 0;
this.unknown03 = 0; this.unknown03 = 0;
this.pToken = 0; this.pToken = 0;
@ -81,7 +81,7 @@ public class ItemProductionMsg extends ClientNetMsg {
this.buildingUUID = building.getObjectUUID(); this.buildingUUID = building.getObjectUUID();
this.npcUUID = vendor.getObjectUUID(); this.npcUUID = vendor.getObjectUUID();
this.itemType = item.getObjectType().ordinal(); this.itemType = item.getObjectType().ordinal();
this.itemUUID = item.getObjectUUID(); this.templateID = item.getObjectUUID();
this.unknown01 = 0; this.unknown01 = 0;
this.totalProduction = 0; this.totalProduction = 0;
this.unknown03 = 0; this.unknown03 = 0;
@ -139,7 +139,7 @@ public class ItemProductionMsg extends ClientNetMsg {
if (!add) { if (!add) {
writer.put((byte) 1); writer.put((byte) 1);
Item item = Item.getFromCache(this.itemUUID); Item item = Item.getFromCache(this.templateID);
if (item != null) if (item != null)
Item.serializeForClientMsgWithoutSlot(item, writer); Item.serializeForClientMsgWithoutSlot(item, writer);
writer.putInt(building.getStrongboxValue()); writer.putInt(building.getStrongboxValue());
@ -154,9 +154,9 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.put((byte) 1); writer.put((byte) 1);
Item item; Item item;
if (this.itemType == GameObjectType.Item.ordinal()) if (this.itemType == GameObjectType.Item.ordinal())
item = Item.getFromCache(this.itemUUID); item = Item.getFromCache(this.templateID);
else else
item = MobLoot.getFromCache(this.itemUUID); item = MobLoot.getFromCache(this.templateID);
if (item != null) if (item != null)
Item.serializeForClientMsgWithoutSlot(item, writer); Item.serializeForClientMsgWithoutSlot(item, writer);
writer.putInt(building.getStrongboxValue()); writer.putInt(building.getStrongboxValue());
@ -166,7 +166,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_CONFIRM_TAKE: case ACTION_CONFIRM_TAKE:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(1); writer.putInt(1);
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -178,7 +178,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_SETPRICE: case ACTION_SETPRICE:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(1); writer.putInt(1);
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -191,7 +191,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_CONFIRM_SETPRICE: case ACTION_CONFIRM_SETPRICE:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(1); writer.putInt(1);
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -205,7 +205,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_DEPOSIT: case ACTION_DEPOSIT:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(1); writer.putInt(1);
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -246,7 +246,7 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
writer.putInt(1); writer.putInt(1);
MobLoot toRoll = MobLoot.getFromCache(this.itemUUID); MobLoot toRoll = MobLoot.getFromCache(this.templateID);
writer.putInt(-1497023830); writer.putInt(-1497023830);
if (toRoll != null && toRoll.getPrefix() != null && !toRoll.getPrefix().isEmpty()) { if (toRoll != null && toRoll.getPrefix() != null && !toRoll.getPrefix().isEmpty()) {
EffectsBase eb = PowersManager.getEffectByIDString(toRoll.getPrefix()); EffectsBase eb = PowersManager.getEffectByIDString(toRoll.getPrefix());
@ -273,7 +273,7 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putString(toRoll.name); writer.putString(toRoll.name);
writer.putInt(GameObjectType.MobLoot.ordinal()); writer.putInt(GameObjectType.MobLoot.ordinal());
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(0); //items left to produce? writer.putInt(0); //items left to produce?
if (toRoll != null) { if (toRoll != null) {
@ -322,7 +322,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_COMPLETE: case ACTION_COMPLETE:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(this.totalProduction); writer.putInt(this.totalProduction);
writer.putInt(this.unknown03); writer.putInt(this.unknown03);
writer.putInt(this.pToken); writer.putInt(this.pToken);
@ -334,7 +334,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_JUNK: case ACTION_JUNK:
writer.putInt(this.itemType); writer.putInt(this.itemType);
writer.putInt(this.itemUUID); writer.putInt(this.templateID);
writer.putInt(this.totalProduction); writer.putInt(this.totalProduction);
writer.putInt(this.unknown03); writer.putInt(this.unknown03);
writer.putInt(this.pToken); writer.putInt(this.pToken);
@ -372,7 +372,7 @@ public class ItemProductionMsg extends ClientNetMsg {
switch (this.actionType) { switch (this.actionType) {
case ACTION_SETPRICE: case ACTION_SETPRICE:
this.itemType = reader.getInt(); this.itemType = reader.getInt();
this.itemUUID = reader.getInt(); this.templateID = reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
@ -397,15 +397,15 @@ public class ItemProductionMsg extends ClientNetMsg {
HashMap<Integer, Integer> tempIDs = new HashMap<>(); HashMap<Integer, Integer> tempIDs = new HashMap<>();
for (int i = 0; i < this.size; i++) { for (int i = 0; i < this.size; i++) {
int type = reader.getInt(); // Item type padding int type = reader.getInt(); // Item type padding
this.itemUUID = reader.getInt(); this.templateID = reader.getInt();
tempIDs.put(this.itemUUID, type); tempIDs.put(this.templateID, type);
} }
reader.getInt(); reader.getInt();
this.itemIDtoTypeMap = tempIDs; this.itemIDtoTypeMap = tempIDs;
break; break;
case ACTION_DEPOSIT: case ACTION_DEPOSIT:
this.itemType = reader.getInt(); this.itemType = reader.getInt();
this.itemUUID = reader.getInt(); this.templateID = reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
@ -417,7 +417,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case ACTION_JUNK: case ACTION_JUNK:
this.itemType = reader.getInt(); this.itemType = reader.getInt();
this.itemUUID = reader.getInt(); this.templateID = reader.getInt();
this.totalProduction = reader.getInt(); this.totalProduction = reader.getInt();
this.unknown03 = reader.getInt(); this.unknown03 = reader.getInt();
this.pToken = reader.getInt(); this.pToken = reader.getInt();
@ -429,7 +429,7 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
default: default:
this.itemType = reader.getInt(); this.itemType = reader.getInt();
this.itemUUID = reader.getInt(); this.templateID = reader.getInt();
this.totalProduction = reader.getInt(); this.totalProduction = reader.getInt();
this.unknown03 = reader.getInt(); this.unknown03 = reader.getInt();
this.pToken = reader.getInt(); this.pToken = reader.getInt();
@ -475,12 +475,12 @@ public class ItemProductionMsg extends ClientNetMsg {
this.unknown03 = unknown03; this.unknown03 = unknown03;
} }
public int getItemUUID() { public int getTemplateID() {
return itemUUID; return templateID;
} }
public void setItemUUID(int itemUUID) { public void setTemplateID(int templateID) {
this.itemUUID = itemUUID; this.templateID = templateID;
} }
public int getpToken() { public int getpToken() {

Loading…
Cancel
Save