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:
ronancpl
2019-10-29 01:48:58 -03:00
parent 54cdba01ae
commit 7d8d4691da
80 changed files with 944 additions and 496 deletions

View File

@@ -64,7 +64,6 @@ import org.apache.mina.core.session.IoSession;
import client.inventory.MapleInventoryType;
import constants.game.GameConstants;
import constants.net.ServerConstants;
import scripting.AbstractPlayerInteraction;
import scripting.event.EventInstanceManager;
import scripting.event.EventManager;
@@ -120,7 +119,8 @@ public class MapleClient {
private final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT, true);
private final Lock encoderLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT_ENCODER, true);
private final Lock announcerLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT_ANNOUNCER, true);
private static final Lock loginLocks[] = new Lock[200]; // thanks Masterrulax & try2hack for pointing out a bottleneck issue here
private static final int lockCount = 200;
private static final Lock loginLocks[] = new Lock[lockCount]; // thanks Masterrulax & try2hack for pointing out a bottleneck issue here
private Calendar tempBanCalendar;
private int votePoints;
private int voteTime = -1;
@@ -131,7 +131,7 @@ public class MapleClient {
private int lang = 0;
static {
for (int i = 0; i < 200; i++) {
for (int i = 0; i < lockCount; i++) {
loginLocks[i] = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT_LOGIN, true);
}
}
@@ -454,14 +454,14 @@ public class MapleClient {
}
public int finishLogin() {
Lock loginLock = loginLocks[this.getAccID() % 200];
Lock loginLock = loginLocks[this.getAccID() % lockCount];
loginLock.lock();
try {
if (getLoginState() > LOGIN_NOTLOGGEDIN) { // 0 = LOGIN_NOTLOGGEDIN, 1= LOGIN_SERVER_TRANSITION, 2 = LOGIN_LOGGEDIN
loggedIn = false;
return 7;
}
updateLoginState(LOGIN_LOGGEDIN);
updateLoginState(MapleClient.LOGIN_LOGGEDIN);
} finally {
loginLock.unlock();
}
@@ -851,7 +851,7 @@ public class MapleClient {
if (rs.getTimestamp("lastlogin").getTime() + 30000 < Server.getInstance().getCurrentTime()) {
int accountId = accId;
state = LOGIN_NOTLOGGEDIN;
updateLoginState(LOGIN_NOTLOGGEDIN); // ACCID = 0, issue found thanks to Tochi & K u ssss o & Thora & Omo Oppa
updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); // ACCID = 0, issue found thanks to Tochi & K u ssss o & Thora & Omo Oppa
this.setAccID(accountId);
}
}
@@ -1231,6 +1231,22 @@ public class MapleClient {
}
return disconnectForBeingAFaggot;
}
public void checkChar(int accid) { /// issue with multiple chars from same account login found by shavit, resinate
if (true) {
return;
}
for (World w : Server.getInstance().getWorlds()) {
for (MapleCharacter chr : w.getPlayerStorage().getAllCharacters()) {
if (accid == chr.getAccountID()) {
FilePrinter.print(FilePrinter.EXPLOITS, "Player: " + chr.getName() + " has been removed from " + GameConstants.WORLD_NAMES[w.getId()] + ". Possible Dupe attempt.");
chr.getClient().forceDisconnect();
w.getPlayerStorage().removePlayer(chr.getId());
}
}
}
}
public int getVotePoints(){
int points = 0;