Reformat and clean up "net" package

This commit is contained in:
P0nk
2021-09-09 23:26:02 +02:00
parent 69f4580637
commit 6be6ea9927
235 changed files with 3556 additions and 3398 deletions

View File

@@ -31,59 +31,58 @@ import tools.PacketCreator;
import tools.Randomizer;
/**
*
* @author Xotic (XoticStory) & BubblesDev
*/
public final class MobDamageMobFriendlyHandler extends AbstractPacketHandler {
@Override
public final void handlePacket(InPacket p, Client c) {
int attacker = p.readInt();
p.readInt();
int damaged = p.readInt();
MapleMap map = c.getPlayer().getMap();
Monster monster = map.getMonsterByOid(damaged);
@Override
public final void handlePacket(InPacket p, Client c) {
int attacker = p.readInt();
p.readInt();
int damaged = p.readInt();
if (monster == null || map.getMonsterByOid(attacker) == null) {
return;
}
MapleMap map = c.getPlayer().getMap();
Monster monster = map.getMonsterByOid(damaged);
int damage = Randomizer.nextInt(((monster.getMaxHp() / 13 + monster.getPADamage() * 10)) * 2 + 500) / 10; // Formula planned by Beng.
if (monster.getHp() - damage < 1) { // friendly dies
if(monster.getId() == 9300102) {
map.broadcastMessage(PacketCreator.serverNotice(6, "The Watch Hog has been injured by the aliens. Better luck next time..."));
} else if (monster.getId() == 9300061) { //moon bunny
map.broadcastMessage(PacketCreator.serverNotice(6, "The Moon Bunny went home because he was sick."));
} else if(monster.getId() == 9300093) { //tylus
map.broadcastMessage(PacketCreator.serverNotice(6, "Tylus has fallen by the overwhelming forces of the ambush."));
} else if(monster.getId() == 9300137) { //juliet
map.broadcastMessage(PacketCreator.serverNotice(6, "Juliet has fainted in the middle of the combat."));
} else if(monster.getId() == 9300138) { //romeo
map.broadcastMessage(PacketCreator.serverNotice(6, "Romeo has fainted in the middle of the combat."));
} else if(monster.getId() == 9400322 || monster.getId() == 9400327 || monster.getId() == 9400332) { //snowman
map.broadcastMessage(PacketCreator.serverNotice(6, "The Snowman has melted on the heat of the battle."));
} else if(monster.getId() == 9300162) { //delli
map.broadcastMessage(PacketCreator.serverNotice(6, "Delli vanished after the ambush, sheets still laying on the ground..."));
}
map.killFriendlies(monster);
} else {
EventInstanceManager eim = map.getEventInstance();
if (eim != null) {
eim.friendlyDamaged(monster);
}
}
monster.applyAndGetHpDamage(damage, false);
int remainingHp = monster.getHp();
if(remainingHp <= 0) {
remainingHp = 0;
map.removeMapObject(monster);
}
if (monster == null || map.getMonsterByOid(attacker) == null) {
return;
}
map.broadcastMessage(PacketCreator.MobDamageMobFriendly(monster, damage, remainingHp), monster.getPosition());
c.sendPacket(PacketCreator.enableActions());
}
int damage = Randomizer.nextInt(((monster.getMaxHp() / 13 + monster.getPADamage() * 10)) * 2 + 500) / 10; // Formula planned by Beng.
if (monster.getHp() - damage < 1) { // friendly dies
if (monster.getId() == 9300102) {
map.broadcastMessage(PacketCreator.serverNotice(6, "The Watch Hog has been injured by the aliens. Better luck next time..."));
} else if (monster.getId() == 9300061) { //moon bunny
map.broadcastMessage(PacketCreator.serverNotice(6, "The Moon Bunny went home because he was sick."));
} else if (monster.getId() == 9300093) { //tylus
map.broadcastMessage(PacketCreator.serverNotice(6, "Tylus has fallen by the overwhelming forces of the ambush."));
} else if (monster.getId() == 9300137) { //juliet
map.broadcastMessage(PacketCreator.serverNotice(6, "Juliet has fainted in the middle of the combat."));
} else if (monster.getId() == 9300138) { //romeo
map.broadcastMessage(PacketCreator.serverNotice(6, "Romeo has fainted in the middle of the combat."));
} else if (monster.getId() == 9400322 || monster.getId() == 9400327 || monster.getId() == 9400332) { //snowman
map.broadcastMessage(PacketCreator.serverNotice(6, "The Snowman has melted on the heat of the battle."));
} else if (monster.getId() == 9300162) { //delli
map.broadcastMessage(PacketCreator.serverNotice(6, "Delli vanished after the ambush, sheets still laying on the ground..."));
}
map.killFriendlies(monster);
} else {
EventInstanceManager eim = map.getEventInstance();
if (eim != null) {
eim.friendlyDamaged(monster);
}
}
monster.applyAndGetHpDamage(damage, false);
int remainingHp = monster.getHp();
if (remainingHp <= 0) {
remainingHp = 0;
map.removeMapObject(monster);
}
map.broadcastMessage(PacketCreator.MobDamageMobFriendly(monster, damage, remainingHp), monster.getPosition());
c.sendPacket(PacketCreator.enableActions());
}
}