// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.devcmd.cmds; import engine.Enum.GameObjectType; import engine.InterestManagement.WorldGrid; import engine.devcmd.AbstractDevCmd; import engine.gameManager.*; import engine.objects.*; import org.pmw.tinylog.Logger; /** * @author Eighty */ public class setProfit extends AbstractDevCmd { public setProfit() { super("setprofit"); } @Override protected void _doCmd(PlayerCharacter pc, String[] words, AbstractGameObject target) { if (words.length < 2) { this.sendUsage(pc); return; } float updateValue; try { updateValue = Float.parseFloat(words[1]); } catch (NumberFormatException e) { throwbackError(pc, "Failed to parse supplied contractID or level to an Integer."); return; // NaN } if(target.getObjectType().equals(GameObjectType.NPC) == false){ return; } NPC npc = (NPC)target; if(words[0].toLowerCase().equals("buy")){ npc.buyPercent = updateValue; npc.updateDatabase(); return; } if(words[0].toLowerCase().equals("sell")){ npc.sellPercent = updateValue; npc.updateDatabase(); return; } } @Override protected String _getHelpString() { return "Sets profit margin of targeted NPC"; } @Override protected String _getUsageString() { return "' /setprofit buy/sell VALUE(1.0)'"; } }