Dynamic World/Channel shutdown + Equip levels on Duey + AP/SP patch

Implemented dynamic world/channel shutdown, coupling with the dynamic deployment from last commit rendering on a fully automated world/channel management.
Fixed some spawned mobs not being properly registered on events.
Implemented a respawn mechanic sensitive to number of players on map. More mobs will spawn the greater the number of players is. Server flag: USE_ENABLE_FULL_RESPAWN = false.
Implemented a mechanic for delayed mob loot drops, on which the delay is determined by the death animation duration. Server flag: USE_SPAWN_LOOT_ON_ANIMATION = true.
Fixed EIM being disposed incorrectly when the dispose is called through scripts.
Protected concurrently AP and SP distribution handlers.
Slightly improved HealOvertimeHandler performance.
Fixed Duey not propagating equipment level and experience when transfering items.
Buyback now has a short grace period, granting the returning player time for decision making (players won't die right away, rather sticks at 1HP).
Reviewed item monitor task not properly protected concurrently.
Fixed some issues with ropes on some Kampung Village maps.
Fixed "maxhpmp" command allowing to pass negative values.
This commit is contained in:
ronancpl
2018-07-28 22:00:52 -03:00
parent 8aadf7c369
commit cc541f39d5
77 changed files with 33492 additions and 32661 deletions

View File

@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -39,6 +40,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.MonitoredReentrantLock;
import net.server.audit.locks.MonitoredReentrantReadWriteLock;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
import net.MapleServerHandler;
import net.mina.MapleCodecFactory;
@@ -95,6 +97,7 @@ public final class Channel {
private OverallScheduler channelSchedulers[] = new OverallScheduler[4];
private Map<Integer, MapleHiredMerchant> hiredMerchants = new HashMap<>();
private final Map<Integer, Integer> storedVars = new HashMap<>();
private Set<Integer> playersAway = new HashSet<>();
private List<MapleExpedition> expeditions = new ArrayList<>();
private List<MapleExpeditionType> expedType = new ArrayList<>();
private MapleEvent event;
@@ -128,7 +131,7 @@ public final class Channel {
private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[4];
private MonitoredReentrantLock lock = new MonitoredReentrantLock(MonitoredLockType.CHANNEL, true);
private MonitoredReentrantLock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL, true);
public Channel(final int world, final int channel, long startTime) {
this.world = world;
@@ -165,7 +168,7 @@ public final class Channel {
}
for(int i = 0; i < 4; i++) {
faceLock[i] = new MonitoredReentrantLock(MonitoredLockType.CHANNEL_FACEEXPRS, true);
faceLock[i] = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL_FACEEXPRS, true);
mobStatusSchedulers[i] = new MobStatusScheduler();
mobAnimationSchedulers[i] = new MobAnimationScheduler();
@@ -208,6 +211,7 @@ public final class Channel {
eventSM = null;
closeChannelSchedules();
players = null;
acceptor.unbind();
@@ -263,10 +267,10 @@ public final class Channel {
channelSchedulers[i] = null;
}
faceLock[i].dispose();
faceLock[i] = faceLock[i].dispose();
}
lock.dispose();
lock = lock.dispose();
}
private void closeAllMerchants() {
@@ -291,7 +295,7 @@ public final class Channel {
public int getWorld() {
return world;
}
public void addPlayer(MapleCharacter chr) {
players.addPlayer(chr);
chr.announce(MaplePacketCreator.serverMessage(serverMessage));
@@ -355,6 +359,18 @@ public final class Channel {
}
return partym;
}
public void insertPlayerAway(int chrId) { // either they in CS or MTS
playersAway.add(chrId);
}
public void removePlayerAway(int chrId) {
playersAway.remove(chrId);
}
public boolean canUninstall() {
return players.getSize() == 0 && playersAway.isEmpty();
}
public class respawnMaps implements Runnable {