From 032e703704996b997d75eead253af98d61895bac Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 24 Aug 2024 19:35:17 -0500 Subject: [PATCH] gimme command for testing --- src/engine/devcmd/cmds/GimmeCmd.java | 58 +++++++++++++++++++++++ src/engine/gameManager/DevCmdManager.java | 3 ++ 2 files changed, 61 insertions(+) create mode 100644 src/engine/devcmd/cmds/GimmeCmd.java diff --git a/src/engine/devcmd/cmds/GimmeCmd.java b/src/engine/devcmd/cmds/GimmeCmd.java new file mode 100644 index 00000000..08993ded --- /dev/null +++ b/src/engine/devcmd/cmds/GimmeCmd.java @@ -0,0 +1,58 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + + +package engine.devcmd.cmds; + +import engine.Enum.ItemContainerType; +import engine.Enum.ItemType; +import engine.Enum.OwnerType; +import engine.devcmd.AbstractDevCmd; +import engine.gameManager.ChatManager; +import engine.gameManager.DbManager; +import engine.objects.*; +import engine.powers.EffectsBase; + +import java.util.ArrayList; + +/** + * @author Eighty + */ +public class GimmeCmd extends AbstractDevCmd { + + public GimmeCmd() { + super("gimme"); + } + + @Override + protected void _doCmd(PlayerCharacter pc, String[] words, + AbstractGameObject target) { + int amt = 0; + int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems(); + amt = 10000000 - currentGold; + 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(); + + } + + @Override + protected String _getHelpString() { + return "Round up current gold in inventory to 10,000,000"; + } + + @Override + protected String _getUsageString() { + return "'./gimme"; + } + +} diff --git a/src/engine/gameManager/DevCmdManager.java b/src/engine/gameManager/DevCmdManager.java index a09f041c..d8d3ff69 100644 --- a/src/engine/gameManager/DevCmdManager.java +++ b/src/engine/gameManager/DevCmdManager.java @@ -102,6 +102,7 @@ public enum DevCmdManager { DevCmdManager.registerDevCmd(new SetAdminRuneCmd()); DevCmdManager.registerDevCmd(new SetInvulCmd()); DevCmdManager.registerDevCmd(new MakeItemCmd()); + DevCmdManager.registerDevCmd(new GimmeCmd()); DevCmdManager.registerDevCmd(new EnchantCmd()); DevCmdManager.registerDevCmd(new SetSubRaceCmd()); // Admin @@ -184,8 +185,10 @@ public enum DevCmdManager { case "printstats": case "printskills": case "printpowers": + case "gimme": if(!a.status.equals(Enum.AccountStatus.ADMIN)) target = pcSender; + playerAllowed = true; break; } if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {