Mob aggro overhaul + STR-DEX autoassign patch + Guild & Pl. Store fix

Reviewed Monster Magnet skill effect on mobs, now properly showing up to other players.
Reworked concurrency protection on login handler, now properly synchronizing requests for the same accountId.
Reviewed an expedition issue with attempting to send packets on loggedoff players. Expeditions no longer holds a character object list of its own, rather finding players through their id on the world storage.
Added stat requirement definition as first message on 1st job NPCs.
Fixed an issue with area triggered NPC conversations not getting properly disposed.
Reviewed "launch.bat", internally referencing Java7 engine. Assuming it has been installed in the default directory on the system, it's no longer necessary to set precedence on PATH for it.
Fixed need for "reapproval from the 3rd job instructors" to attempt Zakum once more.
Reviewed goto command. Non-GM's no longer has access to area maps, only towns.
Implemented a new server flag for enforcing base rates (server rate: 1x) on players level 10 or lower.
Fixed player guild tooltips not being properly marshalled to others on the map, at the event of several guild actions.
Reviewed event system allowing creation of same-name events, potentially leading to null EIM problems.
Refactored some locks on MapleCharacter, potentially solving a deadlock case within expiring/forfeiting quest methods.
Implemented a major overhaul on mob aggro system, now updating player aggro in real-time based on their latest DPS. Properly refactored and encapsulated aggro mechanics.
Fixed NPE on disposing events with alive mobs.
Added server-side birthday check handling when opening player shops or merchants having cash items in store.
Fixed player shop tooltip not finishing properly when shop owner closes store with visitors still in there.
Fixed forceChangeMap method not warping players to the designated event map (rather sending them to the starting event map).
Reviewed "summon" command, now using forceChangeMap, also changing channels if needed.
Reworked HeavenMS autoassigner: STR-based classes now ups a bit more DEX than before, since its a vital attribute for accuracy on their actions.
Added meso ceil check on player transactions. Trades now gets suspended if the max amount is reached.
Implemented server-side item limit check on player shops and merchants.
Fixed an exploit with merchants, on where players would be able to save the selling item on DB before taking from inventory.
This commit is contained in:
ronancpl
2019-01-31 00:49:15 -02:00
parent 98be29b088
commit efc8884e19
101 changed files with 17235 additions and 16461 deletions

View File

