Boss Daily Entry + Maker enable actions + Duey Quick Delivery

Fixed Legendary Spirit UI getting stuck when trying to apply scrolls in equipments without upgrade slots available.
Revised map leasing. Players no longer lose ownership when changing maps. Players are allowed to lease one map each time.
Revised expeditions warping players out as soon as the leader leaves the event or the number of players inside gets to be less than the minimum required to enter.
Fixed start/complete quest commands not acting properly for some quests.
Refactored quest loadouts unnecessarily reloading MapleData.
Implemented support for daily boss limit entry, usable on expeditions.
Revised potential exploit cases within chair, face expression, quest action, summon damage and mob damage mob handlers.
Adjusted displayed date in Duey. Value displayed now should be consistent with the expected expiration time.
Refactored damage for friendly mobs getting handled inside packet structure.
Implemented support for Quick Delivery from Duey.
Fixed Horntail specifically not dropping loots after recent updates.
Refactored commands system. All commands are instanced at boot time instead of at every call.
Fixed usage of Maker skill not sending MAKER_RESULT packet to players. This automatically reenables the actions button (such as create) in Maker UI.
Adjusted minidungeons, now using time limits specified in their respective recipes.
Reviewed the "timeLimit" property utilized by maps, which was poised to work on 2 different concepts altogether.
Fixed Gaga space event, should be functional now.
Added RPS minigame, resources implemented by Arnah.
Fixed damage taken from mob auto-destruction not working properly.
This commit is contained in:
ronancpl
2019-06-27 20:34:39 -03:00
parent a39a210c1f
commit fba27fb3b1
82 changed files with 2902 additions and 2611 deletions

View File

@@ -21,16 +21,24 @@
*/
package net.server.channel.handlers;
import java.util.Map;
import client.MapleClient;
import client.MapleCharacter;
import client.autoban.AutobanFactory;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
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;
/**
*
* @author Jay Estrella
* @author Ronan
*/
public final class MobDamageMobHandler extends AbstractMaplePacketHandler {
@Override
@@ -38,14 +46,69 @@ public final class MobDamageMobHandler extends AbstractMaplePacketHandler {
int from = slea.readInt();
slea.readInt();
int to = slea.readInt();
slea.readByte();
boolean magic = slea.readByte() == 0;
int dmg = slea.readInt();
MapleCharacter chr = c.getPlayer();
MapleMap map = chr.getMap();
if (map.getMonsterByOid(from) != null && map.getMonsterByOid(to) != null) {
map.damageMonster(chr, map.getMonsterByOid(to), dmg);
map.broadcastMessage(MaplePacketCreator.damageMonster(to, dmg));
MapleMonster attacker = map.getMonsterByOid(from);
MapleMonster damaged = map.getMonsterByOid(to);
if (attacker != null && damaged != null) {
int maxDmg = calcMaxDamage(attacker, damaged, magic); // thanks Darter (YungMoozi) for reporting unchecked dmg
if (dmg > maxDmg) {
AutobanFactory.DAMAGE_HACK.alert(c.getPlayer(), "Possible packet editing hypnotize damage exploit."); // thanks Rien dev team
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " had hypnotized " + MapleMonsterInformationProvider.getInstance().getMobNameFromId(attacker.getId()) + " to attack " + MapleMonsterInformationProvider.getInstance().getMobNameFromId(damaged.getId()) + " with damage " + dmg + " (max: " + maxDmg + ")");
dmg = maxDmg;
}
map.damageMonster(chr, damaged, dmg);
map.broadcastMessage(chr, MaplePacketCreator.damageMonster(to, dmg), false);
}
}
private static int calcMaxDamage(MapleMonster attacker, MapleMonster damaged, boolean magic) {
int attackerAtk, damagedDef, attackerLevel = attacker.getLevel();
double maxDamage;
if (magic) {
int atkRate = calcModifier(attacker, MonsterStatus.MAGIC_ATTACK_UP, MonsterStatus.MATK);
attackerAtk = (attacker.getStats().getMADamage() * atkRate) / 100;
int defRate = calcModifier(damaged, MonsterStatus.MAGIC_DEFENSE_UP, MonsterStatus.MDEF);
damagedDef = (damaged.getStats().getMDDamage() * defRate) / 100;
maxDamage = ((attackerAtk * (1.15 + (0.025 * attackerLevel))) - (0.75 * damagedDef)) * (Math.log(Math.abs(damagedDef - attackerAtk)) / Math.log(12));
} else {
int atkRate = calcModifier(attacker, MonsterStatus.WEAPON_ATTACK_UP, MonsterStatus.WATK);
attackerAtk = (attacker.getStats().getPADamage() * atkRate) / 100;
int defRate = calcModifier(damaged, MonsterStatus.WEAPON_DEFENSE_UP, MonsterStatus.WDEF);
damagedDef = (damaged.getStats().getPDDamage() * defRate) / 100;
maxDamage = ((attackerAtk * (1.15 + (0.025 * attackerLevel))) - (0.75 * damagedDef)) * (Math.log(Math.abs(damagedDef - attackerAtk)) / Math.log(17));
}
return (int) maxDamage;
}
private static int calcModifier(MapleMonster monster, MonsterStatus buff, MonsterStatus nerf) {
int atkModifier;
final Map<MonsterStatus, MonsterStatusEffect> monsterStati = monster.getStati();
MonsterStatusEffect atkBuff = monsterStati.get(buff);
if (atkBuff != null) {
atkModifier = atkBuff.getStati().get(buff);
} else {
atkModifier = 100;
}
MonsterStatusEffect atkNerf = monsterStati.get(nerf);
if (atkNerf != null) {
atkModifier -= atkNerf.getStati().get(nerf);
}
return atkModifier;
}
}