Reactor Loot + Obstacles damage mob + Static calls from scripts
Revised starting AP, now working out with flags. To supply the 9AP shortage of 4/4/4/4, two options: one giving out 9 AP from the start, other giving 4/5 AP when changing jobs (1st, 2nd). This change would also work with the autoassign for beginners flag. Refactored several quest scripts, that would be glitching the player when doing quest start/complete and disposing under the same script status. Cleared some cases with the quest reward system where it would call out a "full inventory" even though new inventory slots could get discovered when doing the quest loot transaction. Fixed an issue with player stores being deployed overlapping in a few scenarios. Fixed reduced EXP gain from kills when triggering skill Mortal Blow. Added "open Duey" functionality when clicking "O" in the incoming package notification. Fixed packages without messages (a quirk from quick delivery) not accounting visually as a "quick" one. Fixed certain mounts (non-item skill mounts, such as Yeti or Spaceship) not showing up properly to other players when changing maps. Added handler for mob damage by environment objects (OrbisPQ jail storage area). Added a placeholder on mob's stolen items to prevent more steals to be placed as soon as the Steal mechanism is triggered. Patched boss logs not removing recent entries from the DB tables (the reset method is actually supposed to clear every entry). Revised a possible memory leak scenario happening due to an exception thrown midway monster kill method. Improved reactor drops, now placing loots visible for the acting player centered (similar as to how mob loots work). Refactored several issues in scripts, related to accessing static Java methods through an object, that would start appearing after transitioning to Java 8.
This commit is contained in:
@@ -245,6 +245,7 @@ public final class PacketProcessor {
|
||||
registerHandler(RecvOpcode.PLAYER_MAP_TRANSFER, new PlayerMapTransitionHandler());
|
||||
registerHandler(RecvOpcode.USE_MAPLELIFE, new UseMapleLifeHandler());
|
||||
registerHandler(RecvOpcode.USE_CATCH_ITEM, new UseCatchItemHandler());
|
||||
registerHandler(RecvOpcode.FIELD_DAMAGE_MOB, new FieldDamageMobHandler());
|
||||
registerHandler(RecvOpcode.MOB_DAMAGE_MOB_FRIENDLY, new MobDamageMobFriendlyHandler());
|
||||
registerHandler(RecvOpcode.PARTY_SEARCH_REGISTER, new PartySearchRegisterHandler());
|
||||
registerHandler(RecvOpcode.PARTY_SEARCH_START, new PartySearchStartHandler());
|
||||
|
||||
@@ -170,6 +170,7 @@ public enum RecvOpcode {
|
||||
MOVE_DRAGON(0xB5),
|
||||
MOVE_LIFE(0xBC),
|
||||
AUTO_AGGRO(0xBD),
|
||||
FIELD_DAMAGE_MOB(0xBF),
|
||||
MOB_DAMAGE_MOB_FRIENDLY(0xC0),
|
||||
MONSTER_BOMB(0xC1),
|
||||
MOB_DAMAGE_MOB(0xC2),
|
||||
|
||||
@@ -1868,12 +1868,12 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
resetServerWorlds();
|
||||
|
||||
ThreadManager.getInstance().stop();
|
||||
TimerManager.getInstance().purge();
|
||||
TimerManager.getInstance().stop();
|
||||
|
||||
|
||||
resetServerWorlds();
|
||||
|
||||
System.out.println("Worlds + Channels are offline.");
|
||||
acceptor.unbind();
|
||||
acceptor = null;
|
||||
|
||||
@@ -321,8 +321,9 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
|
||||
Skill steal = SkillFactory.getSkill(Bandit.STEAL);
|
||||
if (monster.getStolen().size() < 1) { // One steal per mob <3
|
||||
if (steal.getEffect(player.getSkillLevel(steal)).makeChanceResult()) {
|
||||
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
|
||||
monster.addStolen(0);
|
||||
|
||||
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
|
||||
List<Integer> dropPool = mi.retrieveDropPool(monster.getId());
|
||||
if(!dropPool.isEmpty()) {
|
||||
Integer rndPool = (int) Math.floor(Math.random() * dropPool.get(dropPool.size() - 1));
|
||||
@@ -441,11 +442,13 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
|
||||
} else {
|
||||
mortalBlow = SkillFactory.getSkill(Sniper.MORTAL_BLOW);
|
||||
}
|
||||
if (player.getSkillLevel(mortalBlow) > 0) {
|
||||
MapleStatEffect mortal = mortalBlow.getEffect(player.getSkillLevel(mortalBlow));
|
||||
|
||||
int skillLevel = player.getSkillLevel(mortalBlow);
|
||||
if (skillLevel > 0) {
|
||||
MapleStatEffect mortal = mortalBlow.getEffect(skillLevel);
|
||||
if (monster.getHp() <= (monster.getStats().getHp() * mortal.getX()) / 100) {
|
||||
if (Randomizer.rand(1, 100) <= mortal.getY()) {
|
||||
monster.getMap().killMonster(monster, player, true);
|
||||
map.damageMonster(player, monster, Integer.MAX_VALUE); // thanks Conrad for noticing reduced EXP gain from skill kill
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,10 @@ public class CashShopSurpriseHandler extends AbstractMaplePacketHandler {
|
||||
Pair<Item, Item> cssResult = cs.openCashShopSurprise();
|
||||
|
||||
if(cssResult != null) {
|
||||
//Item cssItem = cssResult.getLeft(), cssBox = cssResult.getRight();
|
||||
//c.announce(MaplePacketCreator.onCashGachaponOpenSuccess(c.getAccID(), cssBox.getSN(), cssBox.getQuantity(), cssItem, cssItem.getItemId(), cssItem.getQuantity(), true));
|
||||
c.announce(MaplePacketCreator.showCashShopMessage((byte) 0xA4));
|
||||
Item cssItem = cssResult.getLeft(), cssBox = cssResult.getRight();
|
||||
c.announce(MaplePacketCreator.onCashGachaponOpenSuccess(c.getAccID(), cssBox.getSN(), cssBox.getQuantity(), cssItem, cssItem.getItemId(), cssItem.getQuantity(), true));
|
||||
} else {
|
||||
//c.announce(MaplePacketCreator.onCashItemGachaponOpenFailed());
|
||||
c.announce(MaplePacketCreator.showCashShopMessage((byte) 0x00));
|
||||
c.announce(MaplePacketCreator.onCashItemGachaponOpenFailed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,16 +37,18 @@ public final class DueyHandler extends AbstractMaplePacketHandler {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
byte operation = slea.readByte();
|
||||
if (operation == DueyProcessor.Actions.TOSERVER_SEND_ITEM.getCode()) {
|
||||
if (operation == DueyProcessor.Actions.TOSERVER_RECV_ITEM.getCode()) { // on click 'O' Button, thanks inhyuk
|
||||
DueyProcessor.dueySendTalk(c, false);
|
||||
} else if (operation == DueyProcessor.Actions.TOSERVER_SEND_ITEM.getCode()) {
|
||||
byte inventId = slea.readByte();
|
||||
short itemPos = slea.readShort();
|
||||
short amount = slea.readShort();
|
||||
int mesos = slea.readInt();
|
||||
String recipient = slea.readMapleAsciiString();
|
||||
boolean quick = slea.readByte() != 0;
|
||||
String message = quick ? slea.readMapleAsciiString() : "";
|
||||
String message = quick ? slea.readMapleAsciiString() : null;
|
||||
|
||||
DueyProcessor.dueySendItem(c, inventId, itemPos, amount, mesos, message, recipient, quick);
|
||||
} else if (operation == DueyProcessor.Actions.TOSERVER_REMOVE_PACKAGE.getCode()) {
|
||||
|
||||
59
src/net/server/channel/handlers/FieldDamageMobHandler.java
Normal file
59
src/net/server/channel/handlers/FieldDamageMobHandler.java
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
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 constants.GameConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MapleMonsterInformationProvider;
|
||||
import server.maps.MapleMap;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
public class FieldDamageMobHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
int mobOid = slea.readInt(); // packet structure found thanks to Darter (Rajan)
|
||||
int dmg = slea.readInt();
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleMap map = chr.getMap();
|
||||
|
||||
if (map.getEnvironment().isEmpty()) { // no environment objects activated to actually hit the mob
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to use an obstacle on mapid " + map.getId() + " to attack.");
|
||||
return;
|
||||
}
|
||||
|
||||
MapleMonster mob = map.getMonsterByOid(mobOid);
|
||||
if (mob != null) {
|
||||
if (dmg < 0 || dmg > GameConstants.MAX_FIELD_MOB_DAMAGE) {
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to use an obstacle on mapid " + map.getId() + " to attack " + MapleMonsterInformationProvider.getInstance().getMobNameFromId(mob.getId()) + " with damage " + dmg);
|
||||
return;
|
||||
}
|
||||
|
||||
map.broadcastMessage(chr, MaplePacketCreator.damageMonster(mobOid, dmg), true);
|
||||
map.damageMonster(chr, mob, dmg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,9 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.autoban.AutobanManager;
|
||||
import constants.GameConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import server.maps.MapleMapFactory;
|
||||
import server.maps.MapleMap;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
@@ -47,7 +46,8 @@ public final class HealOvertimeHandler extends AbstractMaplePacketHandler {
|
||||
abm.setTimestamp(8, timestamp, 28); // thanks Vcoc & Thora for pointing out d/c happening here
|
||||
if ((abm.getLastSpam(0) + 1500) > timestamp) AutobanFactory.FAST_HP_HEALING.addPoint(abm, "Fast hp healing");
|
||||
|
||||
int abHeal = (int)(77 * MapleMapFactory.getMapRecoveryRate(chr.getMapId()) * 1.5); // thanks Ari for noticing players not getting healed in sauna in certain cases
|
||||
MapleMap map = chr.getMap();
|
||||
int abHeal = (int)(77 * map.getRecovery() * 1.5); // thanks Ari for noticing players not getting healed in sauna in certain cases
|
||||
if (healHP > abHeal) {
|
||||
AutobanFactory.HIGH_HP_HEALING.autoban(chr, "Healing: " + healHP + "; Max is " + abHeal + ".");
|
||||
return;
|
||||
@@ -60,7 +60,10 @@ public final class HealOvertimeHandler extends AbstractMaplePacketHandler {
|
||||
short healMP = slea.readShort();
|
||||
if (healMP != 0 && healMP < 1000) {
|
||||
abm.setTimestamp(9, timestamp, 28);
|
||||
if ((abm.getLastSpam(1) + 1500) > timestamp) AutobanFactory.FAST_MP_HEALING.addPoint(abm, "Fast mp healing");
|
||||
if ((abm.getLastSpam(1) + 1500) > timestamp) {
|
||||
AutobanFactory.FAST_MP_HEALING.addPoint(abm, "Fast mp healing");
|
||||
return; // thanks resinate for noticing mp being gained even after detection
|
||||
}
|
||||
chr.addMP(healMP);
|
||||
abm.spam(1, timestamp);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,12 @@ import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import client.MapleClient;
|
||||
import constants.GameConstants;
|
||||
import java.awt.Point;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.MaplePortal;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MaplePlayerShop;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
@@ -40,7 +44,34 @@ public final class HiredMerchantRequest extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if (chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapleMapObjectType.HIRED_MERCHANT)).isEmpty() && (GameConstants.isFreeMarketRoom(chr.getMapId()))) {
|
||||
|
||||
try {
|
||||
for (MapleMapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
if (mmo instanceof MapleCharacter) {
|
||||
MapleCharacter mc = (MapleCharacter) mmo;
|
||||
|
||||
MaplePlayerShop shop = mc.getPlayerShop();
|
||||
if (shop != null && shop.isOwner(mc)) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Point cpos = chr.getPosition();
|
||||
MaplePortal portal = chr.getMap().findClosestTeleportPortal(cpos);
|
||||
if (portal != null && portal.getPosition().distance(cpos) < 120.0) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(10));
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (GameConstants.isFreeMarketRoom(chr.getMapId())) {
|
||||
if (!chr.hasMerchant()) {
|
||||
try {
|
||||
if (ItemFactory.MERCHANT.loadItems(chr.getId(), false).isEmpty() && chr.getMerchantMeso() == 0) {
|
||||
|
||||
@@ -30,6 +30,10 @@ import tools.data.output.MaplePacketLittleEndianWriter;
|
||||
public final class NPCAnimationHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (c.getPlayer().isChangingMaps()) { // possible cause of error 38 in some map transition scenarios, thanks Arnah
|
||||
return;
|
||||
}
|
||||
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
int length = (int) slea.available();
|
||||
if (length == 6) { // NPC Talk
|
||||
|
||||
@@ -34,11 +34,13 @@ import constants.ServerConstants;
|
||||
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MaplePortal;
|
||||
import server.MapleTrade;
|
||||
import constants.GameConstants;
|
||||
import server.maps.FieldLimit;
|
||||
import server.maps.MapleHiredMerchant;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapleMiniGame;
|
||||
import server.maps.MapleMiniGame.MiniGameType;
|
||||
import server.maps.MaplePlayerShop;
|
||||
@@ -49,6 +51,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -237,13 +240,9 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Point cpos = chr.getPosition();
|
||||
if (chr.getMap().findClosestWarpPortal(cpos).getPosition().distance(cpos) < 120.0) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(10));
|
||||
return;
|
||||
}
|
||||
} catch (NullPointerException npe) {}
|
||||
if (!canPlaceStore(chr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String desc = slea.readMapleAsciiString();
|
||||
slea.skip(3);
|
||||
@@ -362,6 +361,10 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
c.announce(MaplePacketCreator.hiredMerchantOwnerMaintenanceLeave());
|
||||
}
|
||||
|
||||
if (!canPlaceStore(chr)) { // thanks Ari for noticing player shops overlapping on opening time
|
||||
return;
|
||||
}
|
||||
|
||||
MaplePlayerShop shop = chr.getPlayerShop();
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
@@ -797,4 +800,37 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean canPlaceStore(MapleCharacter chr) {
|
||||
try {
|
||||
for (MapleMapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
if (mmo instanceof MapleCharacter) {
|
||||
MapleCharacter mc = (MapleCharacter) mmo;
|
||||
if (mc.getId() == chr.getId()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MaplePlayerShop shop = mc.getPlayerShop();
|
||||
if (shop != null && shop.isOwner(mc)) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Point cpos = chr.getPosition();
|
||||
MaplePortal portal = chr.getMap().findClosestTeleportPortal(cpos);
|
||||
if (portal != null && portal.getPosition().distance(cpos) < 120.0) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(10));
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter.DelayedQuestUpdate;
|
||||
import client.MapleClient;
|
||||
import client.MapleQuestStatus;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,7 @@ public class RaiseUIStateHandler extends AbstractMaplePacketHandler {
|
||||
quest.forceStart(c.getPlayer(), 22000);
|
||||
c.getPlayer().updateQuestInfo(quest.getId(), "0");
|
||||
} else if (mqs.getStatus() == MapleQuestStatus.Status.STARTED) {
|
||||
c.announce(MaplePacketCreator.updateQuest(mqs, false));
|
||||
c.getPlayer().announceUpdateQuest(DelayedQuestUpdate.UPDATE, mqs, false);
|
||||
} else {
|
||||
//c.announce(MaplePacketCreator.updateQuestInfo(mqs.getQuestID(), 22000, "0"));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.server.worker;
|
||||
|
||||
import net.server.PlayerStorage;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import server.maps.MapleMapManager;
|
||||
|
||||
/**
|
||||
* @author Resinate
|
||||
@@ -11,8 +13,14 @@ public class RespawnWorker implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Channel ch : Server.getInstance().getAllChannels()) {
|
||||
if (!ch.getPlayerStorage().getAllCharacters().isEmpty()) {
|
||||
ch.getMapFactory().updateMaps();
|
||||
PlayerStorage ps = ch.getPlayerStorage();
|
||||
if (ps != null) {
|
||||
if (!ps.getAllCharacters().isEmpty()) {
|
||||
MapleMapManager mapManager = ch.getMapFactory();
|
||||
if (mapManager != null) {
|
||||
mapManager.updateMaps();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user