@@ -237,6 +237,15 @@ public class AbstractPlayerInteraction {
return intList;
}
public boolean canHoldAll(List<Double> itemids) {
List<Double> quantity = new LinkedList<>();
for (int i = 0; i < itemids.size(); i++) {
quantity.add(1.0);
}
return canHoldAll(itemids, quantity);
}
public boolean canHoldAll(List<Double> itemids, List<Double> quantity) {
return canHoldAll(convertToIntegerArray(itemids), convertToIntegerArray(quantity), true);
}
@@ -554,8 +563,6 @@ public class AbstractPlayerInteraction {
if(expires >= 0)
item.setExpiration(System.currentTimeMillis() + expires);
item.setPetId(petId);
if (!MapleInventoryManipulator.checkSpace(c, id, quantity, "")) {
c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + ItemConstants.getInventoryType(id).name() + " inventory.");

View File

@@ -229,7 +229,11 @@ public class EventInstanceManager {
}
public synchronized void registerPlayer(final MapleCharacter chr) {
public synchronized void registerPlayer(final MapleCharacter chr) {
registerPlayer(chr, true);
}
public synchronized void registerPlayer(final MapleCharacter chr, boolean runEntryScript) {
if (chr == null || !chr.isLoggedinWorld() || disposed) {
return;
}
@@ -246,10 +250,12 @@ public class EventInstanceManager {
wL.unlock();
}
try {
em.getIv().invokeFunction("playerEntry", EventInstanceManager.this, chr);
} catch (ScriptException | NoSuchMethodException ex) {
ex.printStackTrace();
if (runEntryScript) {
try {
em.getIv().invokeFunction("playerEntry", EventInstanceManager.this, chr);
} catch (ScriptException | NoSuchMethodException ex) {
ex.printStackTrace();
}
}
}
@@ -372,7 +378,7 @@ public class EventInstanceManager {
private void registerExpeditionTeam(MapleExpedition exped, int recruitMap) {
expedition = exped;
for (MapleCharacter chr: exped.getMembers()) {
for (MapleCharacter chr: exped.getActiveMembers()) {
if (chr.getMapId() == recruitMap) {
registerPlayer(chr);
}
@@ -628,7 +634,6 @@ public class EventInstanceManager {
sL.lock();
try {
if(!eventCleared) em.disposeInstance(name);
em = null;
} finally {
sL.unlock();
}
@@ -636,10 +641,11 @@ public class EventInstanceManager {
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
mapFactory.dispose(); // reactors issue on dispose event maps found thanks to MedicOP
mapFactory.dispose(); // issues from instantly disposing some event objects found thanks to MedicOP
wL.lock();
try {
mapFactory = null;
em = null;
} finally {
wL.unlock();
}
@@ -675,7 +681,6 @@ public class EventInstanceManager {
@Override
public void run() {
try {
if(em == null) return;
em.getIv().invokeFunction(methodName, EventInstanceManager.this);
} catch (ScriptException | NoSuchMethodException ex) {
ex.printStackTrace();

View File

@@ -22,7 +22,6 @@
package scripting.event;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -116,13 +115,16 @@ public class EventManager {
ex.printStackTrace();
}
Collection<EventInstanceManager> eimList;
synchronized(instances) {
for(EventInstanceManager eim : instances.values()) {
eim.dispose(true);
}
eimList = getInstances();
instances.clear();
}
for(EventInstanceManager eim : eimList) {
eim.dispose(true);
}
List<EventInstanceManager> readyEims;
queueLock.lock();
try {
@@ -253,7 +255,9 @@ public class EventManager {
}
public Collection<EventInstanceManager> getInstances() {
return Collections.unmodifiableCollection(instances.values());
synchronized (instances) {
return new LinkedList<>(instances.values());
}
}
public EventInstanceManager newInstance(String name) {
@@ -265,7 +269,13 @@ public class EventManager {
ret.setName(name);
}
instances.put(name, ret);
synchronized (instances) {
if (instances.containsKey(name)) {
return null;
}
instances.put(name, ret);
}
return ret;
}
@@ -274,7 +284,10 @@ public class EventManager {
@Override
public void run() {
freeLobbyInstance(name);
instances.remove(name);
synchronized (instances) {
instances.remove(name);
}
}
}, ServerConstants.EVENT_LOBBY_DELAY * 1000);
}
@@ -379,14 +392,17 @@ public class EventManager {
if(!startLobbyInstance(lobbyId)) return false;
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", leader.getClient().getChannel()));
if(eim == null) {
EventInstanceManager eim;
try {
eim = (EventInstanceManager) (iv.invokeFunction("setup", leader.getClient().getChannel()));
instanceLocks.put(eim.getName(), lobbyId);
} catch (NullPointerException npe) {
if(lobbyId > -1) {
setLockLobby(lobbyId, false);
}
return false;
}
instanceLocks.put(eim.getName(), lobbyId);
eim.setLeader(leader);
exped.start();
@@ -442,14 +458,16 @@ public class EventManager {
}
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, (lobbyId > -1) ? lobbyId : leader.getId()));
if(eim == null) {
EventInstanceManager eim;
try {
eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, (lobbyId > -1) ? lobbyId : leader.getId()));
instanceLocks.put(eim.getName(), lobbyId);
} catch (NullPointerException npe) {
if(lobbyId > -1) {
setLockLobby(lobbyId, false);
}
return false;
}
instanceLocks.put(eim.getName(), lobbyId);
eim.setLeader(leader);
if(chr != null) eim.registerPlayer(chr);
@@ -500,14 +518,17 @@ public class EventManager {
if(!startLobbyInstance(lobbyId)) return false;
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
if(eim == null) {
EventInstanceManager eim;
try {
eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
instanceLocks.put(eim.getName(), lobbyId);
} catch (NullPointerException npe) {
if(lobbyId > -1) {
setLockLobby(lobbyId, false);
}
return false;
}
instanceLocks.put(eim.getName(), lobbyId);
eim.setLeader(leader);
eim.registerParty(party, map);
@@ -559,14 +580,17 @@ public class EventManager {
if(!startLobbyInstance(lobbyId)) return false;
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, (lobbyId > -1) ? lobbyId : party.getLeaderId()));
if(eim == null) {
EventInstanceManager eim;
try {
eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, (lobbyId > -1) ? lobbyId : party.getLeaderId()));
instanceLocks.put(eim.getName(), lobbyId);
} catch (NullPointerException npe) {
if(lobbyId > -1) {
setLockLobby(lobbyId, false);
}
return false;
}
instanceLocks.put(eim.getName(), lobbyId);
eim.setLeader(leader);
eim.registerParty(party, map);

View File

@@ -100,6 +100,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
public void dispose() {
NPCScriptManager.getInstance().dispose(this);
getClient().announce(MaplePacketCreator.enableActions());
}
public void sendNext(String text) {