Browse Source

resource vendor now sells in stack sizes of 500k purchase

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
c55f67a977
  1. 8
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/objects/Contract.java
  3. 4
      src/engine/objects/Warehouse.java

8
src/engine/net/client/ClientMessagePump.java

@ -1472,6 +1472,7 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1472,6 +1472,7 @@ public class ClientMessagePump implements NetMsgHandler {
}
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
boolean stacked = false;
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
for(Item item : itemMan.getInventory()){
int itemID = item.getItemBaseID();
int meID = me.getItemBase().getUUID();
@ -1479,8 +1480,8 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1479,8 +1480,8 @@ public class ClientMessagePump implements NetMsgHandler {
if(Warehouse.maxResources.isEmpty())
Warehouse.getMaxResources();
int maxStack = Warehouse.maxResources.get(itemID);
if(maxStack > item.getNumOfItems() + 1){
item.setNumOfItems(item.getNumOfItems() + 1);
if(maxStack > item.getNumOfItems() + buystack){
item.setNumOfItems(item.getNumOfItems() + buystack);
stacked = true;
itemMan.updateInventory();
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems(),0);
@ -1493,7 +1494,8 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1493,7 +1494,8 @@ public class ClientMessagePump implements NetMsgHandler {
if (buy != null) {
me.transferEnchants(buy);
itemMan.addItemToInventory(buy);
//itemMan.updateInventory();
buy.setNumOfItems(buystack);
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems(),0);
}
}
}else {

2
src/engine/objects/Contract.java

@ -201,7 +201,7 @@ public class Contract extends AbstractGameObject { @@ -201,7 +201,7 @@ public class Contract extends AbstractGameObject {
if(this.getObjectUUID() == 900){
for(MobEquipment me : this.sellInventory){
me.magicValue = Warehouse.getCostForResource(me.getItemBase().getUUID());
me.magicValue = Warehouse.getCostForResource(me.getItemBase().getUUID()) * Warehouse.getSellStackSize(me.getItemBase().getUUID());
}
}
if(this.getObjectUUID() == 1202)

4
src/engine/objects/Warehouse.java

@ -1455,4 +1455,8 @@ public class Warehouse extends AbstractWorldObject { @@ -1455,4 +1455,8 @@ public class Warehouse extends AbstractWorldObject {
return newCost;
}
public static int getSellStackSize(int id){
return (int)500000 / (getCostForResource(id));
}
}

Loading…
Cancel
Save