Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+41 -42
View File
@@ -17,61 +17,60 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
*
*/
public class AddGoldCmd extends AbstractDevCmd {
public AddGoldCmd() {
public AddGoldCmd() {
super("addgold");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
Item gold = pc.getCharItemManager().getGoldInventory();
int curAmt;
if (gold == null)
curAmt = 0;
else
curAmt = gold.getNumOfItems();
Item gold = pc.getCharItemManager().getGoldInventory();
int curAmt;
if (gold == null)
curAmt = 0;
else
curAmt = gold.getNumOfItems();
int amt;
try {
amt = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return;
}
if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
return;
} else if ((curAmt + amt) > 10000000) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return;
}
int amt;
try {
amt = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return;
}
if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
return;
} else if ((curAmt + amt) > 10000000) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return;
}
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
pc.getCharItemManager().updateInventory();
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
pc.getCharItemManager().updateInventory();
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "adds gold to inventory";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /addGold quantity'";
}
}
}