Rename and clean up MapleLifeFactory

This commit is contained in:
P0nk
2021-09-09 22:04:57 +02:00
parent 1f349d1dae
commit 38c700ca48
113 changed files with 309 additions and 308 deletions

View File

@@ -27,7 +27,7 @@ import client.Character;
import client.Client;
import client.command.Command;
import net.server.Server;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import tools.PacketCreator;
public class BombCommand extends Command {
@@ -41,13 +41,13 @@ public class BombCommand extends Command {
if (params.length > 0) {
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
if (victim != null) {
victim.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), victim.getPosition());
victim.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300166), victim.getPosition());
Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.serverNotice(5, player.getName() + " used !bomb on " + victim.getName()));
} else {
player.message("Player '" + params[0] + "' could not be found on this world.");
}
} else {
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300166), player.getPosition());
}
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm3;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleNPC;
import tools.PacketCreator;
@@ -42,7 +42,7 @@ public class NpcCommand extends Command {
player.yellowMessage("Syntax: !npc <npcid>");
return;
}
MapleNPC npc = MapleLifeFactory.getNPC(Integer.parseInt(params[0]));
MapleNPC npc = LifeFactory.getNPC(Integer.parseInt(params[0]));
if (npc != null) {
npc.setPosition(player.getPosition());
npc.setCy(player.getPosition().y);

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm3;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
public class SpawnCommand extends Command {
@@ -42,16 +42,16 @@ public class SpawnCommand extends Command {
return;
}
MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(params[0]));
MapleMonster monster = LifeFactory.getMonster(Integer.parseInt(params[0]));
if (monster == null) {
return;
}
if (params.length == 2) {
for (int i = 0; i < Integer.parseInt(params[1]); i++) {
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition());
}
} else {
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition());
}
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
public class CakeCommand extends Command {
@@ -37,7 +37,7 @@ public class CakeCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
MapleMonster monster = MapleLifeFactory.getMonster(9400606);
MapleMonster monster = LifeFactory.getMonster(9400606);
if (params.length == 1) {
double mobHp = Double.parseDouble(params[0]);
int newHp = (mobHp <= 0) ? Integer.MAX_VALUE : ((mobHp > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) mobHp);

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
public class PapCommand extends Command {
{
@@ -38,6 +38,6 @@ public class PapCommand extends Command {
Character player = c.getPlayer();
// thanks Conrad for noticing mobid typo here
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8500001), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8500001), player.getPosition());
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
public class PianusCommand extends Command {
{
@@ -36,6 +36,6 @@ public class PianusCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8510000), player.getPosition());
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
public class PinkbeanCommand extends Command {
{
@@ -36,7 +36,7 @@ public class PinkbeanCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8820001), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8820001), player.getPosition());
}
}

View File

@@ -27,7 +27,7 @@ import client.Character;
import client.Client;
import client.command.Command;
import net.server.channel.Channel;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.maps.MapleMap;
import tools.DatabaseConnection;
@@ -60,7 +60,7 @@ public class PmobCommand extends Command {
int ypos = checkpos.y;
int fh = player.getMap().getFootholds().findBelow(checkpos).getId();
MapleMonster mob = MapleLifeFactory.getMonster(mobId);
MapleMonster mob = LifeFactory.getMonster(mobId);
if (mob != null && !mob.getName().equals("MISSINGNO")) {
mob.setPosition(checkpos);
mob.setCy(ypos);

View File

@@ -27,7 +27,7 @@ import client.Character;
import client.Client;
import client.command.Command;
import net.server.channel.Channel;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleNPC;
import server.maps.MapleMap;
import tools.DatabaseConnection;
@@ -59,7 +59,7 @@ public class PnpcCommand extends Command {
return;
}
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
MapleNPC npc = LifeFactory.getNPC(npcId);
Point checkpos = player.getMap().getGroundBelow(player.getPosition());
int xpos = checkpos.x;
@@ -85,7 +85,7 @@ public class PnpcCommand extends Command {
ps.executeUpdate();
for (Channel ch : player.getWorldServer().getChannels()) {
npc = MapleLifeFactory.getNPC(npcId);
npc = LifeFactory.getNPC(npcId);
npc.setPosition(checkpos);
npc.setCy(ypos);
npc.setRx0(xpos + 50);

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
public class ZakumCommand extends Command {
{
@@ -36,9 +36,9 @@ public class ZakumCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8800000), player.getPosition());
player.getMap().spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(8800000), player.getPosition());
for (int x = 8800003; x < 8800011; x++) {
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(x), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(x), player.getPosition());
}
}
}

