forked from MagicBane/Server
Experience Modifiers added to ConfigManager
This commit is contained in:
@@ -2643,36 +2643,6 @@ public class Enum {
|
||||
MAGE;
|
||||
}
|
||||
|
||||
public enum DropRateType {
|
||||
EXP_RATE_MOD,
|
||||
GOLD_RATE_MOD,
|
||||
DROP_RATE_MOD,
|
||||
HOT_EXP_RATE_MOD,
|
||||
HOT_GOLD_RATE_MOD,
|
||||
HOT_DROP_RATE_MOD;
|
||||
|
||||
public float rate;
|
||||
|
||||
public static void init() {
|
||||
|
||||
for (DropRateType rateType : DropRateType.values()) {
|
||||
|
||||
switch (rateType) {
|
||||
case EXP_RATE_MOD:
|
||||
case GOLD_RATE_MOD:
|
||||
case DROP_RATE_MOD:
|
||||
rateType.rate = Float.parseFloat(ConfigManager.MB_NORMAL_RATE.getValue());
|
||||
break;
|
||||
case HOT_EXP_RATE_MOD:
|
||||
case HOT_GOLD_RATE_MOD:
|
||||
case HOT_DROP_RATE_MOD:
|
||||
rateType.rate = Float.parseFloat(ConfigManager.MB_HOTZONE_RATE.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum MinionType {
|
||||
AELFBORNGUARD(951,1637, MinionClass.MELEE, "Guard","Aelfborn"),
|
||||
AELFBORNMAGE(952, 1635, MinionClass.MAGE,"Adept","Aelfborn"),
|
||||
|
||||
@@ -14,7 +14,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.net.NetMsgHandler;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.server.login.LoginServer;
|
||||
import engine.server.world.WorldServer;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -67,8 +66,10 @@ public enum ConfigManager {
|
||||
MB_WORLD_KEYCLONE_MAX,
|
||||
|
||||
//drop rates
|
||||
MB_NORMAL_RATE,
|
||||
MB_HOTZONE_RATE,
|
||||
MB_NORMAL_EXP_RATE,
|
||||
MB_NORMAL_DROP_RATE,
|
||||
MB_HOTZONE_EXP_RATE,
|
||||
MB_HOTZONE_DROP_RATE,
|
||||
MB_HOTZONE_DURATION,
|
||||
|
||||
MB_HOTZONE_MIN_LEVEL,
|
||||
@@ -117,11 +118,6 @@ public enum ConfigManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setting drop rates
|
||||
|
||||
Logger.info("Setting drop rates...");
|
||||
Enum.DropRateType.init();
|
||||
|
||||
// compile regex here
|
||||
|
||||
Logger.info("Compiling regex");
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.TargetColor;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -332,12 +333,7 @@ public class Experience {
|
||||
if (killer == null || mob == null)
|
||||
return;
|
||||
|
||||
double xp = 0.0;
|
||||
|
||||
//Get the xp modifier for the world
|
||||
float xpMod = Enum.DropRateType.EXP_RATE_MOD.rate;
|
||||
|
||||
|
||||
double grantedExperience = 0.0;
|
||||
|
||||
if (g != null) { // Do group EXP stuff
|
||||
|
||||
@@ -374,18 +370,18 @@ public class Experience {
|
||||
}
|
||||
|
||||
// Process every player in the group getting XP
|
||||
for (PlayerCharacter pc : giveEXPTo) {
|
||||
if (pc.getLevel() >= MBServerStatics.LEVELCAP)
|
||||
for (PlayerCharacter playerCharacter : giveEXPTo) {
|
||||
if (playerCharacter.getLevel() >= MBServerStatics.LEVELCAP)
|
||||
continue;
|
||||
|
||||
// Sets Max XP with server exp mod taken into account.
|
||||
xp = (double) xpMod * maxXPPerKill(pc.getLevel());
|
||||
grantedExperience = (double) Float.parseFloat(ConfigManager.MB_NORMAL_EXP_RATE.getValue()) * maxXPPerKill(playerCharacter.getLevel());
|
||||
|
||||
// Adjust XP for Mob Level
|
||||
xp *= getConMod(pc, mob);
|
||||
grantedExperience *= getConMod(playerCharacter, mob);
|
||||
|
||||
// Process XP for this member
|
||||
penalty = getGroupMemberPenalty(leadership, pc, giveEXPTo,
|
||||
penalty = getGroupMemberPenalty(leadership, playerCharacter, giveEXPTo,
|
||||
highestLevel);
|
||||
|
||||
// Leadership Penalty Reduction
|
||||
@@ -393,27 +389,27 @@ public class Experience {
|
||||
penalty -= ((leadership) * 0.01) * penalty;
|
||||
|
||||
// Modify for hotzone
|
||||
if (xp != 0)
|
||||
if (grantedExperience != 0)
|
||||
if (ZoneManager.inHotZone(mob.getLoc()))
|
||||
xp *= Enum.DropRateType.HOT_EXP_RATE_MOD.rate;
|
||||
grantedExperience *= Float.parseFloat(ConfigManager.MB_HOTZONE_EXP_RATE.getValue());
|
||||
|
||||
// Check for 0 XP due to white mob, otherwise subtract penalty
|
||||
// xp
|
||||
if (xp == 0) {
|
||||
xp = 1;
|
||||
if (grantedExperience == 0) {
|
||||
grantedExperience = 1;
|
||||
} else {
|
||||
xp -= (penalty * 0.01) * xp;
|
||||
grantedExperience -= (penalty * 0.01) * grantedExperience;
|
||||
|
||||
// Errant Penalty Calculation
|
||||
if (pc.getGuild().isEmptyGuild())
|
||||
xp *= 0.6;
|
||||
if (playerCharacter.getGuild().isEmptyGuild())
|
||||
grantedExperience *= 0.6;
|
||||
}
|
||||
|
||||
if (xp == 0)
|
||||
xp = 1;
|
||||
if (grantedExperience == 0)
|
||||
grantedExperience = 1;
|
||||
|
||||
// Grant the player the EXP
|
||||
pc.grantXP((int) Math.floor(xp));
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience));
|
||||
}
|
||||
|
||||
} else { // Give EXP to a single character
|
||||
@@ -424,20 +420,20 @@ public class Experience {
|
||||
return;
|
||||
|
||||
// Get XP and adjust for Mob Level with world xp modifier taken into account
|
||||
xp = (double) xpMod * maxXPPerKill(killer.getLevel());
|
||||
xp *= getConMod(killer, mob);
|
||||
grantedExperience = (double) Float.parseFloat(ConfigManager.MB_NORMAL_EXP_RATE.getValue()) * maxXPPerKill(killer.getLevel());
|
||||
grantedExperience *= getConMod(killer, mob);
|
||||
|
||||
// Modify for hotzone
|
||||
if (ZoneManager.inHotZone(mob.getLoc()))
|
||||
xp *= Enum.DropRateType.HOT_EXP_RATE_MOD.rate;
|
||||
grantedExperience *= Float.parseFloat(ConfigManager.MB_HOTZONE_EXP_RATE.getValue());
|
||||
|
||||
// Errant penalty
|
||||
if (xp != 1)
|
||||
if (grantedExperience != 1)
|
||||
if (killer.getGuild().isEmptyGuild())
|
||||
xp *= .6;
|
||||
grantedExperience *= .6;
|
||||
|
||||
// Grant XP
|
||||
killer.grantXP((int) Math.floor(xp));
|
||||
killer.grantXP((int) Math.floor(grantedExperience));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import engine.Enum;
|
||||
import engine.Enum.ItemContainerType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.Enum.OwnerType;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -210,7 +211,7 @@ public class LootTable {
|
||||
|
||||
float chance = mlb.getChance() *.01f;
|
||||
|
||||
chance *= Enum.DropRateType.DROP_RATE_MOD.rate;
|
||||
chance *= Float.parseFloat(ConfigManager.MB_NORMAL_DROP_RATE.getValue());
|
||||
|
||||
calculatedLootTable = mlb.getLootTableID();
|
||||
|
||||
|
||||
@@ -1506,17 +1506,14 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
double gold = (ThreadLocalRandom.current().nextDouble() * (maxGold - minGold) + minGold);
|
||||
|
||||
|
||||
//server specific gold multiplier
|
||||
double goldMod = DropRateType.GOLD_RATE_MOD.rate;
|
||||
gold *= goldMod;
|
||||
|
||||
gold *= Float.parseFloat(ConfigManager.MB_NORMAL_DROP_RATE.getValue());
|
||||
|
||||
//modify for hotzone
|
||||
|
||||
if (ZoneManager.inHotZone(mob.getLoc()))
|
||||
gold *= DropRateType.HOT_GOLD_RATE_MOD.rate;
|
||||
|
||||
gold *= DropRateType.GOLD_RATE_MOD.rate;
|
||||
gold *= Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue());
|
||||
|
||||
return (int) gold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user