Unexpirable diseases & Holy Symbol patch

Fixed diseases becoming unexpirable after trying to change channels or entering the Cash Shop.
Fixed Holy Symbol acting oddly in solo scenario.
Adjusted Summon Sack lv. 9, that would try to spawn mobs with inexistent id on the field.
This commit is contained in:
ronancpl
2018-04-10 22:14:13 -03:00
parent 6da5edd837
commit 5d8ede3247
23 changed files with 818 additions and 751 deletions

View File

@@ -21,6 +21,7 @@
*/
package net.server;
import client.MapleDisease;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -31,11 +32,13 @@ import tools.locks.MonitoredReentrantLock;
/**
*
* @author Danny//changed to map :3
* @author Ronan//debuffs to storage as well
*/
public class PlayerBuffStorage {
private int id = (int) (Math.random() * 100);
private final Lock lock = new MonitoredReentrantLock(MonitoredLockType.BUFF_STORAGE, true);
private Map<Integer, List<PlayerBuffValueHolder>> buffs = new HashMap<>();
private Map<Integer, Map<MapleDisease, Long>> diseases = new HashMap<>();
public void addBuffsToStorage(int chrid, List<PlayerBuffValueHolder> toStore) {
lock.lock();
@@ -52,7 +55,25 @@ public class PlayerBuffStorage {
return buffs.remove(chrid);
} finally {
lock.unlock();
}
}
}
public void addDiseasesToStorage(int chrid, Map<MapleDisease, Long> toStore) {
lock.lock();
try {
diseases.put(chrid, toStore);
} finally {
lock.unlock();
}
}
public Map<MapleDisease, Long> getDiseasesFromStorage(int chrid) {
lock.lock();
try {
return diseases.remove(chrid);
} finally {
lock.unlock();
}
}
@Override

View File

@@ -252,11 +252,11 @@ public final class DueyHandler extends AbstractMaplePacketHandler {
}
}
private void addMesoToDB(int mesos, String sName, int recipientID) {
private static void addMesoToDB(int mesos, String sName, int recipientID) {
addItemToDB(null, 1, mesos, sName, recipientID);
}
private void addItemToDB(Item item, int quantity, int mesos, String sName, int recipientID) {
public static void addItemToDB(Item item, int quantity, int mesos, String sName, int recipientID) {
Connection con = null;
try {
con = DatabaseConnection.getConnection();
@@ -344,7 +344,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler {
}
}
private String getCurrentDate() {
private static String getCurrentDate() {
String date = "";
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DATE) - 1; // instant duey ?
@@ -373,7 +373,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler {
return fee;
}
private void removeItemFromDB(int packageid) {
private static void removeItemFromDB(int packageid) {
Connection con = null;
try {
con = DatabaseConnection.getConnection();

View File

@@ -59,8 +59,10 @@ public class EnterCashShopHandler extends AbstractMaplePacketHandler {
mc.unregisterChairBuff();
Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(mc.getId(), mc.getAllBuffs());
Server.getInstance().getPlayerBuffStorage().addDiseasesToStorage(mc.getId(), mc.getAllDiseases());
mc.setAwayFromWorld(true);
mc.cancelAllBuffs(true);
mc.cancelAllDebuffs();
mc.cancelBuffExpireTask();
mc.cancelDiseaseExpireTask();
mc.cancelSkillCooldownTask();

View File

@@ -68,8 +68,10 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
chr.unregisterChairBuff();
Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(chr.getId(), chr.getAllBuffs());
Server.getInstance().getPlayerBuffStorage().addDiseasesToStorage(chr.getId(), chr.getAllDiseases());
chr.setAwayFromWorld(true);
chr.cancelAllBuffs(true);
chr.cancelAllDebuffs();
chr.cancelBuffExpireTask();
chr.cancelDiseaseExpireTask();
chr.cancelSkillCooldownTask();

View File

@@ -46,6 +46,7 @@ import client.BuddylistEntry;
import client.CharacterNameAndId;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleDisease;
import client.MapleFamily;
import client.SkillFactory;
import client.inventory.MapleInventoryType;
@@ -54,6 +55,7 @@ import constants.GameConstants;
import constants.ServerConstants;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
@@ -115,6 +117,11 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
player.silentGiveBuffs(timedBuffs);
}
Map<MapleDisease, Long> diseases = server.getPlayerBuffStorage().getDiseasesFromStorage(cid);
if (diseases != null) {
player.silentApplyDiseases(diseases);
}
c.announce(MaplePacketCreator.getCharInfo(player));
if (!player.isHidden()) {
player.toggleHide(true);

View File

@@ -30,6 +30,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
* @author Lerk
*/
public final class ReactorHitHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
//System.out.println(slea); //To see if there are any differences with packets
//CD 00 6B 00 00 00 01 00 00 00 03 00 00 00 20 03 F7 03 00 00