Rename and clean up MapleMapManager
This commit is contained in:
@@ -7114,7 +7114,7 @@ public class Character extends AbstractCharacterObject {
|
|||||||
|
|
||||||
|
|
||||||
if (channelserver) {
|
if (channelserver) {
|
||||||
MapleMapManager mapManager = client.getChannelServer().getMapFactory();
|
MapManager mapManager = client.getChannelServer().getMapFactory();
|
||||||
ret.map = mapManager.getMap(ret.mapid);
|
ret.map = mapManager.getMap(ret.mapid);
|
||||||
|
|
||||||
if (ret.map == null) {
|
if (ret.map == null) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public final class Channel {
|
|||||||
private PlayerStorage players = new PlayerStorage();
|
private PlayerStorage players = new PlayerStorage();
|
||||||
private ChannelServer channelServer;
|
private ChannelServer channelServer;
|
||||||
private String serverMessage;
|
private String serverMessage;
|
||||||
private MapleMapManager mapManager;
|
private MapManager mapManager;
|
||||||
private EventScriptManager eventSM;
|
private EventScriptManager eventSM;
|
||||||
private ServicesManager services;
|
private ServicesManager services;
|
||||||
private Map<Integer, HiredMerchant> hiredMerchants = new HashMap<>();
|
private Map<Integer, HiredMerchant> hiredMerchants = new HashMap<>();
|
||||||
@@ -113,7 +113,7 @@ public final class Channel {
|
|||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
||||||
this.ongoingStartTime = startTime + 10000; // rude approach to a world's last channel boot time, placeholder for the 1st wedding reservation ever
|
this.ongoingStartTime = startTime + 10000; // rude approach to a world's last channel boot time, placeholder for the 1st wedding reservation ever
|
||||||
this.mapManager = new MapleMapManager(null, world, channel);
|
this.mapManager = new MapManager(null, world, channel);
|
||||||
this.port = BASE_PORT + (this.channel - 1) + (world * 100);
|
this.port = BASE_PORT + (this.channel - 1) + (world * 100);
|
||||||
this.ip = YamlConfig.config.server.HOST + ":" + port;
|
this.ip = YamlConfig.config.server.HOST + ":" + port;
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ public final class Channel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleMapManager getMapFactory() {
|
public MapManager getMapFactory() {
|
||||||
return mapManager;
|
return mapManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package net.server.task;
|
|||||||
import net.server.PlayerStorage;
|
import net.server.PlayerStorage;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import net.server.channel.Channel;
|
import net.server.channel.Channel;
|
||||||
import server.maps.MapleMapManager;
|
import server.maps.MapManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Resinate
|
* @author Resinate
|
||||||
@@ -16,7 +16,7 @@ public class RespawnTask implements Runnable {
|
|||||||
PlayerStorage ps = ch.getPlayerStorage();
|
PlayerStorage ps = ch.getPlayerStorage();
|
||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
if (!ps.getAllCharacters().isEmpty()) {
|
if (!ps.getAllCharacters().isEmpty()) {
|
||||||
MapleMapManager mapManager = ch.getMapFactory();
|
MapManager mapManager = ch.getMapFactory();
|
||||||
if (mapManager != null) {
|
if (mapManager != null) {
|
||||||
mapManager.updateMaps();
|
mapManager.updateMaps();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ import server.expeditions.Expedition;
|
|||||||
import server.life.LifeFactory;
|
import server.life.LifeFactory;
|
||||||
import server.life.Monster;
|
import server.life.Monster;
|
||||||
import server.life.NPC;
|
import server.life.NPC;
|
||||||
|
import server.maps.MapManager;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import server.maps.MapleMapManager;
|
|
||||||
import server.maps.MaplePortal;
|
import server.maps.MaplePortal;
|
||||||
import server.maps.MapleReactor;
|
import server.maps.MapleReactor;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
@@ -71,7 +71,7 @@ public class EventInstanceManager {
|
|||||||
private Map<Character, Integer> killCount = new HashMap<>();
|
private Map<Character, Integer> killCount = new HashMap<>();
|
||||||
private EventManager em;
|
private EventManager em;
|
||||||
private EventScriptScheduler ess;
|
private EventScriptScheduler ess;
|
||||||
private MapleMapManager mapManager;
|
private MapManager mapManager;
|
||||||
private String name;
|
private String name;
|
||||||
private Properties props = new Properties();
|
private Properties props = new Properties();
|
||||||
private Map<String, Object> objectProps = new HashMap<>();
|
private Map<String, Object> objectProps = new HashMap<>();
|
||||||
@@ -114,7 +114,7 @@ public class EventInstanceManager {
|
|||||||
this.em = em;
|
this.em = em;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ess = new EventScriptScheduler();
|
this.ess = new EventScriptScheduler();
|
||||||
this.mapManager = new MapleMapManager(this, em.getWorldServer().getId(), em.getChannelServer().getId());
|
this.mapManager = new MapManager(this, em.getWorldServer().getId(), em.getChannelServer().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
@@ -656,7 +656,7 @@ public class EventInstanceManager {
|
|||||||
sL = sL.dispose();
|
sL = sL.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleMapManager getMapFactory() {
|
public MapManager getMapFactory() {
|
||||||
return mapManager;
|
return mapManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ import server.gachapon.MapleGachapon;
|
|||||||
import server.gachapon.MapleGachapon.MapleGachaponItem;
|
import server.gachapon.MapleGachapon.MapleGachaponItem;
|
||||||
import server.life.LifeFactory;
|
import server.life.LifeFactory;
|
||||||
import server.life.PlayerNPC;
|
import server.life.PlayerNPC;
|
||||||
|
import server.maps.MapManager;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import server.maps.MapleMapManager;
|
|
||||||
import server.maps.MapleMapObject;
|
import server.maps.MapleMapObject;
|
||||||
import server.maps.MapleMapObjectType;
|
import server.maps.MapleMapObjectType;
|
||||||
import server.partyquest.AriantColiseum;
|
import server.partyquest.AriantColiseum;
|
||||||
@@ -499,7 +499,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
PyramidMode mod = PyramidMode.valueOf(mode);
|
PyramidMode mod = PyramidMode.valueOf(mode);
|
||||||
|
|
||||||
Party partyz = getPlayer().getParty();
|
Party partyz = getPlayer().getParty();
|
||||||
MapleMapManager mapManager = c.getChannelServer().getMapFactory();
|
MapManager mapManager = c.getChannelServer().getMapFactory();
|
||||||
|
|
||||||
MapleMap map = null;
|
MapleMap map = null;
|
||||||
int mapid = 926010100;
|
int mapid = 926010100;
|
||||||
|
|||||||
+12
-12
@@ -30,17 +30,17 @@ import scripting.event.EventInstanceManager;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class MapleMapManager {
|
public class MapManager {
|
||||||
|
private final int channel;
|
||||||
private int channel, world;
|
private final int world;
|
||||||
private EventInstanceManager event;
|
private EventInstanceManager event;
|
||||||
|
|
||||||
private Map<Integer, MapleMap> maps = new HashMap<>();
|
|
||||||
|
|
||||||
private MonitoredReadLock mapsRLock;
|
|
||||||
private MonitoredWriteLock mapsWLock;
|
|
||||||
|
|
||||||
public MapleMapManager(EventInstanceManager eim, int world, int channel) {
|
private final Map<Integer, MapleMap> maps = new HashMap<>();
|
||||||
|
|
||||||
|
private final MonitoredReadLock mapsRLock;
|
||||||
|
private final MonitoredWriteLock mapsWLock;
|
||||||
|
|
||||||
|
public MapManager(EventInstanceManager eim, int world, int channel) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.event = eim;
|
this.event = eim;
|
||||||
@@ -103,7 +103,7 @@ public class MapleMapManager {
|
|||||||
|
|
||||||
return (map != null) ? map : loadMapFromWz(mapid, true);
|
return (map != null) ? map : loadMapFromWz(mapid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleMap getDisposableMap(int mapid) {
|
public MapleMap getDisposableMap(int mapid) {
|
||||||
return loadMapFromWz(mapid, false);
|
return loadMapFromWz(mapid, false);
|
||||||
}
|
}
|
||||||
@@ -125,14 +125,14 @@ public class MapleMapManager {
|
|||||||
mapsRLock.unlock();
|
mapsRLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMaps() {
|
public void updateMaps() {
|
||||||
for (MapleMap map : getMaps().values()) {
|
for (MapleMap map : getMaps().values()) {
|
||||||
map.respawn();
|
map.respawn();
|
||||||
map.mobMpRecovery();
|
map.mobMpRecovery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
for (MapleMap map : getMaps().values()) {
|
for (MapleMap map : getMaps().values()) {
|
||||||
map.dispose();
|
map.dispose();
|
||||||
Reference in New Issue
Block a user