Browse Source

added set profit dev command

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
c99a361ca7
  1. 72
      src/engine/devcmd/cmds/setProfit.java
  2. 1
      src/engine/gameManager/DevCmdManager.java

72
src/engine/devcmd/cmds/setProfit.java

@ -0,0 +1,72 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// 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)'";
}
}

1
src/engine/gameManager/DevCmdManager.java

@ -121,6 +121,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new PurgeObjectsCmd()); DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
DevCmdManager.registerDevCmd(new SplatMobCmd()); DevCmdManager.registerDevCmd(new SplatMobCmd());
DevCmdManager.registerDevCmd(new SlotNpcCmd()); DevCmdManager.registerDevCmd(new SlotNpcCmd());
DevCmdManager.registerDevCmd(new setProfit());
DevCmdManager.registerDevCmd(new GateInfoCmd()); DevCmdManager.registerDevCmd(new GateInfoCmd());
DevCmdManager.registerDevCmd(new ShowOffsetCmd()); DevCmdManager.registerDevCmd(new ShowOffsetCmd());
DevCmdManager.registerDevCmd(new RealmInfoCmd()); DevCmdManager.registerDevCmd(new RealmInfoCmd());

Loading…
Cancel
Save