Pooled Io Write + EXP loss & Detached morph patch + Storages in World
Fixed autocommit getting called early/unavailable in a few catch blocks, when trying to save player. Fixed the missing variable declaration in several quest scripts that were recently formatted. Reworked the EXP loss formula applied at a knock-out. The new formula follows past discussions in several MS forums. Fixed a deadlock issue related with party HP and party doors management. Refactored management of packets sent to client through an IoSession. New system no longer makes use of a synchronized statement when calling announce(packet), rather makes use of dedicated threads to send queued packets for the respective players. Fixed SP reset allowing increase of unexpected skills. Refactored storages, no longer instantiated as coupled with the character, rather instantiated in a map within the world object, with accountid as key. Reviewed usage of character objects of offline party members, that weren't being properly checked. Fixed some unexpected cases with buffs and morphs (within the enhanced buff system) making the latter show up as another morph figure. Added a "priority buff" perspective within the enhanced buff system, to let such priority items/skills take awareness over other buffs. (This would be vital for some quests, as the one reported in #514 ) Fixed EXP gains in certain scenarios showing up with less amount than the expected (due to float point operations). Fixed a critical bug that have emerged in a recent mount-skill update, issue happened due to an improper object initialization. Fixed mount information packet not being relayed to the player at world login time, rendering some quests not startable until the mob levels up.
This commit is contained in:
@@ -139,28 +139,15 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void warpParty(int id, int portalId, int fromMinId, int fromMaxId) {
|
||||
for (MapleCharacter mc : getPartyMembers()) {
|
||||
if(mc.getMapId() >= fromMinId && mc.getMapId() <= fromMaxId) {
|
||||
mc.changeMap(id, portalId);
|
||||
for (MapleCharacter mc : this.getPlayer().getPartyMembersOnline()) {
|
||||
if (mc.isLoggedinWorld()) {
|
||||
if(mc.getMapId() >= fromMinId && mc.getMapId() <= fromMaxId) {
|
||||
mc.changeMap(id, portalId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapleCharacter> getPartyMembers() {
|
||||
if (getPlayer().getParty() == null) {
|
||||
return null;
|
||||
}
|
||||
List<MapleCharacter> chars = new LinkedList<>();
|
||||
for (Channel channel : Server.getInstance().getChannelsFromWorld(getPlayer().getWorld())) {
|
||||
for (MapleCharacter chr : channel.getPartyMembers(getPlayer().getParty())) {
|
||||
if (chr != null) {
|
||||
chars.add(chr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
|
||||
public MapleMap getWarpMap(int map) {
|
||||
return getPlayer().getWarpMap(map);
|
||||
}
|
||||
@@ -804,9 +791,14 @@ public class AbstractPlayerInteraction {
|
||||
removeAll(id);
|
||||
return;
|
||||
}
|
||||
for (MaplePartyCharacter chr : getParty().getMembers()) {
|
||||
if (chr != null && chr.isOnline() && chr.getPlayer().getClient() != null){
|
||||
removeAll(id, chr.getPlayer().getClient());
|
||||
for (MaplePartyCharacter mpc : getParty().getMembers()) {
|
||||
if (mpc == null || !mpc.isOnline()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MapleCharacter chr = mpc.getPlayer();
|
||||
if (chr != null && chr.getClient() != null){
|
||||
removeAll(id, chr.getClient());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -837,9 +829,14 @@ public class AbstractPlayerInteraction {
|
||||
|
||||
if(instance) {
|
||||
for(MaplePartyCharacter member: party.getMembers()) {
|
||||
if(member == null || !member.isOnline() || member.getPlayer().getEventInstance() == null){
|
||||
if(member == null || !member.isOnline()){
|
||||
size--;
|
||||
}
|
||||
} else {
|
||||
MapleCharacter chr = member.getPlayer();
|
||||
if(chr != null && chr.getEventInstance() == null) {
|
||||
size--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,6 +846,9 @@ public class AbstractPlayerInteraction {
|
||||
continue;
|
||||
}
|
||||
MapleCharacter player = member.getPlayer();
|
||||
if(player == null) {
|
||||
continue;
|
||||
}
|
||||
if(instance && player.getEventInstance() == null){
|
||||
continue; // They aren't in the instance, don't give EXP.
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import javax.script.*;
|
||||
|
||||
import constants.ServerConstants;
|
||||
import jdk.nashorn.api.scripting.NashornScriptEngine;
|
||||
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
|
||||
import tools.FilePrinter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package scripting.event;
|
||||
|
||||
import tools.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -39,7 +38,7 @@ import net.server.audit.locks.MonitoredReentrantReadWriteLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import server.MaplePortal;
|
||||
import server.maps.MaplePortal;
|
||||
import server.TimerManager;
|
||||
import server.MapleStatEffect;
|
||||
import server.expeditions.MapleExpedition;
|
||||
@@ -67,6 +66,7 @@ import server.ThreadManager;
|
||||
import server.life.MapleLifeFactory;
|
||||
import server.life.MapleNPC;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -366,9 +366,13 @@ public class EventInstanceManager {
|
||||
}
|
||||
|
||||
public void registerParty(MapleParty party, MapleMap map) {
|
||||
for (MaplePartyCharacter pc : party.getEligibleMembers()) {
|
||||
MapleCharacter c = map.getCharacterById(pc.getId());
|
||||
registerPlayer(c);
|
||||
for (MaplePartyCharacter mpc : party.getEligibleMembers()) {
|
||||
if (mpc.isOnline()) { // thanks resinate
|
||||
MapleCharacter chr = map.getCharacterById(mpc.getId());
|
||||
if (chr != null) {
|
||||
registerPlayer(chr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +472,7 @@ public class EventInstanceManager {
|
||||
} catch (ScriptException | NoSuchMethodException ex) {} // optional
|
||||
}
|
||||
|
||||
public synchronized void changedLeader(final MapleCharacter ldr) {
|
||||
public synchronized void changedLeader(final MaplePartyCharacter ldr) {
|
||||
try {
|
||||
invokeScriptFunction("changedLeader", EventInstanceManager.this, ldr);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
|
||||
@@ -759,7 +759,7 @@ public class EventManager {
|
||||
return(new ArrayList<>());
|
||||
}
|
||||
try {
|
||||
Object p = iv.invokeFunction("getEligibleParty", party.getPartyMembers());
|
||||
Object p = iv.invokeFunction("getEligibleParty", party.getPartyMembersOnline());
|
||||
|
||||
if(p != null) {
|
||||
List<MaplePartyCharacter> lmpc;
|
||||
|
||||
@@ -684,8 +684,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
map = cs.getMapFactory().getMap(980000100 + 100 * field);
|
||||
mapExit = cs.getMapFactory().getMap(980000000);
|
||||
for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) {
|
||||
final MapleCharacter mc;
|
||||
mc = ps.getCharacterById(mpc.getId());
|
||||
final MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.setChallenged(false);
|
||||
mc.changeMap(map, map.getPortal(0));
|
||||
@@ -780,11 +779,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
PlayerStorage ps = c.getChannelServer().getPlayerStorage();
|
||||
for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) {
|
||||
MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
mc.setMonsterCarnival(null);
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(null);
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||
MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
mc.setMonsterCarnival(null);
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(null);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
warpoutCPQLobby(lobbyMap);
|
||||
@@ -826,11 +829,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
PlayerStorage ps = c.getChannelServer().getPlayerStorage();
|
||||
for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) {
|
||||
MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
mc.setMonsterCarnival(null);
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(null);
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||
MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
mc.setMonsterCarnival(null);
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(null);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
warpoutCPQLobby(lobbyMap);
|
||||
@@ -905,8 +912,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
mapExit = cs.getMapFactory().getMap(980030000);
|
||||
map = cs.getMapFactory().getMap(980031000 + 1000 * field);
|
||||
for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) {
|
||||
final MapleCharacter mc;
|
||||
mc = ps.getCharacterById(mpc.getId());
|
||||
final MapleCharacter mc = ps.getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.setChallenged(false);
|
||||
mc.changeMap(map, map.getPortal(0));
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
import server.MaplePortal;
|
||||
import server.maps.MaplePortal;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
@@ -35,7 +35,7 @@ import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineFactory;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import server.MaplePortal;
|
||||
import server.maps.MaplePortal;
|
||||
import tools.FilePrinter;
|
||||
|
||||
public class PortalScriptManager {
|
||||
|
||||
Reference in New Issue
Block a user