Browse Source

inline accessors

combat-2
MagicBot 7 months ago
parent
commit
85a66339e2
  1. 22
      src/engine/net/client/handlers/ItemProductionMsgHandler.java
  2. 92
      src/engine/net/client/msg/ItemProductionMsg.java

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

@ -373,7 +373,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// Grab reference to vendor we are interacting with // Grab reference to vendor we are interacting with
vendorNPC = (NPC) DbManager.getObject(mbEnums.GameObjectType.NPC, msg.getNpcUUID()); vendorNPC = (NPC) DbManager.getObject(mbEnums.GameObjectType.NPC, msg.npcUUID);
// Oops? // Oops?
@ -386,39 +386,39 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
case PRODUCE: case PRODUCE:
boolean isRandom = false; boolean isRandom = false;
if (msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0) if (msg.unknown03 != 0 && msg.pToken == 0 && msg.sToken == 0)
isRandom = true; isRandom = true;
//Create Multiple Item Function.. Fill all empty slots //Create Multiple Item Function.. Fill all empty slots
if (msg.getSize() > 0) { if (msg.size > 0) {
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.getTotal_to_produce(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getTemplateID()); vendorNPC.produceItem(player.getObjectUUID(), msg.total_to_produce, isRandom, msg.pToken, msg.sToken, msg.name, msg.templateID);
} }
} }
} else } else
vendorNPC.produceItem(player.getObjectUUID(), msg.getTotal_to_produce(), isRandom, msg.getpToken(), msg.getsToken(), msg.getName(), msg.getTemplateID()); vendorNPC.produceItem(player.getObjectUUID(), msg.total_to_produce, isRandom, msg.pToken, msg.sToken, msg.name, msg.templateID);
break; break;
case JUNK: case JUNK:
junkItem(msg.getTemplateID(), vendorNPC, origin); junkItem(msg.templateID, vendorNPC, origin);
break; break;
case RECYCLE: case RECYCLE:
recycleItem(msg.getItems(), vendorNPC, origin); recycleItem(msg.items, vendorNPC, origin);
msg.actionType = mbEnums.ProductionActionType.TAKE; msg.actionType = mbEnums.ProductionActionType.TAKE;
dispatch = Dispatch.borrow(player, msg); dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
break; break;
case COMPLETE: case COMPLETE:
vendorNPC.completeItem(msg.getTemplateID()); vendorNPC.completeItem(msg.templateID);
break; break;
case DEPOSIT: case DEPOSIT:
depositItem(msg.getTemplateID(), vendorNPC, origin); depositItem(msg.templateID, vendorNPC, origin);
break; break;
case SETPRICE: case SETPRICE:
setItemPrice(msg.getItemType(), msg.getTemplateID(), msg.getItemPrice(), vendorNPC, origin); setItemPrice(msg.itemType, msg.templateID, msg.itemPrice, vendorNPC, origin);
break; break;
case TAKE: case TAKE:
takeItem(msg.getItems(), vendorNPC, origin); takeItem(msg.items, vendorNPC, origin);
dispatch = Dispatch.borrow(player, msg); dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
break; break;

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

@ -206,7 +206,6 @@ public class ItemProductionMsg extends ClientNetMsg {
break; break;
case TAKE: case TAKE:
case RECYCLE: case RECYCLE:
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
writer.putInt(1); writer.putInt(1);
@ -237,6 +236,7 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putInt(1); writer.putInt(1);
MobLoot toRoll = MobLoot.getFromCache(this.templateID); 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());
if (eb == null) if (eb == null)
@ -265,13 +265,8 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putInt(this.templateID); writer.putInt(this.templateID);
writer.putInt(0); //items left to produce? writer.putInt(0); //items left to produce?
if (toRoll != null) {
writer.putInt(toRoll.templateID); writer.putInt(toRoll.templateID);
writer.putInt(toRoll.getValue()); writer.putInt(toRoll.getValue());
} else {
writer.putInt(0);
writer.putInt(0);
}
NPC vendor = NPC.getFromCache(this.npcUUID); NPC vendor = NPC.getFromCache(this.npcUUID);
if (vendor != null) { if (vendor != null) {
@ -341,7 +336,6 @@ public class ItemProductionMsg extends ClientNetMsg {
writer.putInt(0); writer.putInt(0);
break; break;
} }
} }
/** /**
@ -432,91 +426,7 @@ public class ItemProductionMsg extends ClientNetMsg {
else else
reader.getShort(); reader.getShort();
break; break;
}
}
public int getItemType() {
return itemType;
}
public int getUnknown01() {
return unknown01;
}
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
public int getTotal_to_produce() {
return total_to_produce;
}
public void setTotal_to_produce(int unknown02) {
this.total_to_produce = unknown02;
}
public int getUnknown03() {
return unknown03;
}
public void setUnknown03(int unknown03) {
this.unknown03 = unknown03;
}
public int getTemplateID() {
return templateID;
} }
public void setTemplateID(int templateID) {
this.templateID = templateID;
}
public int getpToken() {
return pToken;
}
public void setpToken(int pToken) {
this.pToken = pToken;
}
public int getsToken() {
return sToken;
}
public void setsToken(int sToken) {
this.sToken = sToken;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getNpcUUID() {
return npcUUID;
}
public HashMap<Integer, Integer> getItems() {
return items;
}
/**
* @return the itemPrice
*/
public int getItemPrice() {
return itemPrice;
} }
} }

Loading…
Cancel
Save