Monster drops are retrieved from DropProvider (postgres db)
This commit emphasizes the need for events to be reworked. This is the chain of constructors the DropProvider has to pass through to reach MapleMap: Channel -> EventScriptManager -> EventManager -> EventInstanceManager -> MapManager -> MapleMap
This commit is contained in:
@@ -361,7 +361,7 @@ public class Server {
|
||||
wldRLock.unlock();
|
||||
}
|
||||
|
||||
Channel channel = new Channel(worldid, channelid, getCurrentTime());
|
||||
Channel channel = new Channel(worldid, channelid, getCurrentTime(), channelDependencies.dropProvider());
|
||||
channel.setServerMessage(YamlConfig.config.worlds.get(worldid).why_am_i_recommended);
|
||||
|
||||
if (world.addChannel(channel)) {
|
||||
@@ -434,7 +434,7 @@ public class Server {
|
||||
long bootTime = getCurrentTime();
|
||||
for (int j = 1; j <= YamlConfig.config.worlds.get(i).channels; j++) {
|
||||
int channelid = j;
|
||||
Channel channel = new Channel(i, channelid, bootTime);
|
||||
Channel channel = new Channel(i, channelid, bootTime, channelDependencies.dropProvider());
|
||||
|
||||
world.addChannel(channel);
|
||||
channelInfo.put(channelid, channel.getIP());
|
||||
|
||||
@@ -24,6 +24,7 @@ package net.server.channel;
|
||||
import client.Character;
|
||||
import config.YamlConfig;
|
||||
import constants.id.MapId;
|
||||
import database.drop.DropProvider;
|
||||
import net.netty.ChannelServer;
|
||||
import net.packet.Packet;
|
||||
import net.server.PlayerStorage;
|
||||
@@ -73,6 +74,7 @@ public final class Channel {
|
||||
private MapManager mapManager;
|
||||
private EventScriptManager eventSM;
|
||||
private ServicesManager services;
|
||||
private final DropProvider dropProvider;
|
||||
private final Map<Integer, HiredMerchant> hiredMerchants = new HashMap<>();
|
||||
private final Map<Integer, Integer> storedVars = new HashMap<>();
|
||||
private final Set<Integer> playersAway = new HashSet<>();
|
||||
@@ -107,12 +109,13 @@ public final class Channel {
|
||||
private final Lock merchRlock;
|
||||
private final Lock merchWlock;
|
||||
|
||||
public Channel(final int world, final int channel, long startTime) {
|
||||
public Channel(final int world, final int channel, long startTime, DropProvider dropProvider) {
|
||||
this.world = world;
|
||||
this.channel = channel;
|
||||
this.dropProvider = dropProvider;
|
||||
|
||||
this.ongoingStartTime = startTime + 10000; // rude approach to a world's last channel boot time, placeholder for the 1st wedding reservation ever
|
||||
this.mapManager = new MapManager(null, world, channel);
|
||||
this.mapManager = new MapManager(null, world, channel, dropProvider);
|
||||
this.port = BASE_PORT + (this.channel - 1) + (world * 100);
|
||||
this.ip = YamlConfig.config.server.HOST + ":" + port;
|
||||
|
||||
@@ -125,11 +128,11 @@ public final class Channel {
|
||||
expedType.addAll(Arrays.asList(ExpeditionType.values()));
|
||||
|
||||
if (Server.getInstance().isOnline()) { // postpone event loading to improve boot time... thanks Riizade, daronhudson for noticing slow startup times
|
||||
eventSM = new EventScriptManager(this, getEvents());
|
||||
eventSM = new EventScriptManager(this, getEvents(), dropProvider);
|
||||
eventSM.init();
|
||||
} else {
|
||||
String[] ev = {"0_EXAMPLE"};
|
||||
eventSM = new EventScriptManager(this, ev);
|
||||
eventSM = new EventScriptManager(this, ev, dropProvider);
|
||||
}
|
||||
|
||||
dojoStage = new int[20];
|
||||
@@ -162,7 +165,7 @@ public final class Channel {
|
||||
|
||||
eventSM.cancel();
|
||||
eventSM = null;
|
||||
eventSM = new EventScriptManager(this, getEvents());
|
||||
eventSM = new EventScriptManager(this, getEvents(), dropProvider);
|
||||
}
|
||||
|
||||
public synchronized void shutdown() {
|
||||
@@ -1035,4 +1038,4 @@ public final class Channel {
|
||||
log.debug("Guest list: {}", ongoingChapelGuests);
|
||||
log.debug("Starttime: {}", ongoingStartTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user