Commands overhaul + Selective loot + Antimulticlient Coordinator

Completely overhauled commands layout, each command splitted in Java classes.
Optimized "ranks" command, no more calling the DB to get ranking info.
Implemented a mechanic where mobs only spawns loots that are visible/collectable by the player's party.
Implemented a server flag which sets whether explorers, cygnus and legends are allowed to share the cash shop inventory or not.
Implemented support for dynamic server rates at bootup. Rates can now be assigned at the configuration.ini file.
Devised the anti-multiclient login coordinator feature. Besides multiclient attempts by the same machine, it also prevents unauthorized login attempts into an account.
Fixed PQ instances being forcefully closed even when party leader reassignment upon logout is available.
Fixed mob statis not concurrently protected.
This commit is contained in:
ronancpl
2018-08-28 14:12:00 -03:00
parent b5c6831129
commit 132f286391
210 changed files with 10518 additions and 3851 deletions

View File

@@ -781,8 +781,8 @@ public class EventManager {
}
}
public static int getTransportationTime(int travelTime) {
return (int) Math.ceil(travelTime / ServerConstants.TRAVEL_RATE);
public int getTransportationTime(int travelTime) {
return this.getWorldServer().getTransportationTime(travelTime);
}
private void fillEimQueue() {

View File

@@ -41,6 +41,11 @@ import tools.MaplePacketCreator;
public class ItemScriptManager {
private static ItemScriptManager instance = new ItemScriptManager();
public static ItemScriptManager getInstance() {
return instance;
}
private Map<String, Invocable> scripts = new HashMap<>();
private ScriptEngineFactory sef;
@@ -48,11 +53,7 @@ public class ItemScriptManager {
ScriptEngineManager sem = new ScriptEngineManager();
sef = sem.getEngineByName("javascript").getFactory();
}
public static ItemScriptManager getInstance() {
return instance;
}
public boolean scriptExists(String scriptName) {
File scriptFile = new File("scripts/item/" + scriptName + ".js");
return scriptFile.exists();

View File

@@ -40,6 +40,11 @@ import tools.FilePrinter;
public class MapScriptManager {
private static MapScriptManager instance = new MapScriptManager();
public static MapScriptManager getInstance() {
return instance;
}
private Map<String, Invocable> scripts = new HashMap<>();
private ScriptEngineFactory sef;
@@ -48,10 +53,6 @@ public class MapScriptManager {
sef = sem.getEngineByName("javascript").getFactory();
}
public static MapScriptManager getInstance() {
return instance;
}
public void reloadScripts() {
scripts.clear();
}

View File

@@ -41,14 +41,15 @@ import tools.MaplePacketCreator;
*/
public class NPCScriptManager extends AbstractScriptManager {
private Map<MapleClient, NPCConversationManager> cms = new HashMap<>();
private Map<MapleClient, Invocable> scripts = new HashMap<>();
private static NPCScriptManager instance = new NPCScriptManager();
public static NPCScriptManager getInstance() {
return instance;
}
private Map<MapleClient, NPCConversationManager> cms = new HashMap<>();
private Map<MapleClient, Invocable> scripts = new HashMap<>();
public boolean start(MapleClient c, int npc, MapleCharacter chr) {
return start(c, npc, null, chr);
}

View File

@@ -41,6 +41,11 @@ import tools.FilePrinter;
public class PortalScriptManager {
private static PortalScriptManager instance = new PortalScriptManager();
public static PortalScriptManager getInstance() {
return instance;
}
private Map<String, PortalScript> scripts = new HashMap<>();
private ScriptEngineFactory sef;
@@ -49,10 +54,6 @@ public class PortalScriptManager {
sef = sem.getEngineByName("javascript").getFactory();
}
public static PortalScriptManager getInstance() {
return instance;
}
private PortalScript getPortalScript(String scriptName) {
if (scripts.containsKey(scriptName)) {
return scripts.get(scriptName);

View File

@@ -39,13 +39,15 @@ import client.MapleQuestStatus;
* @author RMZero213
*/
public class QuestScriptManager extends AbstractScriptManager {
private Map<MapleClient, QuestActionManager> qms = new HashMap<>();
private Map<MapleClient, Invocable> scripts = new HashMap<>();
private static QuestScriptManager instance = new QuestScriptManager();
private static QuestScriptManager instance = new QuestScriptManager();
public synchronized static QuestScriptManager getInstance() {
return instance;
}
private Map<MapleClient, QuestActionManager> qms = new HashMap<>();
private Map<MapleClient, Invocable> scripts = new HashMap<>();
public void start(MapleClient c, short questid, int npc) {
MapleQuest quest = MapleQuest.getInstance(questid);

View File

@@ -43,12 +43,13 @@ import tools.FilePrinter;
public class ReactorScriptManager extends AbstractScriptManager {
private static ReactorScriptManager instance = new ReactorScriptManager();
private Map<Integer, List<ReactorDropEntry>> drops = new HashMap<>();
public synchronized static ReactorScriptManager getInstance() {
return instance;
}
private Map<Integer, List<ReactorDropEntry>> drops = new HashMap<>();
public void onHit(MapleClient c, MapleReactor reactor) {
try {
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);