Services unrestrained to channels + Event scripts placeholder
Fixed an inconsistent scenario where player data would remain in world player storage even though they were no longer online. Implemented missing functionality for "Safety Charm" which allows 30% MaxHP/MP heal on return. Improved services facility, no longer tightly related to channels. Implemented a world service for "save players" (services acts as a monitor). Reviewed the event script initialization approach. Players no longer are retained from logging in on a channel whilst the events don't finish loadup. Fixed certain quest items not showing up, which would happen due to them not being quest requisites. Fixed NPC Pi crashing players when trying to craft arrows. Fixed pet re-evolution quest not working on Robos. Fixed boss HPBar not disappearing in certain situations. Revised gathered mob info on linked mobs, no longer marshaling stats. Fixed two possible deadlock scenarios within the cancel effect method. Added lock auditing support for read-write locks. Implemented code support for Cygnus intro clip. Reviewed updateBuffEffect, now properly checking for pirate buffs in order to send the expected packet. Reviewed unnecessary load of field objects, which would be doing so just for fetching the predicted map names. Fixed mob buff tooltips not showing on "fake" mobs in the event of them turning into "real". Reviewed usage of "unique" constraint on petid within the inventoryitems table. Fixed portal in Ariant unexpectedly leading players who completed the "secret passageway" of Sleepywood into it. Fixed a loop case in quest scripts from Magatia's broker having ore request.
This commit is contained in:
@@ -56,6 +56,7 @@ import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleCharacter.DelayedQuestUpdate;
|
||||
import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.MapleQuestStatus;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.Equip;
|
||||
@@ -94,6 +95,18 @@ public class AbstractPlayerInteraction {
|
||||
return c.getPlayer();
|
||||
}
|
||||
|
||||
public int getJobId() {
|
||||
return getPlayer().getJob().getId();
|
||||
}
|
||||
|
||||
public MapleJob getJob(){
|
||||
return getPlayer().getJob();
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return getPlayer().getLevel();
|
||||
}
|
||||
|
||||
public MapleMap getMap() {
|
||||
return c.getPlayer().getMap();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,12 @@ import config.YamlConfig;
|
||||
import net.server.audit.LockCollector;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.MonitoredReadLock;
|
||||
import net.server.audit.locks.MonitoredReentrantReadWriteLock;
|
||||
import net.server.audit.locks.MonitoredWriteLock;
|
||||
import net.server.audit.locks.factory.MonitoredReadLockFactory;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.audit.locks.factory.MonitoredWriteLockFactory;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import server.maps.MaplePortal;
|
||||
@@ -55,9 +59,6 @@ import constants.inventory.ItemConstants;
|
||||
import constants.net.ServerConstants;
|
||||
import java.awt.Point;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.server.coordinator.world.MapleEventRecallCoordinator;
|
||||
@@ -91,9 +92,9 @@ public class EventInstanceManager {
|
||||
private MapleExpedition expedition = null;
|
||||
private List<Integer> mapIds = new LinkedList<>();
|
||||
|
||||
private final ReentrantReadWriteLock lock = new MonitoredReentrantReadWriteLock(MonitoredLockType.EIM, true);
|
||||
private ReadLock rL = lock.readLock();
|
||||
private WriteLock wL = lock.writeLock();
|
||||
private final MonitoredReentrantReadWriteLock lock = new MonitoredReentrantReadWriteLock(MonitoredLockType.EIM, true);
|
||||
private MonitoredReadLock rL = MonitoredReadLockFactory.createLock(lock);
|
||||
private MonitoredWriteLock wL = MonitoredWriteLockFactory.createLock(lock);
|
||||
|
||||
private MonitoredReentrantLock pL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_PARTY, true);
|
||||
private MonitoredReentrantLock sL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_SCRIPT, true);
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*/
|
||||
package scripting.event;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -48,9 +50,10 @@ public class EventScriptManager extends AbstractScriptManager {
|
||||
public EventManager em;
|
||||
}
|
||||
|
||||
private Map<String, EventEntry> events = new LinkedHashMap<>();
|
||||
private static EventEntry fallback;
|
||||
private Map<String, EventEntry> events = new ConcurrentHashMap<>();
|
||||
private boolean active = false;
|
||||
|
||||
|
||||
public EventScriptManager(Channel cserv, String[] scripts) {
|
||||
super();
|
||||
for (String script : scripts) {
|
||||
@@ -59,12 +62,15 @@ public class EventScriptManager extends AbstractScriptManager {
|
||||
events.put(script, new EventEntry(iv, new EventManager(cserv, iv, script)));
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
fallback = events.remove("0_EXAMPLE");
|
||||
}
|
||||
|
||||
public EventManager getEventManager(String event) {
|
||||
EventEntry entry = events.get(event);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
return fallback.em;
|
||||
}
|
||||
return entry.em;
|
||||
}
|
||||
@@ -72,8 +78,8 @@ public class EventScriptManager extends AbstractScriptManager {
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
||||
public final void init() {
|
||||
for (EventEntry entry : events.values()) {
|
||||
try {
|
||||
entry.iv.put("em", entry.em);
|
||||
@@ -84,16 +90,17 @@ public class EventScriptManager extends AbstractScriptManager {
|
||||
}
|
||||
}
|
||||
|
||||
active = true;
|
||||
active = events.size() > 1; // bootup loads only 1 script
|
||||
}
|
||||
|
||||
private void reloadScripts() {
|
||||
if (events.isEmpty()) {
|
||||
Set<Entry<String, EventEntry>> eventEntries = new HashSet<>(events.entrySet());
|
||||
if (eventEntries.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Channel cserv = events.values().iterator().next().em.getChannelServer();
|
||||
for (Entry<String, EventEntry> entry : events.entrySet()) {
|
||||
Channel cserv = eventEntries.iterator().next().getValue().em.getChannelServer();
|
||||
for (Entry<String, EventEntry> entry : eventEntries) {
|
||||
String script = entry.getKey();
|
||||
NashornScriptEngine iv = getScriptEngine("event/" + script + ".js");
|
||||
events.put(script, new EventEntry(iv, new EventManager(cserv, iv, script)));
|
||||
@@ -112,4 +119,18 @@ public class EventScriptManager extends AbstractScriptManager {
|
||||
entry.em.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
if (events.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<EventEntry> eventEntries = new HashSet<>(events.values());
|
||||
events.clear();
|
||||
|
||||
active = false;
|
||||
for (EventEntry entry : eventEntries) {
|
||||
entry.em.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,35 @@ public class MapScriptMethods extends AbstractPlayerInteraction {
|
||||
public MapScriptMethods(MapleClient c) {
|
||||
super(c);
|
||||
}
|
||||
|
||||
|
||||
public void displayCygnusIntro() {
|
||||
switch (c.getPlayer().getMapId()) {
|
||||
case 913040100:
|
||||
lockUI();
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene0"));
|
||||
break;
|
||||
case 913040101:
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene1"));
|
||||
break;
|
||||
case 913040102:
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene2"));
|
||||
break;
|
||||
case 913040103:
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene3"));
|
||||
break;
|
||||
case 913040104:
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene4"));
|
||||
break;
|
||||
case 913040105:
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene5"));
|
||||
break;
|
||||
case 913040106:
|
||||
lockUI();
|
||||
c.announce(MaplePacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene6"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void displayAranIntro() {
|
||||
switch (c.getPlayer().getMapId()) {
|
||||
case 914090010:
|
||||
|
||||
@@ -253,14 +253,6 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
return this.getText;
|
||||
}
|
||||
|
||||
public int getJobId() {
|
||||
return getPlayer().getJob().getId();
|
||||
}
|
||||
|
||||
public MapleJob getJob(){
|
||||
return getPlayer().getJob();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceStartQuest(int id) {
|
||||
return forceStartQuest(id, npc);
|
||||
@@ -303,10 +295,6 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
getPlayer().gainExp(gain, true, true);
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return getPlayer().getLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showEffect(String effect) {
|
||||
getPlayer().getMap().broadcastMessage(MaplePacketCreator.environmentChange(effect, 3));
|
||||
|
||||
Reference in New Issue
Block a user