Riizade/config file (#520)
* added POJO + yaml file * made config members public * switched to yaml * modified files to use YamlConfig over ServerConstants * removed constants from ServerConstants * removed unused imports * removed unused import * removed world ini * removed now unused .ini files * fixed docker-launch.sh * added jackson dependency JARs * fixed errors * removed unused server config values, added world defaults * don't use env variables for docker * fixed package imports/specifiers for js files
This commit is contained in:
committed by
Ronan Lana
parent
e169971384
commit
181573dc74
@@ -30,6 +30,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import client.Skill;
|
||||
import config.YamlConfig;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.guild.MapleGuild;
|
||||
@@ -627,9 +628,9 @@ public class AbstractPlayerInteraction {
|
||||
it.setUpgradeSlots(3);
|
||||
}
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) {
|
||||
if(YamlConfig.config.server.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) {
|
||||
Equip eqp = (Equip)item;
|
||||
if(!(c.getPlayer().isGM() && ServerConstants.USE_PERFECT_GM_SCROLL)) {
|
||||
if(!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) {
|
||||
eqp.setUpgradeSlots((byte)(eqp.getUpgradeSlots() + 1));
|
||||
}
|
||||
item = MapleItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, 2049100, c.getPlayer().isGM());
|
||||
@@ -855,8 +856,8 @@ public class AbstractPlayerInteraction {
|
||||
int base = PartyQuest.getExp(PQ, player.getLevel());
|
||||
int exp = base * bonus / 100;
|
||||
player.gainExp(exp, true, true);
|
||||
if(ServerConstants.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= ServerConstants.EVENT_END_TIMESTAMP) {
|
||||
player.gainExp((int) (exp * ServerConstants.PQ_BONUS_EXP_RATE), true, true);
|
||||
if(YamlConfig.config.server.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= YamlConfig.config.server.EVENT_END_TIMESTAMP) {
|
||||
player.gainExp((int) (exp * YamlConfig.config.server.PQ_BONUS_EXP_RATE), true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1159,7 +1160,7 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public boolean canGetFirstJob(int jobType) {
|
||||
if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ import java.util.Set;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import config.YamlConfig;
|
||||
import net.server.audit.LockCollector;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
@@ -102,9 +104,9 @@ public class EventInstanceManager {
|
||||
private boolean eventStarted = false;
|
||||
|
||||
// multi-leveled PQ rewards!
|
||||
private Map<Integer, List<Integer>> collectionSet = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS);
|
||||
private Map<Integer, List<Integer>> collectionQty = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS);
|
||||
private Map<Integer, Integer> collectionExp = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS);
|
||||
private Map<Integer, List<Integer>> collectionSet = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS);
|
||||
private Map<Integer, List<Integer>> collectionQty = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS);
|
||||
private Map<Integer, Integer> collectionExp = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS);
|
||||
|
||||
// Exp/Meso rewards by CLEAR on a stage
|
||||
private List<Integer> onMapClearExp = new ArrayList<>();
|
||||
@@ -995,7 +997,7 @@ public class EventInstanceManager {
|
||||
public final void setEventRewards(int eventLevel, List<Object> rwds, List<Object> qtys, int expGiven) {
|
||||
// fixed EXP will be rewarded at the same time the random item is given
|
||||
|
||||
if(eventLevel <= 0 || eventLevel > ServerConstants.MAX_EVENT_LEVELS) return;
|
||||
if(eventLevel <= 0 || eventLevel > YamlConfig.config.server.MAX_EVENT_LEVELS) return;
|
||||
eventLevel--; //event level starts from 1
|
||||
|
||||
List<Integer> rewardIds = convertToIntegerArray(rwds);
|
||||
@@ -1105,7 +1107,7 @@ public class EventInstanceManager {
|
||||
eventCleared = true;
|
||||
|
||||
for (MapleCharacter chr : getPlayers()) {
|
||||
chr.awardQuestPoint(ServerConstants.QUEST_POINT_PER_EVENT_CLEAR);
|
||||
chr.awardQuestPoint(YamlConfig.config.server.QUEST_POINT_PER_EVENT_CLEAR);
|
||||
}
|
||||
|
||||
sL.lock();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package scripting.event;
|
||||
|
||||
import config.YamlConfig;
|
||||
import jdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||
import jdk.nashorn.api.scripting.ScriptUtils;
|
||||
import tools.exceptions.EventInstanceInProgressException;
|
||||
@@ -184,7 +185,7 @@ public class EventManager {
|
||||
}
|
||||
|
||||
public long getLobbyDelay() {
|
||||
return ServerConstants.EVENT_LOBBY_DELAY;
|
||||
return YamlConfig.config.server.EVENT_LOBBY_DELAY;
|
||||
}
|
||||
|
||||
private List<Integer> getLobbyRange() {
|
||||
@@ -312,7 +313,7 @@ public class EventManager {
|
||||
instances.remove(name);
|
||||
}
|
||||
}
|
||||
}, ServerConstants.EVENT_LOBBY_DELAY * 1000);
|
||||
}, YamlConfig.config.server.EVENT_LOBBY_DELAY * 1000);
|
||||
}
|
||||
|
||||
public void setProperty(String key, String value) {
|
||||
@@ -839,7 +840,7 @@ public class EventManager {
|
||||
|
||||
public boolean isQueueFull() {
|
||||
synchronized(queuedGuilds) {
|
||||
return queuedGuilds.size() >= ServerConstants.EVENT_MAX_GUILD_QUEUE;
|
||||
return queuedGuilds.size() >= YamlConfig.config.server.EVENT_MAX_GUILD_QUEUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
package scripting.event.worker;
|
||||
|
||||
import config.YamlConfig;
|
||||
import constants.ServerConstants;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -66,7 +67,7 @@ public class EventScriptScheduler {
|
||||
if (registeredEntries.isEmpty()) {
|
||||
idleProcs++;
|
||||
|
||||
if (idleProcs >= ServerConstants.MOB_STATUS_MONITOR_LIFE) {
|
||||
if (idleProcs >= YamlConfig.config.server.MOB_STATUS_MONITOR_LIFE) {
|
||||
if (schedulerTask != null) {
|
||||
schedulerTask.cancel(false);
|
||||
schedulerTask = null;
|
||||
@@ -118,7 +119,7 @@ public class EventScriptScheduler {
|
||||
return;
|
||||
}
|
||||
|
||||
schedulerTask = TimerManager.getInstance().register(monitorTask, ServerConstants.MOB_STATUS_MONITOR_PROC, ServerConstants.MOB_STATUS_MONITOR_PROC);
|
||||
schedulerTask = TimerManager.getInstance().register(monitorTask, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC);
|
||||
}
|
||||
|
||||
registeredEntries.put(scheduledAction, Server.getInstance().getCurrentTime() + duration);
|
||||
|
||||
@@ -24,6 +24,7 @@ package scripting.npc;
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import config.YamlConfig;
|
||||
import constants.ServerConstants;
|
||||
import net.server.Server;
|
||||
import net.server.guild.MapleAlliance;
|
||||
@@ -340,7 +341,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
|
||||
public boolean canSpawnPlayerNpc(int mapid) {
|
||||
MapleCharacter chr = getPlayer();
|
||||
return !ServerConstants.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && MaplePlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid);
|
||||
return !YamlConfig.config.server.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && MaplePlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid);
|
||||
}
|
||||
|
||||
public MaplePlayerNPC getPlayerNPCByScriptid(int scriptId) {
|
||||
@@ -592,7 +593,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public boolean isUsingOldPqNpcStyle() {
|
||||
return ServerConstants.USE_OLD_GMS_STYLED_PQ_NPCS && this.getPlayer().getParty() != null;
|
||||
return YamlConfig.config.server.USE_OLD_GMS_STYLED_PQ_NPCS && this.getPlayer().getParty() != null;
|
||||
}
|
||||
|
||||
public Object[] getAvailableMasteryBooks() {
|
||||
|
||||
@@ -26,6 +26,7 @@ import client.MapleClient;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import config.YamlConfig;
|
||||
import constants.ItemConstants;
|
||||
import constants.ServerConstants;
|
||||
import java.awt.Point;
|
||||
@@ -288,7 +289,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void hitMonsterWithReactor(int id, int hitsToKill) { // until someone comes with a better solution, why not?
|
||||
int customTime = ServerConstants.MOB_REACTOR_REFRESH_TIME;
|
||||
int customTime = YamlConfig.config.server.MOB_REACTOR_REFRESH_TIME;
|
||||
if(customTime > 0) {
|
||||
reactor.setDelay(customTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user