View File

@@ -29,7 +29,7 @@ import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
@@ -55,7 +55,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
int[][] toSpawn = MapleItemInformationProvider.getInstance().getSummonMobs(p.readInt());
for (int[] toSpawnChild : toSpawn) {
if (Randomizer.nextInt(100) < toSpawnChild[1]) {
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
c.getPlayer().getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
}
}
c.sendPacket(PacketCreator.enableActions());
@@ -141,7 +141,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
int mobId = p.readInt();
int quantity = p.readInt();
for (int i = 0; i < quantity; i++) {
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), c.getPlayer().getPosition());
c.getPlayer().getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), c.getPlayer().getPosition());
}
break;
case 0x18: // Maple & Mobhp

View File

@@ -23,7 +23,7 @@ import client.Character;
import client.Client;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.life.MapleLifeFactory.BanishInfo;
import server.life.LifeFactory.BanishInfo;
import server.life.MapleMonster;
public final class MobBanishPlayerHandler extends AbstractPacketHandler {

View File

@@ -28,7 +28,7 @@ import net.AbstractPacketHandler;
import net.packet.InPacket;
import net.server.world.Party;
import net.server.world.PartyCharacter;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.partyquest.MapleCarnivalFactory;
import server.partyquest.MapleCarnivalFactory.MCSkill;
@@ -62,7 +62,7 @@ public final class MonsterCarnivalHandler extends AbstractPacketHandler {
return;
}
final MapleMonster mob = MapleLifeFactory.getMonster(mobs.get(num).left);
final MapleMonster mob = LifeFactory.getMonster(mobs.get(num).left);
MonsterCarnival mcpq = c.getPlayer().getMonsterCarnival();
if (mcpq != null) {
if (!mcpq.canSummonR() && c.getPlayer().getTeam() == 0 || !mcpq.canSummonB() && c.getPlayer().getTeam() == 1) {

View File

@@ -36,7 +36,7 @@ import constants.skills.Aran;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleStatEffect;
import server.life.MapleLifeFactory.loseItem;
import server.life.LifeFactory.loseItem;
import server.life.*;
import server.maps.MapleMap;
import server.maps.MapleMapObject;

View File

@@ -28,7 +28,7 @@ import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import tools.PacketCreator;
import tools.Randomizer;
@@ -54,7 +54,7 @@ public final class UseSummonBagHandler extends AbstractPacketHandler {
int[][] toSpawn = MapleItemInformationProvider.getInstance().getSummonMobs(itemId);
for (int[] toSpawnChild : toSpawn) {
if (Randomizer.nextInt(100) < toSpawnChild[1]) {
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
c.getPlayer().getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
}
}
}

View File

@@ -948,7 +948,7 @@ public class AbstractPlayerInteraction {
}
public void spawnNpc(int npcId, Point pos, MapleMap map) {
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
MapleNPC npc = LifeFactory.getNPC(npcId);
if (npc != null) {
npc.setPosition(pos);
npc.setCy(pos.y);
@@ -961,13 +961,13 @@ public class AbstractPlayerInteraction {
}
public void spawnMonster(int id, int x, int y) {
MapleMonster monster = MapleLifeFactory.getMonster(id);
MapleMonster monster = LifeFactory.getMonster(id);
monster.setPosition(new Point(x, y));
getPlayer().getMap().spawnMonster(monster);
}
public MapleMonster getMonsterLifeFactory(int mid) {
return MapleLifeFactory.getMonster(mid);
return LifeFactory.getMonster(mid);
}
public MobSkill getMobSkill(int skill, int level) {

View File

@@ -41,7 +41,7 @@ import server.MapleStatEffect;
import server.ThreadManager;
import server.TimerManager;
import server.expeditions.Expedition;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.life.MapleNPC;
import server.maps.MapleMap;
@@ -849,7 +849,7 @@ public class EventInstanceManager {
}
public void spawnNpc(int npcId, Point pos, MapleMap map) {
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
MapleNPC npc = LifeFactory.getNPC(npcId);
if (npc != null) {
npc.setPosition(pos);
npc.setCy(pos.y);
@@ -877,7 +877,7 @@ public class EventInstanceManager {
}
public MapleMonster getMonster(int mid) {
return(MapleLifeFactory.getMonster(mid));
return(LifeFactory.getMonster(mid));
}
private List<Integer> convertToIntegerList(List<Object> objects) {

View File

@@ -38,7 +38,7 @@ import scripting.event.scheduler.EventScriptScheduler;
import server.MapleMarriage;
import server.ThreadManager;
import server.expeditions.Expedition;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.maps.MapleMap;
import server.quest.MapleQuest;
@@ -738,7 +738,7 @@ public class EventManager {
}
public MapleMonster getMonster(int mid) {
return(MapleLifeFactory.getMonster(mid));
return(LifeFactory.getMonster(mid));
}
private void exportReadyGuild(Integer guildId) {

View File

@@ -49,7 +49,7 @@ import server.expeditions.Expedition;
import server.expeditions.ExpeditionType;
import server.gachapon.MapleGachapon;
import server.gachapon.MapleGachapon.MapleGachaponItem;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MaplePlayerNPC;
import server.maps.MapleMap;
import server.maps.MapleMapManager;
@@ -87,7 +87,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
private String getDefaultTalk(int npcid) {
String talk = npcDefaultTalks.get(npcid);
if (talk == null) {
talk = MapleLifeFactory.getNPCDefaultTalk(npcid);
talk = LifeFactory.getNPCDefaultTalk(npcid);
npcDefaultTalks.put(npcid, talk);
}

View File

@@ -31,7 +31,7 @@ import constants.inventory.ItemConstants;
import scripting.AbstractPlayerInteraction;
import server.MapleItemInformationProvider;
import server.TimerManager;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonster;
import server.maps.MapMonitor;
import server.maps.MapleMap;
@@ -262,7 +262,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
public void spawnMonster(int id, int qty, Point pos) {
for (int i = 0; i < qty; i++) {
reactor.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(id), pos);
reactor.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(id), pos);
}
}
@@ -304,7 +304,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
}
public void spawnFakeMonster(int id) {
reactor.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(id), getPosition());
reactor.getMap().spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(id), getPosition());
}
/**

View File

@@ -35,7 +35,7 @@ import net.server.Server;
import provider.*;
import provider.wz.WZFiles;
import server.MakerItemFactory.MakerItemCreateEntry;
import server.life.MapleLifeFactory;
import server.life.LifeFactory;
import server.life.MapleMonsterInformationProvider;
import tools.*;
@@ -1913,7 +1913,7 @@ public class MapleItemInformationProvider {
try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) {
int dropperid = rs.getInt("dropperid");
itemid = getCrystalForLevel(MapleLifeFactory.getMonsterLevel(dropperid) - 1);
itemid = getCrystalForLevel(LifeFactory.getMonsterLevel(dropperid) - 1);
}
}
}

View File

@@ -34,26 +34,25 @@ import java.awt.*;
import java.util.List;
import java.util.*;
public class MapleLifeFactory {
private static DataProvider data = DataProviderFactory.getDataProvider(WZFiles.MOB);
public class LifeFactory {
private static final DataProvider data = DataProviderFactory.getDataProvider(WZFiles.MOB);
private final static DataProvider stringDataWZ = DataProviderFactory.getDataProvider(WZFiles.STRING);
private static Data mobStringData = stringDataWZ.getData("Mob.img");
private static Data npcStringData = stringDataWZ.getData("Npc.img");
private static Map<Integer, MapleMonsterStats> monsterStats = new HashMap<>();
private static Set<Integer> hpbarBosses = getHpBarBosses();
private static final Data mobStringData = stringDataWZ.getData("Mob.img");
private static final Data npcStringData = stringDataWZ.getData("Npc.img");
private static final Map<Integer, MapleMonsterStats> monsterStats = new HashMap<>();
private static final Set<Integer> hpbarBosses = getHpBarBosses();
private static Set<Integer> getHpBarBosses() {
Set<Integer> ret = new HashSet<>();
DataProvider uiDataWZ = DataProviderFactory.getDataProvider(WZFiles.UI);
for (Data bossData : uiDataWZ.getData("UIWindow.img").getChildByPath("MobGage/Mob").getChildren()) {
ret.add(Integer.valueOf(bossData.getName()));
}
return ret;
}
public static AbstractLoadedLife getLife(int id, String type) {
if (type.equalsIgnoreCase("n")) {
return getNPC(id);
@@ -70,7 +69,7 @@ public class MapleLifeFactory {
protected int mpCon;
protected int coolTime;
protected int animationTime;
protected MobAttackInfoHolder(int attackPos, int mpCon, int coolTime, int animationTime) {
this.attackPos = attackPos;
this.mpCon = mpCon;
@@ -78,7 +77,7 @@ public class MapleLifeFactory {
this.animationTime = animationTime;
}
}
private static void setMonsterAttackInfo(int mid, List<MobAttackInfoHolder> attackInfos) {
if (!attackInfos.isEmpty()) {
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
@@ -89,28 +88,28 @@ public class MapleLifeFactory {
}
}
}
private static Pair<MapleMonsterStats, List<MobAttackInfoHolder>> getMonsterStats(int mid) {
Data monsterData = data.getData(StringUtil.getLeftPaddedStr(mid + ".img", '0', 11));
if (monsterData == null) {
return null;
}
Data monsterInfoData = monsterData.getChildByPath("info");
List<MobAttackInfoHolder> attackInfos = new LinkedList<>();
MapleMonsterStats stats = new MapleMonsterStats();
int linkMid = DataTool.getIntConvert("link", monsterInfoData, 0);
if (linkMid != 0) {
Pair<MapleMonsterStats, List<MobAttackInfoHolder>> linkStats = getMonsterStats(linkMid);
if (linkStats == null) {
return null;
}
// thanks resinate for noticing non-propagable infos such as revives getting retrieved
attackInfos.addAll(linkStats.getRight());
}
stats.setHp(DataTool.getIntConvert("maxHP", monsterInfoData));
stats.setFriendly(DataTool.getIntConvert("damagedByMob", monsterInfoData, stats.isFriendly() ? 1 : 0) == 1);
stats.setPADamage(DataTool.getIntConvert("PADamage", monsterInfoData));
@@ -157,12 +156,12 @@ public class MapleLifeFactory {
}
stats.setFirstAttack(firstAttack > 0);
stats.setDropPeriod(DataTool.getIntConvert("dropItemPeriod", monsterInfoData, stats.getDropPeriod() / 10000) * 10000);
// thanks yuxaij, Riizade, Z1peR, Anesthetic for noticing some bosses crashing players due to missing requirements
boolean hpbarBoss = stats.isBoss() && hpbarBosses.contains(mid);
stats.setTagColor(hpbarBoss ? DataTool.getIntConvert("hpTagColor", monsterInfoData, 0) : 0);
stats.setTagBgColor(hpbarBoss ? DataTool.getIntConvert("hpTagBgcolor", monsterInfoData, 0) : 0);
for (Data idata : monsterData) {
if (!idata.getName().equals("info")) {
int delay = 0;
@@ -226,7 +225,7 @@ public class MapleLifeFactory {
if (banishData != null) {
stats.setBanishInfo(new BanishInfo(DataTool.getString("banMsg", banishData), DataTool.getInt("banMap/0/field", banishData, -1), DataTool.getString("banMap/0/portal", banishData, "sp")));
}
int noFlip = DataTool.getInt("noFlip", monsterInfoData, 0);
if (noFlip > 0) {
Point origin = DataTool.getPoint("stand/0/origin", monsterData, null);
@@ -234,10 +233,10 @@ public class MapleLifeFactory {
stats.setFixedStance(origin.getX() < 1 ? 5 : 4); // fixed left/right
}
}
return new Pair<>(stats, attackInfos);
}
public static MapleMonster getMonster(int mid) {
try {
MapleMonsterStats stats = monsterStats.get(mid);
@@ -245,19 +244,19 @@ public class MapleLifeFactory {
Pair<MapleMonsterStats, List<MobAttackInfoHolder>> mobStats = getMonsterStats(mid);
stats = mobStats.getLeft();
setMonsterAttackInfo(mid, mobStats.getRight());
monsterStats.put(mid, stats);
}
MapleMonster ret = new MapleMonster(mid, stats);
return ret;
} catch(NullPointerException npe) {
} catch (NullPointerException npe) {
System.out.println("[SEVERE] MOB " + mid + " failed to load. Issue: " + npe.getMessage() + "\n\n");
npe.printStackTrace();
return null;
}
}
public static int getMonsterLevel(int mid) {
try {
MapleMonsterStats stats = monsterStats.get(mid);
@@ -271,11 +270,11 @@ public class MapleLifeFactory {
} else {
return stats.getLevel();
}
} catch(NullPointerException npe) {
} catch (NullPointerException npe) {
System.out.println("[SEVERE] MOB " + mid + " failed to load. Issue: " + npe.getMessage() + "\n\n");
npe.printStackTrace();
}
return -1;
}
@@ -288,15 +287,16 @@ public class MapleLifeFactory {
public static MapleNPC getNPC(int nid) {
return new MapleNPC(nid, new MapleNPCStats(DataTool.getString(nid + "/name", npcStringData, "MISSINGNO")));
}
public static String getNPCDefaultTalk(int nid) {
return DataTool.getString(nid + "/d0", npcStringData, "(...)");
}
public static class BanishInfo {
private int map;
private String portal, msg;
private final int map;
private final String portal;
private final String msg;
public BanishInfo(String msg, int map, String portal) {
this.msg = msg;
@@ -319,8 +319,9 @@ public class MapleLifeFactory {
public static class loseItem {
private int id;
private byte chance, x;
private final int id;
private final byte chance;
private final byte x;
public loseItem(int id, byte chance, byte x) {
this.id = id;
@@ -343,9 +344,9 @@ public class MapleLifeFactory {
public static class selfDestruction {
private byte action;
private int removeAfter;
private int hp;
private final byte action;
private final int removeAfter;
private final int hp;
public selfDestruction(byte action, int removeAfter, int hp) {
this.action = action;
@@ -356,7 +357,7 @@ public class MapleLifeFactory {
public int getHp() {
return hp;
}
public byte getAction() {
return action;
}

View File

@@ -44,7 +44,7 @@ import net.server.world.PartyCharacter;
import scripting.event.EventInstanceManager;
import server.MapleStatEffect;
import server.TimerManager;
import server.life.MapleLifeFactory.BanishInfo;
import server.life.LifeFactory.BanishInfo;
import server.loot.MapleLootManager;
import server.maps.AbstractAnimatedMapleMapObject;
import server.maps.MapleMap;
@@ -779,7 +779,7 @@ public class MapleMonster extends AbstractLoadedLife {
boolean aggro = lastController.getRight();
for (Integer mid : toSpawn) {
final MapleMonster mob = MapleLifeFactory.getMonster(mid);
final MapleMonster mob = LifeFactory.getMonster(mid);
mob.setPosition(getPosition());
mob.setFh(getFh());
mob.setParentMobOid(getObjectId());

View File

@@ -248,7 +248,7 @@ public class MapleMonsterInformationProvider {
Boolean boss = mobBossCache.get(id);
if (boss == null) {
try {
boss = MapleLifeFactory.getMonster(id).isBoss();
boss = LifeFactory.getMonster(id).isBoss();
} catch (NullPointerException npe) {
boss = false;
} catch (Exception e) { //nonexistant mob

View File

@@ -21,9 +21,9 @@
*/
package server.life;
import server.life.MapleLifeFactory.BanishInfo;
import server.life.MapleLifeFactory.loseItem;
import server.life.MapleLifeFactory.selfDestruction;
import server.life.LifeFactory.BanishInfo;
import server.life.LifeFactory.loseItem;
import server.life.LifeFactory.selfDestruction;
import tools.Pair;
import java.lang.reflect.Field;

View File

@@ -254,7 +254,7 @@ public class MobSkill {
Collections.shuffle(summons);
for (Integer mobId : summons.subList(0, summonLimit)) {
MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
MapleMonster toSpawn = LifeFactory.getMonster(mobId);
if (toSpawn != null) {
if (bossRushMap) {
toSpawn.disableDrops(); // no littering on BRPQ pls

View File

@@ -75,7 +75,7 @@ public class SpawnPoint {
}
public MapleMonster getMonster() {
MapleMonster mob = new MapleMonster(MapleLifeFactory.getMonster(monster));
MapleMonster mob = new MapleMonster(LifeFactory.getMonster(monster));
mob.setPosition(new Point(pos));
mob.setTeam(team);
mob.setFh(fh);

View File

@@ -58,7 +58,7 @@ import server.MapleStatEffect;
import server.TimerManager;
import server.events.gm.*;
import server.life.*;
import server.life.MapleLifeFactory.selfDestruction;
import server.life.LifeFactory.selfDestruction;
import server.partyquest.GuardianSpawnPoint;
import server.partyquest.MapleCarnivalFactory;
import server.partyquest.MapleCarnivalFactory.MCSkill;
@@ -1813,7 +1813,7 @@ public class MapleMap {
}
public void spawnMonsterOnGroundBelow(int id, int x, int y) {
MapleMonster mob = MapleLifeFactory.getMonster(id);
MapleMonster mob = LifeFactory.getMonster(id);
spawnMonsterOnGroundBelow(mob, new Point(x, y));
}
@@ -4039,10 +4039,10 @@ public class MapleMap {
}
public void spawnHorntailOnGroundBelow(final Point targetPoint) { // ayy lmao
MapleMonster htIntro = MapleLifeFactory.getMonster(8810026);
MapleMonster htIntro = LifeFactory.getMonster(8810026);
spawnMonsterOnGroundBelow(htIntro, targetPoint); // htintro spawn animation converting into horntail detected thanks to Arnah
final MapleMonster ht = MapleLifeFactory.getMonster(8810018);
final MapleMonster ht = LifeFactory.getMonster(8810018);
ht.setParentMobOid(htIntro.getObjectId());
ht.addListener(new MonsterListener() {
@Override
@@ -4061,7 +4061,7 @@ public class MapleMap {
spawnMonsterOnGroundBelow(ht, targetPoint);
for (int x = 8810002; x <= 8810009; x++) {
MapleMonster m = MapleLifeFactory.getMonster(x);
MapleMonster m = LifeFactory.getMonster(x);
m.setParentMobOid(htIntro.getObjectId());
m.addListener(new MonsterListener() {

View File

@@ -339,7 +339,7 @@ public class MapleMapFactory {
}
private static AbstractLoadedLife loadLife(int id, String type, int cy, int f, int fh, int rx0, int rx1, int x, int y, int hide) {
AbstractLoadedLife myLife = MapleLifeFactory.getLife(id, type);
AbstractLoadedLife myLife = LifeFactory.getLife(id, type);
myLife.setCy(cy);
myLife.setF(f);
myLife.setFh(fh);

View File

@@ -5,9 +5,9 @@ import provider.wz.DataType;
import provider.wz.WZFiles;
import server.life.Element;
import server.life.ElementalEffectiveness;
import server.life.MapleLifeFactory.BanishInfo;
import server.life.MapleLifeFactory.loseItem;
import server.life.MapleLifeFactory.selfDestruction;
import server.life.LifeFactory.BanishInfo;
import server.life.LifeFactory.loseItem;
import server.life.LifeFactory.selfDestruction;
import server.life.MapleMonsterStats;
import tools.Pair;