Browse Source

ProductionRate added to ConfigManager.

master
MagicBot 2 years ago
parent
commit
c51f6b73af
  1. 99
      src/engine/devcmd/cmds/SetRateCmd.java
  2. 2
      src/engine/gameManager/ConfigManager.java
  3. 1
      src/engine/gameManager/DevCmdManager.java
  4. 17
      src/engine/objects/ItemFactory.java
  5. 1
      src/engine/server/MBServerStatics.java

99
src/engine/devcmd/cmds/SetRateCmd.java

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.DropRateType;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
/**
*
* @author Murray
*
*/
public class SetRateCmd extends AbstractDevCmd {
public SetRateCmd() {
super("setrate");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] args, AbstractGameObject target) {
if (args.length != 2) {
this.sendUsage(pc);
return;
}
float mod = 0f;
try {
mod = Float.parseFloat(args[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied data failed to parse to Float.");
return;
}
if (args[0].equals("exp")){
DropRateType.EXP_RATE_MOD.rate = mod;
throwbackInfo(pc, "Experience Rate set to: " + mod);
} else if (args[0].equals("gold")){
DropRateType.GOLD_RATE_MOD.rate = mod;
throwbackInfo(pc, "Gold Rate set to: " + mod);
} else if (args[0].equals("drop")){
DropRateType.DROP_RATE_MOD.rate = mod;
throwbackInfo(pc, "Drop Multiplier Rate set to: " + mod);
} else if (args[0].equals("hotexp")){
DropRateType.HOT_EXP_RATE_MOD.rate = mod;
throwbackInfo(pc, "HOTZONE Experience Rate set to: " + mod);
} else if (args[0].equals("hotgold")){
DropRateType.HOT_GOLD_RATE_MOD.rate = mod;
throwbackInfo(pc, "HOTZONE Gold Rate set to: " + mod);
} else if (args[0].equals("hotdrop")){
DropRateType.HOT_DROP_RATE_MOD.rate = mod;
throwbackInfo(pc, "HOTZONE Drop Multiplier Rate set to: " + mod);
} else if (args[0].equals("production")){
MBServerStatics.PRODUCTION_TIME_MULTIPLIER = mod;
throwbackInfo(pc, "Production Time Multiplier Rate set to: " + mod);
} else {
this.sendUsage(pc);
}
}
@Override
protected String _getUsageString() {
return "' /setrate {exp|gold|drop|hotexp|hotgold|hotdrop} rate'";
}
@Override
protected String _getHelpString() {
return "Sets the rates for exp, gold or drops. Accepts a float, defaults to 1.0";
}
}

2
src/engine/gameManager/ConfigManager.java

@ -73,6 +73,8 @@ public enum ConfigManager { @@ -73,6 +73,8 @@ public enum ConfigManager {
MB_HOTZONE_MIN_LEVEL,
MB_PRODUCTION_RATE,
// MagicBot configuration.
MB_MAGICBOT_SERVERID,

1
src/engine/gameManager/DevCmdManager.java

@ -109,7 +109,6 @@ public enum DevCmdManager { @@ -109,7 +109,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new GetCacheCountCmd());
DevCmdManager.registerDevCmd(new GetRuneDropRateCmd());
DevCmdManager.registerDevCmd(new DecachePlayerCmd());
DevCmdManager.registerDevCmd(new SetRateCmd());
DevCmdManager.registerDevCmd(new AuditMobsCmd());
DevCmdManager.registerDevCmd(new ChangeNameCmd());
DevCmdManager.registerDevCmd(new GuildListCmd());

17
src/engine/objects/ItemFactory.java

@ -13,10 +13,7 @@ import engine.Enum; @@ -13,10 +13,7 @@ import engine.Enum;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.PowersManager;
import engine.gameManager.*;
import engine.net.ItemProductionManager;
import engine.net.ItemQueue;
import engine.net.client.ClientConnection;
@ -202,7 +199,7 @@ public class ItemFactory { @@ -202,7 +199,7 @@ public class ItemFactory {
// is used to determin whether or not an object has
// compelted rolling. The game object exists previously
// to this, not when 'compelte' is pressed.
long upgradeTime = System.currentTimeMillis() + (long)(time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER) ;
long upgradeTime = System.currentTimeMillis() + (long)(time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
DateTime dateTime = new DateTime();
dateTime = dateTime.withMillis(upgradeTime);
@ -220,7 +217,7 @@ public class ItemFactory { @@ -220,7 +217,7 @@ public class ItemFactory {
pi.setAmount(itemsToRoll);
pi.setRandom(false);
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER));
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
ItemProductionManager.send(produced);
return ml;
@ -620,7 +617,7 @@ public class ItemFactory { @@ -620,7 +617,7 @@ public class ItemFactory {
// is used to determin whether or not an object has
// compelted rolling. The game object exists previously
// to this, not when 'compelte' is pressed.
long upgradeTime = System.currentTimeMillis() + (long)(time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER) ;
long upgradeTime = System.currentTimeMillis() + (long)(time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())) ;
DateTime dateTime = new DateTime();
dateTime = dateTime.withMillis(upgradeTime);
@ -637,7 +634,7 @@ public class ItemFactory { @@ -637,7 +634,7 @@ public class ItemFactory {
pi.setProducedItemID(ml.getObjectUUID());
pi.setAmount(itemsToRoll);
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER));
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
ItemProductionManager.send(produced);
}catch(Exception e){
Logger.error(e);
@ -906,7 +903,7 @@ public class ItemFactory { @@ -906,7 +903,7 @@ public class ItemFactory {
// is used to determin whether or not an object has
// compelted rolling. The game object exists previously
// to this, not when 'compelte' is pressed.
long upgradeTime = System.currentTimeMillis() + (long)(time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER) ;
long upgradeTime = System.currentTimeMillis() + (long)(time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())) ;
DateTime dateTime = new DateTime();
dateTime = dateTime.withMillis(upgradeTime);
@ -920,7 +917,7 @@ public class ItemFactory { @@ -920,7 +917,7 @@ public class ItemFactory {
ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(),vendor.getObjectUUID(),toRoll.getItemBaseID(),dateTime,true,prefix, suffix, toRoll.getCustomName(),playerID);
pi.setProducedItemID(toRoll.getObjectUUID());
pi.setAmount(itemsToRoll);
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * MBServerStatics.PRODUCTION_TIME_MULTIPLIER));
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
ItemProductionManager.send(produced);
return toRoll;
}

1
src/engine/server/MBServerStatics.java

@ -683,7 +683,6 @@ public class MBServerStatics { @@ -683,7 +683,6 @@ public class MBServerStatics {
public static final int DESPAWN_TIMER_ONCE_LOOTED = 5 * 1000;
public static final int MAX_COMBAT_HITBOX_RADIUS = 80;
public static final int PROC_CHANCE = 5; // %chance to proc
public static float PRODUCTION_TIME_MULTIPLIER = .5f;
/*
* Mob loot -- gold calculations

Loading…
Cancel
Save