From d8f211d45d6bb2739bfab4a07c7006f0c5b42b60 Mon Sep 17 00:00:00 2001 From: CodeForFame Date: Thu, 21 Jul 2011 15:43:33 -0500 Subject: [PATCH] Added option to disable congrats on max level Added option for wilderness standstill time Closes #16 Added config for bonus xp in wild --- GameServer/conf/world.xml | 20 ++++++++++++++-- .../src/org/moparscape/msc/config/Config.java | 18 +++++++++----- .../org/moparscape/msc/gs/model/Player.java | 24 +++++++------------ 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/GameServer/conf/world.xml b/GameServer/conf/world.xml index 126d308..7b9f2fa 100644 --- a/GameServer/conf/world.xml +++ b/GameServer/conf/world.xml @@ -18,8 +18,26 @@ false true + + 4.0 4.0 + + 999 + + + 0 + 0 + + + 10000 + + + false None @@ -45,8 +63,6 @@ most active IPs will be stored at a time. --> 5 - - 6000000 diff --git a/GameServer/src/org/moparscape/msc/config/Config.java b/GameServer/src/org/moparscape/msc/config/Config.java index 91f5fad..9b4c21b 100644 --- a/GameServer/src/org/moparscape/msc/config/Config.java +++ b/GameServer/src/org/moparscape/msc/config/Config.java @@ -28,17 +28,15 @@ public class Config { public static boolean members, f2pWildy, APPLICATION_LEVEL_BLOCKING; - public static double expRate, subExpRate; + public static double expRate, subExpRate, WILD_NON_COMBAT_BONUS, WILD_COMBAT_BONUS; public static String[] pmods, mods, admins; - public static int IP_BAN_REMOVAL_DELAY; - public static int GARBAGE_COLLECT_INTERVAL; - public static int SAVE_INTERVAL; + public static int IP_BAN_REMOVAL_DELAY, GARBAGE_COLLECT_INTERVAL, SAVE_INTERVAL; public static String DATE_FORMAT, BLOCK_COMMAND, UNBLOCK_COMMAND, ALERT_CONFIG, COMMAND_CONFIG; - public static int CONNECTION_THROTTLE_SIZE; + public static int CONNECTION_THROTTLE_SIZE, WILD_LEVEL_FOR_NON_COMBAT_BONUS, WILD_STAND_STILL_TIME; public static boolean OS_LEVEL_BLOCKING, APPLICATION_LEVEL_THROTTLE_ALERT, - OS_LEVEL_THROTTLE_ALERT, OS_LEVEL_UNBLOCK_FAILED_ALERT; + OS_LEVEL_THROTTLE_ALERT, OS_LEVEL_UNBLOCK_FAILED_ALERT, CONGRATS_FOR_MAX_LEVEL; static { loadEnv(); @@ -111,6 +109,14 @@ public class Config { ALERT_CONFIG = props.getProperty("alert-config"); COMMAND_CONFIG = props.getProperty("command-config"); + + + WILD_STAND_STILL_TIME = Integer.parseInt(props.getProperty("wild-stand-still-time")); + WILD_LEVEL_FOR_NON_COMBAT_BONUS = Integer.parseInt(props.getProperty("wild-non-combat-min-level")); + WILD_NON_COMBAT_BONUS = Double.parseDouble(props.getProperty("wild-non-combat-bonus")); + WILD_COMBAT_BONUS = Double.parseDouble(props.getProperty("wild-combat-bonus")); + CONGRATS_FOR_MAX_LEVEL = Boolean.parseBoolean(props.getProperty("max-level-congrats")); + props.clear(); diff --git a/GameServer/src/org/moparscape/msc/gs/model/Player.java b/GameServer/src/org/moparscape/msc/gs/model/Player.java index 8697ece..00bc03b 100644 --- a/GameServer/src/org/moparscape/msc/gs/model/Player.java +++ b/GameServer/src/org/moparscape/msc/gs/model/Player.java @@ -659,14 +659,14 @@ public final class Player extends Mob { public boolean canLogout() { if (this != null && this.location != null && this.location.inWilderness()) { - if (GameEngine.getTime() - this.getLastMoved() < 10000) { + if (GameEngine.getTime() - this.getLastMoved() < Config.WILD_STAND_STILL_TIME) { getActionSender() .sendMessage( - "You must stand peacefully in one place for 10 seconds!"); + "You must stand peacefully in one place for " + Config.WILD_STAND_STILL_TIME + " seconds!"); return false; } } - return !isBusy() && GameEngine.getTime() - getCombatTimer() > 10000; + return !isBusy() && GameEngine.getTime() - getCombatTimer() > Config.WILD_STAND_STILL_TIME; } public boolean canReport() { @@ -1570,7 +1570,6 @@ public final class Player extends Mob { return wrongwords; } - // incExp public int ignoreCount() { return ignoreList.size(); } @@ -1606,13 +1605,8 @@ public final class Player extends Mob { } } if (combat && i < 3 - && (combatStyleToIndex() != i && getCombatStyle() != 0)) { // fix - // for - // accidental - // exp - // in - // other - // stats? + && (combatStyleToIndex() != i && getCombatStyle() != 0)) { + // fix for accidental exp in other stats? return; } @@ -1623,9 +1617,9 @@ public final class Player extends Mob { if (getLocation().wildernessLevel() > 1) { if (combat) - exprate = exprate * 2; - if (getLocation().wildernessLevel() > 10 && !combat) - exprate = exprate * 2; + exprate += Config.WILD_COMBAT_BONUS; + if (getLocation().wildernessLevel() > Config.WILD_LEVEL_FOR_NON_COMBAT_BONUS && !combat) + exprate += Config.WILD_NON_COMBAT_BONUS; } exp[i] += amount * exprate; @@ -1639,7 +1633,7 @@ public final class Player extends Mob { incCurStat(i, advanced); incMaxStat(i, advanced); int stat = this.getMaxStat(i); - if (stat == 99) { + if (stat == 99 && Config.CONGRATS_FOR_MAX_LEVEL) { for (Player p : world.getPlayers()) { if (p != null) { p.getActionSender()