Buff System & Map skipping fix + properly disposing Storage + Fairness to locks

Fixed buff system behaving oddly if a buff has value zero, that would render some skills "broken".
Fixed players skipping maps when trying to access portals while under a poor Internet connection.
Fixed storage not disposing players properly in cases where the players does not meet the storage conditions.
Set some locks to use fairness strategy when dealing with atomic code, in order to make the calls to it properly synchronized.
Fixed Aran introductory questline stucking players when certain conditions were met.
Added drop data for some mob versions of Fairy, Yeti and Pepe.
This commit is contained in:
ronancpl
2017-10-29 16:02:50 -02:00
parent 5f1abf3fb3
commit 44949aea37
119 changed files with 760 additions and 32399 deletions

View File

@@ -90,11 +90,11 @@ public final class Channel {
private Map<Integer, Integer> dojoParty = new HashMap<>();
private Map<Integer, MapleMiniDungeon> dungeons = new HashMap<>();
private ReentrantReadWriteLock merchant_lock = new ReentrantReadWriteLock(true);
private ReadLock merchRlock = merchant_lock.readLock();
private WriteLock merchWlock = merchant_lock.writeLock();
private ReentrantReadWriteLock merchantLock = new ReentrantReadWriteLock(true);
private ReadLock merchRlock = merchantLock.readLock();
private WriteLock merchWlock = merchantLock.writeLock();
private Lock lock = new ReentrantLock();
private Lock lock = new ReentrantLock(true);
public Channel(final int world, final int channel) {
this.world = world;

View File

@@ -41,7 +41,8 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleCharacter chr = c.getPlayer();
if (chr.isBanned()) {
if (chr.isChangingMaps() || chr.isBanned()) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (chr.getTrade() != null) {

View File

@@ -31,20 +31,21 @@ import tools.data.input.SeekableLittleEndianAccessor;
public final class ChangeMapSpecialHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
slea.readByte();
String startwp = slea.readMapleAsciiString();
slea.readShort();
MaplePortal portal = c.getPlayer().getMap().getPortal(startwp);
if (portal == null || c.getPlayer().portalDelay() > System.currentTimeMillis() || c.getPlayer().getBlockedPortals().contains(portal.getScriptName())) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (c.getPlayer().isBanned()) {
return;
}
if (c.getPlayer().getTrade() != null) {
MapleTrade.cancelTrade(c.getPlayer());
}
portal.enterPortal(c);
slea.readByte();
String startwp = slea.readMapleAsciiString();
slea.readShort();
MaplePortal portal = c.getPlayer().getMap().getPortal(startwp);
if (portal == null || c.getPlayer().portalDelay() > System.currentTimeMillis() || c.getPlayer().getBlockedPortals().contains(portal.getScriptName())) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (c.getPlayer().isChangingMaps() || c.getPlayer().isBanned()) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (c.getPlayer().getTrade() != null) {
MapleTrade.cancelTrade(c.getPlayer());
}
portal.enterPortal(c);
}
}

View File

@@ -229,11 +229,10 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
} else if (!merchant.isOpen()) {
c.announce(MaplePacketCreator.hiredMerchantMaintenanceMessage());
return;
} else if (merchant.getFreeSlotThreadsafe() == -1) {
} else if (!merchant.addVisitor(c.getPlayer())) {
chr.dropMessage(1, "This shop has reached it's maximum capacity, please come by later.");
return;
} else {
merchant.addVisitor(c.getPlayer());
c.announce(MaplePacketCreator.getHiredMerchant(c.getPlayer(), merchant, false));
}
chr.setHiredMerchant(merchant);

View File

@@ -0,0 +1,34 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.channel.handlers;
import client.MapleClient;
import net.AbstractMaplePacketHandler;
import tools.data.input.SeekableLittleEndianAccessor;
public final class PlayerUpdateHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
c.getPlayer().setMapTransitionComplete();
}
}

View File

@@ -51,6 +51,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
if (chr.getLevel() < 15){
chr.message("You may only use the storage once you have reached level 15.");
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mode == 4) { // take out
@@ -103,6 +104,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
return;
}
if (quantity < 1 || chr.getItemQuantity(itemId, false) < quantity) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (storage.isFull()) {
@@ -139,11 +141,13 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
if (meso < 0 && (storageMesos - meso) < 0) {
meso = -2147483648 + storageMesos;
if (meso < playerMesos) {
c.announce(MaplePacketCreator.enableActions());
return;
}
} else if (meso > 0 && (playerMesos + meso) < 0) {
meso = 2147483647 - playerMesos;
if (meso > storageMesos) {
c.announce(MaplePacketCreator.enableActions());
return;
}
}
@@ -151,6 +155,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
chr.gainMeso(meso, false, true, false);
FilePrinter.print(FilePrinter.STORAGE + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + (meso > 0 ? " took out " : " stored ") + Math.abs(meso) + " mesos\r\n");
} else {
c.announce(MaplePacketCreator.enableActions());
return;
}
storage.sendMeso(c);