|
|
@ -11,6 +11,7 @@ package engine.net.client.msg; |
|
|
|
|
|
|
|
|
|
|
|
import engine.gameManager.BuildingManager; |
|
|
|
import engine.gameManager.BuildingManager; |
|
|
|
import engine.gameManager.PowersManager; |
|
|
|
import engine.gameManager.PowersManager; |
|
|
|
|
|
|
|
import engine.mbEnums; |
|
|
|
import engine.mbEnums.GameObjectType; |
|
|
|
import engine.mbEnums.GameObjectType; |
|
|
|
import engine.net.*; |
|
|
|
import engine.net.*; |
|
|
|
import engine.objects.Building; |
|
|
|
import engine.objects.Building; |
|
|
@ -23,18 +24,6 @@ import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
|
public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
|
|
|
|
|
|
|
|
private static final int ACTION_PRODUCE = 1; |
|
|
|
|
|
|
|
private static final int ACTION_JUNK = 2; |
|
|
|
|
|
|
|
private static final int ACTION_RECYCLE = 3; |
|
|
|
|
|
|
|
private static final int ACTION_COMPLETE = 4; |
|
|
|
|
|
|
|
private static final int ACTION_DEPOSIT = 6; |
|
|
|
|
|
|
|
private static final int ACTION_SETPRICE = 5; |
|
|
|
|
|
|
|
private static final int ACTION_TAKE = 7; |
|
|
|
|
|
|
|
private static final int ACTION_CONFIRM_SETPRICE = 9; |
|
|
|
|
|
|
|
private static final int ACTION_CONFIRM_DEPOSIT = 10; |
|
|
|
|
|
|
|
private static final int ACTION_CONFIRM_TAKE = 11; // Unsure. Sent by client
|
|
|
|
|
|
|
|
private static final int ACTION_CONFIRM_PRODUCE = 8; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int size; |
|
|
|
private int size; |
|
|
|
private int buildingUUID; |
|
|
|
private int buildingUUID; |
|
|
|
private int unknown01; |
|
|
|
private int unknown01; |
|
|
@ -45,7 +34,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
private int pToken; |
|
|
|
private int pToken; |
|
|
|
private int sToken; |
|
|
|
private int sToken; |
|
|
|
private String name; |
|
|
|
private String name; |
|
|
|
private int actionType; |
|
|
|
private mbEnums.ProductionActionType actionType; |
|
|
|
private int npcUUID; |
|
|
|
private int npcUUID; |
|
|
|
private boolean add; |
|
|
|
private boolean add; |
|
|
|
private int itemPrice; |
|
|
|
private int itemPrice; |
|
|
@ -57,7 +46,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
|
|
|
|
|
|
|
|
public ItemProductionMsg() { |
|
|
|
public ItemProductionMsg() { |
|
|
|
super(Protocol.ITEMPRODUCTION); |
|
|
|
super(Protocol.ITEMPRODUCTION); |
|
|
|
this.actionType = 0; |
|
|
|
this.actionType = mbEnums.ProductionActionType.NONE; |
|
|
|
this.size = 0; |
|
|
|
this.size = 0; |
|
|
|
this.buildingUUID = 0; |
|
|
|
this.buildingUUID = 0; |
|
|
|
this.unknown01 = 0; |
|
|
|
this.unknown01 = 0; |
|
|
@ -76,7 +65,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
|
|
|
|
|
|
|
|
public ItemProductionMsg(Building building, NPC vendor, Item item, int actionType, boolean add) { |
|
|
|
public ItemProductionMsg(Building building, NPC vendor, Item item, int actionType, boolean add) { |
|
|
|
super(Protocol.ITEMPRODUCTION); |
|
|
|
super(Protocol.ITEMPRODUCTION); |
|
|
|
this.actionType = actionType; |
|
|
|
this.actionType = mbEnums.ProductionActionType.values()[actionType]; |
|
|
|
this.size = 0; |
|
|
|
this.size = 0; |
|
|
|
this.buildingUUID = building.getObjectUUID(); |
|
|
|
this.buildingUUID = building.getObjectUUID(); |
|
|
|
this.npcUUID = vendor.getObjectUUID(); |
|
|
|
this.npcUUID = vendor.getObjectUUID(); |
|
|
@ -123,7 +112,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
return; |
|
|
|
return; |
|
|
|
// Common Header
|
|
|
|
// Common Header
|
|
|
|
|
|
|
|
|
|
|
|
writer.putInt(this.actionType); |
|
|
|
writer.putInt(this.actionType.ordinal()); |
|
|
|
writer.putInt(GameObjectType.Building.ordinal()); |
|
|
|
writer.putInt(GameObjectType.Building.ordinal()); |
|
|
|
writer.putInt(this.buildingUUID); |
|
|
|
writer.putInt(this.buildingUUID); |
|
|
|
writer.putInt(GameObjectType.NPC.ordinal()); |
|
|
|
writer.putInt(GameObjectType.NPC.ordinal()); |
|
|
@ -131,7 +120,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
|
|
|
|
|
|
|
|
switch (this.actionType) { |
|
|
|
switch (this.actionType) { |
|
|
|
|
|
|
|
|
|
|
|
case ACTION_CONFIRM_DEPOSIT: |
|
|
|
case CONFIRM_DEPOSIT: |
|
|
|
writer.putInt(0); // Not item ordinal?
|
|
|
|
writer.putInt(0); // Not item ordinal?
|
|
|
|
writer.putInt(0); // Not item uuid?
|
|
|
|
writer.putInt(0); // Not item uuid?
|
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -164,7 +153,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.put((byte) 0); |
|
|
|
writer.put((byte) 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_CONFIRM_TAKE: |
|
|
|
case CONFIRM_TAKE: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -176,7 +165,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.put((byte) 0); |
|
|
|
writer.put((byte) 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_SETPRICE: |
|
|
|
case SETPRICE: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -189,7 +178,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.put((byte) 0); |
|
|
|
writer.put((byte) 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_CONFIRM_SETPRICE: |
|
|
|
case CONFIRM_SETPRICE: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -203,7 +192,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
//writer.put((byte) 0);
|
|
|
|
//writer.put((byte) 0);
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_DEPOSIT: |
|
|
|
case DEPOSIT: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -215,8 +204,8 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.put((byte) 0); |
|
|
|
writer.put((byte) 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_TAKE: |
|
|
|
case TAKE: |
|
|
|
case ACTION_RECYCLE: |
|
|
|
case RECYCLE: |
|
|
|
|
|
|
|
|
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
@ -242,7 +231,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_CONFIRM_PRODUCE: |
|
|
|
case CONFIRM_PRODUCE: |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(1); |
|
|
|
writer.putInt(1); |
|
|
@ -320,7 +309,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
//writer.putInt(0); //error popup
|
|
|
|
//writer.putInt(0); //error popup
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_COMPLETE: |
|
|
|
case COMPLETE: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.total_to_produce); |
|
|
|
writer.putInt(this.total_to_produce); |
|
|
@ -332,7 +321,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
writer.putInt(0); |
|
|
|
writer.putInt(0); |
|
|
|
writer.put((byte) 0); |
|
|
|
writer.put((byte) 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_JUNK: |
|
|
|
case JUNK: |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.itemType); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.templateID); |
|
|
|
writer.putInt(this.total_to_produce); |
|
|
|
writer.putInt(this.total_to_produce); |
|
|
@ -363,14 +352,14 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
|
|
|
|
|
|
|
|
// Common header
|
|
|
|
// Common header
|
|
|
|
|
|
|
|
|
|
|
|
this.actionType = reader.getInt(); |
|
|
|
this.actionType = mbEnums.ProductionActionType.values()[reader.getInt()]; |
|
|
|
reader.getInt(); // Building type padding
|
|
|
|
reader.getInt(); // Building type padding
|
|
|
|
this.buildingUUID = reader.getInt(); |
|
|
|
this.buildingUUID = reader.getInt(); |
|
|
|
reader.getInt(); // NPC type padding
|
|
|
|
reader.getInt(); // NPC type padding
|
|
|
|
this.npcUUID = reader.getInt(); |
|
|
|
this.npcUUID = reader.getInt(); |
|
|
|
|
|
|
|
|
|
|
|
switch (this.actionType) { |
|
|
|
switch (this.actionType) { |
|
|
|
case ACTION_SETPRICE: |
|
|
|
case SETPRICE: |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
@ -383,8 +372,8 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.get(); |
|
|
|
reader.get(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_RECYCLE: |
|
|
|
case RECYCLE: |
|
|
|
case ACTION_TAKE: |
|
|
|
case TAKE: |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
@ -403,7 +392,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
this.items = tempIDs; |
|
|
|
this.items = tempIDs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_DEPOSIT: |
|
|
|
case DEPOSIT: |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
@ -415,7 +404,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.get(); |
|
|
|
reader.get(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION_JUNK: |
|
|
|
case JUNK: |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.itemType = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
this.templateID = reader.getInt(); |
|
|
|
this.total_to_produce = reader.getInt(); |
|
|
|
this.total_to_produce = reader.getInt(); |
|
|
@ -438,7 +427,7 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
this.size = reader.getInt(); |
|
|
|
this.size = reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
reader.getInt(); |
|
|
|
|
|
|
|
|
|
|
|
if (this.actionType == ACTION_COMPLETE || this.actionType == ACTION_JUNK) |
|
|
|
if (this.actionType == mbEnums.ProductionActionType.COMPLETE || this.actionType == mbEnums.ProductionActionType.JUNK) |
|
|
|
reader.get(); |
|
|
|
reader.get(); |
|
|
|
else |
|
|
|
else |
|
|
|
reader.getShort(); |
|
|
|
reader.getShort(); |
|
|
@ -516,11 +505,11 @@ public class ItemProductionMsg extends ClientNetMsg { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getActionType() { |
|
|
|
public int getActionType() { |
|
|
|
return actionType; |
|
|
|
return actionType.ordinal(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public final void setActionType(int actionType) { |
|
|
|
public final void setActionType(int actionType) { |
|
|
|
this.actionType = actionType; |
|
|
|
this.actionType = mbEnums.ProductionActionType.values()[actionType]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getNpcUUID() { |
|
|
|
public int getNpcUUID() { |
|
|
|