Mob banish on touch + GMS-like cosmetics + Clear missing names

Fixed erroneous clean slate scroll block on equipments having certain properties.
Implemented a log for bought cash items from Cash Shop.
Implemented mob's player banish by touch (e. g. used by mobs from the Hypnotize quest).
Thoroughly revised stylist/surgeon NPCs, adding several missing GMS-like cosmetic contents.
Thoroughly revised String.wz names having missing item content throughout the WZ files.
Revised missing name info for several faces throughout the WZ files.
Solved a possible deadlock case related with a player vision's spawn object method.
Fixed an issue with "Movement allowed only within account" items being given as "Untradeable" by NPCs.

Happy Holidays and Great New Year everyone!!!
This commit is contained in:
ronancpl
2018-12-22 00:12:13 -02:00
parent a2b8f22e66
commit dc73cb00de
184 changed files with 12897 additions and 3647 deletions

View File

@@ -39,6 +39,7 @@ import server.CashShop.CashItem;
import server.CashShop.CashItemFactory;
import client.inventory.manipulator.MapleInventoryManipulator;
import constants.ServerConstants;
import server.MapleItemInformationProvider;
import tools.FilePrinter;
import tools.MaplePacketCreator;
import tools.Pair;
@@ -62,7 +63,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
final int useNX = slea.readInt();
final int snCS = slea.readInt();
CashItem cItem = CashItemFactory.getItem(snCS);
if (!canBuy(cItem, cs.getCash(useNX))) {
if (!canBuy(chr, cItem, cs.getCash(useNX))) {
FilePrinter.printError(FilePrinter.ITEM, "Denied to sell cash item with SN " + snCS); // preventing NPE here thanks to MedicOP
c.enableCSActions();
return;
@@ -98,7 +99,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
CashItem cItem = CashItemFactory.getItem(slea.readInt());
Map<String, String> recipient = MapleCharacter.getCharacterFromDatabase(slea.readMapleAsciiString());
String message = slea.readMapleAsciiString();
if (!canBuy(cItem, cs.getCash(4)) || message.length() < 1 || message.length() > 73) {
if (!canBuy(chr, cItem, cs.getCash(4)) || message.length() < 1 || message.length() > 73) {
c.enableCSActions();
return;
}
@@ -151,7 +152,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
} else {
CashItem cItem = CashItemFactory.getItem(slea.readInt());
int type = (cItem.getItemId() - 9110000) / 1000;
if (!canBuy(cItem, cs.getCash(cash))) {
if (!canBuy(chr, cItem, cs.getCash(cash))) {
c.enableCSActions();
return;
}
@@ -181,7 +182,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
} else {
CashItem cItem = CashItemFactory.getItem(slea.readInt());
if (!canBuy(cItem, cs.getCash(cash))) {
if (!canBuy(chr, cItem, cs.getCash(cash))) {
c.enableCSActions();
return;
}
@@ -199,7 +200,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
int cash = slea.readInt();
CashItem cItem = CashItemFactory.getItem(slea.readInt());
if (!canBuy(cItem, cs.getCash(cash))) {
if (!canBuy(chr, cItem, cs.getCash(cash))) {
c.enableCSActions();
return;
}
@@ -380,7 +381,12 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
return c.checkBirthDate(cal);
}
private static boolean canBuy(CashItem item, int cash) {
return item != null && item.isOnSale() && item.getPrice() <= cash;
private static boolean canBuy(MapleCharacter chr, CashItem item, int cash) {
if (item != null && item.isOnSale() && item.getPrice() <= cash) {
FilePrinter.print(FilePrinter.CASHITEM_BOUGHT, chr + " bought " + MapleItemInformationProvider.getInstance().getName(item.getItemId()) + " (SN " + item.getSN() + ") for " + item.getPrice());
return true;
} else {
return false;
}
}
}

View File

@@ -45,7 +45,10 @@ public final class ItemRewardHandler extends AbstractMaplePacketHandler {
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
byte slot = (byte) slea.readShort();
int itemId = slea.readInt(); // will load from xml I don't care.
if (c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot).getItemId() != itemId || c.getPlayer().getInventory(MapleInventoryType.USE).countById(itemId) < 1) return;
Item it = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot); // null check here thanks to Thora
if (it == null || it.getItemId() != itemId || c.getPlayer().getInventory(MapleInventoryType.USE).countById(itemId) < 1) return;
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
Pair<Integer, List<RewardItem>> rewards = ii.getItemReward(itemId);
for (RewardItem reward : rewards.getRight()) {

View File

@@ -0,0 +1,45 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2018 RonanLana
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.MapleCharacter;
import client.MapleClient;
import server.life.MapleMonster;
import server.life.MapleLifeFactory.BanishInfo;
import net.AbstractMaplePacketHandler;
import tools.data.input.SeekableLittleEndianAccessor;
public final class MobBanishPlayerHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int mobid = slea.readInt(); // mob banish handling detected thanks to MedicOP
MapleCharacter chr = c.getPlayer();
MapleMonster mob = chr.getMap().getMonsterById(mobid);
if (mob != null) {
BanishInfo banishInfo = mob.getBanish();
if (banishInfo != null) {
chr.changeMapBanish(banishInfo.getMap(), banishInfo.getPortal(), banishInfo.getMsg());
}
}
}
}

View File

@@ -1333,7 +1333,7 @@ public class World {
activePetsLock.lock();
try {
petUpdate = Server.getInstance().getCurrentTime();
deployedPets = Collections.unmodifiableMap(activePets);
deployedPets = new HashMap<>(activePets); // exception here found thanks to MedicOP
} finally {
activePetsLock.unlock();
}
@@ -1391,7 +1391,7 @@ public class World {
activeMountsLock.lock();
try {
mountUpdate = Server.getInstance().getCurrentTime();
deployedMounts = Collections.unmodifiableMap(activeMounts);
deployedMounts = new HashMap<>(activeMounts);
} finally {
activeMountsLock.unlock();
}