all player inventory gold limit checks to use MBServerStatics.PLAYER_GOLD_LIMIT
This commit is contained in:
@@ -14,6 +14,7 @@ import engine.gameManager.ChatManager;
|
|||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
@@ -46,10 +47,10 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (amt < 1 || amt > 10000000) {
|
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
|
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
|
||||||
return;
|
return;
|
||||||
} else if ((curAmt + amt) > 10000000) {
|
} else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,6 +189,24 @@ public enum ChatManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(text.startsWith("./junk")){
|
||||||
|
//junk command
|
||||||
|
PlayerCharacter pc = (PlayerCharacter)player;
|
||||||
|
for(Item i : pc.getCharItemManager().getInventory()){
|
||||||
|
ItemBase ib = i.getItemBase();
|
||||||
|
if(ib.isGlass() || ib.getType().equals(Enum.ItemType.CONTRACT) || ib.isVorg() || ib.getType().equals(Enum.ItemType.RUNE)
|
||||||
|
|| ib.getType().equals(Enum.ItemType.SCROLL) || ib.getType().equals(Enum.ItemType.POTION))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int value = ib.getBaseValue();
|
||||||
|
if(pc.getCharItemManager().getGoldInventory().getNumOfItems() + value > MBServerStatics.PLAYER_GOLD_LIMIT)
|
||||||
|
continue; // cannot hold gold value
|
||||||
|
|
||||||
|
pc.getCharItemManager().addGoldToInventory(value,false);
|
||||||
|
pc.getCharItemManager().junk(i);
|
||||||
|
}
|
||||||
|
pc.getCharItemManager().updateInventory();
|
||||||
|
}
|
||||||
if (ChatManager.isDevCommand(text) == true) {
|
if (ChatManager.isDevCommand(text) == true) {
|
||||||
ChatManager.processDevCommand(player, text);
|
ChatManager.processDevCommand(player, text);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1287,7 +1287,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
|
|
||||||
if (gold.getNumOfItems() + cost > 10000000) {
|
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2334,7 +2334,7 @@ public class CharacterItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) {
|
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||||
if (pc.getClientConnection() != null)
|
if (pc.getClientConnection() != null)
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||||
@@ -2342,7 +2342,7 @@ public class CharacterItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) {
|
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
|
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
|
||||||
if (pc.getClientConnection() != null)
|
if (pc.getClientConnection() != null)
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||||
|
|||||||
@@ -914,4 +914,8 @@ public class ItemBase {
|
|||||||
public void setAutoID(boolean autoID) {
|
public void setAutoID(boolean autoID) {
|
||||||
this.autoID = autoID;
|
this.autoID = autoID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVorg(){
|
||||||
|
return (this.name.contains("Vorgrim") || this.name.contains("Bellugh") || this.name.contains("Crimson Circle"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user