diff --git a/scripts/event/0_EXAMPLE.js b/scripts/event/0_EXAMPLE.js index b08814c392..95716edebf 100644 --- a/scripts/event/0_EXAMPLE.js +++ b/scripts/event/0_EXAMPLE.js @@ -104,7 +104,7 @@ function friendlyKilled(mob, eim) { } function allMonstersDead(eim) { - // When invoking unregisterMonster(MapleMonster mob) OR killed + // When invoking unregisterMonster(Monster mob) OR killed // Happens only when size = 0 } diff --git a/scripts/event/AmoriaPQ.js b/scripts/event/AmoriaPQ.js index 08683d08c0..5b6c7c3832 100644 --- a/scripts/event/AmoriaPQ.js +++ b/scripts/event/AmoriaPQ.js @@ -107,7 +107,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers && mask == 3)) eligible = []; if(onlyMarriedPlayers && hasNotMarried) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -148,9 +148,9 @@ function setup(level, lobbyid) { var mapObj = eim.getInstanceMap(670010700); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mobObj = MapleLifeFactory.getMonster(9400536); + var mobObj = LifeFactory.getMonster(9400536); mapObj.spawnMonsterOnGroundBelow(mobObj, new Point(942, 478)); respawnStages(eim); diff --git a/scripts/event/AreaBossBamboo.js b/scripts/event/AreaBossBamboo.js index c4d3a49c09..7d1543ab18 100644 --- a/scripts/event/AreaBossBamboo.js +++ b/scripts/event/AreaBossBamboo.js @@ -40,9 +40,9 @@ function cancelSchedule() { } function start() { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); var mapObj = em.getChannelServer().getMapFactory().getMap(800020120); // original mapid was 251010101 - var mobObj = MapleLifeFactory.getMonster(6090002); + var mobObj = LifeFactory.getMonster(6090002); if(mapObj.getMonsterById(6090002) != null) { em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossCentipede.js b/scripts/event/AreaBossCentipede.js index 4df057c579..ea4a48ab8f 100644 --- a/scripts/event/AreaBossCentipede.js +++ b/scripts/event/AreaBossCentipede.js @@ -47,11 +47,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var gcent = MapleLifeFactory.getMonster(5220004); + var gcent = LifeFactory.getMonster(5220004); herbGarden.spawnMonsterOnGroundBelow(gcent, new Point(560, 50)); herbGarden.broadcastMessage(PacketCreator.serverNotice(6, "From the mists surrounding the herb garden, the gargantuous Giant Centipede appears.")); em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossDeo.js b/scripts/event/AreaBossDeo.js index 1a83b1128c..56969924b7 100644 --- a/scripts/event/AreaBossDeo.js +++ b/scripts/event/AreaBossDeo.js @@ -47,11 +47,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var deo = MapleLifeFactory.getMonster(3220001); + var deo = LifeFactory.getMonster(3220001); royalCatthusDesert.spawnMonsterOnGroundBelow(deo, new Point(645, 275)); royalCatthusDesert.broadcastMessage(PacketCreator.serverNotice(6, "Deo slowly appeared out of the sand dust.")); em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossDoor1.js b/scripts/event/AreaBossDoor1.js index dc4b01ddaf..d7f624014c 100644 --- a/scripts/event/AreaBossDoor1.js +++ b/scripts/event/AreaBossDoor1.js @@ -50,9 +50,9 @@ function start() { const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(467, 0); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDoor2.js b/scripts/event/AreaBossDoor2.js index c230949dd8..4415f8c35f 100644 --- a/scripts/event/AreaBossDoor2.js +++ b/scripts/event/AreaBossDoor2.js @@ -48,11 +48,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(201, 80); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDoor3.js b/scripts/event/AreaBossDoor3.js index a872cb42a1..9efa3f4f00 100644 --- a/scripts/event/AreaBossDoor3.js +++ b/scripts/event/AreaBossDoor3.js @@ -48,11 +48,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(251, -841); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDoor4.js b/scripts/event/AreaBossDoor4.js index 7fa3b0b079..f1b041965e 100644 --- a/scripts/event/AreaBossDoor4.js +++ b/scripts/event/AreaBossDoor4.js @@ -48,11 +48,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(842, 0); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDoor5.js b/scripts/event/AreaBossDoor5.js index e2844d77f5..eef81a4c82 100644 --- a/scripts/event/AreaBossDoor5.js +++ b/scripts/event/AreaBossDoor5.js @@ -48,11 +48,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(461, 61); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDoor6.js b/scripts/event/AreaBossDoor6.js index 61b406a0ec..c65388ab2e 100644 --- a/scripts/event/AreaBossDoor6.js +++ b/scripts/event/AreaBossDoor6.js @@ -48,11 +48,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var boss = MapleLifeFactory.getMonster(bossMobid); + var boss = LifeFactory.getMonster(bossMobid); var bossPos = new Point(171, 50); map.spawnMonsterOnGroundBelow(boss, bossPos); map.broadcastMessage(PacketCreator.serverNotice(6, bossMsg)); diff --git a/scripts/event/AreaBossDyle.js b/scripts/event/AreaBossDyle.js index bbb6e882e3..dd772c3e0f 100644 --- a/scripts/event/AreaBossDyle.js +++ b/scripts/event/AreaBossDyle.js @@ -47,11 +47,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const PacketCreator = Java.type('tools.PacketCreator'); const Point = Java.type('java.awt.Point'); const spawnpoint = new Point(90, 119); - dangeroudCroko1.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(6220000), spawnpoint); + dangeroudCroko1.spawnMonsterOnGroundBelow(LifeFactory.getMonster(6220000), spawnpoint); dangeroudCroko1.broadcastMessage(PacketCreator.serverNotice(6, "The huge crocodile Dyle has come out from the swamp.")); setupTask = em.schedule("start", 3 * 60 * 60 * 1000); } diff --git a/scripts/event/AreaBossEliza1.js b/scripts/event/AreaBossEliza1.js index df74a9b2bb..b26fc09a5e 100644 --- a/scripts/event/AreaBossEliza1.js +++ b/scripts/event/AreaBossEliza1.js @@ -43,8 +43,8 @@ function cancelSchedule() { } function start() { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var eliza = MapleLifeFactory.getMonster(8220000); + const LifeFactory = Java.type('server.life.LifeFactory'); + var eliza = LifeFactory.getMonster(8220000); var stairwayToTheSky2 = em.getChannelServer().getMapFactory().getMap(200010300); if(stairwayToTheSky2.getMonsterById(8220000) != null) { diff --git a/scripts/event/AreaBossFaust1.js b/scripts/event/AreaBossFaust1.js index b30dc16c83..fb06ac593e 100644 --- a/scripts/event/AreaBossFaust1.js +++ b/scripts/event/AreaBossFaust1.js @@ -47,11 +47,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const PacketCreator = Java.type('tools.PacketCreator'); const Point = Java.type('java.awt.Point'); - var faust1 = MapleLifeFactory.getMonster(5220002); + var faust1 = LifeFactory.getMonster(5220002); const spawnpoint = new Point(456, 278); theForestOfEvil1.spawnMonsterOnGroundBelow(faust1, spawnpoint); theForestOfEvil1.broadcastMessage(PacketCreator.serverNotice(6, "Faust appeared amidst the blue fog.")); diff --git a/scripts/event/AreaBossFaust2.js b/scripts/event/AreaBossFaust2.js index 311734bb90..b2da4f3743 100644 --- a/scripts/event/AreaBossFaust2.js +++ b/scripts/event/AreaBossFaust2.js @@ -41,9 +41,9 @@ function cancelSchedule() { } function start() { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); var theForestOfEvil2 = em.getChannelServer().getMapFactory().getMap(100040106); - var faust2 = MapleLifeFactory.getMonster(5220002); + var faust2 = LifeFactory.getMonster(5220002); if(theForestOfEvil2.getMonsterById(5220002) != null) { em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossKimera.js b/scripts/event/AreaBossKimera.js index 2a50671430..83539eabc3 100644 --- a/scripts/event/AreaBossKimera.js +++ b/scripts/event/AreaBossKimera.js @@ -41,9 +41,9 @@ function cancelSchedule() { } function start() { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); var labSecretBasementPath = em.getChannelServer().getMapFactory().getMap(261030000); - var chimera = MapleLifeFactory.getMonster(8220002); + var chimera = LifeFactory.getMonster(8220002); if(labSecretBasementPath.getMonsterById(8220002) != null) { em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossKingClang.js b/scripts/event/AreaBossKingClang.js index da7bceb2fe..91a3737c00 100644 --- a/scripts/event/AreaBossKingClang.js +++ b/scripts/event/AreaBossKingClang.js @@ -49,8 +49,8 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var kingClang = MapleLifeFactory.getMonster(5220001); + const LifeFactory = Java.type('server.life.LifeFactory'); + var kingClang = LifeFactory.getMonster(5220001); var posX; var posY = 140; posX = Math.floor((Math.random() * 2400) - 1600); diff --git a/scripts/event/AreaBossKingSageCat.js b/scripts/event/AreaBossKingSageCat.js index 11b487772c..1950f8f4b7 100644 --- a/scripts/event/AreaBossKingSageCat.js +++ b/scripts/event/AreaBossKingSageCat.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var goblinForest2 = em.getChannelServer().getMapFactory().getMap(250010504); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var kingSageCat = MapleLifeFactory.getMonster(7220002); + const LifeFactory = Java.type('server.life.LifeFactory'); + var kingSageCat = LifeFactory.getMonster(7220002); if(goblinForest2.getMonsterById(7220002) != null) { em.schedule("start", 3 * 60 *60 * 1000); diff --git a/scripts/event/AreaBossLeviathan.js b/scripts/event/AreaBossLeviathan.js index 4a2a6b64b6..b20e18db76 100644 --- a/scripts/event/AreaBossLeviathan.js +++ b/scripts/event/AreaBossLeviathan.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var leviathansCanyon = em.getChannelServer().getMapFactory().getMap(240040401); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var leviathan = MapleLifeFactory.getMonster(8220003); + const LifeFactory = Java.type('server.life.LifeFactory'); + var leviathan = LifeFactory.getMonster(8220003); if(leviathansCanyon.getMonsterById(8220003) != null) { em.schedule("start", 3 * 60 *60 * 1000); return; diff --git a/scripts/event/AreaBossMano.js b/scripts/event/AreaBossMano.js index 3e46eb9248..64aad889a5 100644 --- a/scripts/event/AreaBossMano.js +++ b/scripts/event/AreaBossMano.js @@ -41,8 +41,8 @@ function cancelSchedule() { function start() { var thicketAroundTheBeach3 = em.getChannelServer().getMapFactory().getMap(104000400); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var mano = MapleLifeFactory.getMonster(2220000); + const LifeFactory = Java.type('server.life.LifeFactory'); + var mano = LifeFactory.getMonster(2220000); if(thicketAroundTheBeach3.getMonsterById(2220000) != null) { em.schedule("start", 3 * 60 * 60 * 1000); return; diff --git a/scripts/event/AreaBossNineTailedFox.js b/scripts/event/AreaBossNineTailedFox.js index cda001496a..550d9a2843 100644 --- a/scripts/event/AreaBossNineTailedFox.js +++ b/scripts/event/AreaBossNineTailedFox.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var moonRidge = em.getChannelServer().getMapFactory().getMap(222010310); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var nineTailedFox = MapleLifeFactory.getMonster(7220001); + const LifeFactory = Java.type('server.life.LifeFactory'); + var nineTailedFox = LifeFactory.getMonster(7220001); if(moonRidge.getMonsterById(7220001) != null) { em.schedule("start", 3 * 60 *60 * 1000); return; diff --git a/scripts/event/AreaBossSeruf.js b/scripts/event/AreaBossSeruf.js index e6eed006d6..b78a9c347b 100644 --- a/scripts/event/AreaBossSeruf.js +++ b/scripts/event/AreaBossSeruf.js @@ -43,8 +43,8 @@ function cancelSchedule() { function start() { var theSeaweedTower = em.getChannelServer().getMapFactory().getMap(230020100); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var seruf = MapleLifeFactory.getMonster(4220001); + const LifeFactory = Java.type('server.life.LifeFactory'); + var seruf = LifeFactory.getMonster(4220001); if(theSeaweedTower.getMonsterById(4220001) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossSnackBar.js b/scripts/event/AreaBossSnackBar.js index 316505b2b3..93cf601be7 100644 --- a/scripts/event/AreaBossSnackBar.js +++ b/scripts/event/AreaBossSnackBar.js @@ -50,11 +50,11 @@ function start() { var setPos = [[-626, -604], [735, -600]]; var rndPos = setPos[Math.floor(Math.random() * setPos.length)]; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var snackBar = MapleLifeFactory.getMonster(8220008); + var snackBar = LifeFactory.getMonster(8220008); snackBarMap.spawnMonsterOnGroundBelow(snackBar, new Point(rndPos[0], rndPos[1])); snackBarMap.broadcastMessage(PacketCreator.serverNotice(6, "Slowly, a suspicious food stand opens up on a strangely remote place.")); em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossStumpy.js b/scripts/event/AreaBossStumpy.js index 90f991354a..7fba0bbfad 100644 --- a/scripts/event/AreaBossStumpy.js +++ b/scripts/event/AreaBossStumpy.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var eastRockyMountain5 = em.getChannelServer().getMapFactory().getMap(101030404); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var stumpy = MapleLifeFactory.getMonster(3220000); + const LifeFactory = Java.type('server.life.LifeFactory'); + var stumpy = LifeFactory.getMonster(3220000); if(eastRockyMountain5.getMonsterById(3220000) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossTaeRoon.js b/scripts/event/AreaBossTaeRoon.js index 5a0f881ca0..b1899ed2cf 100644 --- a/scripts/event/AreaBossTaeRoon.js +++ b/scripts/event/AreaBossTaeRoon.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var territoryOfWanderingBear = em.getChannelServer().getMapFactory().getMap(250010304); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var taeRoon = MapleLifeFactory.getMonster(7220000); + const LifeFactory = Java.type('server.life.LifeFactory'); + var taeRoon = LifeFactory.getMonster(7220000); if(territoryOfWanderingBear.getMonsterById(7220000) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossTimer1.js b/scripts/event/AreaBossTimer1.js index 3ead99a478..97ccda3549 100644 --- a/scripts/event/AreaBossTimer1.js +++ b/scripts/event/AreaBossTimer1.js @@ -41,8 +41,8 @@ function cancelSchedule() { function start() { var whirlpoolOfTime = em.getChannelServer().getMapFactory().getMap(220050100); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var timer1 = MapleLifeFactory.getMonster(5220003); + const LifeFactory = Java.type('server.life.LifeFactory'); + var timer1 = LifeFactory.getMonster(5220003); if(whirlpoolOfTime.getMonsterById(5220003) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossTimer2.js b/scripts/event/AreaBossTimer2.js index aa762ce1d8..cbcfd55a78 100644 --- a/scripts/event/AreaBossTimer2.js +++ b/scripts/event/AreaBossTimer2.js @@ -42,8 +42,8 @@ function cancelSchedule() { function start() { var lostTime1 = em.getChannelServer().getMapFactory().getMap(220050000); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var timer2 = MapleLifeFactory.getMonster(5220003); + const LifeFactory = Java.type('server.life.LifeFactory'); + var timer2 = LifeFactory.getMonster(5220003); if(lostTime1.getMonsterById(5220003) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossTimer3.js b/scripts/event/AreaBossTimer3.js index a0bbb09fc3..23aefeca26 100644 --- a/scripts/event/AreaBossTimer3.js +++ b/scripts/event/AreaBossTimer3.js @@ -43,8 +43,8 @@ function cancelSchedule() { function start() { var lostTime2 = em.getChannelServer().getMapFactory().getMap(220050200); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var timer3 = MapleLifeFactory.getMonster(5220003); + const LifeFactory = Java.type('server.life.LifeFactory'); + var timer3 = LifeFactory.getMonster(5220003); if(lostTime2.getMonsterById(5220003) != null) { em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/AreaBossZeno.js b/scripts/event/AreaBossZeno.js index fe808f1104..a6a3ac9018 100644 --- a/scripts/event/AreaBossZeno.js +++ b/scripts/event/AreaBossZeno.js @@ -47,11 +47,11 @@ function start() { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); const PacketCreator = Java.type('tools.PacketCreator'); - var zeno = MapleLifeFactory.getMonster(6220001); + var zeno = LifeFactory.getMonster(6220001); graysPrairie.spawnMonsterOnGroundBelow(zeno, new Point(-4224, 776)); graysPrairie.broadcastMessage(PacketCreator.serverNotice(6, "Zeno has appeared with a heavy sound of machinery.")); em.schedule("start", 3 * 60 * 60 * 1000); diff --git a/scripts/event/BalrogBattle.js b/scripts/event/BalrogBattle.js index 1ebd80265b..2b79d2bff9 100644 --- a/scripts/event/BalrogBattle.js +++ b/scripts/event/BalrogBattle.js @@ -103,7 +103,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -135,16 +135,16 @@ function releaseLeftClaw(eim) { function spawnBalrog(eim) { var mapObj = eim.getInstanceMap(entryMap); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - mapObj.spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830000), new Point(412, 258)); - mapObj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830002), new Point(412, 258)); - mapObj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830006), new Point(412, 258)); + mapObj.spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(8830000), new Point(412, 258)); + mapObj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8830002), new Point(412, 258)); + mapObj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8830006), new Point(412, 258)); } function spawnSealedBalrog(eim) { const Point = Java.type('java.awt.Point'); - eim.getInstanceMap(entryMap).spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(bossMobId), new Point(412, 258)); + eim.getInstanceMap(entryMap).spawnMonsterOnGroundBelow(LifeFactory.getMonster(bossMobId), new Point(412, 258)); } function playerEntry(eim, player) { diff --git a/scripts/event/BalrogBattle_Easy.js b/scripts/event/BalrogBattle_Easy.js index e6efb9956b..ac0ebec18e 100644 --- a/scripts/event/BalrogBattle_Easy.js +++ b/scripts/event/BalrogBattle_Easy.js @@ -103,7 +103,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -135,16 +135,16 @@ function releaseLeftClaw(eim) { function spawnBalrog(eim) { var mapObj = eim.getInstanceMap(entryMap); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - mapObj.spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830007), new Point(412, 258)); - mapObj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830009), new Point(412, 258)); - mapObj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8830013), new Point(412, 258)); + mapObj.spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(8830007), new Point(412, 258)); + mapObj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8830009), new Point(412, 258)); + mapObj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8830013), new Point(412, 258)); } function spawnSealedBalrog(eim) { const Point = Java.type('java.awt.Point'); - eim.getInstanceMap(entryMap).spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(bossMobId), new Point(412, 258)); + eim.getInstanceMap(entryMap).spawnMonsterOnGroundBelow(LifeFactory.getMonster(bossMobId), new Point(412, 258)); } function playerEntry(eim, player) { diff --git a/scripts/event/Boats.js b/scripts/event/Boats.js index cbcab79119..b989c74895 100644 --- a/scripts/event/Boats.js +++ b/scripts/event/Boats.js @@ -95,17 +95,17 @@ function approach() { } function invasion() { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); var map1 = Boat_to_Ellinia; var pos1 = new java.awt.Point(-538, 143); - map1.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8150000), pos1); - map1.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8150000), pos1); + map1.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8150000), pos1); + map1.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8150000), pos1); var map2 = Boat_to_Orbis; var pos2 = new java.awt.Point(339, 148); - map2.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8150000), pos2); - map2.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8150000), pos2); + map2.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8150000), pos2); + map2.spawnMonsterOnGroundBelow(LifeFactory.getMonster(8150000), pos2); } function cancelSchedule() {} diff --git a/scripts/event/BossRushPQ.js b/scripts/event/BossRushPQ.js index 81cfd89f80..e79f17f81b 100644 --- a/scripts/event/BossRushPQ.js +++ b/scripts/event/BossRushPQ.js @@ -117,7 +117,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_1.js b/scripts/event/CafePQ_1.js index f7c71bb70c..3838da01ff 100644 --- a/scripts/event/CafePQ_1.js +++ b/scripts/event/CafePQ_1.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_2.js b/scripts/event/CafePQ_2.js index 6843fe1240..dfa7d6cd70 100644 --- a/scripts/event/CafePQ_2.js +++ b/scripts/event/CafePQ_2.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_3.js b/scripts/event/CafePQ_3.js index 82aefc9b42..2756114c48 100644 --- a/scripts/event/CafePQ_3.js +++ b/scripts/event/CafePQ_3.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_4.js b/scripts/event/CafePQ_4.js index 2d4aca90f0..330180dfb0 100644 --- a/scripts/event/CafePQ_4.js +++ b/scripts/event/CafePQ_4.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_5.js b/scripts/event/CafePQ_5.js index 4e2f36a319..57b2fd8ff8 100644 --- a/scripts/event/CafePQ_5.js +++ b/scripts/event/CafePQ_5.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/CafePQ_6.js b/scripts/event/CafePQ_6.js index 50c1d4bc9c..9dde1e421e 100644 --- a/scripts/event/CafePQ_6.js +++ b/scripts/event/CafePQ_6.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/DelliBattle.js b/scripts/event/DelliBattle.js index b21edef43d..1238842e37 100644 --- a/scripts/event/DelliBattle.js +++ b/scripts/event/DelliBattle.js @@ -80,7 +80,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/ElementalBattle.js b/scripts/event/ElementalBattle.js index f286ae6564..48e238c90e 100644 --- a/scripts/event/ElementalBattle.js +++ b/scripts/event/ElementalBattle.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/EllinPQ.js b/scripts/event/EllinPQ.js index 51501e6cb0..ac5608cb43 100644 --- a/scripts/event/EllinPQ.js +++ b/scripts/event/EllinPQ.js @@ -90,7 +90,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/ElnathPQ.js b/scripts/event/ElnathPQ.js index 082d16178b..37f3530b71 100644 --- a/scripts/event/ElnathPQ.js +++ b/scripts/event/ElnathPQ.js @@ -80,7 +80,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/GuildQuest.js b/scripts/event/GuildQuest.js index 2e60a73214..796ac62b7d 100644 --- a/scripts/event/GuildQuest.js +++ b/scripts/event/GuildQuest.js @@ -112,7 +112,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/HenesysPQ.js b/scripts/event/HenesysPQ.js index 4a6ccc0098..f9c3bfed64 100644 --- a/scripts/event/HenesysPQ.js +++ b/scripts/event/HenesysPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/HolidayPQ_1.js b/scripts/event/HolidayPQ_1.js index 68920209b6..42490321ab 100644 --- a/scripts/event/HolidayPQ_1.js +++ b/scripts/event/HolidayPQ_1.js @@ -110,7 +110,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -304,9 +304,9 @@ function snowmanEvolve(eim, curLevel) { eim.setIntProperty("snowmanLevel", curLevel + 2); // increment by 2 to decrement by 1 on friendlyKilled mapobj.killMonster(snowman, null, false, 2); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var snowman = MapleLifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); + var snowman = LifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); mapobj.spawnMonsterOnGroundBelow(snowman, new Point(-180, 15)); if(curLevel >= 4) { diff --git a/scripts/event/HolidayPQ_2.js b/scripts/event/HolidayPQ_2.js index 954c677c0d..fd5798c850 100644 --- a/scripts/event/HolidayPQ_2.js +++ b/scripts/event/HolidayPQ_2.js @@ -110,7 +110,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -304,9 +304,9 @@ function snowmanEvolve(eim, curLevel) { eim.setIntProperty("snowmanLevel", curLevel + 2); // increment by 2 to decrement by 1 on friendlyKilled mapobj.killMonster(snowman, null, false, 2); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var snowman = MapleLifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); + var snowman = LifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); mapobj.spawnMonsterOnGroundBelow(snowman, new Point(-180, 15)); if(curLevel >= 4) { diff --git a/scripts/event/HolidayPQ_3.js b/scripts/event/HolidayPQ_3.js index e08173bd6a..5aeef36b51 100644 --- a/scripts/event/HolidayPQ_3.js +++ b/scripts/event/HolidayPQ_3.js @@ -110,7 +110,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -304,9 +304,9 @@ function snowmanEvolve(eim, curLevel) { eim.setIntProperty("snowmanLevel", curLevel + 2); // increment by 2 to decrement by 1 on friendlyKilled mapobj.killMonster(snowman, null, false, 2); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var snowman = MapleLifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); + var snowman = LifeFactory.getMonster(9400317 + (5 * difficulty) + curLevel); mapobj.spawnMonsterOnGroundBelow(snowman, new Point(-180, 15)); if(curLevel >= 4) { diff --git a/scripts/event/HorntailBattle.js b/scripts/event/HorntailBattle.js index cd2dc1d052..538efa49d6 100644 --- a/scripts/event/HorntailBattle.js +++ b/scripts/event/HorntailBattle.js @@ -96,15 +96,15 @@ function setup(channel) { eim.getInstanceMap(240060100).resetPQ(level); eim.getInstanceMap(240060200).resetPQ(level); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); var map, mob; map = eim.getInstanceMap(240060000); - mob = MapleLifeFactory.getMonster(8810000); + mob = LifeFactory.getMonster(8810000); map.spawnMonsterOnGroundBelow(mob, new Point(960, 120)); map = eim.getInstanceMap(240060100); - mob = MapleLifeFactory.getMonster(8810001); + mob = LifeFactory.getMonster(8810001); map.spawnMonsterOnGroundBelow(mob, new Point(-420, 120)); eim.startEventTimer(eventTime * 60000); diff --git a/scripts/event/HorntailPQ.js b/scripts/event/HorntailPQ.js index c7ae6d4f0d..fc194b60b8 100644 --- a/scripts/event/HorntailPQ.js +++ b/scripts/event/HorntailPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/KerningPQ.js b/scripts/event/KerningPQ.js index f0aefe454d..22a2ae0473 100644 --- a/scripts/event/KerningPQ.js +++ b/scripts/event/KerningPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/LatanicaBattle.js b/scripts/event/LatanicaBattle.js index 40a63c8c22..12f8471f2b 100644 --- a/scripts/event/LatanicaBattle.js +++ b/scripts/event/LatanicaBattle.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/LudiMazePQ.js b/scripts/event/LudiMazePQ.js index 475c54f25f..c7db87e9f6 100644 --- a/scripts/event/LudiMazePQ.js +++ b/scripts/event/LudiMazePQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/LudiPQ.js b/scripts/event/LudiPQ.js index eaea40f276..540ae3e889 100644 --- a/scripts/event/LudiPQ.js +++ b/scripts/event/LudiPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/MK_PrimeMinister.js b/scripts/event/MK_PrimeMinister.js index 73202b1102..b086aacec1 100644 --- a/scripts/event/MK_PrimeMinister.js +++ b/scripts/event/MK_PrimeMinister.js @@ -31,7 +31,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(difficulty, lobbyId){ @@ -63,9 +63,9 @@ function respawn(eim){ var weddinghall = eim.getMapInstance(entryMap); weddinghall.getPortal(1).setPortalState(false); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - weddinghall.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(292, 143)); + weddinghall.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(292, 143)); } else { eim.schedule("respawn", 10000); } diff --git a/scripts/event/MK_PrimeMinister2.js b/scripts/event/MK_PrimeMinister2.js index e1539ba7d7..3e3a13f748 100644 --- a/scripts/event/MK_PrimeMinister2.js +++ b/scripts/event/MK_PrimeMinister2.js @@ -31,7 +31,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(difficulty, lobbyId){ @@ -54,9 +54,9 @@ function respawn(eim){ var weddinghall = eim.getMapInstance(entryMap); weddinghall.getPortal(1).setPortalState(false); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - weddinghall.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(292, 143)); + weddinghall.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(292, 143)); } else { eim.schedule("respawn", 10000); } diff --git a/scripts/event/MagatiaPQ_A.js b/scripts/event/MagatiaPQ_A.js index e4216b7446..1759126853 100644 --- a/scripts/event/MagatiaPQ_A.js +++ b/scripts/event/MagatiaPQ_A.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -244,16 +244,16 @@ function respawnStages(eim) { var mapobj = eim.getMapInstance(926110401); var mobcount = mapobj.countMonster(9300150); var mobobj; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if(mobcount == 0) { - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-278, -126)); - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-542, -126)); } else if(mobcount == 1) { - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-542, -126)); } } @@ -313,12 +313,12 @@ function yuleteAction(eim) { mapobj.destroyNPC(2112010); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); var mobobj1, mobobj2; for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(-455, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(-455, 135)); @@ -326,8 +326,8 @@ function yuleteAction(eim) { for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(0, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(0, 135)); @@ -335,8 +335,8 @@ function yuleteAction(eim) { for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(360, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(360, 135)); diff --git a/scripts/event/MagatiaPQ_Z.js b/scripts/event/MagatiaPQ_Z.js index ec12baa753..38c8134b9c 100644 --- a/scripts/event/MagatiaPQ_Z.js +++ b/scripts/event/MagatiaPQ_Z.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { @@ -244,16 +244,16 @@ function respawnStages(eim) { var mapobj = eim.getMapInstance(926100401); var mobcount = mapobj.countMonster(9300150); var mobobj; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if(mobcount == 0) { - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-278, -126)); - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-542, -126)); } else if(mobcount == 1) { - mobobj = MapleLifeFactory.getMonster(9300150); + mobobj = LifeFactory.getMonster(9300150); mapobj.spawnMonsterOnGroundBelow(mobobj, new Point(-542, -126)); } } @@ -313,12 +313,12 @@ function yuleteAction(eim) { mapobj.destroyNPC(2112000); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); var mobobj1, mobobj2; for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(-455, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(-455, 135)); @@ -326,8 +326,8 @@ function yuleteAction(eim) { for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(0, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(0, 135)); @@ -335,8 +335,8 @@ function yuleteAction(eim) { for(var i = 0; i < 5; i++) { - mobobj1 = MapleLifeFactory.getMonster(mob1); - mobobj2 = MapleLifeFactory.getMonster(mob2); + mobobj1 = LifeFactory.getMonster(mob1); + mobobj2 = LifeFactory.getMonster(mob2); mapobj.spawnMonsterOnGroundBelow(mobobj1, new Point(360, 135)); mapobj.spawnMonsterOnGroundBelow(mobobj2, new Point(360, 135)); diff --git a/scripts/event/OrbisPQ.js b/scripts/event/OrbisPQ.js index 8d71fd512b..6078289d95 100644 --- a/scripts/event/OrbisPQ.js +++ b/scripts/event/OrbisPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/PapulatusBattle.js b/scripts/event/PapulatusBattle.js index f75d082f30..7144c2d5cb 100644 --- a/scripts/event/PapulatusBattle.js +++ b/scripts/event/PapulatusBattle.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/PinkBeanBattle.js b/scripts/event/PinkBeanBattle.js index e9574c775c..ce8a5d1722 100644 --- a/scripts/event/PinkBeanBattle.js +++ b/scripts/event/PinkBeanBattle.js @@ -102,9 +102,9 @@ function setup(channel) { eim.getInstanceMap(270050200).resetPQ(level); eim.getInstanceMap(270050300).resetPQ(level); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(8820000); + var mob = LifeFactory.getMonster(8820000); mob.disableDrops(); eim.getInstanceMap(270050100).spawnMonsterOnGroundBelow(mob, new Point(0, -42)); @@ -234,8 +234,8 @@ function spawnJrBoss(mobObj, gotKilled) { spawnid = mobObj.getId() - 17; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var mob = MapleLifeFactory.getMonster(spawnid); + const LifeFactory = Java.type('server.life.LifeFactory'); + var mob = LifeFactory.getMonster(spawnid); mobObj.getMap().spawnMonsterOnGroundBelow(mob, mobObj.getPosition()); } diff --git a/scripts/event/PiratePQ.js b/scripts/event/PiratePQ.js index 8fdd9c0664..e6beb4b594 100644 --- a/scripts/event/PiratePQ.js +++ b/scripts/event/PiratePQ.js @@ -90,7 +90,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/RescueGaga.js b/scripts/event/RescueGaga.js index 99b80fe97a..146d03cdc6 100644 --- a/scripts/event/RescueGaga.js +++ b/scripts/event/RescueGaga.js @@ -77,7 +77,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TD_Battle1.js b/scripts/event/TD_Battle1.js index 3ca55f6b37..c73d9d0934 100644 --- a/scripts/event/TD_Battle1.js +++ b/scripts/event/TD_Battle1.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TD_Battle2.js b/scripts/event/TD_Battle2.js index b893fe4949..165f274238 100644 --- a/scripts/event/TD_Battle2.js +++ b/scripts/event/TD_Battle2.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TD_Battle3.js b/scripts/event/TD_Battle3.js index 175deb3925..33dc52a562 100644 --- a/scripts/event/TD_Battle3.js +++ b/scripts/event/TD_Battle3.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TD_Battle4.js b/scripts/event/TD_Battle4.js index e7e3b15bd6..ead9fb4927 100644 --- a/scripts/event/TD_Battle4.js +++ b/scripts/event/TD_Battle4.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TD_Battle5.js b/scripts/event/TD_Battle5.js index b5ecaf12d3..41c97bfec0 100644 --- a/scripts/event/TD_Battle5.js +++ b/scripts/event/TD_Battle5.js @@ -100,7 +100,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/TreasurePQ.js b/scripts/event/TreasurePQ.js index 10c89e8757..1f2560ef85 100644 --- a/scripts/event/TreasurePQ.js +++ b/scripts/event/TreasurePQ.js @@ -99,7 +99,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/WeddingCathedral.js b/scripts/event/WeddingCathedral.js index d052d9bb88..9a91bb6384 100644 --- a/scripts/event/WeddingCathedral.js +++ b/scripts/event/WeddingCathedral.js @@ -72,9 +72,9 @@ function setEventRewards(eim) { function spawnCakeBoss(eim) { var mapObj = eim.getMapInstance(680000400); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mobObj = MapleLifeFactory.getMonster(9400606); + var mobObj = LifeFactory.getMonster(9400606); mapObj.spawnMonsterOnGroundBelow(mobObj, new Point(777, -177)); } diff --git a/scripts/event/WeddingChapel.js b/scripts/event/WeddingChapel.js index 0cd6b8407f..e43c6de466 100644 --- a/scripts/event/WeddingChapel.js +++ b/scripts/event/WeddingChapel.js @@ -72,9 +72,9 @@ function setEventRewards(eim) { function spawnCakeBoss(eim) { var mapObj = eim.getMapInstance(680000400); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mobObj = MapleLifeFactory.getMonster(9400606); + var mobObj = LifeFactory.getMonster(9400606); mapObj.spawnMonsterOnGroundBelow(mobObj, new Point(777, -177)); } diff --git a/scripts/event/ZakumPQ.js b/scripts/event/ZakumPQ.js index a823ab16cf..111855f747 100644 --- a/scripts/event/ZakumPQ.js +++ b/scripts/event/ZakumPQ.js @@ -98,7 +98,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/event/s4aWorld.js b/scripts/event/s4aWorld.js index d14de547c7..2af88c7a84 100644 --- a/scripts/event/s4aWorld.js +++ b/scripts/event/s4aWorld.js @@ -30,7 +30,7 @@ function getEligibleParty(party) { //selects, from the given party, the tea } if(!(hasLeader && eligible.length >= minPlayers)) eligible = []; - return Java.to(eligible, Java.type('net.server.world.MaplePartyCharacter[]')); + return Java.to(eligible, Java.type('net.server.world.PartyCharacter[]')); } function setup(level, lobbyid) { diff --git a/scripts/map/onUserEnter/100000006.js b/scripts/map/onUserEnter/100000006.js index b518cd8c62..015c5372d5 100644 --- a/scripts/map/onUserEnter/100000006.js +++ b/scripts/map/onUserEnter/100000006.js @@ -9,8 +9,8 @@ function start(ms){ return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(-1027, 216)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(-1027, 216)); } } \ No newline at end of file diff --git a/scripts/map/onUserEnter/108010101.js b/scripts/map/onUserEnter/108010101.js index f4d843eb71..9f0ce09a0a 100644 --- a/scripts/map/onUserEnter/108010101.js +++ b/scripts/map/onUserEnter/108010101.js @@ -16,8 +16,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/108010201.js b/scripts/map/onUserEnter/108010201.js index f4d843eb71..9f0ce09a0a 100644 --- a/scripts/map/onUserEnter/108010201.js +++ b/scripts/map/onUserEnter/108010201.js @@ -16,8 +16,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/108010301.js b/scripts/map/onUserEnter/108010301.js index f4d843eb71..9f0ce09a0a 100644 --- a/scripts/map/onUserEnter/108010301.js +++ b/scripts/map/onUserEnter/108010301.js @@ -16,8 +16,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/108010401.js b/scripts/map/onUserEnter/108010401.js index f4d843eb71..9f0ce09a0a 100644 --- a/scripts/map/onUserEnter/108010401.js +++ b/scripts/map/onUserEnter/108010401.js @@ -16,8 +16,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/108010501.js b/scripts/map/onUserEnter/108010501.js index f4d843eb71..9f0ce09a0a 100644 --- a/scripts/map/onUserEnter/108010501.js +++ b/scripts/map/onUserEnter/108010501.js @@ -16,8 +16,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000001.js b/scripts/map/onUserEnter/677000001.js index d8f70ac43f..8af02ac694 100644 --- a/scripts/map/onUserEnter/677000001.js +++ b/scripts/map/onUserEnter/677000001.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000003.js b/scripts/map/onUserEnter/677000003.js index 706dcb82e3..db5a2edd34 100644 --- a/scripts/map/onUserEnter/677000003.js +++ b/scripts/map/onUserEnter/677000003.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000005.js b/scripts/map/onUserEnter/677000005.js index 1c2bf6e8ab..b6fcf1f90d 100644 --- a/scripts/map/onUserEnter/677000005.js +++ b/scripts/map/onUserEnter/677000005.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000007.js b/scripts/map/onUserEnter/677000007.js index 82201272d2..5e713d868d 100644 --- a/scripts/map/onUserEnter/677000007.js +++ b/scripts/map/onUserEnter/677000007.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000009.js b/scripts/map/onUserEnter/677000009.js index 10b8d80202..ea4672ddd1 100644 --- a/scripts/map/onUserEnter/677000009.js +++ b/scripts/map/onUserEnter/677000009.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/677000012.js b/scripts/map/onUserEnter/677000012.js index 8e02c37a80..2b0236ecf4 100644 --- a/scripts/map/onUserEnter/677000012.js +++ b/scripts/map/onUserEnter/677000012.js @@ -11,7 +11,7 @@ function start(ms) { return; } - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos); + const LifeFactory = Java.type('server.life.LifeFactory'); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), pos); player.message(mobName + " has appeared!"); } \ No newline at end of file diff --git a/scripts/map/onUserEnter/910510000.js b/scripts/map/onUserEnter/910510000.js index a3373b5dd8..7d73d3df97 100644 --- a/scripts/map/onUserEnter/910510000.js +++ b/scripts/map/onUserEnter/910510000.js @@ -2,15 +2,15 @@ function start(ms) { var player = ms.getPlayer(); var map = player.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if (player.isCygnus()) { if (ms.isQuestStarted(20730) && ms.getQuestProgressInt(20730, 9300285) == 0) { - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300285), new Point(680, 258)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300285), new Point(680, 258)); } } else { if (ms.isQuestStarted(21731) && ms.getQuestProgressInt(21731, 9300344) == 0) { - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300344), new Point(680, 258)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300344), new Point(680, 258)); } } } \ No newline at end of file diff --git a/scripts/map/onUserEnter/925040100.js b/scripts/map/onUserEnter/925040100.js index 1ac603c642..f3a36a7691 100644 --- a/scripts/map/onUserEnter/925040100.js +++ b/scripts/map/onUserEnter/925040100.js @@ -3,8 +3,8 @@ function start(ms){ var map = player.getMap(); if(ms.isQuestStarted(21747) && ms.getQuestProgressInt(21747, 9300351) == 0) { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300351), new Point(897, 51)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300351), new Point(897, 51)); } } \ No newline at end of file diff --git a/scripts/map/onUserEnter/926000000.js b/scripts/map/onUserEnter/926000000.js index 65c8f2de66..379dba8698 100644 --- a/scripts/map/onUserEnter/926000000.js +++ b/scripts/map/onUserEnter/926000000.js @@ -3,7 +3,7 @@ function start(ms) { map.resetPQ(1); if(map.countMonster(9100013) == 0) { - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9100013), new java.awt.Point(82, 200)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9100013), new java.awt.Point(82, 200)); } return(true); diff --git a/scripts/map/onUserEnter/pepeking_effect.js b/scripts/map/onUserEnter/pepeking_effect.js index 78df65aa76..f61eb6c8d2 100644 --- a/scripts/map/onUserEnter/pepeking_effect.js +++ b/scripts/map/onUserEnter/pepeking_effect.js @@ -3,7 +3,7 @@ function start(ms){ var player = ms.getPlayer(); var map = player.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(-28, -67)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(-28, -67)); } \ No newline at end of file diff --git a/scripts/npc/1012100.js b/scripts/npc/1012100.js index 698ba0031f..6e0bee2384 100644 --- a/scripts/npc/1012100.js +++ b/scripts/npc/1012100.js @@ -94,9 +94,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1022000.js b/scripts/npc/1022000.js index 8e0ad6d308..00ba0352ee 100644 --- a/scripts/npc/1022000.js +++ b/scripts/npc/1022000.js @@ -95,9 +95,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1022101_old.js b/scripts/npc/1022101_old.js index aaf881afbf..aeb35fb4de 100644 --- a/scripts/npc/1022101_old.js +++ b/scripts/npc/1022101_old.js @@ -116,7 +116,7 @@ function action(mode, type, selection) { if(!cm.hasItem(itemToUse) && vp > 0) useVP = true; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); + const InventoryType = Java.type('client.inventory.InventoryType'); if(choice == 0) { // VP Exchange if(!cm.canHold(itemToUse)) { @@ -141,7 +141,7 @@ function action(mode, type, selection) { cm.logLeaf(nxAmount + " NX"); cm.dispose(); } else if(choice == 2) { - if(!cm.getPlayer().getInventory(MapleInventoryType.SETUP).isFull(chairAmount)) { + if(!cm.getPlayer().getInventory(InventoryType.SETUP).isFull(chairAmount)) { var chairStr = ""; for(var i = 0; i < chairAmount; i++) { @@ -161,7 +161,7 @@ function action(mode, type, selection) { cm.sendOk("Please make sure you have enough space to hold the items!"); } } else if(choice == 3) { - if(!cm.getPlayer().getInventory(MapleInventoryType.EQUIP).isFull(weaponAmount)) { + if(!cm.getPlayer().getInventory(InventoryType.EQUIP).isFull(weaponAmount)) { var weaponStr = ""; for(var i = 0; i < weaponAmount; i++) { @@ -181,7 +181,7 @@ function action(mode, type, selection) { cm.sendOk("Please make sure you have enough space to hold the items!"); } } else if(choice == 4) { - if(!cm.getPlayer().getInventory(MapleInventoryType.USE).isFull(2)) { + if(!cm.getPlayer().getInventory(InventoryType.USE).isFull(2)) { cm.gainItem(buff1ID, buffAmount, true); cm.gainItem(buff2ID, buffAmount, true); cm.gainItem(itemToUse, -1); @@ -192,7 +192,7 @@ function action(mode, type, selection) { } } else if(choice == 5) { if(!cm.haveItem(5030000, 1)) { - if(!cm.getPlayer().getInventory(MapleInventoryType.CASH).isFull(1)){ + if(!cm.getPlayer().getInventory(InventoryType.CASH).isFull(1)){ cm.gainItem(5030000, 1, false, true, 1000 * 60 * 60 * 24 * hiredMerchantLength); if(useVP) diff --git a/scripts/npc/1032001.js b/scripts/npc/1032001.js index 2aad6ef6b4..761e5884e1 100644 --- a/scripts/npc/1032001.js +++ b/scripts/npc/1032001.js @@ -95,9 +95,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1032102.js b/scripts/npc/1032102.js index d63a19f77e..5a9a464b7c 100644 --- a/scripts/npc/1032102.js +++ b/scripts/npc/1032102.js @@ -69,7 +69,7 @@ function action(mode, type, selection) { //var level = cm.getPlayer().getPet(i).getLevel(); //var closeness = cm.getPlayer().getPet(i).getCloseness(); //var fullness = cm.getPlayer().getPet(i).getFullness(); - //MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + //ItemInformationProvider ii = ItemInformationProvider.getInstance(); if (id < 5000029 || id > 5000033) { cm.sendOk("Something wrong, try again."); cm.dispose(); @@ -89,8 +89,8 @@ function action(mode, type, selection) { cm.dispose(); } - /*if (name.equals(MapleItemInformationProvider.getInstance().getName(id))) { - name = MapleItemInformationProvider.getInstance().getName(after); + /*if (name.equals(ItemInformationProvider.getInstance().getName(id))) { + name = ItemInformationProvider.getInstance().getName(after); }*/ cm.gainItem(5380000, -1); @@ -101,9 +101,9 @@ function action(mode, type, selection) { } } else if (status == 2) { if (selection == 0) { - const MapleInventoryManipulator = Java.type('client.inventory.manipulator.MapleInventoryManipulator'); - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - MapleInventoryManipulator.removeFromSlot(cm.getClient(), MapleInventoryType.CASH, 1, 1, true); + const InventoryManipulator = Java.type('client.inventory.manipulator.InventoryManipulator'); + const InventoryType = Java.type('client.inventory.InventoryType'); + InventoryManipulator.removeFromSlot(cm.getClient(), InventoryType.CASH, 1, 1, true); cm.sendOk("Your cash first slot is removed."); } else if (selection == 1) { if (cm.haveItem(5000029, 2)) { diff --git a/scripts/npc/1032109.js b/scripts/npc/1032109.js index 450b9f56f8..2bee5dd172 100644 --- a/scripts/npc/1032109.js +++ b/scripts/npc/1032109.js @@ -35,14 +35,14 @@ function action(mode, type, selection){ var player = cm.getPlayer(); var map = player.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); for(var i = 0; i < 10; i++) - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(117, 183)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(117, 183)); for(var i = 0; i < 10; i++) - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(4, 183)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(4, 183)); for(var i = 0; i < 10; i++) - map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new Point(-109, 183)); + map.spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), new Point(-109, 183)); cm.completeQuest(20718, 1103003); cm.gainExp(4000 * cm.getPlayer().getExpRate()); diff --git a/scripts/npc/1052001.js b/scripts/npc/1052001.js index 090f7ebc02..f70af17f2c 100644 --- a/scripts/npc/1052001.js +++ b/scripts/npc/1052001.js @@ -96,9 +96,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1061014.js b/scripts/npc/1061014.js index cc4410d375..20be342e85 100644 --- a/scripts/npc/1061014.js +++ b/scripts/npc/1061014.js @@ -28,8 +28,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -const exped = MapleExpeditionType.BALROG_NORMAL; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +const exped = ExpeditionType.BALROG_NORMAL; var expedName = "Balrog"; var expedBoss = "Balrog"; var expedMap = "Balrog's Tomb"; diff --git a/scripts/npc/1063000.js b/scripts/npc/1063000.js index 8fe5582c07..f33c77595b 100644 --- a/scripts/npc/1063000.js +++ b/scripts/npc/1063000.js @@ -34,8 +34,8 @@ function start() { cm.gainItem(4031025,10); } else { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(cm.getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(cm.getPlayer().getInventory(InventoryType.ETC).getNumFreeSlot() < 1) { cm.sendNext("Check for a available slot on your ETC inventory."); cm.dispose(); return; diff --git a/scripts/npc/1063001.js b/scripts/npc/1063001.js index f5b3d1ca3f..a73df68fe2 100644 --- a/scripts/npc/1063001.js +++ b/scripts/npc/1063001.js @@ -34,8 +34,8 @@ function start() { cm.gainItem(4031026,20); } else { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(cm.getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(cm.getPlayer().getInventory(InventoryType.ETC).getNumFreeSlot() < 1) { cm.sendNext("Check for a available slot on your ETC inventory."); cm.dispose(); return; diff --git a/scripts/npc/1063002.js b/scripts/npc/1063002.js index 18aaf916ce..858f9e6faa 100644 --- a/scripts/npc/1063002.js +++ b/scripts/npc/1063002.js @@ -34,8 +34,8 @@ function start() { cm.gainItem(4031028,30); } else { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(cm.getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(cm.getPlayer().getInventory(InventoryType.ETC).getNumFreeSlot() < 1) { cm.sendNext("Check for a available slot on your ETC inventory."); cm.dispose(); return; diff --git a/scripts/npc/1063017.js b/scripts/npc/1063017.js index 1597b528ad..080e4a17b5 100644 --- a/scripts/npc/1063017.js +++ b/scripts/npc/1063017.js @@ -31,7 +31,7 @@ function action(mode, type, selection) { } else { const MapleLifeFactoroy = Java.type('server.life.MapleLifeFactoroy'); const Point = Java.type('java.awt.Point'); - cm.getWarpMap(910510202).spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300346), new Point(95, 200)); + cm.getWarpMap(910510202).spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300346), new Point(95, 200)); cm.warp(910510202, 0); } diff --git a/scripts/npc/1090000.js b/scripts/npc/1090000.js index bb12416503..1bf421f35d 100644 --- a/scripts/npc/1090000.js +++ b/scripts/npc/1090000.js @@ -143,9 +143,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1091003.js b/scripts/npc/1091003.js index c3dcd1f73f..6d18bc1430 100644 --- a/scripts/npc/1091003.js +++ b/scripts/npc/1091003.js @@ -155,7 +155,7 @@ function action(mode, type, selection) { } else { var count = 0; - var iter = cm.getChar().getInventory(MapleInventoryType.ETC).listById(mats[i]).iterator(); + var iter = cm.getChar().getInventory(InventoryType.ETC).listById(mats[i]).iterator(); while (iter.hasNext()) { count += iter.next().getQuantity(); } @@ -166,7 +166,7 @@ function action(mode, type, selection) { } else { var count = 0; - var iter = cm.getChar().getInventory(MapleInventoryType.ETC).listById(mats).iterator(); + var iter = cm.getChar().getInventory(InventoryType.ETC).listById(mats).iterator(); while (iter.hasNext()) { count += iter.next().getQuantity(); } diff --git a/scripts/npc/11000.js b/scripts/npc/11000.js index a787830c55..4c2bad1fab 100644 --- a/scripts/npc/11000.js +++ b/scripts/npc/11000.js @@ -19,7 +19,7 @@ */ function start() { - const MapleShopFactory = Java.type('server.MapleShopFactory'); - MapleShopFactory.getInstance().getShop(11000).sendShop(cm.getClient()); + const ShopFactory = Java.type('server.ShopFactory'); + ShopFactory.getInstance().getShop(11000).sendShop(cm.getClient()); cm.dispose(); } diff --git a/scripts/npc/1102003.js b/scripts/npc/1102003.js index f1fe369d80..6877c2c906 100644 --- a/scripts/npc/1102003.js +++ b/scripts/npc/1102003.js @@ -65,9 +65,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/1104002.js b/scripts/npc/1104002.js index 52134cb4cc..8ec461eb7d 100644 --- a/scripts/npc/1104002.js +++ b/scripts/npc/1104002.js @@ -34,9 +34,9 @@ function action(mode, type, selection) { if (mode == 0 && type > 0) { cm.getPlayer().dropMessage(5, "Eleanor: Oh, lost the Empress and still challenging us? Now you've done it! Prepare yourself!!!"); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - mapobj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9001010), new Point(850, 0)); + mapobj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9001010), new Point(850, 0)); mapobj.destroyNPC(1104002); cm.dispose(); diff --git a/scripts/npc/1104100.js b/scripts/npc/1104100.js index 4a0a663049..01483a6148 100644 --- a/scripts/npc/1104100.js +++ b/scripts/npc/1104100.js @@ -63,8 +63,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/1104101.js b/scripts/npc/1104101.js index b6be6958fe..ee9ee252df 100644 --- a/scripts/npc/1104101.js +++ b/scripts/npc/1104101.js @@ -63,8 +63,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/1104102.js b/scripts/npc/1104102.js index c78f05607e..81f249e484 100644 --- a/scripts/npc/1104102.js +++ b/scripts/npc/1104102.js @@ -63,8 +63,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/1104103.js b/scripts/npc/1104103.js index 1ad5d6543a..5cfb08437f 100644 --- a/scripts/npc/1104103.js +++ b/scripts/npc/1104103.js @@ -63,8 +63,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/1104104.js b/scripts/npc/1104104.js index 5ee093086f..129ab86998 100644 --- a/scripts/npc/1104104.js +++ b/scripts/npc/1104104.js @@ -63,8 +63,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/1202010.js b/scripts/npc/1202010.js index f8d05c995c..7aa4b62473 100644 --- a/scripts/npc/1202010.js +++ b/scripts/npc/1202010.js @@ -37,9 +37,9 @@ function action(mode, type, selection) { return; } - const MaplePlayerNPC = Java.type('server.life.MaplePlayerNPC'); + const PlayerNPC = Java.type('server.life.PlayerNPC'); const GameConstants = Java.type('constants.game.GameConstants'); - if(MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { + if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) { cm.sendOk("There you go! Hope you will like it."); cm.gainMeso(-spawnPnpcFee); } else { diff --git a/scripts/npc/2010007.js b/scripts/npc/2010007.js index 5ea75f4e3a..bf00dc8234 100644 --- a/scripts/npc/2010007.js +++ b/scripts/npc/2010007.js @@ -58,8 +58,8 @@ function action(mode, type, selection) { cm.sendOk("You can only increase your Guild's capacity if you are the leader."); cm.dispose(); } else { - var MapleGuild = Java.type("net.server.guild.MapleGuild"); // thanks Conrad for noticing an issue due to call on a static method here - cm.sendYesNo("Increasing your Guild capacity by #b5#k costs #b " + MapleGuild.getIncreaseGuildCost(cm.getPlayer().getGuild().getCapacity()) +" mesos#k, are you sure you want to continue?"); + var Guild = Java.type("net.server.guild.Guild"); // thanks Conrad for noticing an issue due to call on a static method here + cm.sendYesNo("Increasing your Guild capacity by #b5#k costs #b " + Guild.getIncreaseGuildCost(cm.getPlayer().getGuild().getCapacity()) +" mesos#k, are you sure you want to continue?"); } } } else if (status == 2) { diff --git a/scripts/npc/2030013.js b/scripts/npc/2030013.js index b0ab2e5c5d..4770881445 100644 --- a/scripts/npc/2030013.js +++ b/scripts/npc/2030013.js @@ -29,8 +29,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -const exped = MapleExpeditionType.ZAKUM; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +const exped = ExpeditionType.ZAKUM; var expedName = "Zakum"; var expedBoss = "Zakum"; var expedMap = "Zakum's Altar"; diff --git a/scripts/npc/2042000.js b/scripts/npc/2042000.js index 7d0bc50950..72217204bd 100644 --- a/scripts/npc/2042000.js +++ b/scripts/npc/2042000.js @@ -500,8 +500,8 @@ function refineItems(refineType) { var refineFees = [[300,300,300,500,500,500,800,270],[500,500,500,500,500,500,500,1000,3000],[5000,5000,5000,5000,1000000]]; var itemCount = {}; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); @@ -554,8 +554,8 @@ function refineRockItems() { var rockItems = [4011007, 4021009]; var rockFees = [10000, 15000]; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); diff --git a/scripts/npc/2042001.js b/scripts/npc/2042001.js index c2b850a181..009f62b8fa 100644 --- a/scripts/npc/2042001.js +++ b/scripts/npc/2042001.js @@ -499,8 +499,8 @@ function refineItems(refineType) { var refineFees = [[300,300,300,500,500,500,800,270],[500,500,500,500,500,500,500,1000,3000],[5000,5000,5000,5000,1000000]]; var itemCount = {}; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); @@ -553,8 +553,8 @@ function refineRockItems() { var rockItems = [4011007, 4021009]; var rockFees = [10000, 15000]; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); diff --git a/scripts/npc/2042002.js b/scripts/npc/2042002.js index 64416da13d..54df3fe8fc 100644 --- a/scripts/npc/2042002.js +++ b/scripts/npc/2042002.js @@ -500,8 +500,8 @@ function refineItems(refineType) { var refineFees = [[300,300,300,500,500,500,800,270],[500,500,500,500,500,500,500,1000,3000],[5000,5000,5000,5000,1000000]]; var itemCount = {}; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); @@ -554,8 +554,8 @@ function refineRockItems() { var rockItems = [4011007, 4021009]; var rockFees = [10000, 15000]; - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var iter = cm.getPlayer().getInventory(MapleInventoryType.ETC).iterator(); + const InventoryType = Java.type('client.inventory.InventoryType'); + var iter = cm.getPlayer().getInventory(InventoryType.ETC).iterator(); while (iter.hasNext()) { var it = iter.next(); var itemid = it.getItemId(); diff --git a/scripts/npc/2081005.js b/scripts/npc/2081005.js index 84f4be4467..35cf8035ac 100644 --- a/scripts/npc/2081005.js +++ b/scripts/npc/2081005.js @@ -26,8 +26,8 @@ var status = 0; var price = 100000; function isTransformed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.MORPH) == 2210003; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.MORPH) == 2210003; } function start() { diff --git a/scripts/npc/2083004.js b/scripts/npc/2083004.js index 3d95f72be4..5c7d0f7ef0 100644 --- a/scripts/npc/2083004.js +++ b/scripts/npc/2083004.js @@ -29,8 +29,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -const exped = MapleExpeditionType.HORNTAIL; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +const exped = ExpeditionType.HORNTAIL; var expedName = "Horntail"; var expedBoss = "mighty Horntail"; diff --git a/scripts/npc/2101014.js b/scripts/npc/2101014.js index cf2588b614..59dec9e986 100644 --- a/scripts/npc/2101014.js +++ b/scripts/npc/2101014.js @@ -11,10 +11,10 @@ var arena; var arenaName; var type; var map; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -var exped = MapleExpeditionType.ARIANT; -var exped1 = MapleExpeditionType.ARIANT1; -var exped2 = MapleExpeditionType.ARIANT2; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +var exped = ExpeditionType.ARIANT; +var exped1 = ExpeditionType.ARIANT1; +var exped2 = ExpeditionType.ARIANT2; function start() { status = -1; @@ -103,17 +103,17 @@ function action(mode, type, selection) { function fetchArenaType() { switch (arenaType) { case 0 : - exped = MapleExpeditionType.ARIANT; + exped = ExpeditionType.ARIANT; expedicao = cm.getExpedition(exped); map = 980010100; break; case 1 : - exped = MapleExpeditionType.ARIANT1; + exped = ExpeditionType.ARIANT1; expedicao = cm.getExpedition(exped); map = 980010200; break; case 2 : - exped = MapleExpeditionType.ARIANT2; + exped = ExpeditionType.ARIANT2; expedicao = cm.getExpedition(exped); map = 980010300; break; @@ -174,7 +174,7 @@ function enterArena(arenaPlayers) { } function playerAlreadyInLobby(player) { - return cm.getExpedition(MapleExpeditionType.ARIANT) != null && cm.getExpedition(MapleExpeditionType.ARIANT).contains(player) || - cm.getExpedition(MapleExpeditionType.ARIANT1) != null && cm.getExpedition(MapleExpeditionType.ARIANT1).contains(player) || - cm.getExpedition(MapleExpeditionType.ARIANT2) != null && cm.getExpedition(MapleExpeditionType.ARIANT2).contains(player); + return cm.getExpedition(ExpeditionType.ARIANT) != null && cm.getExpedition(ExpeditionType.ARIANT).contains(player) || + cm.getExpedition(ExpeditionType.ARIANT1) != null && cm.getExpedition(ExpeditionType.ARIANT1).contains(player) || + cm.getExpedition(ExpeditionType.ARIANT2) != null && cm.getExpedition(ExpeditionType.ARIANT2).contains(player); } \ No newline at end of file diff --git a/scripts/npc/2101017.js b/scripts/npc/2101017.js index 27302f3aa6..1741dfb41b 100644 --- a/scripts/npc/2101017.js +++ b/scripts/npc/2101017.js @@ -10,7 +10,7 @@ var arena; var arenaName; var type; var map; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); var exped; var expedicao; var expedMembers; @@ -32,14 +32,14 @@ function action(mode, type, selection) { const GameConstants = Java.type('constants.game.GameConstants'); if (cm.getPlayer().getMapId() == 980010100 || cm.getPlayer().getMapId() == 980010200 || cm.getPlayer().getMapId() == 980010300) { if (cm.getPlayer().getMapId() == 980010100) { - exped = MapleExpeditionType.ARIANT; + exped = ExpeditionType.ARIANT; expedicao = cm.getExpedition(exped); } else if (cm.getPlayer().getMapId() == 980010200) { - exped = MapleExpeditionType.ARIANT1; + exped = ExpeditionType.ARIANT1; expedicao = cm.getExpedition(exped); } else { - exped = MapleExpeditionType.ARIANT2; + exped = ExpeditionType.ARIANT2; expedicao = cm.getExpedition(exped); } @@ -116,13 +116,13 @@ function action(mode, type, selection) { } } else if (GameConstants.isAriantColiseumArena(cm.getPlayer().getMapId())) { if (cm.getPlayer().getMapId() == 980010101) { - exped = MapleExpeditionType.ARIANT; + exped = ExpeditionType.ARIANT; expedicao = cm.getExpedition(exped); } else if (cm.getPlayer().getMapId() == 980010201) { - exped = MapleExpeditionType.ARIANT1; + exped = ExpeditionType.ARIANT1; expedicao = cm.getExpedition(exped); } else { - exped = MapleExpeditionType.ARIANT2; + exped = ExpeditionType.ARIANT2; expedicao = cm.getExpedition(exped); } if (status == 0) { diff --git a/scripts/npc/2103000.js b/scripts/npc/2103000.js index 3e386bcce7..c69c792dc4 100644 --- a/scripts/npc/2103000.js +++ b/scripts/npc/2103000.js @@ -22,8 +22,8 @@ function isTigunMorphed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.MORPH) == 2210005; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.MORPH) == 2210005; } function start() { diff --git a/scripts/npc/2111015.js b/scripts/npc/2111015.js index c6d54ae0ce..812d33690d 100644 --- a/scripts/npc/2111015.js +++ b/scripts/npc/2111015.js @@ -21,8 +21,8 @@ var status; function isPillUsed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.HPREC) == 2022198; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.HPREC) == 2022198; } function start() { diff --git a/scripts/npc/2112000.js b/scripts/npc/2112000.js index 44054dc213..cff92a9965 100644 --- a/scripts/npc/2112000.js +++ b/scripts/npc/2112000.js @@ -90,7 +90,7 @@ function action(mode, type, selection) { } else { var state = eim.getIntProperty("yuletePassed"); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if(state == -1) { cm.sendOk("Behold! The pinnacle of Magatia's alchemy studies! Hahahahahahaha..."); @@ -99,7 +99,7 @@ function action(mode, type, selection) { eim.dropMessage(5, "Yulete: I present you my newest weapon, brought by the finest alchemy, Frankenroid!"); var mapobj = eim.getMapInstance(926100401); - var bossobj = MapleLifeFactory.getMonster(9300139); + var bossobj = LifeFactory.getMonster(9300139); //mapobj.spawnMonsterWithEffect(bossobj, 13, new Packages.java.awt.Point(250, 100)); mapobj.spawnMonsterOnGroundBelow(bossobj, new Point(250, 100)); @@ -111,7 +111,7 @@ function action(mode, type, selection) { eim.dropMessage(5, "Yulete: I present you my newest weapon, brought by the finest combined alchemy of Alcadno's and Zenumist's, those that the boring people of Magatia societies have banned to bring along, the mighty Frankenroid!!"); var mapobj = eim.getMapInstance(926100401); - var bossobj = MapleLifeFactory.getMonster(9300140); + var bossobj = LifeFactory.getMonster(9300140); //mapobj.spawnMonsterWithEffect(bossobj, 14, new Packages.java.awt.Point(250, 100)); mapobj.spawnMonsterOnGroundBelow(bossobj, new Point(250, 100)); diff --git a/scripts/npc/2112010.js b/scripts/npc/2112010.js index bbde5fcd92..7a1e226dd3 100644 --- a/scripts/npc/2112010.js +++ b/scripts/npc/2112010.js @@ -90,7 +90,7 @@ function action(mode, type, selection) { } else { var state = eim.getIntProperty("yuletePassed"); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if(state == -1) { cm.sendOk("Behold! The pinnacle of Magatia's alchemy studies! Hahahahahahaha..."); @@ -99,7 +99,7 @@ function action(mode, type, selection) { eim.dropMessage(5, "Yulete: I present you my newest weapon, brought by the finest alchemy, Frankenroid!"); var mapobj = eim.getMapInstance(926110401); - var bossobj = MapleLifeFactory.getMonster(9300151); + var bossobj = LifeFactory.getMonster(9300151); mapobj.spawnMonsterOnGroundBelow(bossobj, new Point(250, 100)); eim.setIntProperty("statusStg7", 1); @@ -109,7 +109,7 @@ function action(mode, type, selection) { eim.dropMessage(5, "Yulete: I present you my newest weapon, brought by the finest combined alchemy of Alcadno's and Zenumist's, those that the boring people of Magatia societies have banned to bring along, the mighty Frankenroid!!"); var mapobj = eim.getMapInstance(926110401); - var bossobj = MapleLifeFactory.getMonster(9300152); + var bossobj = LifeFactory.getMonster(9300152); mapobj.spawnMonsterOnGroundBelow(bossobj, new Point(250, 100)); eim.setIntProperty("statusStg7", 2); diff --git a/scripts/npc/2141001.js b/scripts/npc/2141001.js index 2e94159166..4e2785fbdc 100644 --- a/scripts/npc/2141001.js +++ b/scripts/npc/2141001.js @@ -31,8 +31,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -var exped = MapleExpeditionType.PINKBEAN; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +var exped = ExpeditionType.PINKBEAN; var expedName = "Twilight of the Gods"; var expedBoss = "Pink Bean"; var expedMap = "Twilight of Gods"; diff --git a/scripts/npc/9000019.js b/scripts/npc/9000019.js index 07f0e8658b..ffc677a148 100644 --- a/scripts/npc/9000019.js +++ b/scripts/npc/9000019.js @@ -19,8 +19,8 @@ function action(mode, type, selection) { status--; if(status == 0) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(cm.getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(cm.getPlayer().getInventory(InventoryType.ETC).getNumFreeSlot() < 1) { cm.sendNext("Check for a available slot on your ETC inventory."); cm.dispose(); return; diff --git a/scripts/npc/9040006.js b/scripts/npc/9040006.js index 8ddaff03ec..40c2584222 100644 --- a/scripts/npc/9040006.js +++ b/scripts/npc/9040006.js @@ -211,8 +211,8 @@ function randX() { } function spawnMob(id, x, y, map) { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/npc/9105004.js b/scripts/npc/9105004.js index a5acf4577f..772198f428 100644 --- a/scripts/npc/9105004.js +++ b/scripts/npc/9105004.js @@ -129,7 +129,7 @@ function insidePqAction(mode, type, selection) { } } } else if(status == 1) { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if(stg == -1) { @@ -140,7 +140,7 @@ function insidePqAction(mode, type, selection) { } mapobj.allowSummonState(true); - var snowman = MapleLifeFactory.getMonster(9400317 + (5 * difficulty)); + var snowman = LifeFactory.getMonster(9400317 + (5 * difficulty)); mapobj.spawnMonsterOnGroundBelow(snowman, new Point(-180, 15)); eim.setIntProperty("snowmanLevel", 1); eim.dropMessage(5, "The snowman appeared on the field! Protect it using all means necessary!"); @@ -158,7 +158,7 @@ function insidePqAction(mode, type, selection) { mapobj.broadcastStringMessage(5, "As the snowman grows to it's prime, the Scrooge appears!"); eim.getEm().getIv().invokeFunction("snowmanHeal", eim); - var boss = MapleLifeFactory.getMonster(9400318 + difficulty); + var boss = LifeFactory.getMonster(9400318 + difficulty); mapobj.spawnMonsterOnGroundBelow(boss, new Point(-180, 15)); eim.setProperty("spawnedBoss", "true"); diff --git a/scripts/npc/9120201.js b/scripts/npc/9120201.js index 38b8e6d57f..90d4d67821 100644 --- a/scripts/npc/9120201.js +++ b/scripts/npc/9120201.js @@ -28,8 +28,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -var exped = MapleExpeditionType.SHOWA; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +var exped = ExpeditionType.SHOWA; var expedName = "Showa Gang"; var expedBoss = "The Boss"; var expedMap = "Nightmarish Last Days"; diff --git a/scripts/npc/9201044.js b/scripts/npc/9201044.js index 2c2b724312..b39df0da47 100644 --- a/scripts/npc/9201044.js +++ b/scripts/npc/9201044.js @@ -37,7 +37,7 @@ function spawnMobs(maxSpawn) { var spawnPosY; var mapObj = cm.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); if (stage == 2) { spawnPosX = [619, 299, 47, -140, -471]; @@ -45,9 +45,9 @@ function spawnMobs(maxSpawn) { for(var i = 0; i < 5; i++) { for(var j = 0; j < 2; j++) { - var mobObj1 = MapleLifeFactory.getMonster(9400515); - var mobObj2 = MapleLifeFactory.getMonster(9400516); - var mobObj3 = MapleLifeFactory.getMonster(9400517); + var mobObj1 = LifeFactory.getMonster(9400515); + var mobObj2 = LifeFactory.getMonster(9400516); + var mobObj3 = LifeFactory.getMonster(9400517); mapObj.spawnMonsterOnGroundBelow(mobObj1, new Point(spawnPosX[i], spawnPosY[i])); mapObj.spawnMonsterOnGroundBelow(mobObj2, new Point(spawnPosX[i], spawnPosY[i])); @@ -62,7 +62,7 @@ function spawnMobs(maxSpawn) { var rndMob = 9400519 + Math.floor(Math.random() * 4); var rndPos = Math.floor(Math.random() * 5); - var mobObj = MapleLifeFactory.getMonster(rndMob); + var mobObj = LifeFactory.getMonster(rndMob); mapObj.spawnMonsterOnGroundBelow(mobObj, new Point(spawnPosX[rndPos], spawnPosY[rndPos])); } } diff --git a/scripts/npc/9201047.js b/scripts/npc/9201047.js index faa4730731..cb780bbcb1 100644 --- a/scripts/npc/9201047.js +++ b/scripts/npc/9201047.js @@ -66,9 +66,9 @@ function action(mode, type, selection) { var mapObj = cm.getMap(); mapObj.toggleDrops(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mobObj = MapleLifeFactory.getMonster(9400518); + var mobObj = LifeFactory.getMonster(9400518); mapObj.spawnMonsterOnGroundBelow(mobObj, new Point(-245, 810)); cm.sendOk("The fierry appeared! Defeat it to get the #b#t4031596##k!"); diff --git a/scripts/npc/9201113.js b/scripts/npc/9201113.js index 21f6bfaca5..3164a0babf 100644 --- a/scripts/npc/9201113.js +++ b/scripts/npc/9201113.js @@ -29,8 +29,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -var cwkpq = MapleExpeditionType.CWKPQ; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +var cwkpq = ExpeditionType.CWKPQ; var list = "What would you like to do?#b\r\n\r\n#L1#View current Expedition members#l\r\n#L2#Start the fight!#l\r\n#L3#Stop the expedition.#l"; function start() { diff --git a/scripts/npc/9270047.js b/scripts/npc/9270047.js index c7cc73c902..d70ec6468a 100644 --- a/scripts/npc/9270047.js +++ b/scripts/npc/9270047.js @@ -29,8 +29,8 @@ var expedition; var expedMembers; var player; var em; -const MapleExpeditionType = Java.type('server.expeditions.MapleExpeditionType'); -var exped = MapleExpeditionType.SCARGA; +const ExpeditionType = Java.type('server.expeditions.ExpeditionType'); +var exped = ExpeditionType.SCARGA; var expedName = "Scarga"; var expedBoss = "Scarlion and Targa"; var expedMap = "Spooky World"; diff --git a/scripts/npc/changeName.js b/scripts/npc/changeName.js index a684dc9b1e..add15d283d 100644 --- a/scripts/npc/changeName.js +++ b/scripts/npc/changeName.js @@ -47,8 +47,8 @@ function action(mode, type, selection) { } else if(status == 2) { var text = cm.getText(); - const MapleCharacter = Java.type('client.MapleCharacter'); - var canCreate = MapleCharacter.canCreateChar(text); + const Character = Java.type('client.Character'); + var canCreate = Character.canCreateChar(text); if(canCreate) { cm.getPlayer().setName(text); cm.sendOk("Your name has been changed to #b" + text + "#k. You will have to login again for this to take effect.", 1); diff --git a/scripts/npc/gachaponInfo.js b/scripts/npc/gachaponInfo.js index 68dad89a8d..a803118eaa 100644 --- a/scripts/npc/gachaponInfo.js +++ b/scripts/npc/gachaponInfo.js @@ -27,9 +27,9 @@ var status; var gachaMessages; function start() { - const MapleGachapon = Java.type('server.gachapon.MapleGachapon'); - gachaMessages = MapleGachapon.Gachapon.getLootInfo(); - gachas = MapleGachapon.Gachapon.values(); + const Gachapon = Java.type('server.gachapon.Gachapon'); + gachaMessages = Gachapon.GachaponType.getLootInfo(); + gachas = Gachapon.GachaponType.values(); status = -1; action(1, 0, 0); diff --git a/scripts/npc/scroll_generator.js b/scripts/npc/scroll_generator.js index eeeaa5014b..9b7fb4b97f 100644 --- a/scripts/npc/scroll_generator.js +++ b/scripts/npc/scroll_generator.js @@ -207,8 +207,8 @@ function getScrollSuccessTier(scrollStats) { function getAvailableScrollsPool(baseScrolls, rewardTier, successTier) { var scrolls = []; - const MapleItemInformationProvider = Java.type('server.MapleItemInformationProvider'); - var ii = MapleItemInformationProvider.getInstance(); + const ItemInformationProvider = Java.type('server.ItemInformationProvider'); + var ii = ItemInformationProvider.getInstance(); for (var i = 0; i < baseScrolls.length; i++) { for (var j = 0; j < 100; j++) { @@ -244,9 +244,9 @@ function getPlayerCardTierPower() { countTier[ceTier] += ce.getValue(); if (ceTier >= 8) { // is special card - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - const MapleItemInformationProvider = Java.type('server.MapleItemInformationProvider'); - var mobLevel = MapleLifeFactory.getMonsterLevel(MapleItemInformationProvider.getInstance().getCardMobId(cardid)); + const LifeFactory = Java.type('server.life.LifeFactory'); + const ItemInformationProvider = Java.type('server.ItemInformationProvider'); + var mobLevel = LifeFactory.getMonsterLevel(ItemInformationProvider.getInstance().getCardMobId(cardid)); var mobTier = getLevelTier(mobLevel) - 1; countTier[mobTier] += (ce.getValue() * 1.2); @@ -421,8 +421,8 @@ function performExchange(sgItemid, sgCount) { } function generateRandomScroll() { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if (cm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() >= 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if (cm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() >= 1) { var itemid = getRandomScroll(calculateScrollTiers()); if (itemid != -1) { if (performExchange(itemid, 1)) { diff --git a/scripts/npc/waterOfLife.js b/scripts/npc/waterOfLife.js index 42209c9206..fbeb877ec4 100644 --- a/scripts/npc/waterOfLife.js +++ b/scripts/npc/waterOfLife.js @@ -77,8 +77,8 @@ function action(mode, type, selection) { if(sPet != null) { cm.sendNext("Your doll has now reawaken as your pet! However, my magic isn't perfect, so I can't promise an eternal life for your pet... Please take care of that pet before the Water of Life dries. Well then, good bye..."); - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - var it = cm.getPlayer().getInventory(MapleInventoryType.CASH).getItem(sPet.getPosition()); + const InventoryType = Java.type('client.inventory.InventoryType'); + var it = cm.getPlayer().getInventory(InventoryType.CASH).getItem(sPet.getPosition()); it.setExpiration(Date.now() + (1000 * 60 * 60 * 24 * 90)); cm.getPlayer().forceUpdateItem(it); diff --git a/scripts/portal/aranTutorOut1.js b/scripts/portal/aranTutorOut1.js index 8274494d9e..1e9c7001d2 100644 --- a/scripts/portal/aranTutorOut1.js +++ b/scripts/portal/aranTutorOut1.js @@ -6,7 +6,7 @@ function enter(pi) { //lol nexon does this xD pi.teachSkill(20000017, 0, -1, -1); pi.teachSkill(20000018, 0, -1, -1); - //nexon sends updatePlayerStats MapleStat.AVAILABLESP 0 + //nexon sends updatePlayerStats Stat.AVAILABLESP 0 pi.teachSkill(20000017, 1, 0, -1); pi.teachSkill(20000018, 1, 0, -1); //actually nexon does enableActions here :P diff --git a/scripts/portal/aranTutorOut2.js b/scripts/portal/aranTutorOut2.js index 0947796690..dc2d184418 100644 --- a/scripts/portal/aranTutorOut2.js +++ b/scripts/portal/aranTutorOut2.js @@ -2,7 +2,7 @@ function enter(pi) { //lol nexon does this xD pi.teachSkill(20000014, 0, -1, -1); pi.teachSkill(20000015, 0, -1, -1); - //nexon sends updatePlayerStats MapleStat.AVAILABLESP 0 + //nexon sends updatePlayerStats Stat.AVAILABLESP 0 pi.teachSkill(20000014, 1, 0, -1); pi.teachSkill(20000015, 1, 0, -1); //actually nexon does enableActions here :P diff --git a/scripts/portal/aranTutorOut3.js b/scripts/portal/aranTutorOut3.js index e6747dfe6a..f1f71ad9b4 100644 --- a/scripts/portal/aranTutorOut3.js +++ b/scripts/portal/aranTutorOut3.js @@ -1,7 +1,7 @@ function enter(pi) { //lol nexon does this xD pi.teachSkill(20000016, 0, -1, -1); - //nexon sends updatePlayerStats MapleStat.AVAILABLESP 0 + //nexon sends updatePlayerStats Stat.AVAILABLESP 0 pi.teachSkill(20000016, 1, 0, -1); //actually nexon does enableActions here :P pi.playPortalSound(); pi.warp(914000220, 1); diff --git a/scripts/portal/ariant_queens.js b/scripts/portal/ariant_queens.js index 67a0deb58c..053b2f23f7 100644 --- a/scripts/portal/ariant_queens.js +++ b/scripts/portal/ariant_queens.js @@ -19,8 +19,8 @@ */ function isTigunMorphed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.MORPH) == 2210005; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.MORPH) == 2210005; } function enter(pi) { diff --git a/scripts/portal/davy_next4.js b/scripts/portal/davy_next4.js index a7cfc46440..6bf9207c57 100644 --- a/scripts/portal/davy_next4.js +++ b/scripts/portal/davy_next4.js @@ -7,10 +7,10 @@ function enter(pi) { var chests = parseInt(eim.getProperty("openedChests")); var boss; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - if(chests == 0) boss = MapleLifeFactory.getMonster(9300119); //lord pirate - else if(chests == 1) boss = MapleLifeFactory.getMonster(9300105); //angry lord pirate - else boss = MapleLifeFactory.getMonster(9300106); //enraged lord pirate + const LifeFactory = Java.type('server.life.LifeFactory'); + if(chests == 0) boss = LifeFactory.getMonster(9300119); //lord pirate + else if(chests == 1) boss = LifeFactory.getMonster(9300105); //angry lord pirate + else boss = LifeFactory.getMonster(9300106); //enraged lord pirate boss.changeDifficulty(level, true); diff --git a/scripts/portal/enterInfo.js b/scripts/portal/enterInfo.js index aedd9c1f75..6b6026054b 100644 --- a/scripts/portal/enterInfo.js +++ b/scripts/portal/enterInfo.js @@ -1,9 +1,9 @@ function enter(pi) { var mapobj = pi.getWarpMap(104000004); if(pi.isQuestActive(21733) && pi.getQuestProgressInt(21733, 9300345) == 0 && mapobj.countMonsters() == 0) { - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - mapobj.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300345), new Point(0, 0)); + mapobj.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300345), new Point(0, 0)); pi.setQuestProgress(21733, 21762, 2); } diff --git a/scripts/portal/enterMCave.js b/scripts/portal/enterMCave.js index 34d720b36f..51189a3ef8 100644 --- a/scripts/portal/enterMCave.js +++ b/scripts/portal/enterMCave.js @@ -34,8 +34,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/portal/enterNepenthes.js b/scripts/portal/enterNepenthes.js index 7a5f1393b2..1a673381bb 100644 --- a/scripts/portal/enterNepenthes.js +++ b/scripts/portal/enterNepenthes.js @@ -7,9 +7,9 @@ function enter(pi) { mapobj1.resetPQ(1); mapobj2.resetPQ(1); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - mapobj2.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300348), new Point(591, -34)); + mapobj2.spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300348), new Point(591, -34)); pi.playPortalSound(); pi.warp(920030000,2); return true; diff --git a/scripts/portal/enterPort.js b/scripts/portal/enterPort.js index d162cc1529..2bc63eee5b 100644 --- a/scripts/portal/enterPort.js +++ b/scripts/portal/enterPort.js @@ -42,8 +42,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/quest/2001.js b/scripts/quest/2001.js index 1eaf42574a..a4551592ab 100644 --- a/scripts/quest/2001.js +++ b/scripts/quest/2001.js @@ -15,8 +15,8 @@ function end(mode, type, selection) { } else if(status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() < 1) { qm.getPlayer().dropMessage(1, "USE inventory full."); qm.dispose(); return; @@ -25,11 +25,11 @@ function end(mode, type, selection) { var talkStr = "Okay, now choose the scroll of your liking ... The odds of winning are 10% each. \r\n\r\n#rSELECT A ITEM\r\n#b"; stance = qm.getPlayer().getJobStyle(); - const MapleJob = Java.type('client.MapleJob'); - if(stance == MapleJob.WARRIOR || stance == MapleJob.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); - else if(stance == MapleJob.MAGICIAN) vecItem = new Array(2043702, 2043802); - else if(stance == MapleJob.BOWMAN || stance == MapleJob.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); - else if(stance == MapleJob.THIEF) vecItem = new Array(2043302, 2044702); + const Job = Java.type('client.Job'); + if(stance == Job.WARRIOR || stance == Job.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); + else if(stance == Job.MAGICIAN) vecItem = new Array(2043702, 2043802); + else if(stance == Job.BOWMAN || stance == Job.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); + else if(stance == Job.THIEF) vecItem = new Array(2043302, 2044702); else vecItem = new Array(2044802, 2044902); for (var i = 0; i < vecItem.length; i++) diff --git a/scripts/quest/20101.js b/scripts/quest/20101.js index 0a77f931d2..7c4f02cf44 100644 --- a/scripts/quest/20101.js +++ b/scripts/quest/20101.js @@ -37,8 +37,8 @@ function end(mode, type, selection) { qm.gainItem(1302077, 1); qm.gainItem(1142066, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.changeJob(MapleJob.DAWNWARRIOR1); + const Job = Java.type('client.Job'); + qm.changeJob(Job.DAWNWARRIOR1); qm.getPlayer().resetStats(); } qm.forceCompleteQuest(); diff --git a/scripts/quest/20102.js b/scripts/quest/20102.js index 0435dacb0f..ad28095c09 100644 --- a/scripts/quest/20102.js +++ b/scripts/quest/20102.js @@ -37,8 +37,8 @@ function end(mode, type, selection) { qm.gainItem(1372043, 1); qm.gainItem(1142066, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.changeJob(MapleJob.BLAZEWIZARD1); + const Job = Java.type('client.Job'); + qm.changeJob(Job.BLAZEWIZARD1); qm.getPlayer().resetStats(); } qm.forceCompleteQuest(); diff --git a/scripts/quest/20103.js b/scripts/quest/20103.js index 6fc2b0e5b0..6e7971dd96 100644 --- a/scripts/quest/20103.js +++ b/scripts/quest/20103.js @@ -38,8 +38,8 @@ function end(mode, type, selection) { qm.gainItem(2060000, 2000); qm.gainItem(1452051, 1); qm.gainItem(1142066, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.changeJob(MapleJob.WINDARCHER1); + const Job = Java.type('client.Job'); + qm.changeJob(Job.WINDARCHER1); qm.getPlayer().resetStats(); } qm.forceCompleteQuest(); diff --git a/scripts/quest/20104.js b/scripts/quest/20104.js index 8e84d797bd..453d8eba51 100644 --- a/scripts/quest/20104.js +++ b/scripts/quest/20104.js @@ -38,8 +38,8 @@ function end(mode, type, selection) { qm.gainItem(1472061, 1); qm.gainItem(2070000, 800); qm.gainItem(1142066, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.changeJob(MapleJob.NIGHTWALKER1); + const Job = Java.type('client.Job'); + qm.changeJob(Job.NIGHTWALKER1); qm.getPlayer().resetStats(); } qm.forceCompleteQuest(); diff --git a/scripts/quest/20105.js b/scripts/quest/20105.js index 3d9ee17190..1b761cd52d 100644 --- a/scripts/quest/20105.js +++ b/scripts/quest/20105.js @@ -37,8 +37,8 @@ function end(mode, type, selection) { qm.gainItem(1482014, 1); qm.gainItem(1142066, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.THUNDERBREAKER1); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.THUNDERBREAKER1); qm.getPlayer().resetStats(); } qm.forceCompleteQuest(); diff --git a/scripts/quest/20201.js b/scripts/quest/20201.js index 32be42207f..1a8899550f 100644 --- a/scripts/quest/20201.js +++ b/scripts/quest/20201.js @@ -54,8 +54,8 @@ function end(mode, type, selection) { } qm.gainItem(4032096, -30); qm.gainItem(1142067, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.DAWNWARRIOR2); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.DAWNWARRIOR2); qm.completeQuest(); } qm.sendNext("You are a Knight-in-Training no more. You are now an official knight of the Cygnus Knights."); diff --git a/scripts/quest/20202.js b/scripts/quest/20202.js index 818e6d44df..0a10d40e41 100644 --- a/scripts/quest/20202.js +++ b/scripts/quest/20202.js @@ -54,8 +54,8 @@ function end(mode, type, selection) { } qm.gainItem(4032097, -30); qm.gainItem(1142067, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.BLAZEWIZARD2); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.BLAZEWIZARD2); qm.completeQuest(); } qm.sendNext("You are no longer a Knight-in-Training. You are now an official Cygnus Knight!"); diff --git a/scripts/quest/20203.js b/scripts/quest/20203.js index e39be7bd65..228b7d2d21 100644 --- a/scripts/quest/20203.js +++ b/scripts/quest/20203.js @@ -54,8 +54,8 @@ function end(mode, type, selection) { } qm.gainItem(4032098, -30); qm.gainItem(1142067, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.WINDARCHER2); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.WINDARCHER2); qm.completeQuest(); } qm.sendNext("You are no longer a Knight-in-Training. You are now officially a Cygnus Knight."); diff --git a/scripts/quest/20204.js b/scripts/quest/20204.js index 58a995c9df..9813d9e9a4 100644 --- a/scripts/quest/20204.js +++ b/scripts/quest/20204.js @@ -54,8 +54,8 @@ function end(mode, type, selection) { } qm.gainItem(4032099, -30); qm.gainItem(1142067, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.NIGHTWALKER2); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.NIGHTWALKER2); qm.completeQuest(); } qm.sendNext("You are no longer a Knight-in-Training. You have officially become a Cygnus Knight."); diff --git a/scripts/quest/20205.js b/scripts/quest/20205.js index c9c5cc94be..6920a99641 100644 --- a/scripts/quest/20205.js +++ b/scripts/quest/20205.js @@ -54,8 +54,8 @@ function end(mode, type, selection) { } qm.gainItem(4032100, -30); qm.gainItem(1142067, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.THUNDERBREAKER2); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.THUNDERBREAKER2); qm.completeQuest(); } qm.sendNext("You are now no longer a Knight-in-Training. You have now officially become a Cygnus Knight."); diff --git a/scripts/quest/20311.js b/scripts/quest/20311.js index 5a7723caef..8a7b53ed22 100644 --- a/scripts/quest/20311.js +++ b/scripts/quest/20311.js @@ -54,8 +54,8 @@ function start(mode, type, selection) { } else { qm.completeQuest(); qm.gainItem(1142068, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.DAWNWARRIOR3); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.DAWNWARRIOR3); qm.sendOk("#h #, as of this moment, you are an Advanced Knight. From this moment on, you shall carry yourself with dignity and respect befitting your new title, an Advanced Knight of Cygnus Knights. May your glory continue to shine as bright as this moment."); } } diff --git a/scripts/quest/20312.js b/scripts/quest/20312.js index 1f5fcdbe21..1391a51685 100644 --- a/scripts/quest/20312.js +++ b/scripts/quest/20312.js @@ -54,8 +54,8 @@ function start(mode, type, selection) { } else { qm.completeQuest(); qm.gainItem(1142068, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.BLAZEWIZARD3); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.BLAZEWIZARD3); qm.sendOk("#h #, as of this moment, you are an Advanced Knight. From this moment on, you will train yourself with fervor as you will lead your group of Knights for the safety of this world. That fervor will provide you with plenty of courage."); } } diff --git a/scripts/quest/20313.js b/scripts/quest/20313.js index 8f87176ee8..156bcc527a 100644 --- a/scripts/quest/20313.js +++ b/scripts/quest/20313.js @@ -54,8 +54,8 @@ function start(mode, type, selection) { } else { qm.completeQuest(); qm.gainItem(1142068, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.WINDARCHER3); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.WINDARCHER3); qm.sendOk("#h #, as of this moment, you are an Advanced Knight. From this moment on, you will be carrying a while lot of responsibility befitting your new title as an Advanced Knight of Cygnus Knights. You may view the world in a carefree mode, but please remember what your mission is."); } } diff --git a/scripts/quest/20314.js b/scripts/quest/20314.js index 785fbbda4b..c0f9b50d5b 100644 --- a/scripts/quest/20314.js +++ b/scripts/quest/20314.js @@ -53,8 +53,8 @@ function start(mode, type, selection) { qm.sendNext("If you wish to receive the medal befitting the title, you may want to make some room in your equipment inventory."); } else { qm.gainItem(1142068, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.NIGHTWALKER3); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.NIGHTWALKER3); qm.completeQuest(); qm.sendOk("#h #, from here on out, you are an Advanced Knight of Cygnus Knights. The title comes with a newfound broad view on everything. You may encounter temptations here and there, but I want you to keep your faith and beliefs intact and do not succumb to the darkness."); } diff --git a/scripts/quest/20315.js b/scripts/quest/20315.js index bccbc89910..ea3d066580 100644 --- a/scripts/quest/20315.js +++ b/scripts/quest/20315.js @@ -53,8 +53,8 @@ function start(mode, type, selection) { qm.sendNext("If you wish to receive the medal befitting the title, you may want to make some room in your equipment inventory."); } else { qm.gainItem(1142068, 1); - const MapleJob = Java.type('client.MapleJob'); - qm.getPlayer().changeJob(MapleJob.THUNDERBREAKER3); + const Job = Java.type('client.Job'); + qm.getPlayer().changeJob(Job.THUNDERBREAKER3); qm.completeQuest(); qm.sendOk("#h #, from here on out, you will become an Advanced Knight of the Knights of Cygnus! As your standing rises, so does the difficulty of the tasks you will be receiving. But challenge is good, right? You have to enjoy life. Enjoy what's given to you!"); } diff --git a/scripts/quest/2034.js b/scripts/quest/2034.js index 49d013c6b0..2f12e04233 100644 --- a/scripts/quest/2034.js +++ b/scripts/quest/2034.js @@ -14,8 +14,8 @@ function end(mode, type, selection) { } else if(status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.EQUIP).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.EQUIP).getNumFreeSlot() < 1) { qm.sendOk("Please free a EQUIP inventory slot to receive the reward."); qm.dispose(); return; @@ -23,12 +23,12 @@ function end(mode, type, selection) { var stance = qm.getPlayer().getJobStyle(); - const MapleJob = Java.type('client.MapleJob'); - if(stance == MapleJob.WARRIOR) item = 1072003; - else if(stance == MapleJob.MAGICIAN) item = 1072077; - else if(stance == MapleJob.BOWMAN || stance == MapleJob.CROSSBOWMAN) item = 1072081; - else if(stance == MapleJob.THIEF) item = 1072035; - else if(stance == MapleJob.BRAWLER || stance == MapleJob.GUNSLINGER) item = 1072294; + const Job = Java.type('client.Job'); + if(stance == Job.WARRIOR) item = 1072003; + else if(stance == Job.MAGICIAN) item = 1072077; + else if(stance == Job.BOWMAN || stance == Job.CROSSBOWMAN) item = 1072081; + else if(stance == Job.THIEF) item = 1072035; + else if(stance == Job.BRAWLER || stance == Job.GUNSLINGER) item = 1072294; else item = 1072018; qm.gainItem(item, 1); diff --git a/scripts/quest/20514.js b/scripts/quest/20514.js index b487c7a658..2584f4c9ac 100644 --- a/scripts/quest/20514.js +++ b/scripts/quest/20514.js @@ -37,8 +37,8 @@ function raiseOpen() { } if (diffExp > 0) { // thanks IxianMace for noticing Mimiana egg not following progress by EXP - const MapleItemInformationProvider = Java.type('server.MapleItemInformationProvider'); - var consItem = MapleItemInformationProvider.getInstance().getQuestConsumablesInfo(4220137); + const ItemInformationProvider = Java.type('server.ItemInformationProvider'); + var consItem = ItemInformationProvider.getInstance().getQuestConsumablesInfo(4220137); var exp = consItem.exp; var grade = consItem.grade; diff --git a/scripts/quest/21401.js b/scripts/quest/21401.js index 380cc7a6aa..f939cfd9d5 100644 --- a/scripts/quest/21401.js +++ b/scripts/quest/21401.js @@ -75,8 +75,8 @@ function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); const Point = Java.type('java.awt.Point'); - var mob = MapleLifeFactory.getMonster(id); + var mob = LifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/quest/3239.js b/scripts/quest/3239.js index 2ba8548747..6abc08e0d1 100644 --- a/scripts/quest/3239.js +++ b/scripts/quest/3239.js @@ -17,8 +17,8 @@ function end(mode, type, selection) { if (status == 0) { if (qm.haveItem(4031092, 10)) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if (qm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() >= 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if (qm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() >= 1) { qm.sendOk("Well done! You brought back all the #t4031092# that were missing. Here, take this scroll as a token of my gratitude..."); } else { qm.sendOk("Free a space on your USE inventory before receiving your prize."); diff --git a/scripts/quest/3314.js b/scripts/quest/3314.js index f54e2b99b0..f0c4746ade 100644 --- a/scripts/quest/3314.js +++ b/scripts/quest/3314.js @@ -21,8 +21,8 @@ var status = -1; function isPillUsed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.HPREC) == 2022198; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.HPREC) == 2022198; } function end(mode, type, selection) { diff --git a/scripts/quest/3414.js b/scripts/quest/3414.js index a39808d21b..3e8a966ef4 100644 --- a/scripts/quest/3414.js +++ b/scripts/quest/3414.js @@ -15,8 +15,8 @@ function end(mode, type, selection) { } else if(status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() < 1) { qm.getPlayer().dropMessage(1, "USE inventory full."); qm.dispose(); return; @@ -25,11 +25,11 @@ function end(mode, type, selection) { var talkStr = "Here, please select the scroll of your choice. All success rates are at 10%. \r\n\r\n#rSELECT A ITEM\r\n#b" stance = qm.getPlayer().getJobStyle(); - const MapleJob = Java.type('client.MapleJob'); - if(stance == MapleJob.WARRIOR || stance == MapleJob.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); - else if(stance == MapleJob.MAGICIAN) vecItem = new Array(2043702, 2043802); - else if(stance == MapleJob.BOWMAN || stance == MapleJob.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); - else if(stance == MapleJob.THIEF) vecItem = new Array(2043302, 2044702); + const Job = Java.type('client.Job'); + if(stance == Job.WARRIOR || stance == Job.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); + else if(stance == Job.MAGICIAN) vecItem = new Array(2043702, 2043802); + else if(stance == Job.BOWMAN || stance == Job.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); + else if(stance == Job.THIEF) vecItem = new Array(2043302, 2044702); else vecItem = new Array(2044802, 2044902); for (var i = 0; i < vecItem.length; i++) diff --git a/scripts/quest/3414_free10rate.js b/scripts/quest/3414_free10rate.js index 22bb951a07..95d39af1da 100644 --- a/scripts/quest/3414_free10rate.js +++ b/scripts/quest/3414_free10rate.js @@ -18,11 +18,11 @@ function end(mode, type, selection) { var talkStr = "Here, please select the scroll of your choice. All success rates are at 10%. \r\n\r\n#rSELECT A ITEM\r\n#b" stance = qm.getPlayer().getJobStyle(); - const MapleJob = Java.type('client.MapleJob'); - if(stance == MapleJob.WARRIOR || stance == MapleJob.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); - else if(stance == MapleJob.MAGICIAN) vecItem = new Array(2043702, 2043802); - else if(stance == MapleJob.BOWMAN || stance == MapleJob.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); - else if(stance == MapleJob.THIEF) vecItem = new Array(2043302, 2044702); + const Job = Java.type('client.Job'); + if(stance == Job.WARRIOR || stance == Job.BEGINNER) vecItem = new Array(2043002, 2043102, 2043202, 2044002, 2044102, 2044202, 2044402, 2044302); + else if(stance == Job.MAGICIAN) vecItem = new Array(2043702, 2043802); + else if(stance == Job.BOWMAN || stance == Job.CROSSBOWMAN) vecItem = new Array(2044502, 2044602); + else if(stance == Job.THIEF) vecItem = new Array(2043302, 2044702); else vecItem = new Array(2044802, 2044902); for (var i = 0; i < vecItem.length; i++) diff --git a/scripts/quest/3437.js b/scripts/quest/3437.js index da1ddd9077..70e6eb1f4b 100644 --- a/scripts/quest/3437.js +++ b/scripts/quest/3437.js @@ -13,8 +13,8 @@ function end(mode, type, selection) { if(status == 0) { qm.sendNext("What the? Are you telling me you've already taken out 150 #o4230120#s? And these ... yes, these really are 120 #t4000122#s. I was wondering how you were going to complete this mission all by yourself, but you took care of it just fine. Alright, here ... this is a very important item for me, but please take it."); } else if(status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.EQUIP).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.EQUIP).getNumFreeSlot() < 1) { qm.sendOk("Please free a EQUIP inventory slot to receive the reward."); qm.dispose(); return; @@ -23,12 +23,12 @@ function end(mode, type, selection) { var talkStr = "Do you like the glove? I've kept this for a while, and I was planning on using it someday, but it looks much better on you. Please put it to good use; besides, I got so much stuff from the Sector, that I don't need it anymore."; stance = qm.getPlayer().getJobStyle(); - const MapleJob = Java.type('client.MapleJob'); - if(stance == MapleJob.WARRIOR) item = 1082024; - else if(stance == MapleJob.MAGICIAN) item = 1082063; - else if(stance == MapleJob.BOWMAN || stance == MapleJob.CROSSBOWMAN) item = 1082072; - else if(stance == MapleJob.THIEF) item = 1082076; - else if(stance == MapleJob.BRAWLER || stance == MapleJob.GUNSLINGER) item = 1082195; + const Job = Java.type('client.Job'); + if(stance == Job.WARRIOR) item = 1082024; + else if(stance == Job.MAGICIAN) item = 1082063; + else if(stance == Job.BOWMAN || stance == Job.CROSSBOWMAN) item = 1082072; + else if(stance == Job.THIEF) item = 1082076; + else if(stance == Job.BRAWLER || stance == Job.GUNSLINGER) item = 1082195; else item = 1082149; qm.sendNext(talkStr); diff --git a/scripts/quest/3452.js b/scripts/quest/3452.js index 709f74d959..1f4f818002 100644 --- a/scripts/quest/3452.js +++ b/scripts/quest/3452.js @@ -10,8 +10,8 @@ function end(mode, type, selection) { qm.sendNext("Take these #bMana Elixir Pills#k as a token of my gratitude."); } else if (status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() >= 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() >= 1) { qm.gainItem(4000099, -1); qm.gainItem(2000011, 50); qm.gainExp(8000); diff --git a/scripts/quest/3454.js b/scripts/quest/3454.js index b6d0ebb721..967e713af4 100644 --- a/scripts/quest/3454.js +++ b/scripts/quest/3454.js @@ -44,8 +44,8 @@ function end(mode, type, selection) { status--; if (status == 0) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if(qm.getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if(qm.getPlayer().getInventory(InventoryType.ETC).getNumFreeSlot() < 1) { qm.sendOk("Make room on your ETC inventory first."); qm.dispose(); return; diff --git a/scripts/quest/3514.js b/scripts/quest/3514.js index 2dd7a00afb..3568e9a35d 100644 --- a/scripts/quest/3514.js +++ b/scripts/quest/3514.js @@ -44,8 +44,8 @@ function start(mode, type, selection) { } function usedPotion(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.HPREC) == 2022337; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.HPREC) == 2022337; } function end(mode, type, selection) { diff --git a/scripts/quest/3833.js b/scripts/quest/3833.js index 05ac8aa67a..873f9084bd 100644 --- a/scripts/quest/3833.js +++ b/scripts/quest/3833.js @@ -8,8 +8,8 @@ function end(mode, type, selection) { if (status == 0) { qm.sendOk("Great! You managed to get the herb I need. As a #btoken of gratitude#k, take this item to help on your journey."); } else if (status == 1) { - const MapleInventoryType = Java.type('client.inventory.MapleInventoryType'); - if (qm.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() >= 2) { + const InventoryType = Java.type('client.inventory.InventoryType'); + if (qm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() >= 2) { if (qm.haveItem(4000294, 1000)) { qm.gainItem(4000294, -1000); qm.gainItem(2040501, 1); diff --git a/scripts/quest/3941.js b/scripts/quest/3941.js index f24af97ebd..12173499e1 100644 --- a/scripts/quest/3941.js +++ b/scripts/quest/3941.js @@ -21,8 +21,8 @@ */ function isTigunMorphed(ch) { - const MapleBuffStat = Java.type('client.MapleBuffStat'); - return ch.getBuffSource(MapleBuffStat.MORPH) == 2210005; + const BuffStat = Java.type('client.BuffStat'); + return ch.getBuffSource(BuffStat.MORPH) == 2210005; } var status = -1; diff --git a/scripts/quest/4659.js b/scripts/quest/4659.js index d612aab6f3..bfc0389130 100644 --- a/scripts/quest/4659.js +++ b/scripts/quest/4659.js @@ -104,9 +104,9 @@ function end(mode, type, selection) { qm.gainMeso(-10000); qm.evolvePet(i, after); -// var petId = MaplePet.createPet(rand + 5000049, level, closeness, fullness); +// var petId = Pet.createPet(rand + 5000049, level, closeness, fullness); // if (petId == -1) return; -// MapleInventoryManipulator.addById(qm.getClient(), rand+5000049, 1, "", petId); +// InventoryManipulator.addById(qm.getClient(), rand+5000049, 1, "", petId); qm.dispose(); } else { qm.dropMessage(1,"Your inventory is full"); diff --git a/scripts/quest/8185.js b/scripts/quest/8185.js index 64dfb33217..156554aacc 100644 --- a/scripts/quest/8185.js +++ b/scripts/quest/8185.js @@ -86,8 +86,8 @@ function end(mode, type, selection) { return; } - /* if (name.equals(MapleItemInformationProvider.getInstance().getName(id))) { - name = MapleItemInformationProvider.getInstance().getName(after); + /* if (name.equals(ItemInformationProvider.getInstance().getName(id))) { + name = ItemInformationProvider.getInstance().getName(after); } */ //qm.unequipPet(qm.getClient()); diff --git a/scripts/quest/8189.js b/scripts/quest/8189.js index b349ef9e39..8bc9bcba94 100644 --- a/scripts/quest/8189.js +++ b/scripts/quest/8189.js @@ -87,8 +87,8 @@ function end(mode, type, selection) { } } while (after == pet.getItemId()); - /*if (name.equals(MapleItemInformationProvider.getInstance().getName(id))) { - name = MapleItemInformationProvider.getInstance().getName(after); + /*if (name.equals(ItemInformationProvider.getInstance().getName(id))) { + name = ItemInformationProvider.getInstance().getName(after); } */ qm.gainMeso(-10000); diff --git a/scripts/reactor/2708000.js b/scripts/reactor/2708000.js index f25f3db81a..0ddc2a77be 100644 --- a/scripts/reactor/2708000.js +++ b/scripts/reactor/2708000.js @@ -24,8 +24,8 @@ function spawnJrBoss(mobObj) { mobObj.getMap().killMonster(mobObj.getId()); var spawnid = mobObj.getId() - 17; - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); - var mob = MapleLifeFactory.getMonster(spawnid); + const LifeFactory = Java.type('server.life.LifeFactory'); + var mob = LifeFactory.getMonster(spawnid); mobObj.getMap().spawnMonsterOnGroundBelow(mob, mobObj.getPosition()); } diff --git a/scripts/reactor/6701000.js b/scripts/reactor/6701000.js index 2f873daa13..918e523ad7 100644 --- a/scripts/reactor/6701000.js +++ b/scripts/reactor/6701000.js @@ -30,9 +30,9 @@ function act(){ var startId = 9400523; var mobObj, mapObj = rm.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); for(var i = 0; i < 7; i++) { - mobObj = MapleLifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); + mobObj = LifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); mapObj.spawnMonsterOnGroundBelow(mobObj, rm.getReactor().getPosition()); } } \ No newline at end of file diff --git a/scripts/reactor/6701001.js b/scripts/reactor/6701001.js index 2f873daa13..918e523ad7 100644 --- a/scripts/reactor/6701001.js +++ b/scripts/reactor/6701001.js @@ -30,9 +30,9 @@ function act(){ var startId = 9400523; var mobObj, mapObj = rm.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); for(var i = 0; i < 7; i++) { - mobObj = MapleLifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); + mobObj = LifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); mapObj.spawnMonsterOnGroundBelow(mobObj, rm.getReactor().getPosition()); } } \ No newline at end of file diff --git a/scripts/reactor/6701002.js b/scripts/reactor/6701002.js index 2f873daa13..918e523ad7 100644 --- a/scripts/reactor/6701002.js +++ b/scripts/reactor/6701002.js @@ -30,9 +30,9 @@ function act(){ var startId = 9400523; var mobObj, mapObj = rm.getMap(); - const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const LifeFactory = Java.type('server.life.LifeFactory'); for(var i = 0; i < 7; i++) { - mobObj = MapleLifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); + mobObj = LifeFactory.getMonster(startId + Math.floor(Math.random() * 3)); mapObj.spawnMonsterOnGroundBelow(mobObj, rm.getReactor().getPosition()); } } \ No newline at end of file diff --git a/src/main/java/client/AbstractMapleCharacterObject.java b/src/main/java/client/AbstractCharacterObject.java similarity index 90% rename from src/main/java/client/AbstractMapleCharacterObject.java rename to src/main/java/client/AbstractCharacterObject.java index cda953e31a..d7dc91400d 100644 --- a/src/main/java/client/AbstractMapleCharacterObject.java +++ b/src/main/java/client/AbstractCharacterObject.java @@ -28,7 +28,7 @@ import net.server.audit.locks.MonitoredWriteLock; import net.server.audit.locks.factory.MonitoredReadLockFactory; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; import net.server.audit.locks.factory.MonitoredWriteLockFactory; -import server.maps.AbstractAnimatedMapleMapObject; +import server.maps.AbstractAnimatedMapObject; import server.maps.MapleMap; import java.util.Arrays; @@ -37,46 +37,45 @@ import java.util.Map; import java.util.concurrent.locks.Lock; /** - * * @author RonanLana */ -public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMapleMapObject { +public abstract class AbstractCharacterObject extends AbstractAnimatedMapObject { protected MapleMap map; protected int str, dex, luk, int_, hp, maxhp, mp, maxmp; protected int hpMpApUsed, remainingAp; protected int[] remainingSp = new int[10]; protected transient int clientmaxhp, clientmaxmp, localmaxhp = 50, localmaxmp = 5; protected float transienthp = Float.NEGATIVE_INFINITY, transientmp = Float.NEGATIVE_INFINITY; - + private AbstractCharacterListener listener = null; - protected Map statUpdates = new HashMap<>(); - + protected Map statUpdates = new HashMap<>(); + protected Lock effLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EFF, true); protected MonitoredReadLock statRlock; protected MonitoredWriteLock statWlock; - - protected AbstractMapleCharacterObject() { + + protected AbstractCharacterObject() { MonitoredReentrantReadWriteLock locks = new MonitoredReentrantReadWriteLock(MonitoredLockType.CHARACTER_STA, true); statRlock = MonitoredReadLockFactory.createLock(locks); statWlock = MonitoredWriteLockFactory.createLock(locks); - + for (int i = 0; i < remainingSp.length; i++) { remainingSp[i] = 0; } } - + protected void setListener(AbstractCharacterListener listener) { this.listener = listener; } - + public void setMap(MapleMap map) { this.map = map; } - + public MapleMap getMap() { return map; } - + public int getStr() { statRlock.lock(); try { @@ -85,7 +84,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getDex() { statRlock.lock(); try { @@ -94,7 +93,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getInt() { statRlock.lock(); try { @@ -112,7 +111,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getRemainingAp() { statRlock.lock(); try { @@ -121,7 +120,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + protected int getRemainingSp(int jobid) { statRlock.lock(); try { @@ -139,7 +138,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getHpMpApUsed() { statRlock.lock(); try { @@ -148,7 +147,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public boolean isAlive() { statRlock.lock(); try { @@ -157,7 +156,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getHp() { statRlock.lock(); try { @@ -166,7 +165,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getMp() { statRlock.lock(); try { @@ -175,7 +174,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getMaxHp() { statRlock.lock(); try { @@ -184,7 +183,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getMaxMp() { statRlock.lock(); try { @@ -193,15 +192,15 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple statRlock.unlock(); } } - + public int getClientMaxHp() { return clientmaxhp; } - + public int getClientMaxMp() { return clientmaxmp; } - + public int getCurrentMaxHp() { return localmaxhp; } @@ -209,40 +208,42 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple public int getCurrentMaxMp() { return localmaxmp; } - + private void setHpMpApUsed(int mpApUsed) { this.hpMpApUsed = mpApUsed; } - + private void dispatchHpChanged(final int oldHp) { listener.onHpChanged(oldHp); } - + private void dispatchHpmpPoolUpdated() { listener.onHpmpPoolUpdate(); } - + private void dispatchStatUpdated() { listener.onStatUpdate(); } - + private void dispatchStatPoolUpdateAnnounced() { listener.onAnnounceStatPoolUpdate(); } - + protected void setHp(int newHp) { int oldHp = hp; - + int thp = newHp; if (thp < 0) { thp = 0; } else if (thp > localmaxhp) { thp = localmaxhp; } - - if (this.hp != thp) this.transienthp = Float.NEGATIVE_INFINITY; + + if (this.hp != thp) { + this.transienthp = Float.NEGATIVE_INFINITY; + } this.hp = thp; - + dispatchHpChanged(oldHp); } @@ -253,35 +254,41 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple } else if (tmp > localmaxmp) { tmp = localmaxmp; } - - if (this.mp != tmp) this.transientmp = Float.NEGATIVE_INFINITY; + + if (this.mp != tmp) { + this.transientmp = Float.NEGATIVE_INFINITY; + } this.mp = tmp; } - + private void setRemainingAp(int remainingAp) { this.remainingAp = remainingAp; } - + private void setRemainingSp(int remainingSp, int skillbook) { this.remainingSp[skillbook] = remainingSp; } - + protected void setMaxHp(int hp_) { - if (this.maxhp < hp_) this.transienthp = Float.NEGATIVE_INFINITY; + if (this.maxhp < hp_) { + this.transienthp = Float.NEGATIVE_INFINITY; + } this.maxhp = hp_; this.clientmaxhp = Math.min(30000, hp_); } - + protected void setMaxMp(int mp_) { - if (this.maxmp < mp_) this.transientmp = Float.NEGATIVE_INFINITY; + if (this.maxmp < mp_) { + this.transientmp = Float.NEGATIVE_INFINITY; + } this.maxmp = mp_; this.clientmaxmp = Math.min(30000, mp_); } - + private static long clampStat(int v, int min, int max) { return (v < min) ? min : ((v > max) ? max : v); } - + private static long calcStatPoolNode(Integer v, int displacement) { long r; if (v == null) { @@ -289,21 +296,21 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple } else { r = clampStat(v, -32767, 32767); } - + return ((r & 0x0FFFF) << displacement); } - + private static long calcStatPoolLong(Integer v1, Integer v2, Integer v3, Integer v4) { long ret = 0; - + ret |= calcStatPoolNode(v1, 48); ret |= calcStatPoolNode(v2, 32); ret |= calcStatPoolNode(v3, 16); ret |= calcStatPoolNode(v4, 0); - + return ret; } - + private void changeStatPool(Long hpMpPool, Long strDexIntLuk, Long newSp, int newAp, boolean silent) { effLock.lock(); statWlock.lock(); @@ -317,7 +324,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple short newMp = (short) (hpMpPool >> 32); short newMaxHp = (short) (hpMpPool >> 16); short newMaxMp = hpMpPool.shortValue(); - + if (newMaxHp != Short.MIN_VALUE) { if (newMaxHp < 50) { newMaxHp = 50; @@ -325,13 +332,13 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple poolUpdate = true; setMaxHp(newMaxHp); - statUpdates.put(MapleStat.MAXHP, clientmaxhp); - statUpdates.put(MapleStat.HP, hp); + statUpdates.put(Stat.MAXHP, clientmaxhp); + statUpdates.put(Stat.HP, hp); } if (newHp != Short.MIN_VALUE) { setHp(newHp); - statUpdates.put(MapleStat.HP, hp); + statUpdates.put(Stat.HP, hp); } if (newMaxMp != Short.MIN_VALUE) { @@ -341,13 +348,13 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple poolUpdate = true; setMaxMp(newMaxMp); - statUpdates.put(MapleStat.MAXMP, clientmaxmp); - statUpdates.put(MapleStat.MP, mp); + statUpdates.put(Stat.MAXMP, clientmaxmp); + statUpdates.put(Stat.MP, mp); } if (newMp != Short.MIN_VALUE) { setMp(newMp); - statUpdates.put(MapleStat.MP, mp); + statUpdates.put(Stat.MP, mp); } } @@ -359,45 +366,45 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple if (newStr >= 4) { setStr(newStr); - statUpdates.put(MapleStat.STR, str); + statUpdates.put(Stat.STR, str); } if (newDex >= 4) { setDex(newDex); - statUpdates.put(MapleStat.DEX, dex); + statUpdates.put(Stat.DEX, dex); } if (newInt >= 4) { setInt(newInt); - statUpdates.put(MapleStat.INT, int_); + statUpdates.put(Stat.INT, int_); } if (newLuk >= 4) { setLuk(newLuk); - statUpdates.put(MapleStat.LUK, luk); + statUpdates.put(Stat.LUK, luk); } if (newAp >= 0) { setRemainingAp(newAp); - statUpdates.put(MapleStat.AVAILABLEAP, remainingAp); + statUpdates.put(Stat.AVAILABLEAP, remainingAp); } statUpdate = true; } - + if (newSp != null) { short sp = (short) (newSp >> 16); short skillbook = newSp.shortValue(); - + setRemainingSp(sp, skillbook); - statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]); + statUpdates.put(Stat.AVAILABLESP, remainingSp[skillbook]); } if (!statUpdates.isEmpty()) { if (poolUpdate) { dispatchHpmpPoolUpdated(); } - + if (statUpdate) { dispatchStatUpdated(); } @@ -411,64 +418,64 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void healHpMp() { updateHpMp(30000); } - + public void updateHpMp(int x) { updateHpMp(x, x); } - + public void updateHpMp(int newhp, int newmp) { changeHpMp(newhp, newmp, false); } - + protected void changeHpMp(int newhp, int newmp, boolean silent) { changeHpMpPool(newhp, newmp, null, null, silent); } - + private void changeHpMpPool(Integer hp, Integer mp, Integer maxhp, Integer maxmp, boolean silent) { long hpMpPool = calcStatPoolLong(hp, mp, maxhp, maxmp); changeStatPool(hpMpPool, null, null, -1, silent); } - + public void updateHp(int hp) { updateHpMaxHp(hp, null); } - + public void updateMaxHp(int maxhp) { updateHpMaxHp(null, maxhp); } - + public void updateHpMaxHp(int hp, int maxhp) { updateHpMaxHp(Integer.valueOf(hp), Integer.valueOf(maxhp)); } - + private void updateHpMaxHp(Integer hp, Integer maxhp) { changeHpMpPool(hp, null, maxhp, null, false); } - + public void updateMp(int mp) { updateMpMaxMp(mp, null); } - + public void updateMaxMp(int maxmp) { updateMpMaxMp(null, maxmp); } - + public void updateMpMaxMp(int mp, int maxmp) { updateMpMaxMp(Integer.valueOf(mp), Integer.valueOf(maxmp)); } - + private void updateMpMaxMp(Integer mp, Integer maxmp) { changeHpMpPool(null, mp, null, maxmp, false); } - + public void updateMaxHpMaxMp(int maxhp, int maxmp) { changeHpMpPool(null, null, maxhp, maxmp, false); } - + protected void enforceMaxHpMp() { effLock.lock(); statWlock.lock(); @@ -481,7 +488,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public int safeAddHP(int delta) { effLock.lock(); statWlock.lock(); @@ -497,7 +504,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void addHP(int delta) { effLock.lock(); statWlock.lock(); @@ -508,7 +515,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void addMP(int delta) { effLock.lock(); statWlock.lock(); @@ -530,7 +537,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + protected void addMaxMPMaxHP(int hpdelta, int mpdelta, boolean silent) { effLock.lock(); statWlock.lock(); @@ -541,7 +548,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void addMaxHP(int delta) { effLock.lock(); statWlock.lock(); @@ -552,7 +559,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void addMaxMP(int delta) { effLock.lock(); statWlock.lock(); @@ -563,39 +570,39 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + private void setStr(int str) { this.str = str; } - + private void setDex(int dex) { this.dex = dex; } - + private void setInt(int int_) { this.int_ = int_; } - + private void setLuk(int luk) { this.luk = luk; } - + public boolean assignStr(int x) { return assignStrDexIntLuk(x, null, null, null); } - + public boolean assignDex(int x) { return assignStrDexIntLuk(null, x, null, null); } - + public boolean assignInt(int x) { return assignStrDexIntLuk(null, null, x, null); } - + public boolean assignLuk(int x) { return assignStrDexIntLuk(null, null, null, x); } - + public boolean assignHP(int deltaHP, int deltaAp) { effLock.lock(); statWlock.lock(); @@ -603,7 +610,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple if (remainingAp - deltaAp < 0 || hpMpApUsed + deltaAp < 0 || maxhp >= 30000) { return false; } - + long hpMpPool = calcStatPoolLong(null, null, maxhp + deltaHP, maxmp); long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); @@ -615,7 +622,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public boolean assignMP(int deltaMP, int deltaAp) { effLock.lock(); statWlock.lock(); @@ -635,15 +642,15 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + private static int apAssigned(Integer x) { return x != null ? x : 0; } - + public boolean assignStrDexIntLuk(int deltaStr, int deltaDex, int deltaInt, int deltaLuk) { return assignStrDexIntLuk(Integer.valueOf(deltaStr), Integer.valueOf(deltaDex), Integer.valueOf(deltaInt), Integer.valueOf(deltaLuk)); } - + private boolean assignStrDexIntLuk(Integer deltaStr, Integer deltaDex, Integer deltaInt, Integer deltaLuk) { effLock.lock(); statWlock.lock(); @@ -654,11 +661,19 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple } int newStr = str, newDex = dex, newInt = int_, newLuk = luk; - if (deltaStr != null) newStr += deltaStr; // thanks Rohenn for noticing an NPE case after "null" started being used - if (deltaDex != null) newDex += deltaDex; - if (deltaInt != null) newInt += deltaInt; - if (deltaLuk != null) newLuk += deltaLuk; - + if (deltaStr != null) { + newStr += deltaStr; // thanks Rohenn for noticing an NPE case after "null" started being used + } + if (deltaDex != null) { + newDex += deltaDex; + } + if (deltaInt != null) { + newInt += deltaInt; + } + if (deltaLuk != null) { + newLuk += deltaLuk; + } + if (newStr < 4 || newStr > YamlConfig.config.server.MAX_AP) { return false; } @@ -683,11 +698,11 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void updateStrDexIntLuk(int x) { updateStrDexIntLuk(x, x, x, x, -1); } - + public void changeRemainingAp(int x, boolean silent) { effLock.lock(); statWlock.lock(); @@ -698,7 +713,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + public void gainAp(int deltaAp, boolean silent) { effLock.lock(); statWlock.lock(); @@ -709,26 +724,26 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + protected void updateStrDexIntLuk(int str, int dex, int int_, int luk, int remainingAp) { changeStrDexIntLuk(str, dex, int_, luk, remainingAp, false); } - + private void changeStrDexIntLuk(Integer str, Integer dex, Integer int_, Integer luk, int remainingAp, boolean silent) { long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); changeStatPool(null, strDexIntLuk, null, remainingAp, silent); } - + private void changeStrDexIntLukSp(Integer str, Integer dex, Integer int_, Integer luk, int remainingAp, int remainingSp, int skillbook, boolean silent) { long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); long sp = calcStatPoolLong(0, 0, remainingSp, skillbook); changeStatPool(null, strDexIntLuk, sp, remainingAp, silent); } - + protected void updateStrDexIntLukSp(int str, int dex, int int_, int luk, int remainingAp, int remainingSp, int skillbook) { changeStrDexIntLukSp(str, dex, int_, luk, remainingAp, remainingSp, skillbook, false); } - + protected void setRemainingSp(int[] sps) { effLock.lock(); statWlock.lock(); @@ -739,16 +754,16 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple effLock.unlock(); } } - + protected void updateRemainingSp(int remainingSp, int skillbook) { changeRemainingSp(remainingSp, skillbook, false); } - + protected void changeRemainingSp(int remainingSp, int skillbook, boolean silent) { long sp = calcStatPoolLong(0, 0, remainingSp, skillbook); changeStatPool(null, null, sp, Short.MIN_VALUE, silent); } - + public void gainSp(int deltaSp, int skillbook, boolean silent) { effLock.lock(); statWlock.lock(); diff --git a/src/main/java/client/BuddyList.java b/src/main/java/client/BuddyList.java index f7579c5b9a..4ce83e62fe 100644 --- a/src/main/java/client/BuddyList.java +++ b/src/main/java/client/BuddyList.java @@ -129,7 +129,7 @@ public class BuddyList { public void broadcast(Packet packet, PlayerStorage pstorage) { for(int bid : getBuddyIds()) { - MapleCharacter chr = pstorage.getCharacterById(bid); + Character chr = pstorage.getCharacterById(bid); if(chr != null && chr.isLoggedinWorld()) { chr.sendPacket(packet); @@ -165,7 +165,7 @@ public class BuddyList { return pendingRequests.pollLast(); } - public void addBuddyRequest(MapleClient c, int cidFrom, String nameFrom, int channelFrom) { + public void addBuddyRequest(Client c, int cidFrom, String nameFrom, int channelFrom) { put(new BuddylistEntry(nameFrom, "Default Group", cidFrom, channelFrom, false)); if (pendingRequests.isEmpty()) { c.sendPacket(PacketCreator.requestBuddylistAdd(cidFrom, c.getPlayer().getId(), nameFrom)); diff --git a/src/main/java/client/MapleBuffStat.java b/src/main/java/client/BuffStat.java similarity index 92% rename from src/main/java/client/MapleBuffStat.java rename to src/main/java/client/BuffStat.java index a70a7e2bfe..70a692a204 100644 --- a/src/main/java/client/MapleBuffStat.java +++ b/src/main/java/client/BuffStat.java @@ -21,7 +21,7 @@ */ package client; -public enum MapleBuffStat { +public enum BuffStat { //SLOW(0x1L), MORPH(0x2L), RECOVERY(0x4L), @@ -42,21 +42,21 @@ public enum MapleBuffStat { GHOST_MORPH(0x20000L), AURA(0x40000L), CONFUSE(0x80000L), - + // ------ COUPON feature ------ COUPON_EXP1(0x100000L), COUPON_EXP2(0x200000L), COUPON_EXP3(0x400000L), COUPON_EXP4(0x400000L), COUPON_DRP1(0x800000L), COUPON_DRP2(0x1000000L), COUPON_DRP3(0x1000000L), - + // ------ monster card buffs, thanks to Arnah (Vertisy) ------ ITEM_UP_BY_ITEM(0x100000L), RESPECT_PIMMUNE(0x200000L), RESPECT_MIMMUNE(0x400000L), DEFENSE_ATT(0x800000L), DEFENSE_STATE(0x1000000L), - + HPREC(0x2000000L), MPREC(0x4000000L), BERSERK_FURY(0x8000000L), @@ -97,15 +97,15 @@ public enum MapleBuffStat { EXP_INCREASE(0x2000000000000000L), WEAKEN(0x4000000000000000L), MAP_PROTECTION(0x8000000000000000L), - + //all incorrect buffstats - SLOW(0x200000000L, true), - ELEMENTAL_RESET(0x200000000L, true), - MAGIC_SHIELD(0x400000000L, true), - MAGIC_RESISTANCE(0x800000000L, true), + SLOW(0x200000000L, true), + ELEMENTAL_RESET(0x200000000L, true), + MAGIC_SHIELD(0x400000000L, true), + MAGIC_RESISTANCE(0x800000000L, true), // needs Soul Stone //end incorrect buffstats - + WIND_WALK(0x400000000L, true), ARAN_COMBO(0x1000000000L, true), COMBO_DRAIN(0x2000000000L, true), @@ -116,19 +116,19 @@ public enum MapleBuffStat { ENERGY_CHARGE(0x4000000000000L, true), DASH2(0x8000000000000L, true), // correct (speed) DASH(0x10000000000000L, true), // correct (jump) - MONSTER_RIDING(0x20000000000000L, true), + MONSTER_RIDING(0x20000000000000L, true), SPEED_INFUSION(0x40000000000000L, true), HOMING_BEACON(0x80000000000000L, true); private final long i; private final boolean isFirst; - private MapleBuffStat(long i, boolean isFirst) { + BuffStat(long i, boolean isFirst) { this.i = i; this.isFirst = isFirst; } - private MapleBuffStat(long i) { + BuffStat(long i) { this.i = i; this.isFirst = false; } @@ -140,7 +140,7 @@ public enum MapleBuffStat { public boolean isFirst() { return isFirst; } - + @Override public String toString() { return name(); diff --git a/src/main/java/client/MapleCharacter.java b/src/main/java/client/Character.java similarity index 78% rename from src/main/java/client/MapleCharacter.java rename to src/main/java/client/Character.java index 94a2e7b047..e271d0d5b1 100644 --- a/src/main/java/client/MapleCharacter.java +++ b/src/main/java/client/Character.java @@ -26,10 +26,10 @@ import client.autoban.AutobanManager; import client.creator.CharacterFactoryRecipe; import client.inventory.*; import client.inventory.Equip.StatUpgrade; -import client.inventory.manipulator.MapleCashidGenerator; -import client.inventory.manipulator.MapleInventoryManipulator; -import client.keybind.MapleKeyBinding; -import client.keybind.MapleQuickslotBinding; +import client.inventory.manipulator.CashIdGenerator; +import client.inventory.manipulator.InventoryManipulator; +import client.keybind.KeyBinding; +import client.keybind.QuickslotBinding; import client.newyear.NewYearCardRecord; import client.processor.action.PetAutopotProcessor; import client.processor.npc.FredrickProcessor; @@ -44,11 +44,11 @@ import net.server.PlayerCoolDownValueHolder; import net.server.Server; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; -import net.server.coordinator.world.MapleInviteCoordinator; +import net.server.coordinator.world.InviteCoordinator; +import net.server.guild.Alliance; +import net.server.guild.Guild; +import net.server.guild.GuildCharacter; import net.server.guild.GuildPackets; -import net.server.guild.MapleAlliance; -import net.server.guild.MapleGuild; -import net.server.guild.MapleGuildCharacter; import net.server.services.task.channel.FaceExpressionService; import net.server.services.task.world.CharacterSaveService; import net.server.services.type.ChannelServices; @@ -58,23 +58,23 @@ import scripting.AbstractPlayerInteraction; import scripting.event.EventInstanceManager; import scripting.item.ItemScriptManager; import server.*; -import server.MapleItemInformationProvider.ScriptedItem; -import server.events.MapleEvents; +import server.ItemInformationProvider.ScriptedItem; +import server.events.Events; import server.events.RescueGaga; -import server.events.gm.MapleFitness; -import server.events.gm.MapleOla; -import server.life.MapleMonster; -import server.life.MaplePlayerNPC; +import server.events.gm.Fitness; +import server.events.gm.Ola; import server.life.MobSkill; import server.life.MobSkillFactory; +import server.life.Monster; +import server.life.PlayerNPC; import server.maps.*; -import server.maps.MapleMiniGame.MiniGameResult; -import server.minigame.MapleRockPaperScissor; +import server.maps.MiniGame.MiniGameResult; +import server.minigame.RockPaperScissor; import server.partyquest.AriantColiseum; import server.partyquest.MonsterCarnival; import server.partyquest.MonsterCarnivalParty; import server.partyquest.PartyQuest; -import server.quest.MapleQuest; +import server.quest.Quest; import tools.*; import tools.exceptions.NotEnabledException; import tools.packets.WeddingPackets; @@ -93,13 +93,13 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.regex.Pattern; -public class MapleCharacter extends AbstractMapleCharacterObject { - private static final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); +public class Character extends AbstractCharacterObject { + private static final ItemInformationProvider ii = ItemInformationProvider.getInstance(); private static final String LEVEL_200 = "[Congrats] %s has reached Level %d! Congratulate %s on such an amazing achievement!"; private static final String[] BLOCKED_NAMES = {"admin", "owner", "moderator", "intern", "donor", "administrator", "FREDRICK", "help", "helper", "alert", "notice", "maplestory", "fuck", "wizet", "fucking", "negro", "fuk", "fuc", "penis", "pussy", "asshole", "gay", - "nigger", "homo", "suck", "cum", "shit", "shitty", "condom", "security", "official", "rape", "nigga", "sex", "tit", "boner", "orgy", "clit", "asshole", "fatass", "bitch", "support", "gamemaster", "cock", "gaay", "gm", - "operate", "master", "sysop", "party", "GameMaster", "community", "message", "event", "test", "meso", "Scania", "yata", "AsiaSoft", "henesys"}; - + "nigger", "homo", "suck", "cum", "shit", "shitty", "condom", "security", "official", "rape", "nigga", "sex", "tit", "boner", "orgy", "clit", "asshole", "fatass", "bitch", "support", "gamemaster", "cock", "gaay", "gm", + "operate", "master", "sysop", "party", "GameMaster", "community", "message", "event", "test", "meso", "Scania", "yata", "AsiaSoft", "henesys"}; + private int world; private int accountid, id, level; private int rank, rankMove, jobRank, jobRankMove; @@ -115,7 +115,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private int energybar; private int gmLevel; private int ci = 0; - private MapleFamilyEntry familyEntry; + private FamilyEntry familyEntry; private int familyId; private int bookCover; private int battleshipHp = 0; @@ -142,60 +142,60 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private String commandtext; private String dataString; private String search = null; - private AtomicBoolean mapTransitioning = new AtomicBoolean(true); // player client is currently trying to change maps or log in the game map - private AtomicBoolean awayFromWorld = new AtomicBoolean(true); // player is online, but on cash shop or mts - private AtomicInteger exp = new AtomicInteger(); - private AtomicInteger gachaexp = new AtomicInteger(); - private AtomicInteger meso = new AtomicInteger(); - private AtomicInteger chair = new AtomicInteger(-1); + private final AtomicBoolean mapTransitioning = new AtomicBoolean(true); // player client is currently trying to change maps or log in the game map + private final AtomicBoolean awayFromWorld = new AtomicBoolean(true); // player is online, but on cash shop or mts + private final AtomicInteger exp = new AtomicInteger(); + private final AtomicInteger gachaexp = new AtomicInteger(); + private final AtomicInteger meso = new AtomicInteger(); + private final AtomicInteger chair = new AtomicInteger(-1); private int merchantmeso; private BuddyList buddylist; private EventInstanceManager eventInstance = null; - private MapleHiredMerchant hiredMerchant = null; - private MapleClient client; - private MapleGuildCharacter mgc = null; - private MaplePartyCharacter mpc = null; + private HiredMerchant hiredMerchant = null; + private Client client; + private GuildCharacter mgc = null; + private PartyCharacter mpc = null; private Inventory[] inventory; - private MapleJob job = MapleJob.BEGINNER; - private MapleMessenger messenger = null; - private MapleMiniGame miniGame; - private MapleRockPaperScissor rps; - private MapleMount maplemount; - private MapleParty party; - private MaplePet[] pets = new MaplePet[3]; - private MaplePlayerShop playerShop = null; - private MapleShop shop = null; - private MapleSkinColor skinColor = MapleSkinColor.NORMAL; - private MapleStorage storage = null; - private MapleTrade trade = null; + private Job job = Job.BEGINNER; + private Messenger messenger = null; + private MiniGame miniGame; + private RockPaperScissor rps; + private Mount maplemount; + private Party party; + private final Pet[] pets = new Pet[3]; + private PlayerShop playerShop = null; + private Shop shop = null; + private SkinColor skinColor = SkinColor.NORMAL; + private Storage storage = null; + private Trade trade = null; private MonsterBook monsterbook; private CashShop cashshop; - private Set newyears = new LinkedHashSet<>(); - private SavedLocation savedLocations[]; - private SkillMacro[] skillMacros = new SkillMacro[5]; + private final Set newyears = new LinkedHashSet<>(); + private final SavedLocation[] savedLocations; + private final SkillMacro[] skillMacros = new SkillMacro[5]; private List lastmonthfameids; - private List> lastVisitedMaps = new LinkedList<>(); + private final List> lastVisitedMaps = new LinkedList<>(); private WeakReference ownedMap = new WeakReference<>(null); - private final Map quests; - private Set controlled = new LinkedHashSet<>(); - private Map entered = new LinkedHashMap<>(); - private Set visibleMapObjects = Collections.newSetFromMap(new ConcurrentHashMap<>()); - private Map skills = new LinkedHashMap<>(); - private Map activeCoupons = new LinkedHashMap<>(); - private Map activeCouponRates = new LinkedHashMap<>(); - private EnumMap effects = new EnumMap<>(MapleBuffStat.class); - private Map buffEffectsCount = new LinkedHashMap<>(); - private Map diseaseExpires = new LinkedHashMap<>(); - private Map> buffEffects = new LinkedHashMap<>(); // non-overriding buffs thanks to Ronan - private Map buffExpires = new LinkedHashMap<>(); - private Map keymap = new LinkedHashMap<>(); - private Map summons = new LinkedHashMap<>(); - private Map coolDowns = new LinkedHashMap<>(); - private EnumMap> diseases = new EnumMap<>(MapleDisease.class); + private final Map quests; + private final Set controlled = new LinkedHashSet<>(); + private final Map entered = new LinkedHashMap<>(); + private final Set visibleMapObjects = Collections.newSetFromMap(new ConcurrentHashMap<>()); + private final Map skills = new LinkedHashMap<>(); + private final Map activeCoupons = new LinkedHashMap<>(); + private final Map activeCouponRates = new LinkedHashMap<>(); + private final EnumMap effects = new EnumMap<>(BuffStat.class); + private final Map buffEffectsCount = new LinkedHashMap<>(); + private final Map diseaseExpires = new LinkedHashMap<>(); + private final Map> buffEffects = new LinkedHashMap<>(); // non-overriding buffs thanks to Ronan + private final Map buffExpires = new LinkedHashMap<>(); + private final Map keymap = new LinkedHashMap<>(); + private final Map summons = new LinkedHashMap<>(); + private final Map coolDowns = new LinkedHashMap<>(); + private final EnumMap> diseases = new EnumMap<>(Disease.class); private byte[] m_aQuickslotLoaded; - private MapleQuickslotBinding m_pQuickslotKeyMapped; - private MapleDoor pdoor = null; - private Map questExpirations = new LinkedHashMap<>(); + private QuickslotBinding m_pQuickslotKeyMapped; + private Door pdoor = null; + private Map questExpirations = new LinkedHashMap<>(); private ScheduledFuture dragonBloodSchedule; private ScheduledFuture hpDecreaseTask; private ScheduledFuture beholderHealingSchedule, beholderBuffSchedule, berserkSchedule; @@ -209,36 +209,36 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private ScheduledFuture chairRecoveryTask = null; private ScheduledFuture pendantOfSpirit = null; //1122017 private ScheduledFuture cpqSchedule = null; - private Lock chrLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CHR, true); - private Lock evtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EVT, true); - private Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true); - private Lock prtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PRT); - private Lock cpnLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CPN); - private Map> excluded = new LinkedHashMap<>(); - private Set excludedItems = new LinkedHashSet<>(); - private Set disabledPartySearchInvites = new LinkedHashSet<>(); - private static String[] ariantroomleader = new String[3]; - private static int[] ariantroomslot = new int[3]; + private final Lock chrLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CHR, true); + private final Lock evtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EVT, true); + private final Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true); + private final Lock prtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PRT); + private final Lock cpnLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CPN); + private final Map> excluded = new LinkedHashMap<>(); + private final Set excludedItems = new LinkedHashSet<>(); + private final Set disabledPartySearchInvites = new LinkedHashSet<>(); + private static final String[] ariantroomleader = new String[3]; + private static final int[] ariantroomslot = new int[3]; private long portaldelay = 0, lastcombo = 0; private short combocounter = 0; - private List blockedPortals = new ArrayList<>(); - private Map area_info = new LinkedHashMap<>(); + private final List blockedPortals = new ArrayList<>(); + private final Map area_info = new LinkedHashMap<>(); private AutobanManager autoban; private boolean isbanned = false; private boolean blockCashShop = false; private boolean allowExpGain = true; private byte pendantExp = 0, lastmobcount = 0, doorSlot = -1; - private List trockmaps = new ArrayList<>(); - private List viptrockmaps = new ArrayList<>(); - private Map events = new LinkedHashMap<>(); + private final List trockmaps = new ArrayList<>(); + private final List viptrockmaps = new ArrayList<>(); + private Map events = new LinkedHashMap<>(); private PartyQuest partyQuest = null; - private List> npcUpdateQuests = new LinkedList<>(); - private MapleDragon dragon = null; - private MapleRing marriageRing; + private final List> npcUpdateQuests = new LinkedList<>(); + private Dragon dragon = null; + private Ring marriageRing; private int marriageItemid = -1; private int partnerId = -1; - private List crushRings = new ArrayList<>(); - private List friendshipRings = new ArrayList<>(); + private final List crushRings = new ArrayList<>(); + private final List friendshipRings = new ArrayList<>(); private boolean loggedIn = false; private boolean useCS; //chaos scroll upon crafting item. private long npcCd; @@ -258,106 +258,106 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere private long loginTime; private boolean chasing = false; - - private MapleCharacter() { + + private Character() { super.setListener(new AbstractCharacterListener() { @Override public void onHpChanged(int oldHp) { hpChangeAction(oldHp); } - + @Override public void onHpmpPoolUpdate() { - List> hpmpupdate = recalcLocalStats(); - for (Pair p : hpmpupdate) { + List> hpmpupdate = recalcLocalStats(); + for (Pair p : hpmpupdate) { statUpdates.put(p.getLeft(), p.getRight()); } if (hp > localmaxhp) { setHp(localmaxhp); - statUpdates.put(MapleStat.HP, hp); + statUpdates.put(Stat.HP, hp); } if (mp > localmaxmp) { setMp(localmaxmp); - statUpdates.put(MapleStat.MP, mp); + statUpdates.put(Stat.MP, mp); } } - + @Override public void onStatUpdate() { recalcLocalStats(); } - + @Override public void onAnnounceStatPoolUpdate() { - List> statup = new ArrayList<>(8); - for (Map.Entry s : statUpdates.entrySet()) { + List> statup = new ArrayList<>(8); + for (Map.Entry s : statUpdates.entrySet()) { statup.add(new Pair<>(s.getKey(), s.getValue())); } - sendPacket(PacketCreator.updatePlayerStats(statup, true, MapleCharacter.this)); + sendPacket(PacketCreator.updatePlayerStats(statup, true, Character.this)); } }); - + useCS = false; - + setStance(0); - inventory = new Inventory[MapleInventoryType.values().length]; + inventory = new Inventory[InventoryType.values().length]; savedLocations = new SavedLocation[SavedLocationType.values().length]; - - for (MapleInventoryType type : MapleInventoryType.values()) { + + for (InventoryType type : InventoryType.values()) { byte b = 24; - if (type == MapleInventoryType.CASH) { + if (type == InventoryType.CASH) { b = 96; } - inventory[type.ordinal()] = new Inventory(this, type, (byte) b); + inventory[type.ordinal()] = new Inventory(this, type, b); } - inventory[MapleInventoryType.CANHOLD.ordinal()] = new MapleInventoryProof(this); - + inventory[InventoryType.CANHOLD.ordinal()] = new InventoryProof(this); + for (int i = 0; i < SavedLocationType.values().length; i++) { savedLocations[i] = null; } quests = new LinkedHashMap<>(); setPosition(new Point(0, 0)); } - - private static MapleJob getJobStyleInternal(int jobid, byte opt) { + + private static Job getJobStyleInternal(int jobid, byte opt) { int jobtype = jobid / 100; - - if(jobtype == MapleJob.WARRIOR.getId() / 100 || jobtype == MapleJob.DAWNWARRIOR1.getId() / 100 || jobtype == MapleJob.ARAN1.getId() / 100) { - return(MapleJob.WARRIOR); - } else if(jobtype == MapleJob.MAGICIAN.getId() / 100 || jobtype == MapleJob.BLAZEWIZARD1.getId() / 100 || jobtype == MapleJob.EVAN1.getId() / 100) { - return(MapleJob.MAGICIAN); - } else if(jobtype == MapleJob.BOWMAN.getId() / 100 || jobtype == MapleJob.WINDARCHER1.getId() / 100) { - if(jobid / 10 == MapleJob.CROSSBOWMAN.getId() / 10) { - return(MapleJob.CROSSBOWMAN); + + if (jobtype == Job.WARRIOR.getId() / 100 || jobtype == Job.DAWNWARRIOR1.getId() / 100 || jobtype == Job.ARAN1.getId() / 100) { + return (Job.WARRIOR); + } else if (jobtype == Job.MAGICIAN.getId() / 100 || jobtype == Job.BLAZEWIZARD1.getId() / 100 || jobtype == Job.EVAN1.getId() / 100) { + return (Job.MAGICIAN); + } else if (jobtype == Job.BOWMAN.getId() / 100 || jobtype == Job.WINDARCHER1.getId() / 100) { + if (jobid / 10 == Job.CROSSBOWMAN.getId() / 10) { + return (Job.CROSSBOWMAN); } else { - return(MapleJob.BOWMAN); + return (Job.BOWMAN); } - } else if(jobtype == MapleJob.THIEF.getId() / 100 || jobtype == MapleJob.NIGHTWALKER1.getId() / 100) { - return(MapleJob.THIEF); - } else if(jobtype == MapleJob.PIRATE.getId() / 100 || jobtype == MapleJob.THUNDERBREAKER1.getId() / 100) { - if(opt == (byte) 0x80) { - return(MapleJob.BRAWLER); + } else if (jobtype == Job.THIEF.getId() / 100 || jobtype == Job.NIGHTWALKER1.getId() / 100) { + return (Job.THIEF); + } else if (jobtype == Job.PIRATE.getId() / 100 || jobtype == Job.THUNDERBREAKER1.getId() / 100) { + if (opt == (byte) 0x80) { + return (Job.BRAWLER); } else { - return(MapleJob.GUNSLINGER); + return (Job.GUNSLINGER); } } - - return(MapleJob.BEGINNER); + + return (Job.BEGINNER); } - - public MapleJob getJobStyle(byte opt) { + + public Job getJobStyle(byte opt) { return getJobStyleInternal(this.getJob().getId(), opt); } - - public MapleJob getJobStyle() { + + public Job getJobStyle() { return getJobStyle((byte) ((this.getStr() > this.getDex()) ? 0x80 : 0x40)); } - public static MapleCharacter getDefault(MapleClient c) { - MapleCharacter ret = new MapleCharacter(); + public static Character getDefault(Client c) { + Character ret = new Character(); ret.client = c; ret.setGMLevel(0); ret.hp = 50; @@ -369,22 +369,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.int_ = 4; ret.luk = 4; ret.map = null; - ret.job = MapleJob.BEGINNER; + ret.job = Job.BEGINNER; ret.level = 1; ret.accountid = c.getAccID(); ret.buddylist = new BuddyList(20); ret.maplemount = null; - ret.getInventory(MapleInventoryType.EQUIP).setSlotLimit(24); - ret.getInventory(MapleInventoryType.USE).setSlotLimit(24); - ret.getInventory(MapleInventoryType.SETUP).setSlotLimit(24); - ret.getInventory(MapleInventoryType.ETC).setSlotLimit(24); - + ret.getInventory(InventoryType.EQUIP).setSlotLimit(24); + ret.getInventory(InventoryType.USE).setSlotLimit(24); + ret.getInventory(InventoryType.SETUP).setSlotLimit(24); + ret.getInventory(InventoryType.ETC).setSlotLimit(24); + // Select a keybinding method int[] selectedKey; int[] selectedType; int[] selectedAction; - - if(YamlConfig.config.server.USE_CUSTOM_KEYSET) { + + if (YamlConfig.config.server.USE_CUSTOM_KEYSET) { selectedKey = GameConstants.getCustomKey(true); selectedType = GameConstants.getCustomType(true); selectedAction = GameConstants.getCustomAction(true); @@ -393,12 +393,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { selectedType = GameConstants.getCustomType(false); selectedAction = GameConstants.getCustomAction(false); } - + for (int i = 0; i < selectedKey.length; i++) { - ret.keymap.put(selectedKey[i], new MapleKeyBinding(selectedType[i], selectedAction[i])); + ret.keymap.put(selectedKey[i], new KeyBinding(selectedType[i], selectedAction[i])); } - - + + //to fix the map 0 lol for (int i = 0; i < 5; i++) { ret.trockmaps.add(999999999); @@ -409,42 +409,42 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return ret; } - + public boolean isLoggedinWorld() { return this.isLoggedin() && !this.isAwayFromWorld(); } - + public boolean isAwayFromWorld() { return awayFromWorld.get(); } - + public void setEnteredChannelWorld() { awayFromWorld.set(false); client.getChannelServer().removePlayerAway(id); - + if (canRecvPartySearchInvite) { this.getWorldServer().getPartySearchCoordinator().attachPlayer(this); } } - + public void setAwayFromChannelWorld() { setAwayFromChannelWorld(false); } - + public void setDisconnectedFromChannelWorld() { setAwayFromChannelWorld(true); } - + private void setAwayFromChannelWorld(boolean disconnect) { awayFromWorld.set(true); - - if(!disconnect) { + + if (!disconnect) { client.getChannelServer().insertPlayerAway(id); } else { client.getChannelServer().removePlayerAway(id); } } - + public void updatePartySearchAvailability(boolean psearchAvailable) { if (psearchAvailable) { if (canRecvPartySearchInvite && getParty() == null) { @@ -456,59 +456,59 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + public boolean toggleRecvPartySearchInvite() { canRecvPartySearchInvite = !canRecvPartySearchInvite; - + if (canRecvPartySearchInvite) { updatePartySearchAvailability(getParty() == null); } else { this.getWorldServer().getPartySearchCoordinator().detachPlayer(this); } - + return canRecvPartySearchInvite; } - + public boolean isRecvPartySearchInviteEnabled() { return canRecvPartySearchInvite; } - + public void resetPartySearchInvite(int fromLeaderid) { disabledPartySearchInvites.remove(fromLeaderid); } - + public void disablePartySearchInvite(int fromLeaderid) { disabledPartySearchInvites.add(fromLeaderid); } - + public boolean hasDisabledPartySearchInvite(int fromLeaderid) { return disabledPartySearchInvites.contains(fromLeaderid); } - + public void setSessionTransitionState() { client.setCharacterOnSessionTransitionState(this.getId()); } - + public boolean getCS() { return useCS; } - + public void setCS(boolean cs) { useCS = cs; } - + public long getNpcCooldown() { return npcCd; } - + public void setNpcCooldown(long d) { npcCd = d; } - + public void setOwlSearch(int id) { owlSearch = id; } - + public int getOwlSearch() { return owlSearch; } @@ -517,30 +517,30 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.lock(); chrLock.lock(); try { - this.coolDowns.put(Integer.valueOf(skillId), new MapleCoolDownValueHolder(skillId, startTime, length)); + this.coolDowns.put(Integer.valueOf(skillId), new CooldownValueHolder(skillId, startTime, length)); } finally { chrLock.unlock(); effLock.unlock(); } } - public void addCrushRing(MapleRing r) { + public void addCrushRing(Ring r) { crushRings.add(r); } - public MapleRing getRingById(int id) { - for (MapleRing ring : getCrushRings()) { + public Ring getRingById(int id) { + for (Ring ring : getCrushRings()) { if (ring.getRingId() == id) { return ring; } } - for (MapleRing ring : getFriendshipRings()) { + for (Ring ring : getFriendshipRings()) { if (ring.getRingId() == id) { return ring; } } - - if(marriageRing != null) { + + if (marriageRing != null) { if (marriageRing.getRingId() == id) { return marriageRing; } @@ -548,43 +548,41 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return null; } - + public int getMarriageItemId() { return marriageItemid; } - + public void setMarriageItemId(int itemid) { marriageItemid = itemid; } - + public int getPartnerId() { return partnerId; } - + public void setPartnerId(int partnerid) { partnerId = partnerid; } - + public int getRelationshipId() { return getWorldServer().getRelationshipId(id); } - + public boolean isMarried() { return marriageRing != null && partnerId > 0; } - + public boolean hasJustMarried() { EventInstanceManager eim = getEventInstance(); - if(eim != null) { + if (eim != null) { String prop = eim.getProperty("groomId"); - - if(prop != null) { - if((Integer.parseInt(prop) == id || eim.getIntProperty("brideId") == id) && (mapid == 680000110 || mapid == 680000210)) { - return true; - } + + if (prop != null) { + return (Integer.parseInt(prop) == id || eim.getIntProperty("brideId") == id) && (mapid == 680000110 || mapid == 680000210); } } - + return false; } @@ -599,24 +597,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return pts; } - + public void addFame(int famechange) { this.fame += famechange; } - public void addFriendshipRing(MapleRing r) { + public void addFriendshipRing(Ring r) { friendshipRings.add(r); } - - public void addMarriageRing(MapleRing r) { + + public void addMarriageRing(Ring r) { marriageRing = r; } - + public void addMesosTraded(int gain) { this.mesosTraded += gain; } - - public void addPet(MaplePet pet) { + + public void addPet(Pet pet) { petLock.lock(); try { for (int i = 0; i < 3; i++) { @@ -629,16 +627,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { petLock.unlock(); } } - - public void addSummon(int id, MapleSummon summon) { + + public void addSummon(int id, Summon summon) { summons.put(id, summon); - + if (summon.isPuppet()) { map.addPlayerPuppet(this); } } - public void addVisibleMapObject(MapleMapObject mo) { + public void addVisibleMapObject(MapObject mo) { visibleMapObjects.add(mo); } @@ -668,7 +666,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (accountId) { query = "SELECT id FROM accounts WHERE name = ?"; } else { - query ="SELECT accountid FROM characters WHERE name = ?"; + query = "SELECT accountid FROM characters WHERE name = ?"; } boolean ret = false; @@ -692,17 +690,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return false; } - - public int calculateMaxBaseDamage(int watk, MapleWeaponType weapon) { + + public int calculateMaxBaseDamage(int watk, WeaponType weapon) { int mainstat, secondarystat; - if (getJob().isA(MapleJob.THIEF) && weapon == MapleWeaponType.DAGGER_OTHER) { - weapon = MapleWeaponType.DAGGER_THIEVES; + if (getJob().isA(Job.THIEF) && weapon == WeaponType.DAGGER_OTHER) { + weapon = WeaponType.DAGGER_THIEVES; } - if (weapon == MapleWeaponType.BOW || weapon == MapleWeaponType.CROSSBOW || weapon == MapleWeaponType.GUN) { + if (weapon == WeaponType.BOW || weapon == WeaponType.CROSSBOW || weapon == WeaponType.GUN) { mainstat = localdex; secondarystat = localstr; - } else if (weapon == MapleWeaponType.CLAW || weapon == MapleWeaponType.DAGGER_THIEVES) { + } else if (weapon == WeaponType.CLAW || weapon == WeaponType.DAGGER_THIEVES) { mainstat = localluk; secondarystat = localdex + localstr; } else { @@ -714,11 +712,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int calculateMaxBaseDamage(int watk) { int maxbasedamage; - Item weapon_item = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11); + Item weapon_item = getInventory(InventoryType.EQUIPPED).getItem((short) -11); if (weapon_item != null) { maxbasedamage = calculateMaxBaseDamage(watk, ii.getWeaponType(weapon_item.getItemId())); } else { - if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) { + if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) { double weapMulti = 3; if (job.getId() % 100 != 0) { weapMulti = 4.2; @@ -732,30 +730,30 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return maxbasedamage; } - + public int calculateMaxBaseMagicDamage(int matk) { int maxbasedamage = matk; int totalint = getTotalInt(); - + if (totalint > 2000) { maxbasedamage -= 2000; maxbasedamage += (int) ((0.09033024267 * totalint) + 3823.8038); } else { maxbasedamage -= totalint; - + if (totalint > 1700) { maxbasedamage += (int) (0.1996049769 * Math.pow(totalint, 1.300631341)); } else { maxbasedamage += (int) (0.1996049769 * Math.pow(totalint, 1.290631341)); } } - + return (maxbasedamage * 107) / 100; } public void setCombo(short count) { if (count < combocounter) { - cancelEffectFromBuffStat(MapleBuffStat.ARAN_COMBO); + cancelEffectFromBuffStat(BuffStat.ARAN_COMBO); } combocounter = (short) Math.min(30000, count); if (count > 0) { @@ -782,29 +780,29 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setLastMobCount(byte count) { lastmobcount = count; } - + public boolean cannotEnterCashShop() { return blockCashShop; } - + public void toggleBlockCashShop() { blockCashShop = !blockCashShop; } - + public void toggleExpGain() { allowExpGain = !allowExpGain; } - public void setClient(MapleClient c) { + public void setClient(Client c) { this.client = c; } - - public void newClient(MapleClient c) { + + public void newClient(Client c) { this.loggedIn = true; c.setAccountName(this.client.getAccountName());//No null's for accountName this.setClient(c); this.map = c.getChannelServer().getMapFactory().getMap(getMapId()); - MaplePortal portal = map.findClosestPlayerSpawnpoint(getPosition()); + Portal portal = map.findClosestPlayerSpawnpoint(getPosition()); if (portal == null) { portal = map.getPortal(0); } @@ -814,7 +812,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public String getMedalText() { String medal = ""; - final Item medalItem = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49); + final Item medalItem = getInventory(InventoryType.EQUIPPED).getItem((short) -49); if (medalItem != null) { medal = "<" + ii.getName(medalItem.getItemId()) + "> "; } @@ -826,16 +824,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (!hide) { this.hidden = false; sendPacket(PacketCreator.getGMEffect(0x10, (byte) 0)); - List dsstat = Collections.singletonList(MapleBuffStat.DARKSIGHT); + List dsstat = Collections.singletonList(BuffStat.DARKSIGHT); getMap().broadcastGMMessage(this, PacketCreator.cancelForeignBuff(id, dsstat), false); getMap().broadcastSpawnPlayerMapObjectMessage(this, this, false); - - for(MapleSummon ms: this.getSummonsValues()) { + + for (Summon ms : this.getSummonsValues()) { getMap().broadcastNONGMMessage(this, PacketCreator.spawnSummon(ms, false), false); } - - for (MapleMapObject mo : this.getMap().getMonsters()) { - MapleMonster m = (MapleMonster) mo; + + for (MapObject mo : this.getMap().getMonsters()) { + Monster m = (Monster) mo; m.aggroUpdateController(); } } else { @@ -844,14 +842,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (!login) { getMap().broadcastNONGMMessage(this, PacketCreator.removePlayerFromMap(getId()), false); } - List> ldsstat = Collections.singletonList(new Pair(MapleBuffStat.DARKSIGHT, 0)); + List> ldsstat = Collections.singletonList(new Pair(BuffStat.DARKSIGHT, 0)); getMap().broadcastGMMessage(this, PacketCreator.giveForeignBuff(id, ldsstat), false); this.releaseControlledMonsters(); } sendPacket(PacketCreator.enableActions()); } } - + public void Hide(boolean hide) { Hide(hide, false); } @@ -861,8 +859,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void cancelMagicDoor() { - List mbsvhList = getAllStatups(); - for (MapleBuffStatValueHolder mbsvh : mbsvhList) { + List mbsvhList = getAllStatups(); + for (BuffStatValueHolder mbsvh : mbsvhList) { if (mbsvh.effect.isMagicDoor()) { cancelEffect(mbsvh.effect, false, mbsvh.startTime); break; @@ -870,7 +868,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - private void cancelPlayerBuffs(List buffstats) { + private void cancelPlayerBuffs(List buffstats) { if (client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null) { updateLocalStats(); sendPacket(PacketCreator.cancelBuff(buffstats)); @@ -891,28 +889,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean canDoor() { - MapleDoor door = getPlayerDoor(); + Door door = getPlayerDoor(); return door == null || (door.isActive() && door.getElapsedDeployTime() > 5000); } - + public void setHasSandboxItem() { hasSandboxItem = true; } - + public void removeSandboxItems() { // sandbox idea thanks to Morty if (!hasSandboxItem) { return; } - - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); - for(MapleInventoryType invType : MapleInventoryType.values()) { + + ItemInformationProvider ii = ItemInformationProvider.getInstance(); + for (InventoryType invType : InventoryType.values()) { Inventory inv = this.getInventory(invType); - + inv.lockInventory(); try { - for(Item item : new ArrayList<>(inv.list())) { - if(MapleInventoryManipulator.isSandboxItem(item)) { - MapleInventoryManipulator.removeFromSlot(client, invType, item.getPosition(), item.getQuantity(), false); + for (Item item : new ArrayList<>(inv.list())) { + if (InventoryManipulator.isSandboxItem(item)) { + InventoryManipulator.removeFromSlot(client, invType, item.getPosition(), item.getQuantity(), false); dropMessage(5, "[" + ii.getName(item.getItemId()) + "] has passed its trial conditions and will be removed from your inventory."); } } @@ -920,11 +918,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { inv.unlockInventory(); } } - + hasSandboxItem = false; } - public FameStatus canGiveFame(MapleCharacter from) { + public FameStatus canGiveFame(Character from) { if (this.isGM()) { return FameStatus.OK; } else if (lastfametime >= System.currentTimeMillis() - 3600000 * 24) { @@ -1013,28 +1011,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (skilllevel > 0) { continue; } - + changeSkillLevel(skill, (byte) 0, 10, -1); } } } - + private void broadcastChangeJob() { - for (MapleCharacter chr : map.getAllPlayers()) { - MapleClient chrC = chr.getClient(); + for (Character chr : map.getAllPlayers()) { + Client chrC = chr.getClient(); if (chrC != null) { // propagate new job 3rd-person effects (FJ, Aran 1st strike, etc) this.sendDestroyData(chrC); this.sendSpawnData(chrC); } } - + TimerManager.getInstance().schedule(new Runnable() { // need to delay to ensure clientside has finished reloading character data @Override public void run() { - MapleCharacter thisChr = MapleCharacter.this; + Character thisChr = Character.this; MapleMap map = thisChr.getMap(); - + if (map != null) { map.broadcastMessage(thisChr, PacketCreator.showForeignEffect(thisChr.getId(), 8), false); } @@ -1042,11 +1040,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { }, 777); } - public synchronized void changeJob(MapleJob newJob) { + public synchronized void changeJob(Job newJob) { if (newJob == null) { return;//the fuck you doing idiot! } - + if (canRecvPartySearchInvite && getParty() == null) { this.updatePartySearchAvailability(false); this.job = newJob; @@ -1054,7 +1052,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } else { this.job = newJob; } - + int spGain = 1; if (GameConstants.hasSPTable(newJob)) { spGain += 2; @@ -1062,16 +1060,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (newJob.getId() % 10 == 2) { spGain += 2; } - + if (YamlConfig.config.server.USE_ENFORCE_JOB_SP_RANGE) { spGain = getChangedJobSp(newJob); } } - + if (spGain > 0) { gainSp(spGain, GameConstants.getSkillBook(newJob.getId()), true); } - + // thanks xinyifly for finding out missing AP awards (AP Reset can be used as a compass) if (newJob.getId() % 100 >= 1) { if (this.isCygnus()) { @@ -1086,13 +1084,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { gainAp(4, true); } } - + if (!isGM()) { for (byte i = 1; i < 5; i++) { gainSlots(i, 4, true); } } - + int addhp = 0, addmp = 0; int job_ = job.getId() % 1000; // lame temp "fix" if (job_ == 100) { // 1st warrior @@ -1124,74 +1122,74 @@ public class MapleCharacter extends AbstractMapleCharacterObject { addmp += 275; } */ - + effLock.lock(); statWlock.lock(); try { addMaxMPMaxHP(addhp, addmp, true); recalcLocalStats(); - List> statup = new ArrayList<>(7); - statup.add(new Pair<>(MapleStat.HP, hp)); - statup.add(new Pair<>(MapleStat.MP, mp)); - statup.add(new Pair<>(MapleStat.MAXHP, clientmaxhp)); - statup.add(new Pair<>(MapleStat.MAXMP, clientmaxmp)); - statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); - statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); - statup.add(new Pair<>(MapleStat.JOB, job.getId())); + List> statup = new ArrayList<>(7); + statup.add(new Pair<>(Stat.HP, hp)); + statup.add(new Pair<>(Stat.MP, mp)); + statup.add(new Pair<>(Stat.MAXHP, clientmaxhp)); + statup.add(new Pair<>(Stat.MAXMP, clientmaxmp)); + statup.add(new Pair<>(Stat.AVAILABLEAP, remainingAp)); + statup.add(new Pair<>(Stat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); + statup.add(new Pair<>(Stat.JOB, job.getId())); sendPacket(PacketCreator.updatePlayerStats(statup, true, this)); } finally { statWlock.unlock(); effLock.unlock(); } - - setMPC(new MaplePartyCharacter(this)); + + setMPC(new PartyCharacter(this)); silentPartyUpdate(); - + if (dragon != null) { getMap().broadcastMessage(PacketCreator.removeDragon(dragon.getObjectId())); dragon = null; } - + if (this.guildid > 0) { getGuild().broadcast(PacketCreator.jobMessage(0, job.getId(), name), this.getId()); } - MapleFamily family = getFamily(); - if(family != null) { + Family family = getFamily(); + if (family != null) { family.broadcast(PacketCreator.jobMessage(1, job.getId(), name), this.getId()); } setMasteries(this.job.getId()); guildUpdate(); - + broadcastChangeJob(); - + if (GameConstants.hasSPTable(newJob) && newJob.getId() != 2001) { - if (getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) { - cancelBuffStats(MapleBuffStat.MONSTER_RIDING); + if (getBuffedValue(BuffStat.MONSTER_RIDING) != null) { + cancelBuffStats(BuffStat.MONSTER_RIDING); } createDragon(); } - + if (YamlConfig.config.server.USE_ANNOUNCE_CHANGEJOB) { if (!this.isGM()) { broadcastAcquaintances(6, "[" + GameConstants.ordinal(GameConstants.getJobBranch(newJob)) + " Job] " + name + " has just become a " + GameConstants.getJobName(this.job.getId()) + "."); // thanks Vcoc for noticing job name appearing in uppercase here } } } - + public void broadcastAcquaintances(int type, String message) { broadcastAcquaintances(PacketCreator.serverNotice(type, message)); } - + public void broadcastAcquaintances(Packet packet) { buddylist.broadcast(packet, getWorldServer().getPlayerStorage()); - MapleFamily family = getFamily(); - if(family != null) { + Family family = getFamily(); + if (family != null) { family.broadcast(packet, id); } - - MapleGuild guild = getGuild(); - if(guild != null) { + + Guild guild = getGuild(); + if (guild != null) { guild.broadcast(packet, id); } @@ -1203,25 +1201,25 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(packet); } - public void changeKeybinding(int key, MapleKeyBinding keybinding) { + public void changeKeybinding(int key, KeyBinding keybinding) { if (keybinding.getType() != 0) { keymap.put(Integer.valueOf(key), keybinding); } else { keymap.remove(Integer.valueOf(key)); } } - + public void changeQuickslotKeybinding(byte[] aQuickslotKeyMapped) { - this.m_pQuickslotKeyMapped = new MapleQuickslotBinding(aQuickslotKeyMapped); + this.m_pQuickslotKeyMapped = new QuickslotBinding(aQuickslotKeyMapped); } - + public void broadcastStance(int newStance) { setStance(newStance); broadcastStance(); } - + public void broadcastStance() { - map.broadcastMessage(this, PacketCreator.movePlayer(id, this.getIdleMovement(), AbstractAnimatedMapleMapObject.IDLE_MOVEMENT_PACKET_LENGTH), false); + map.broadcastMessage(this, PacketCreator.movePlayer(id, this.getIdleMovement(), AbstractAnimatedMapObject.IDLE_MOVEMENT_PACKET_LENGTH), false); } public MapleMap getWarpMap(int map) { @@ -1236,87 +1234,87 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return warpMap; } - + // for use ONLY inside OnUserEnter map scripts that requires a player to change map while still moving between maps. public void warpAhead(int map) { newWarpMap = map; } - + private void eventChangedMap(int map) { EventInstanceManager eim = getEventInstance(); if (eim != null) { eim.changedMap(this, map); } } - + private void eventAfterChangedMap(int map) { EventInstanceManager eim = getEventInstance(); if (eim != null) { eim.afterChangedMap(this, map); } } - + public boolean canRecoverLastBanish() { return System.currentTimeMillis() - this.banishTime < 5 * 60 * 1000; } - + public Pair getLastBanishData() { return new Pair<>(this.banishMap, this.banishSp); } - + public void clearBanishPlayerData() { this.banishMap = -1; this.banishSp = -1; this.banishTime = 0; } - + public void setBanishPlayerData(int banishMap, int banishSp, long banishTime) { this.banishMap = banishMap; this.banishSp = banishSp; this.banishTime = banishTime; } - + public void changeMapBanish(int mapid, String portal, String msg) { - if(YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) { - for(Item it: this.getInventory(MapleInventoryType.EQUIPPED).list()) { - if((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) { + if (YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) { + for (Item it : this.getInventory(InventoryType.EQUIPPED).list()) { + if ((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) { return; } } } - + int banMap = this.getMapId(); int banSp = this.getMap().findClosestPlayerSpawnpoint(this.getPosition()).getId(); long banTime = System.currentTimeMillis(); - + if (msg != null) { dropMessage(5, msg); } - + MapleMap map_ = getWarpMap(mapid); - MaplePortal portal_ = map_.getPortal(portal); + Portal portal_ = map_.getPortal(portal); changeMap(map_, portal_ != null ? portal_ : map_.getRandomPlayerSpawnpoint()); - + setBanishPlayerData(banMap, banSp, banTime); } public void changeMap(int map) { MapleMap warpMap; EventInstanceManager eim = getEventInstance(); - + if (eim != null) { warpMap = eim.getMapInstance(map); } else { warpMap = client.getChannelServer().getMapFactory().getMap(map); } - + changeMap(warpMap, warpMap.getRandomPlayerSpawnpoint()); } public void changeMap(int map, int portal) { MapleMap warpMap; EventInstanceManager eim = getEventInstance(); - + if (eim != null) { warpMap = eim.getMapInstance(map); } else { @@ -1329,7 +1327,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void changeMap(int map, String portal) { MapleMap warpMap; EventInstanceManager eim = getEventInstance(); - + if (eim != null) { warpMap = eim.getMapInstance(map); } else { @@ -1339,10 +1337,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { changeMap(warpMap, warpMap.getPortal(portal)); } - public void changeMap(int map, MaplePortal portal) { + public void changeMap(int map, Portal portal) { MapleMap warpMap; EventInstanceManager eim = getEventInstance(); - + if (eim != null) { warpMap = eim.getMapInstance(map); } else { @@ -1359,10 +1357,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void changeMap(MapleMap to, int portal) { changeMap(to, to.getPortal(portal)); } - - public void changeMap(final MapleMap target, MaplePortal pto) { + + public void changeMap(final MapleMap target, Portal pto) { canWarpCounter++; - + eventChangedMap(target.getId()); // player can be dropped from an event here, hence the new warping target. MapleMap to = getWarpMap(target.getId()); if (pto == null) { @@ -1370,274 +1368,272 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } changeMapInternal(to, pto.getPosition(), PacketCreator.getWarpToMap(to, pto.getId(), this)); canWarpMap = false; - + canWarpCounter--; - if(canWarpCounter == 0) { + if (canWarpCounter == 0) { canWarpMap = true; } - + eventAfterChangedMap(this.getMapId()); } public void changeMap(final MapleMap target, final Point pos) { canWarpCounter++; - + eventChangedMap(target.getId()); MapleMap to = getWarpMap(target.getId()); changeMapInternal(to, pos, PacketCreator.getWarpToMap(to, 0x80, pos, this)); canWarpMap = false; - + canWarpCounter--; - if(canWarpCounter == 0) { + if (canWarpCounter == 0) { canWarpMap = true; } - + eventAfterChangedMap(this.getMapId()); } - - public void forceChangeMap(final MapleMap target, MaplePortal pto) { + + public void forceChangeMap(final MapleMap target, Portal pto) { // will actually enter the map given as parameter, regardless of being an eventmap or whatnot - + canWarpCounter++; eventChangedMap(999999999); - + EventInstanceManager mapEim = target.getEventInstance(); - if(mapEim != null) { + if (mapEim != null) { EventInstanceManager playerEim = this.getEventInstance(); - if(playerEim != null) { + if (playerEim != null) { playerEim.exitPlayer(this); - if(playerEim.getPlayerCount() == 0) { + if (playerEim.getPlayerCount() == 0) { playerEim.dispose(); } } - + // thanks Thora for finding an issue with players not being actually warped into the target event map (rather sent to the event starting map) mapEim.registerPlayer(this, false); } - + MapleMap to = target; // warps directly to the target intead of the target's map id, this allows GMs to patrol players inside instances. if (pto == null) { pto = to.getPortal(0); } changeMapInternal(to, pto.getPosition(), PacketCreator.getWarpToMap(to, pto.getId(), this)); canWarpMap = false; - + canWarpCounter--; - if(canWarpCounter == 0) { + if (canWarpCounter == 0) { canWarpMap = true; } - + eventAfterChangedMap(this.getMapId()); } - + private boolean buffMapProtection() { int thisMapid = mapid; int returnMapid = client.getChannelServer().getMapFactory().getMap(thisMapid).getReturnMapId(); - + effLock.lock(); chrLock.lock(); try { - for(Entry mbs : effects.entrySet()) { - if(mbs.getKey() == MapleBuffStat.MAP_PROTECTION) { - byte value = (byte)mbs.getValue().value; - - if(value == 1 && ((returnMapid == 211000000 && thisMapid != 200082300) || returnMapid == 193000000)) { + for (Entry mbs : effects.entrySet()) { + if (mbs.getKey() == BuffStat.MAP_PROTECTION) { + byte value = (byte) mbs.getValue().value; + + if (value == 1 && ((returnMapid == 211000000 && thisMapid != 200082300) || returnMapid == 193000000)) { return true; //protection from cold - } else if(value == 2 && (returnMapid == 230000000 || thisMapid == 200082300)) { - return true; //breathing underwater } else { - return false; + return value == 2 && (returnMapid == 230000000 || thisMapid == 200082300); //breathing underwater } } - } + } } finally { chrLock.unlock(); effLock.unlock(); } - - for(Item it: this.getInventory(MapleInventoryType.EQUIPPED).list()) { - if((it.getFlag() & ItemConstants.COLD) == ItemConstants.COLD && ((returnMapid == 211000000 && thisMapid != 200082300) || returnMapid == 193000000)) { + + for (Item it : this.getInventory(InventoryType.EQUIPPED).list()) { + if ((it.getFlag() & ItemConstants.COLD) == ItemConstants.COLD && ((returnMapid == 211000000 && thisMapid != 200082300) || returnMapid == 193000000)) { return true; //protection from cold } } - + return false; } - + public List getLastVisitedMapids() { List lastVisited = new ArrayList<>(5); - + petLock.lock(); try { - for(WeakReference lv : lastVisitedMaps) { + for (WeakReference lv : lastVisitedMaps) { MapleMap lvm = lv.get(); - - if(lvm != null) { + + if (lvm != null) { lastVisited.add(lvm.getId()); } } } finally { petLock.unlock(); } - + return lastVisited; } - - public void partyOperationUpdate(MapleParty party, List exPartyMembers) { + + public void partyOperationUpdate(Party party, List exPartyMembers) { List> mapids; - + petLock.lock(); try { mapids = new LinkedList<>(lastVisitedMaps); } finally { petLock.unlock(); } - - List partyMembers = new LinkedList<>(); - for(MapleCharacter mc : (exPartyMembers != null) ? exPartyMembers : this.getPartyMembersOnline()) { - if(mc.isLoggedinWorld()) { + + List partyMembers = new LinkedList<>(); + for (Character mc : (exPartyMembers != null) ? exPartyMembers : this.getPartyMembersOnline()) { + if (mc.isLoggedinWorld()) { partyMembers.add(mc); } } - - MapleCharacter partyLeaver = null; - if(exPartyMembers != null) { + + Character partyLeaver = null; + if (exPartyMembers != null) { partyMembers.remove(this); partyLeaver = this; } - + MapleMap map = this.getMap(); - List partyItems = null; - + List partyItems = null; + int partyId = exPartyMembers != null ? -1 : this.getPartyId(); - for(WeakReference mapRef : mapids) { + for (WeakReference mapRef : mapids) { MapleMap mapObj = mapRef.get(); - - if(mapObj != null) { - List partyMapItems = mapObj.updatePlayerItemDropsToParty(partyId, id, partyMembers, partyLeaver); + + if (mapObj != null) { + List partyMapItems = mapObj.updatePlayerItemDropsToParty(partyId, id, partyMembers, partyLeaver); if (map.hashCode() == mapObj.hashCode()) { partyItems = partyMapItems; } } } - + if (partyItems != null && exPartyMembers == null) { map.updatePartyItemDropsToNewcomer(this, partyItems); } - + updatePartyTownDoors(party, this, partyLeaver, partyMembers); } - - private static void addPartyPlayerDoor(MapleCharacter target) { - MapleDoor targetDoor = target.getPlayerDoor(); - if(targetDoor != null) { + + private static void addPartyPlayerDoor(Character target) { + Door targetDoor = target.getPlayerDoor(); + if (targetDoor != null) { target.applyPartyDoor(targetDoor, true); } } - - private static void removePartyPlayerDoor(MapleParty party, MapleCharacter target) { + + private static void removePartyPlayerDoor(Party party, Character target) { target.removePartyDoor(party); } - - private static void updatePartyTownDoors(MapleParty party, MapleCharacter target, MapleCharacter partyLeaver, List partyMembers) { - if(partyLeaver != null) { + + private static void updatePartyTownDoors(Party party, Character target, Character partyLeaver, List partyMembers) { + if (partyLeaver != null) { removePartyPlayerDoor(party, target); } else { addPartyPlayerDoor(target); } - - Map partyDoors = null; - if(!partyMembers.isEmpty()) { + + Map partyDoors = null; + if (!partyMembers.isEmpty()) { partyDoors = party.getDoors(); - - for(MapleCharacter pchr : partyMembers) { - MapleDoor door = partyDoors.get(pchr.getId()); - if(door != null) { + + for (Character pchr : partyMembers) { + Door door = partyDoors.get(pchr.getId()); + if (door != null) { door.updateDoorPortal(pchr); } } - - for(MapleDoor door : partyDoors.values()) { - for(MapleCharacter pchar : partyMembers) { - MapleDoorObject mdo = door.getTownDoor(); + + for (Door door : partyDoors.values()) { + for (Character pchar : partyMembers) { + DoorObject mdo = door.getTownDoor(); mdo.sendDestroyData(pchar.getClient(), true); pchar.removeVisibleMapObject(mdo); } } - - if(partyLeaver != null) { - Collection leaverDoors = partyLeaver.getDoors(); - for(MapleDoor door : leaverDoors) { - for(MapleCharacter pchar : partyMembers) { - MapleDoorObject mdo = door.getTownDoor(); + + if (partyLeaver != null) { + Collection leaverDoors = partyLeaver.getDoors(); + for (Door door : leaverDoors) { + for (Character pchar : partyMembers) { + DoorObject mdo = door.getTownDoor(); mdo.sendDestroyData(pchar.getClient(), true); pchar.removeVisibleMapObject(mdo); } } } - - List histMembers = party.getMembersSortedByHistory(); - for(Integer chrid : histMembers) { - MapleDoor door = partyDoors.get(chrid); - if(door != null) { - for(MapleCharacter pchar : partyMembers) { - MapleDoorObject mdo = door.getTownDoor(); + List histMembers = party.getMembersSortedByHistory(); + for (Integer chrid : histMembers) { + Door door = partyDoors.get(chrid); + + if (door != null) { + for (Character pchar : partyMembers) { + DoorObject mdo = door.getTownDoor(); mdo.sendSpawnData(pchar.getClient()); pchar.addVisibleMapObject(mdo); } } } } - - if(partyLeaver != null) { - Collection leaverDoors = partyLeaver.getDoors(); - - if(partyDoors != null) { - for(MapleDoor door : partyDoors.values()) { - MapleDoorObject mdo = door.getTownDoor(); + + if (partyLeaver != null) { + Collection leaverDoors = partyLeaver.getDoors(); + + if (partyDoors != null) { + for (Door door : partyDoors.values()) { + DoorObject mdo = door.getTownDoor(); mdo.sendDestroyData(partyLeaver.getClient(), true); partyLeaver.removeVisibleMapObject(mdo); } } - - for(MapleDoor door : leaverDoors) { - MapleDoorObject mdo = door.getTownDoor(); + + for (Door door : leaverDoors) { + DoorObject mdo = door.getTownDoor(); mdo.sendDestroyData(partyLeaver.getClient(), true); partyLeaver.removeVisibleMapObject(mdo); } - - for(MapleDoor door : leaverDoors) { + + for (Door door : leaverDoors) { door.updateDoorPortal(partyLeaver); - - MapleDoorObject mdo = door.getTownDoor(); + + DoorObject mdo = door.getTownDoor(); mdo.sendSpawnData(partyLeaver.getClient()); partyLeaver.addVisibleMapObject(mdo); } } } - + private Integer getVisitedMapIndex(MapleMap map) { int idx = 0; - - for(WeakReference mapRef : lastVisitedMaps) { - if(map.equals(mapRef.get())) { + + for (WeakReference mapRef : lastVisitedMaps) { + if (map.equals(mapRef.get())) { return idx; } - + idx++; } - + return -1; } - + public void visitMap(MapleMap map) { petLock.lock(); try { int idx = getVisitedMapIndex(map); - - if(idx == -1) { - if(lastVisitedMaps.size() == YamlConfig.config.server.MAP_VISITED_SIZE) { + + if (idx == -1) { + if (lastVisitedMaps.size() == YamlConfig.config.server.MAP_VISITED_SIZE) { lastVisitedMaps.remove(0); } } else { @@ -1651,46 +1647,46 @@ public class MapleCharacter extends AbstractMapleCharacterObject { petLock.unlock(); } } - + public void setOwnedMap(MapleMap map) { ownedMap = new WeakReference<>(map); } - + public MapleMap getOwnedMap() { return ownedMap.get(); } public void notifyMapTransferToPartner(int mapid) { - if(partnerId > 0) { - final MapleCharacter partner = getWorldServer().getPlayerStorage().getCharacterById(partnerId); - if(partner != null && !partner.isAwayFromWorld()) { + if (partnerId > 0) { + final Character partner = getWorldServer().getPlayerStorage().getCharacterById(partnerId); + if (partner != null && !partner.isAwayFromWorld()) { partner.sendPacket(WeddingPackets.OnNotifyWeddingPartnerTransfer(id, mapid)); } } } - + public void removeIncomingInvites() { - MapleInviteCoordinator.removePlayerIncomingInvites(id); + InviteCoordinator.removePlayerIncomingInvites(id); } private void changeMapInternal(final MapleMap to, final Point pos, Packet warpPacket) { if (!canWarpMap) { return; } - + this.mapTransitioning.set(true); - + this.unregisterChairBuff(); this.clearBanishPlayerData(); - MapleTrade.cancelTrade(this, MapleTrade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP); + Trade.cancelTrade(this, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP); this.closePlayerInteractions(); - - MapleParty e = null; + + Party e = null; if (this.getParty() != null && this.getParty().getEnemy() != null) { e = this.getParty().getEnemy(); } - final MapleParty k = e; - + final Party k = e; + sendPacket(warpPacket); map.removePlayer(this); if (client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null) { @@ -1698,7 +1694,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { setPosition(pos); map.addPlayer(this); visitMap(map); - + prtLock.lock(); try { if (party != null) { @@ -1709,11 +1705,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { prtLock.unlock(); } - if (MapleCharacter.this.getParty() != null) { - MapleCharacter.this.getParty().setEnemy(k); + if (Character.this.getParty() != null) { + Character.this.getParty().setEnemy(k); } silentPartyUpdateInternal(getParty()); // EIM script calls inside - + if (getMap().getHPDec() > 0) { resetHpDecreaseTask(); } @@ -1722,20 +1718,20 @@ public class MapleCharacter extends AbstractMapleCharacterObject { client.disconnect(true, false); // thanks BHB for noticing a player storage stuck case here return; } - + notifyMapTransferToPartner(map.getId()); - + //alas, new map has been specified when a warping was being processed... - if(newWarpMap != -1) { + if (newWarpMap != -1) { canWarpMap = true; - + int temp = newWarpMap; newWarpMap = -1; changeMap(temp); } else { // if this event map has a gate already opened, render it EventInstanceManager eim = getEventInstance(); - if(eim != null) { + if (eim != null) { eim.recoverOpenedGate(this, map.getId()); } @@ -1743,11 +1739,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.environmentMoveList(map.getEnvironment().entrySet())); } } - + public boolean isChangingMaps() { return this.mapTransitioning.get(); } - + public void setMapTransitionComplete() { this.mapTransitioning.set(false); } @@ -1788,8 +1784,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (berserkSchedule != null) { berserkSchedule.cancel(false); } - final MapleCharacter chr = this; - if (job.equals(MapleJob.DARKKNIGHT)) { + final Character chr = this; + if (job.equals(Job.DARKKNIGHT)) { Skill BerserkX = SkillFactory.getSkill(DarkKnight.BERSERK); final int skilllevel = getSkillLevel(BerserkX); if (skilllevel > 0) { @@ -1800,12 +1796,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (awayFromWorld.get()) { return; } - + sendPacket(PacketCreator.showOwnBerserk(skilllevel, berserk)); if (!isHidden) { - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showBerserk(getId(), skilllevel, berserk), false); + getMap().broadcastMessage(Character.this, PacketCreator.showBerserk(getId(), skilllevel, berserk), false); } else { - getMap().broadcastGMMessage(MapleCharacter.this, PacketCreator.showBerserk(getId(), skilllevel, berserk), false); + getMap().broadcastGMMessage(Character.this, PacketCreator.showBerserk(getId(), skilllevel, berserk), false); } } }, 5000, 3000); @@ -1816,12 +1812,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void checkMessenger() { if (messenger != null && messengerposition < 4 && messengerposition > -1) { World worldz = getWorldServer(); - worldz.silentJoinMessenger(messenger.getId(), new MapleMessengerCharacter(this, messengerposition), messengerposition); + worldz.silentJoinMessenger(messenger.getId(), new MessengerCharacter(this, messengerposition), messengerposition); worldz.updateMessenger(getMessenger().getId(), name, client.getChannel()); } } - public void controlMonster(MapleMonster monster) { + public void controlMonster(Monster monster) { if (cpnLock.tryLock()) { try { controlled.add(monster); @@ -1830,8 +1826,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - public void stopControllingMonster(MapleMonster monster) { + + public void stopControllingMonster(Monster monster) { if (cpnLock.tryLock()) { try { controlled.remove(monster); @@ -1840,7 +1836,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + public int getNumControlledMonsters() { cpnLock.lock(); try { @@ -1849,8 +1845,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { cpnLock.unlock(); } } - - public Collection getControlledMonsters() { + + public Collection getControlledMonsters() { cpnLock.lock(); try { return new ArrayList<>(controlled); @@ -1858,10 +1854,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { cpnLock.unlock(); } } - + public void releaseControlledMonsters() { - Collection controlledMonsters; - + Collection controlledMonsters; + cpnLock.lock(); try { controlledMonsters = new ArrayList<>(controlled); @@ -1869,31 +1865,31 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { cpnLock.unlock(); } - - for (MapleMonster monster : controlledMonsters) { + + for (Monster monster : controlledMonsters) { monster.aggroRedirectController(); } } - + public boolean applyConsumeOnPickup(final int itemid) { if (itemid / 1000000 == 2) { if (ii.isConsumeOnPickup(itemid)) { if (ItemConstants.isPartyItem(itemid)) { - List pchr = this.getPartyMembersOnSameMap(); - - if(!ItemConstants.isPartyAllcure(itemid)) { - MapleStatEffect mse = ii.getItemEffect(itemid); - - if(!pchr.isEmpty()) { - for (MapleCharacter mc : pchr) { + List pchr = this.getPartyMembersOnSameMap(); + + if (!ItemConstants.isPartyAllcure(itemid)) { + StatEffect mse = ii.getItemEffect(itemid); + + if (!pchr.isEmpty()) { + for (Character mc : pchr) { mse.applyTo(mc); } } else { mse.applyTo(this); } } else { - if(!pchr.isEmpty()) { - for (MapleCharacter mc : pchr) { + if (!pchr.isEmpty()) { + for (Character mc : pchr) { mc.dispelDebuffs(); } } else { @@ -1903,7 +1899,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } else { ii.getItemEffect(itemid).applyTo(this); } - + if (itemid / 10000 == 238) { this.getMonsterBook().addCard(client, itemid); } @@ -1912,28 +1908,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return false; } - - public final void pickupItem(MapleMapObject ob) { + + public final void pickupItem(MapObject ob) { pickupItem(ob, -1); } - - public final void pickupItem(MapleMapObject ob, int petIndex) { // yes, one picks the MapleMapObject, not the MapleMapItem + + public final void pickupItem(MapObject ob, int petIndex) { // yes, one picks the MapObject, not the MapItem if (ob == null) { // pet index refers to the one picking up the item return; } - - if (ob instanceof MapleMapItem) { - MapleMapItem mapitem = (MapleMapItem) ob; + + if (ob instanceof MapItem) { + MapItem mapitem = (MapItem) ob; if (System.currentTimeMillis() - mapitem.getDropTime() < 400 || !mapitem.canBePickedBy(this)) { sendPacket(PacketCreator.enableActions()); return; } - - List mpcs = new LinkedList<>(); - if (mapitem.getMeso() > 0 && !mapitem.isPickedUp()) { + + List mpcs = new LinkedList<>(); + if (mapitem.getMeso() > 0 && !mapitem.isPickedUp()) { mpcs = getPartyMembersOnSameMap(); } - + ScriptedItem itemScript = null; mapitem.lockItem(); try { @@ -1942,21 +1938,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.enableActions()); return; } - + boolean isPet = petIndex > -1; final Packet pickupPacket = PacketCreator.removeItemFromMap(mapitem.getObjectId(), (isPet) ? 5 : 2, this.getId(), isPet, petIndex); Item mItem = mapitem.getItem(); boolean hasSpaceInventory = true; - if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = MapleInventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) { + if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = InventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) { int mapId = this.getMapId(); - + if ((mapId > 209000000 && mapId < 209000016) || (mapId >= 990000500 && mapId <= 990000502)) {//happyville trees and guild PQ if (!mapitem.isPlayerDrop() || mapitem.getDropper().getObjectId() == client.getPlayer().getObjectId()) { - if(mapitem.getMeso() > 0) { + if (mapitem.getMeso() > 0) { if (!mpcs.isEmpty()) { int mesosamm = mapitem.getMeso() / mpcs.size(); - for (MapleCharacter partymem : mpcs) { + for (Character partymem : mpcs) { if (partymem.isLoggedinWorld()) { partymem.gainMeso(mesosamm, true, true, false); } @@ -1964,9 +1960,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } else { this.gainMeso(mapitem.getMeso(), true, true, false); } - + this.getMap().pickItemDrop(pickupPacket, mapitem); - } else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { + } else if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { // Add NX to account, show effect and make item disappear int nxGain = mapitem.getItemId() == 4031865 ? 100 : 250; this.getCashShop().gainCash(1, nxGain); @@ -1974,7 +1970,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300); this.getMap().pickItemDrop(pickupPacket, mapitem); - } else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) { + } else if (InventoryManipulator.addFromDrop(client, mItem, true)) { this.getMap().pickItemDrop(pickupPacket, mapitem); } else { sendPacket(PacketCreator.enableActions()); @@ -1988,17 +1984,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.enableActions()); return; } - + if (!this.needQuestItem(mapitem.getQuest(), mapitem.getItemId())) { sendPacket(PacketCreator.showItemUnavailable()); sendPacket(PacketCreator.enableActions()); return; } - + if (mapitem.getMeso() > 0) { if (!mpcs.isEmpty()) { int mesosamm = mapitem.getMeso() / mpcs.size(); - for (MapleCharacter partymem : mpcs) { + for (Character partymem : mpcs) { if (partymem.isLoggedinWorld()) { partymem.gainMeso(mesosamm, true, true, false); } @@ -2011,19 +2007,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (info != null && info.runOnPickup()) { itemScript = info; } else { - if (!MapleInventoryManipulator.addFromDrop(client, mItem, true)) { + if (!InventoryManipulator.addFromDrop(client, mItem, true)) { sendPacket(PacketCreator.enableActions()); return; } } - } else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { + } else if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { // Add NX to account, show effect and make item disappear int nxGain = mapitem.getItemId() == 4031865 ? 100 : 250; this.getCashShop().gainCash(1, nxGain); - + showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300); } else if (applyConsumeOnPickup(mItem.getItemId())) { - } else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) { + } else if (InventoryManipulator.addFromDrop(client, mItem, true)) { if (mItem.getItemId() == 4031868) { updateAriantScore(); } @@ -2033,14 +2029,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } this.getMap().pickItemDrop(pickupPacket, mapitem); - } else if(!hasSpaceInventory) { + } else if (!hasSpaceInventory) { sendPacket(PacketCreator.getInventoryFull()); sendPacket(PacketCreator.getShowInventoryFull()); } } finally { mapitem.unlockItem(); } - + if (itemScript != null) { ItemScriptManager ism = ItemScriptManager.getInstance(); ism.runItemScript(client, itemScript); @@ -2052,49 +2048,49 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int countItem(int itemid) { return inventory[ItemConstants.getInventoryType(itemid).ordinal()].countById(itemid); } - + public boolean canHold(int itemid) { return canHold(itemid, 1); } - + public boolean canHold(int itemid, int quantity) { return client.getAbstractPlayerInteraction().canHold(itemid, quantity); } - + public boolean canHoldUniques(List itemids) { for (Integer itemid : itemids) { if (ii.isPickupRestricted(itemid) && this.haveItem(itemid)) { return false; } } - + return true; } public boolean isRidingBattleship() { - Integer bv = getBuffedValue(MapleBuffStat.MONSTER_RIDING); + Integer bv = getBuffedValue(BuffStat.MONSTER_RIDING); return bv != null && bv.equals(Corsair.BATTLE_SHIP); } - + public void announceBattleshipHp() { sendPacket(PacketCreator.skillCooldown(5221999, battleshipHp)); } - + public void decreaseBattleshipHp(int decrease) { this.battleshipHp -= decrease; if (battleshipHp <= 0) { Skill battleship = SkillFactory.getSkill(Corsair.BATTLE_SHIP); int cooldown = battleship.getEffect(getSkillLevel(battleship)).getCooldown(); sendPacket(PacketCreator.skillCooldown(Corsair.BATTLE_SHIP, cooldown)); - addCooldown(Corsair.BATTLE_SHIP, Server.getInstance().getCurrentTime(), (long)(cooldown * 1000)); + addCooldown(Corsair.BATTLE_SHIP, Server.getInstance().getCurrentTime(), cooldown * 1000); removeCooldown(5221999); - cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING); + cancelEffectFromBuffStat(BuffStat.MONSTER_RIDING); } else { announceBattleshipHp(); addCooldown(5221999, 0, Long.MAX_VALUE); } } - + public void decreaseReports() { this.possibleReports--; } @@ -2113,24 +2109,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ex.printStackTrace(); } } - - private void nextPendingRequest(MapleClient c) { + + private void nextPendingRequest(Client c) { CharacterNameAndId pendingBuddyRequest = c.getPlayer().getBuddylist().pollPendingRequest(); if (pendingBuddyRequest != null) { c.sendPacket(PacketCreator.requestBuddylistAdd(pendingBuddyRequest.getId(), c.getPlayer().getId(), pendingBuddyRequest.getName())); } } - - private void notifyRemoteChannel(MapleClient c, int remoteChannel, int otherCid, BuddyList.BuddyOperation operation) { - MapleCharacter player = c.getPlayer(); + + private void notifyRemoteChannel(Client c, int remoteChannel, int otherCid, BuddyList.BuddyOperation operation) { + Character player = c.getPlayer(); if (remoteChannel != -1) { c.getWorldServer().buddyChanged(otherCid, player.getId(), player.getName(), c.getChannel(), operation); } } - + public void deleteBuddy(int otherCid) { BuddyList bl = getBuddylist(); - + if (bl.containsVisible(otherCid)) { notifyRemoteChannel(client, getWorldServer().find(otherCid), otherCid, BuddyList.BuddyOperation.DELETED); } @@ -2138,8 +2134,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.updateBuddylist(getBuddylist().getBuddies())); nextPendingRequest(client); } - - public static boolean deleteCharFromDB(MapleCharacter player, int senderAccId) { + + public static boolean deleteCharFromDB(Character player, int senderAccId) { int cid = player.getId(); if (!Server.getInstance().haveCharacterEntry(senderAccId, cid)) { // thanks zera (EpiphanyMS) for pointing a critical exploit with non-authed character deletion request return false; @@ -2164,7 +2160,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { int buddyid = rs.getInt("buddyid"); - MapleCharacter buddy = Server.getInstance().getWorld(world).getPlayerStorage().getCharacterById(buddyid); + Character buddy = Server.getInstance().getWorld(world).getPlayerStorage().getCharacterById(buddyid); if (buddy != null) { buddy.deleteBuddy(cid); @@ -2204,7 +2200,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (ResultSet rs = ps.executeQuery()) { if (rs.next() && rs.getInt("guildid") > 0) { - Server.getInstance().deleteGuildCharacter(new MapleGuildCharacter(player, cid, 0, rs.getString("name"), (byte) -1, (byte) -1, 0, rs.getInt("guildrank"), rs.getInt("guildid"), false, rs.getInt("allianceRank"))); + Server.getInstance().deleteGuildCharacter(new GuildCharacter(player, cid, 0, rs.getString("name"), (byte) -1, (byte) -1, 0, rs.getInt("guildrank"), rs.getInt("guildid"), false, rs.getInt("allianceRank"))); } } } @@ -2269,7 +2265,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps3.executeUpdate(); } - MapleCashidGenerator.freeCashId(ringid); + CashIdGenerator.freeCashId(ringid); } } } @@ -2286,7 +2282,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps2.setInt(1, petid); ps2.executeUpdate(); } - MapleCashidGenerator.freeCashId(petid); + CashIdGenerator.freeCashId(petid); } } } @@ -2317,7 +2313,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { String[] toDel = {"famelog", "inventoryitems", "keymap", "queststatus", "savedlocations", "trocklocations", "skillmacros", "skills", "eventstats", "server_queue"}; for (String s : toDel) { - MapleCharacter.deleteWhereCharacterId(con, "DELETE FROM `" + s + "` WHERE characterid = ?", cid); + Character.deleteWhereCharacterId(con, "DELETE FROM `" + s + "` WHERE characterid = ?", cid); } Server.getInstance().deleteCharacterEntry(accId, cid); @@ -2327,7 +2323,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + private static void deleteQuestProgressWhereCharacterId(Connection con, int cid) throws SQLException { try (PreparedStatement ps = con.prepareStatement("DELETE FROM medalmaps WHERE characterid = ?")) { ps.setInt(1, cid); @@ -2338,7 +2334,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(1, cid); ps.executeUpdate(); } - + try (PreparedStatement ps = con.prepareStatement("DELETE FROM queststatus WHERE characterid = ?")) { ps.setInt(1, cid); ps.executeUpdate(); @@ -2370,20 +2366,20 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + private static Pair> getChairTaskIntervalRate(int maxhp, int maxmp) { float toHeal = Math.max(maxhp, maxmp); float maxDuration = YamlConfig.config.server.CHAIR_EXTRA_HEAL_MAX_DELAY * 1000; - + int rate = 0; int minRegen = 1, maxRegen = (256 * YamlConfig.config.server.CHAIR_EXTRA_HEAL_MULTIPLIER) - 1, midRegen = 1; while (minRegen < maxRegen) { midRegen = (int) ((minRegen + maxRegen) * 0.94); - + float procs = toHeal / midRegen; float newRate = maxDuration / procs; rate = (int) newRate; - + if (newRate < 420) { minRegen = (int) (1.2 * midRegen); } else if (newRate > 5000) { @@ -2392,7 +2388,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { break; } } - + float procs = maxDuration / rate; int hpRegen, mpRegen; if (maxhp > maxmp) { @@ -2402,10 +2398,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { hpRegen = (int) Math.ceil(maxhp / procs); mpRegen = midRegen; } - + return new Pair<>(rate, new Pair<>(hpRegen, mpRegen)); } - + private void updateChairHealStats() { statRlock.lock(); try { @@ -2415,7 +2411,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { statRlock.unlock(); } - + effLock.lock(); statWlock.lock(); try { @@ -2429,12 +2425,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + private void startChairTask() { if (chair.get() < 0) { return; } - + int healInterval; effLock.lock(); try { @@ -2443,26 +2439,26 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { effLock.unlock(); } - + chrLock.lock(); try { if (chairRecoveryTask != null) { stopChairTask(); } - + chairRecoveryTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { updateChairHealStats(); final int healHP = localchairhp; final int healMP = localchairmp; - - if(MapleCharacter.this.getHp() < localmaxhp) { + + if (Character.this.getHp() < localmaxhp) { byte recHP = (byte) (healHP / YamlConfig.config.server.CHAIR_EXTRA_HEAL_MULTIPLIER); - + sendPacket(PacketCreator.showOwnRecovery(recHP)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showRecovery(id, recHP), false); - } else if (MapleCharacter.this.getMp() >= localmaxmp) { + getMap().broadcastMessage(Character.this, PacketCreator.showRecovery(id, recHP), false); + } else if (Character.this.getMp() >= localmaxmp) { stopChairTask(); // optimizing schedule management when player is already with full pool. } @@ -2473,7 +2469,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + private void stopExtraTask() { chrLock.lock(); try { @@ -2485,7 +2481,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + private void startExtraTask(final byte healHP, final byte healMP, final short healInterval) { chrLock.lock(); try { @@ -2494,22 +2490,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + private void startExtraTaskInternal(final byte healHP, final byte healMP, final short healInterval) { extraRecInterval = healInterval; extraRecoveryTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - if (getBuffSource(MapleBuffStat.HPREC) == -1 && getBuffSource(MapleBuffStat.MPREC) == -1) { + if (getBuffSource(BuffStat.HPREC) == -1 && getBuffSource(BuffStat.MPREC) == -1) { stopExtraTask(); return; } - - if(MapleCharacter.this.getHp() < localmaxhp) { - if(healHP > 0) { + + if (Character.this.getHp() < localmaxhp) { + if (healHP > 0) { sendPacket(PacketCreator.showOwnRecovery(healHP)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showRecovery(id, healHP), false); + getMap().broadcastMessage(Character.this, PacketCreator.showRecovery(id, healHP), false); } } @@ -2530,9 +2526,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void dispel() { - if(!(YamlConfig.config.server.USE_UNDISPEL_HOLY_SHIELD && this.hasActiveBuff(Bishop.HOLY_SHIELD))) { - List mbsvhList = getAllStatups(); - for (MapleBuffStatValueHolder mbsvh : mbsvhList) { + if (!(YamlConfig.config.server.USE_UNDISPEL_HOLY_SHIELD && this.hasActiveBuff(Bishop.HOLY_SHIELD))) { + List mbsvhList = getAllStatups(); + for (BuffStatValueHolder mbsvh : mbsvhList) { if (mbsvh.effect.isSkill()) { if (mbsvh.effect.getBuffSourceId() != Aran.COMBO_ABILITY) { // check discovered thanks to Croosade dev team cancelEffect(mbsvh.effect, false, mbsvh.startTime); @@ -2542,7 +2538,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public final boolean hasDisease(final MapleDisease dis) { + public final boolean hasDisease(final Disease dis) { chrLock.lock(); try { return diseases.containsKey(dis); @@ -2550,7 +2546,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public final int getDiseasesSize() { chrLock.lock(); try { @@ -2560,79 +2556,79 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public Map> getAllDiseases() { + public Map> getAllDiseases() { chrLock.lock(); try { long curtime = Server.getInstance().getCurrentTime(); - Map> ret = new LinkedHashMap<>(); - - for(Entry de : diseaseExpires.entrySet()) { - Pair dee = diseases.get(de.getKey()); - MapleDiseaseValueHolder mdvh = dee.getLeft(); - + Map> ret = new LinkedHashMap<>(); + + for (Entry de : diseaseExpires.entrySet()) { + Pair dee = diseases.get(de.getKey()); + DiseaseValueHolder mdvh = dee.getLeft(); + ret.put(de.getKey(), new Pair<>(mdvh.length - (curtime - mdvh.startTime), dee.getRight())); } - + return ret; } finally { chrLock.unlock(); } } - - public void silentApplyDiseases(Map> diseaseMap) { + + public void silentApplyDiseases(Map> diseaseMap) { chrLock.lock(); try { long curTime = Server.getInstance().getCurrentTime(); - - for(Entry> di : diseaseMap.entrySet()) { + + for (Entry> di : diseaseMap.entrySet()) { long expTime = curTime + di.getValue().getLeft(); - + diseaseExpires.put(di.getKey(), expTime); - diseases.put(di.getKey(), new Pair<>(new MapleDiseaseValueHolder(curTime, di.getValue().getLeft()), di.getValue().getRight())); + diseases.put(di.getKey(), new Pair<>(new DiseaseValueHolder(curTime, di.getValue().getLeft()), di.getValue().getRight())); } } finally { chrLock.unlock(); } } - + public void announceDiseases() { - Set>> chrDiseases; - + Set>> chrDiseases; + chrLock.lock(); try { // Poison damage visibility and diseases status visibility, extended through map transitions thanks to Ronan if (!this.isLoggedinWorld()) { return; } - + chrDiseases = new LinkedHashSet<>(diseases.entrySet()); } finally { chrLock.unlock(); } - - for(Entry> di : chrDiseases) { - MapleDisease disease = di.getKey(); - MobSkill skill = di.getValue().getRight(); - final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); - if (disease != MapleDisease.SLOW) { + for (Entry> di : chrDiseases) { + Disease disease = di.getKey(); + MobSkill skill = di.getValue().getRight(); + final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); + + if (disease != Disease.SLOW) { map.broadcastMessage(PacketCreator.giveForeignDebuff(id, debuff, skill)); } else { map.broadcastMessage(PacketCreator.giveForeignSlowDebuff(id, debuff, skill)); } } } - - public void collectDiseases() { - for (MapleCharacter chr : map.getAllPlayers()) { - int cid = chr.getId(); - - for (Entry> di : chr.getAllDiseases().entrySet()) { - MapleDisease disease = di.getKey(); - MobSkill skill = di.getValue().getRight(); - final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); - if (disease != MapleDisease.SLOW) { + public void collectDiseases() { + for (Character chr : map.getAllPlayers()) { + int cid = chr.getId(); + + for (Entry> di : chr.getAllDiseases().entrySet()) { + Disease disease = di.getKey(); + MobSkill skill = di.getValue().getRight(); + final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); + + if (disease != Disease.SLOW) { this.sendPacket(PacketCreator.giveForeignDebuff(cid, debuff, skill)); } else { this.sendPacket(PacketCreator.giveForeignSlowDebuff(cid, debuff, skill)); @@ -2640,32 +2636,32 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - public void giveDebuff(final MapleDisease disease, MobSkill skill) { + + public void giveDebuff(final Disease disease, MobSkill skill) { if (!hasDisease(disease) && getDiseasesSize() < 2) { - if (!(disease == MapleDisease.SEDUCE || disease == MapleDisease.STUN)) { + if (!(disease == Disease.SEDUCE || disease == Disease.STUN)) { if (hasActiveBuff(Bishop.HOLY_SHIELD)) { return; } } - + chrLock.lock(); try { long curTime = Server.getInstance().getCurrentTime(); diseaseExpires.put(disease, curTime + skill.getDuration()); - diseases.put(disease, new Pair<>(new MapleDiseaseValueHolder(curTime, skill.getDuration()), skill)); + diseases.put(disease, new Pair<>(new DiseaseValueHolder(curTime, skill.getDuration()), skill)); } finally { chrLock.unlock(); } - - if (disease == MapleDisease.SEDUCE && chair.get() < 0) { + + if (disease == Disease.SEDUCE && chair.get() < 0) { sitChair(-1); } - - final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); + + final List> debuff = Collections.singletonList(new Pair<>(disease, Integer.valueOf(skill.getX()))); sendPacket(PacketCreator.giveDebuff(debuff, skill)); - - if (disease != MapleDisease.SLOW) { + + if (disease != Disease.SLOW) { map.broadcastMessage(this, PacketCreator.giveForeignDebuff(id, debuff, skill), false); } else { map.broadcastMessage(this, PacketCreator.giveForeignSlowDebuff(id, debuff, skill), false); @@ -2673,12 +2669,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public void dispelDebuff(MapleDisease debuff) { + public void dispelDebuff(Disease debuff) { if (hasDisease(debuff)) { long mask = debuff.getValue(); sendPacket(PacketCreator.cancelDebuff(mask)); - - if (debuff != MapleDisease.SLOW) { + + if (debuff != Disease.SLOW) { map.broadcastMessage(this, PacketCreator.cancelForeignDebuff(id, mask), false); } else { map.broadcastMessage(this, PacketCreator.cancelForeignSlowDebuff(id), false); @@ -2695,21 +2691,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void dispelDebuffs() { - dispelDebuff(MapleDisease.CURSE); - dispelDebuff(MapleDisease.DARKNESS); - dispelDebuff(MapleDisease.POISON); - dispelDebuff(MapleDisease.SEAL); - dispelDebuff(MapleDisease.WEAKEN); - dispelDebuff(MapleDisease.SLOW); // thanks Conrad for noticing ZOMBIFY isn't dispellable + dispelDebuff(Disease.CURSE); + dispelDebuff(Disease.DARKNESS); + dispelDebuff(Disease.POISON); + dispelDebuff(Disease.SEAL); + dispelDebuff(Disease.WEAKEN); + dispelDebuff(Disease.SLOW); // thanks Conrad for noticing ZOMBIFY isn't dispellable } - + public void purgeDebuffs() { - dispelDebuff(MapleDisease.SEDUCE); - dispelDebuff(MapleDisease.ZOMBIFY); - dispelDebuff(MapleDisease.CONFUSE); + dispelDebuff(Disease.SEDUCE); + dispelDebuff(Disease.ZOMBIFY); + dispelDebuff(Disease.CONFUSE); dispelDebuffs(); } - + public void cancelAllDebuffs() { chrLock.lock(); try { @@ -2719,10 +2715,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public void dispelSkill(int skillid) { - List allBuffs = getAllStatups(); - for (MapleBuffStatValueHolder mbsvh : allBuffs) { + List allBuffs = getAllStatups(); + for (BuffStatValueHolder mbsvh : allBuffs) { if (skillid == 0) { if (mbsvh.effect.isSkill() && (mbsvh.effect.getSourceId() % 10000000 == 1004 || dispelSkills(mbsvh.effect.getSourceId()))) { cancelEffect(mbsvh.effect, false, mbsvh.startTime); @@ -2750,24 +2746,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + public void changeFaceExpression(int emote) { long timeNow = Server.getInstance().getCurrentTime(); - if(timeNow - lastExpression > 2000) { + if (timeNow - lastExpression > 2000) { lastExpression = timeNow; - + FaceExpressionService service = (FaceExpressionService) client.getChannelServer().getServiceAccess(ChannelServices.FACE_EXPRESSION); service.registerFaceExpression(map, this, emote); } } private void doHurtHp() { - if (!(this.getInventory(MapleInventoryType.EQUIPPED).findById(getMap().getHPDecProtect()) != null || buffMapProtection())) { + if (!(this.getInventory(InventoryType.EQUIPPED).findById(getMap().getHPDecProtect()) != null || buffMapProtection())) { addHP(-getMap().getHPDec()); lastHpDec = Server.getInstance().getCurrentTime(); } } - + private void startHpDecreaseTask(long lastHpTask) { hpDecreaseTask = TimerManager.getInstance().register(new Runnable() { @Override @@ -2776,16 +2772,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } }, YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL, YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL - lastHpTask); } - + public void resetHpDecreaseTask() { if (hpDecreaseTask != null) { hpDecreaseTask.cancel(false); } - + long lastHpTask = Server.getInstance().getCurrentTime() - lastHpDec; startHpDecreaseTask((lastHpTask > YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL) ? YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL : lastHpTask); } - + public void dropMessage(String message) { dropMessage(0, message); } @@ -2793,7 +2789,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void dropMessage(int type, String message) { sendPacket(PacketCreator.serverNotice(type, message)); } - + public void enteredScript(String script, int mapid) { if (!entered.containsKey(mapid)) { entered.put(mapid, script); @@ -2808,7 +2804,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { getWorldServer().updateMessenger(getMessenger(), getName(), getWorld(), client.getChannel()); } } - + public void cancelDiseaseExpireTask() { if (diseaseExpireTask != null) { diseaseExpireTask.cancel(false); @@ -2821,29 +2817,29 @@ public class MapleCharacter extends AbstractMapleCharacterObject { diseaseExpireTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - Set toExpire = new LinkedHashSet<>(); - + Set toExpire = new LinkedHashSet<>(); + chrLock.lock(); try { long curTime = Server.getInstance().getCurrentTime(); - - for(Entry de : diseaseExpires.entrySet()) { - if(de.getValue() < curTime) { + + for (Entry de : diseaseExpires.entrySet()) { + if (de.getValue() < curTime) { toExpire.add(de.getKey()); } } } finally { chrLock.unlock(); } - - for(MapleDisease d : toExpire) { + + for (Disease d : toExpire) { dispelDebuff(d); } } }, 1500); } } - + public void cancelBuffExpireTask() { if (buffExpireTask != null) { buffExpireTask.cancel(false); @@ -2857,16 +2853,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { @Override public void run() { Set> es; - List toCancel = new ArrayList<>(); - + List toCancel = new ArrayList<>(); + effLock.lock(); chrLock.lock(); try { es = new LinkedHashSet<>(buffExpires.entrySet()); - + long curTime = Server.getInstance().getCurrentTime(); - for(Entry bel : es) { - if(curTime >= bel.getValue()) { + for (Entry bel : es) { + if (curTime >= bel.getValue()) { toCancel.add(buffEffects.get(bel.getKey()).entrySet().iterator().next().getValue()); //rofl } } @@ -2874,15 +2870,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); effLock.unlock(); } - - for(MapleBuffStatValueHolder mbsvh : toCancel) { + + for (BuffStatValueHolder mbsvh : toCancel) { cancelEffect(mbsvh.effect, false, mbsvh.startTime); } } }, 1500); } } - + public void cancelSkillCooldownTask() { if (skillCooldownTask != null) { skillCooldownTask.cancel(false); @@ -2895,8 +2891,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { skillCooldownTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - Set> es; - + Set> es; + effLock.lock(); chrLock.lock(); try { @@ -2905,11 +2901,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); effLock.unlock(); } - + long curTime = Server.getInstance().getCurrentTime(); - for(Entry bel : es) { - MapleCoolDownValueHolder mcdvh = bel.getValue(); - if(curTime >= mcdvh.startTime + mcdvh.length) { + for (Entry bel : es) { + CooldownValueHolder mcdvh = bel.getValue(); + if (curTime >= mcdvh.startTime + mcdvh.length) { removeCooldown(mcdvh.skillId); sendPacket(PacketCreator.skillCooldown(mcdvh.skillId, 0)); } @@ -2918,7 +2914,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { }, 1500); } } - + public void cancelExpirationTask() { if (itemExpireTask != null) { itemExpireTask.cancel(false); @@ -2932,10 +2928,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { @Override public void run() { boolean deletedCoupon = false; - + long expiration, currenttime = System.currentTimeMillis(); Set keys = getSkills().keySet(); - for (Iterator i = keys.iterator(); i.hasNext();) { + for (Iterator i = keys.iterator(); i.hasNext(); ) { Skill key = i.next(); SkillEntry skill = getSkills().get(key); if (skill.expiration != -1 && skill.expiration < currenttime) { @@ -2947,7 +2943,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { for (Inventory inv : inventory) { for (Item item : inv.list()) { expiration = item.getExpiration(); - + if (expiration != -1 && (expiration < currenttime) && ((item.getFlag() & ItemConstants.LOCK) == ItemConstants.LOCK)) { short lock = item.getFlag(); lock &= ~(ItemConstants.LOCK); @@ -2962,11 +2958,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { deletedCoupon = true; } } else { - MaplePet pet = item.getPet(); // thanks Lame for noticing pets not getting despawned after expiration time + Pet pet = item.getPet(); // thanks Lame for noticing pets not getting despawned after expiration time if (pet != null) { unequipPet(pet, true); } - + if (ItemConstants.isExpirablePet(item.getItemId())) { sendPacket(PacketCreator.itemExpired(item.getItemId())); toberemove.add(item); @@ -2977,13 +2973,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - if(!toberemove.isEmpty()) { + + if (!toberemove.isEmpty()) { for (Item item : toberemove) { - MapleInventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true); + InventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true); } - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + ItemInformationProvider ii = ItemInformationProvider.getInstance(); for (Item item : toberemove) { List toadd = new ArrayList<>(); Pair replace = ii.getReplaceOnExpire(item.getItemId()); @@ -2994,14 +2990,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } for (Integer itemid : toadd) { - MapleInventoryManipulator.addById(client, itemid, (short) 1); + InventoryManipulator.addById(client, itemid, (short) 1); } } toberemove.clear(); } - - if(deletedCoupon) { + + if (deletedCoupon) { updateCouponRates(); } } @@ -3011,7 +3007,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public enum FameStatus { - + OK, NOT_TODAY, NOT_THIS_MONTH } @@ -3027,24 +3023,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { long currentgexp = gachaexp.get(); if ((currentgexp + exp.get()) >= ExpTable.getExpNeededForLevel(level)) { expgain += ExpTable.getExpNeededForLevel(level) - exp.get(); - + int nextneed = ExpTable.getExpNeededForLevel(level + 1); if (currentgexp - expgain >= nextneed) { expgain += nextneed; } - + this.gachaexp.set((int) (currentgexp - expgain)); } else { expgain = this.gachaexp.getAndSet(0); } gainExp(expgain, false, true); - updateSingleStat(MapleStat.GACHAEXP, this.gachaexp.get()); + updateSingleStat(Stat.GACHAEXP, this.gachaexp.get()); } public void addGachaExp(int gain) { - updateSingleStat(MapleStat.GACHAEXP, gachaexp.addAndGet(gain)); + updateSingleStat(Stat.GACHAEXP, gachaexp.addAndGet(gain)); } - + public void gainExp(int gain) { gainExp(gain, true, true); } @@ -3052,65 +3048,65 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void gainExp(int gain, boolean show, boolean inChat) { gainExp(gain, show, inChat, true); } - + public void gainExp(int gain, boolean show, boolean inChat, boolean white) { gainExp(gain, 0, show, inChat, white); } - + public void gainExp(int gain, int party, boolean show, boolean inChat, boolean white) { - if (hasDisease(MapleDisease.CURSE)) { + if (hasDisease(Disease.CURSE)) { gain *= 0.5; party *= 0.5; } - - if(gain < 0) { + + if (gain < 0) { gain = Integer.MAX_VALUE; // integer overflow, heh. } - - if(party < 0) { + + if (party < 0) { party = Integer.MAX_VALUE; // integer overflow, heh. } - - int equip = (int) Math.min((long)(gain / 10) * pendantExp, Integer.MAX_VALUE); - - gainExpInternal((long) gain, equip, party, show, inChat, white); + + int equip = (int) Math.min((long) (gain / 10) * pendantExp, Integer.MAX_VALUE); + + gainExpInternal(gain, equip, party, show, inChat, white); } - + public void loseExp(int loss, boolean show, boolean inChat) { loseExp(loss, show, inChat, true); } - + public void loseExp(int loss, boolean show, boolean inChat, boolean white) { gainExpInternal(-loss, 0, 0, show, inChat, white); } - + private void announceExpGain(long gain, int equip, int party, boolean inChat, boolean white) { gain = Math.min(gain, Integer.MAX_VALUE); if (gain == 0) { if (party == 0) { return; } - + gain = party; party = 0; white = false; } - + sendPacket(PacketCreator.getShowExpGain((int) gain, equip, party, inChat, white)); } - + private synchronized void gainExpInternal(long gain, int equip, int party, boolean show, boolean inChat, boolean white) { // need of method synchonization here detected thanks to MedicOP long total = Math.max(gain + equip + party, -exp.get()); - + if (level < getMaxLevel() && (allowExpGain || this.getEventInstance() != null)) { long leftover = 0; long nextExp = exp.get() + total; - + if (nextExp > (long) Integer.MAX_VALUE) { total = Integer.MAX_VALUE - exp.get(); leftover = nextExp - Integer.MAX_VALUE; } - updateSingleStat(MapleStat.EXP, exp.addAndGet((int) total)); + updateSingleStat(Stat.EXP, exp.addAndGet((int) total)); if (show) { announceExpGain(gain, equip, party, inChat, white); } @@ -3118,12 +3114,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { levelUp(true); if (level == getMaxLevel()) { setExp(0); - updateSingleStat(MapleStat.EXP, 0); + updateSingleStat(Stat.EXP, 0); break; } } - - if(leftover > 0) { + + if (leftover > 0) { gainExpInternal(leftover, equip, party, false, inChat, white); } else { lastExpGainTime = System.currentTimeMillis(); @@ -3147,36 +3143,36 @@ public class MapleCharacter extends AbstractMapleCharacterObject { petLock.unlock(); } } - + public void gainFame(int delta) { gainFame(delta, null, 0); } - - public boolean gainFame(int delta, MapleCharacter fromPlayer, int mode) { + + public boolean gainFame(int delta, Character fromPlayer, int mode) { Pair fameRes = applyFame(delta); delta = fameRes.getRight(); if (delta != 0) { int thisFame = fameRes.getLeft(); - updateSingleStat(MapleStat.FAME, thisFame); - + updateSingleStat(Stat.FAME, thisFame); + if (fromPlayer != null) { fromPlayer.sendPacket(PacketCreator.giveFameResponse(mode, getName(), thisFame)); sendPacket(PacketCreator.receiveFame(mode, fromPlayer.getName())); } else { sendPacket(PacketCreator.getShowFameGain(delta)); } - + return true; } else { return false; } } - + public boolean canHoldMeso(int gain) { // thanks lucasziron for pointing out a need to check space availability for mesos on player transactions long nextMeso = (long) meso.get() + gain; return nextMeso <= Integer.MAX_VALUE; } - + public void gainMeso(int gain) { gainMeso(gain, true, false, true); } @@ -3199,9 +3195,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { petLock.unlock(); } - + if (gain != 0) { - updateSingleStat(MapleStat.MESO, (int) nextMeso, enableActions); + updateSingleStat(Stat.MESO, (int) nextMeso, enableActions); if (show) { sendPacket(PacketCreator.getShowMesoGain(gain, inChat)); } @@ -3220,18 +3216,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public List getAllCooldowns() { List ret = new ArrayList<>(); - + effLock.lock(); chrLock.lock(); try { - for (MapleCoolDownValueHolder mcdvh : coolDowns.values()) { + for (CooldownValueHolder mcdvh : coolDowns.values()) { ret.add(new PlayerCoolDownValueHolder(mcdvh.skillId, mcdvh.startTime, mcdvh.length)); } } finally { chrLock.unlock(); effLock.unlock(); } - + return ret; } @@ -3246,16 +3242,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public static int getAriantSlotsRoom(int room) { return ariantroomslot[room]; } - + public void updateAriantScore() { updateAriantScore(0); } - + public void updateAriantScore(int dropQty) { AriantColiseum arena = this.getAriantColiseum(); if (arena != null) { arena.updateAriantScore(this, countItem(4031868)); - + if (dropQty > 0) { arena.addLostShards(dropQty); } @@ -3293,11 +3289,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return character; } - public Long getBuffedStarttime(MapleBuffStat effect) { + public Long getBuffedStarttime(BuffStat effect) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(effect); + BuffStatValueHolder mbsvh = effects.get(effect); if (mbsvh == null) { return null; } @@ -3308,11 +3304,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public Integer getBuffedValue(MapleBuffStat effect) { + public Integer getBuffedValue(BuffStat effect) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(effect); + BuffStatValueHolder mbsvh = effects.get(effect); if (mbsvh == null) { return null; } @@ -3323,11 +3319,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public int getBuffSource(MapleBuffStat stat) { + public int getBuffSource(BuffStat stat) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(stat); + BuffStatValueHolder mbsvh = effects.get(stat); if (mbsvh == null) { return -1; } @@ -3338,11 +3334,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public MapleStatEffect getBuffEffect(MapleBuffStat stat) { + public StatEffect getBuffEffect(BuffStat stat) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(stat); + BuffStatValueHolder mbsvh = effects.get(stat); if (mbsvh == null) { return null; } else { @@ -3364,14 +3360,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - - private List getAllStatups() { + + private List getAllStatups() { effLock.lock(); chrLock.lock(); try { - List ret = new ArrayList<>(); - for(Map bel : buffEffects.values()) { - for(MapleBuffStatValueHolder mbsvh : bel.values()) { + List ret = new ArrayList<>(); + for (Map bel : buffEffects.values()) { + for (BuffStatValueHolder mbsvh : bel.values()) { ret.add(mbsvh); } } @@ -3381,19 +3377,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public List getAllBuffs() { // buff values will be stored in an arbitrary order effLock.lock(); chrLock.lock(); try { long curtime = Server.getInstance().getCurrentTime(); - + Map ret = new LinkedHashMap<>(); - for(Map bel : buffEffects.values()) { - for(MapleBuffStatValueHolder mbsvh : bel.values()) { + for (Map bel : buffEffects.values()) { + for (BuffStatValueHolder mbsvh : bel.values()) { int srcid = mbsvh.effect.getBuffSourceId(); - if(!ret.containsKey(srcid)) { - ret.put(srcid, new PlayerBuffValueHolder((int)(curtime - mbsvh.startTime), mbsvh.effect)); + if (!ret.containsKey(srcid)) { + ret.put(srcid, new PlayerBuffValueHolder((int) (curtime - mbsvh.startTime), mbsvh.effect)); } } } @@ -3404,13 +3400,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public List> getAllActiveStatups() { + public List> getAllActiveStatups() { effLock.lock(); chrLock.lock(); try { - List> ret = new ArrayList<>(); - for (MapleBuffStat mbs : effects.keySet()) { - MapleBuffStatValueHolder mbsvh = effects.get(mbs); + List> ret = new ArrayList<>(); + for (BuffStat mbs : effects.keySet()) { + BuffStatValueHolder mbsvh = effects.get(mbs); ret.add(new Pair<>(mbs, mbsvh.value)); } return ret; @@ -3419,7 +3415,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public boolean hasBuffFromSourceid(int sourceid) { effLock.lock(); chrLock.lock(); @@ -3430,10 +3426,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public boolean hasActiveBuff(int sourceid) { - LinkedList allBuffs; - + LinkedList allBuffs; + effLock.lock(); chrLock.lock(); try { @@ -3442,133 +3438,133 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); effLock.unlock(); } - - for (MapleBuffStatValueHolder mbsvh : allBuffs) { + + for (BuffStatValueHolder mbsvh : allBuffs) { if (mbsvh.effect.getBuffSourceId() == sourceid) { return true; } } return false; } - - private List> getActiveStatupsFromSourceid(int sourceid) { // already under effLock & chrLock - List> ret = new ArrayList<>(); - List> singletonStatups = new ArrayList<>(); - for(Entry bel : buffEffects.get(sourceid).entrySet()) { - MapleBuffStat mbs = bel.getKey(); - MapleBuffStatValueHolder mbsvh = effects.get(bel.getKey()); - - Pair p; - if(mbsvh != null) { + + private List> getActiveStatupsFromSourceid(int sourceid) { // already under effLock & chrLock + List> ret = new ArrayList<>(); + List> singletonStatups = new ArrayList<>(); + for (Entry bel : buffEffects.get(sourceid).entrySet()) { + BuffStat mbs = bel.getKey(); + BuffStatValueHolder mbsvh = effects.get(bel.getKey()); + + Pair p; + if (mbsvh != null) { p = new Pair<>(mbs, mbsvh.value); } else { p = new Pair<>(mbs, 0); } - + if (!isSingletonStatup(mbs)) { // thanks resinate, Daddy Egg for pointing out morph issues when updating it along with other statups ret.add(p); } else { singletonStatups.add(p); } } - - Collections.sort(ret, new Comparator>() { + + Collections.sort(ret, new Comparator>() { @Override - public int compare(Pair p1, Pair p2) { + public int compare(Pair p1, Pair p2) { return p1.getLeft().compareTo(p2.getLeft()); } }); - + if (!singletonStatups.isEmpty()) { - Collections.sort(singletonStatups, new Comparator>() { + Collections.sort(singletonStatups, new Comparator>() { @Override - public int compare(Pair p1, Pair p2) { + public int compare(Pair p1, Pair p2) { return p1.getLeft().compareTo(p2.getLeft()); } }); - + ret.addAll(singletonStatups); } - + return ret; } - - private void addItemEffectHolder(Integer sourceid, long expirationtime, Map statups) { + + private void addItemEffectHolder(Integer sourceid, long expirationtime, Map statups) { buffEffects.put(sourceid, statups); buffExpires.put(sourceid, expirationtime); } - - private boolean removeEffectFromItemEffectHolder(Integer sourceid, MapleBuffStat buffStat) { - Map lbe = buffEffects.get(sourceid); - - if(lbe.remove(buffStat) != null) { - buffEffectsCount.put(buffStat, (byte)(buffEffectsCount.get(buffStat) - 1)); - - if(lbe.isEmpty()) { + + private boolean removeEffectFromItemEffectHolder(Integer sourceid, BuffStat buffStat) { + Map lbe = buffEffects.get(sourceid); + + if (lbe.remove(buffStat) != null) { + buffEffectsCount.put(buffStat, (byte) (buffEffectsCount.get(buffStat) - 1)); + + if (lbe.isEmpty()) { buffEffects.remove(sourceid); buffExpires.remove(sourceid); } - + return true; } - + return false; } - + private void removeItemEffectHolder(Integer sourceid) { - Map be = buffEffects.remove(sourceid); - if(be != null) { - for(Entry bei : be.entrySet()) { - buffEffectsCount.put(bei.getKey(), (byte)(buffEffectsCount.get(bei.getKey()) - 1)); + Map be = buffEffects.remove(sourceid); + if (be != null) { + for (Entry bei : be.entrySet()) { + buffEffectsCount.put(bei.getKey(), (byte) (buffEffectsCount.get(bei.getKey()) - 1)); } } - + buffExpires.remove(sourceid); } - - private void dropWorstEffectFromItemEffectHolder(MapleBuffStat mbs) { + + private void dropWorstEffectFromItemEffectHolder(BuffStat mbs) { Integer min = Integer.MAX_VALUE; Integer srcid = -1; - for(Entry> bpl: buffEffects.entrySet()) { - MapleBuffStatValueHolder mbsvh = bpl.getValue().get(mbs); - if(mbsvh != null) { - if(mbsvh.value < min) { + for (Entry> bpl : buffEffects.entrySet()) { + BuffStatValueHolder mbsvh = bpl.getValue().get(mbs); + if (mbsvh != null) { + if (mbsvh.value < min) { min = mbsvh.value; srcid = bpl.getKey(); } } } - + removeEffectFromItemEffectHolder(srcid, mbs); } - - private MapleBuffStatValueHolder fetchBestEffectFromItemEffectHolder(MapleBuffStat mbs) { + + private BuffStatValueHolder fetchBestEffectFromItemEffectHolder(BuffStat mbs) { Pair max = new Pair<>(Integer.MIN_VALUE, 0); - MapleBuffStatValueHolder mbsvh = null; - for(Entry> bpl: buffEffects.entrySet()) { - MapleBuffStatValueHolder mbsvhi = bpl.getValue().get(mbs); - if(mbsvhi != null) { - if(!mbsvhi.effect.isActive(this)) { + BuffStatValueHolder mbsvh = null; + for (Entry> bpl : buffEffects.entrySet()) { + BuffStatValueHolder mbsvhi = bpl.getValue().get(mbs); + if (mbsvhi != null) { + if (!mbsvhi.effect.isActive(this)) { continue; } - - if(mbsvhi.value > max.left) { + + if (mbsvhi.value > max.left) { max = new Pair<>(mbsvhi.value, mbsvhi.effect.getStatups().size()); mbsvh = mbsvhi; - } else if(mbsvhi.value == max.left && mbsvhi.effect.getStatups().size() > max.right) { + } else if (mbsvhi.value == max.left && mbsvhi.effect.getStatups().size() > max.right) { max = new Pair<>(mbsvhi.value, mbsvhi.effect.getStatups().size()); mbsvh = mbsvhi; } } } - - if(mbsvh != null) { + + if (mbsvh != null) { effects.put(mbs, mbsvh); } return mbsvh; } - - private void extractBuffValue(int sourceid, MapleBuffStat stat) { + + private void extractBuffValue(int sourceid, BuffStat stat) { chrLock.lock(); try { removeEffectFromItemEffectHolder(sourceid, stat); @@ -3576,42 +3572,42 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public void debugListAllBuffs() { effLock.lock(); chrLock.lock(); try { System.out.println("-------------------"); System.out.println("CACHED BUFF COUNT: "); - for(Entry bpl : buffEffectsCount.entrySet()) { + for (Entry bpl : buffEffectsCount.entrySet()) { System.out.println(bpl.getKey() + ": " + bpl.getValue()); } System.out.println("-------------------"); System.out.println("CACHED BUFFS: "); - for(Entry> bpl : buffEffects.entrySet()) { + for (Entry> bpl : buffEffects.entrySet()) { System.out.print(bpl.getKey() + ": "); - for(Entry pble : bpl.getValue().entrySet()) { + for (Entry pble : bpl.getValue().entrySet()) { System.out.print(pble.getKey().name() + pble.getValue().value + ", "); } System.out.println(); } System.out.println("-------------------"); - + System.out.println("IN ACTION:"); - for(Entry bpl : effects.entrySet()) { - System.out.println(bpl.getKey().name() + " -> " + MapleItemInformationProvider.getInstance().getName(bpl.getValue().effect.getSourceId())); + for (Entry bpl : effects.entrySet()) { + System.out.println(bpl.getKey().name() + " -> " + ItemInformationProvider.getInstance().getName(bpl.getValue().effect.getSourceId())); } } finally { chrLock.unlock(); effLock.unlock(); } } - + public void debugListAllBuffsCount() { effLock.lock(); chrLock.lock(); try { - for(Entry mbsl : buffEffectsCount.entrySet()) { + for (Entry mbsl : buffEffectsCount.entrySet()) { System.out.println(mbsl.getKey().name() + " -> " + mbsl.getValue()); } } finally { @@ -3619,19 +3615,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public void cancelAllBuffs(boolean softcancel) { if (softcancel) { effLock.lock(); chrLock.lock(); try { - cancelEffectFromBuffStat(MapleBuffStat.SUMMON); - cancelEffectFromBuffStat(MapleBuffStat.PUPPET); - cancelEffectFromBuffStat(MapleBuffStat.COMBO); - + cancelEffectFromBuffStat(BuffStat.SUMMON); + cancelEffectFromBuffStat(BuffStat.PUPPET); + cancelEffectFromBuffStat(BuffStat.COMBO); + effects.clear(); - - for(Integer srcid : new ArrayList<>(buffEffects.keySet())) { + + for (Integer srcid : new ArrayList<>(buffEffects.keySet())) { removeItemEffectHolder(srcid); } } finally { @@ -3639,13 +3635,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } else { - Map mseBuffs = new LinkedHashMap<>(); + Map mseBuffs = new LinkedHashMap<>(); effLock.lock(); chrLock.lock(); try { - for(Entry> bpl : buffEffects.entrySet()) { - for(Entry mbse : bpl.getValue().entrySet()) { + for (Entry> bpl : buffEffects.entrySet()) { + for (Entry mbse : bpl.getValue().entrySet()) { mseBuffs.put(mbse.getValue().effect, mbse.getValue().startTime); } } @@ -3654,24 +3650,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } - for (Entry mse : mseBuffs.entrySet()) { + for (Entry mse : mseBuffs.entrySet()) { cancelEffect(mse.getKey(), false, mse.getValue()); } } } - private void dropBuffStats(List> effectsToCancel) { - for (Pair cancelEffectCancelTasks : effectsToCancel) { + private void dropBuffStats(List> effectsToCancel) { + for (Pair cancelEffectCancelTasks : effectsToCancel) { //boolean nestedCancel = false; - + chrLock.lock(); try { /* if (buffExpires.get(cancelEffectCancelTasks.getRight().effect.getBuffSourceId()) != null) { nestedCancel = true; }*/ - - if(cancelEffectCancelTasks.getRight().bestApplied) { + + if (cancelEffectCancelTasks.getRight().bestApplied) { fetchBestEffectFromItemEffectHolder(cancelEffectCancelTasks.getLeft()); } } finally { @@ -3684,40 +3680,40 @@ public class MapleCharacter extends AbstractMapleCharacterObject { }*/ } } - - private List> deregisterBuffStats(Map stats) { + + private List> deregisterBuffStats(Map stats) { chrLock.lock(); try { - List> effectsToCancel = new ArrayList<>(stats.size()); - for (Entry stat : stats.entrySet()) { + List> effectsToCancel = new ArrayList<>(stats.size()); + for (Entry stat : stats.entrySet()) { int sourceid = stat.getValue().effect.getBuffSourceId(); - - if(!buffEffects.containsKey(sourceid)) { + + if (!buffEffects.containsKey(sourceid)) { buffExpires.remove(sourceid); } - - MapleBuffStat mbs = stat.getKey(); + + BuffStat mbs = stat.getKey(); effectsToCancel.add(new Pair<>(mbs, stat.getValue())); - - MapleBuffStatValueHolder mbsvh = effects.get(mbs); + + BuffStatValueHolder mbsvh = effects.get(mbs); if (mbsvh != null && mbsvh.effect.getBuffSourceId() == sourceid) { mbsvh.bestApplied = true; effects.remove(mbs); - - if (mbs == MapleBuffStat.RECOVERY) { + + if (mbs == BuffStat.RECOVERY) { if (recoveryTask != null) { recoveryTask.cancel(false); recoveryTask = null; } - } else if (mbs == MapleBuffStat.SUMMON || mbs == MapleBuffStat.PUPPET) { + } else if (mbs == BuffStat.SUMMON || mbs == BuffStat.PUPPET) { int summonId = mbsvh.effect.getSourceId(); - MapleSummon summon = summons.get(summonId); + Summon summon = summons.get(summonId); if (summon != null) { getMap().broadcastMessage(PacketCreator.removeSummon(summon, true), summon.getPosition()); getMap().removeMapObject(summon); removeVisibleMapObject(summon); - + summons.remove(summonId); if (summon.isPuppet()) { map.removePlayerPuppet(this); @@ -3732,22 +3728,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - } else if (mbs == MapleBuffStat.DRAGONBLOOD) { + } else if (mbs == BuffStat.DRAGONBLOOD) { dragonBloodSchedule.cancel(false); dragonBloodSchedule = null; - } else if (mbs == MapleBuffStat.HPREC || mbs == MapleBuffStat.MPREC) { - if(mbs == MapleBuffStat.HPREC) { + } else if (mbs == BuffStat.HPREC || mbs == BuffStat.MPREC) { + if (mbs == BuffStat.HPREC) { extraHpRec = 0; } else { extraMpRec = 0; } - + if (extraRecoveryTask != null) { extraRecoveryTask.cancel(false); extraRecoveryTask = null; } - - if(extraHpRec != 0 || extraMpRec != 0) { + + if (extraHpRec != 0 || extraMpRec != 0) { startExtraTaskInternal(extraHpRec, extraMpRec, extraRecInterval); } } @@ -3759,14 +3755,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public void cancelEffect(int itemId) { cancelEffect(ii.getItemEffect(itemId), false, -1); } - public boolean cancelEffect(MapleStatEffect effect, boolean overwrite, long startTime) { + public boolean cancelEffect(StatEffect effect, boolean overwrite, long startTime) { boolean ret; - + prtLock.lock(); effLock.lock(); try { @@ -3775,34 +3771,36 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); prtLock.unlock(); } - + if (effect.isMagicDoor() && ret) { prtLock.lock(); effLock.lock(); try { if (!hasBuffFromSourceid(Priest.MYSTIC_DOOR)) { - MapleDoor.attemptRemoveDoor(this); + Door.attemptRemoveDoor(this); } } finally { effLock.unlock(); prtLock.unlock(); } } - + return ret; } - - private static MapleStatEffect getEffectFromBuffSource(Map buffSource) { + + private static StatEffect getEffectFromBuffSource(Map buffSource) { try { return buffSource.entrySet().iterator().next().getValue().effect; } catch (Exception e) { return null; } } - - private boolean isUpdatingEffect(Set activeEffects, MapleStatEffect mse) { - if (mse == null) return false; - + + private boolean isUpdatingEffect(Set activeEffects, StatEffect mse) { + if (mse == null) { + return false; + } + // thanks xinyifly for noticing "Speed Infusion" crashing game when updating buffs during map transition boolean active = mse.isActive(this); if (active) { @@ -3811,105 +3809,105 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return activeEffects.contains(mse); } } - + public void updateActiveEffects() { effLock.lock(); // thanks davidlafriniere, maple006, RedHat for pointing a deadlock occurring here try { - Set updatedBuffs = new LinkedHashSet<>(); - Set activeEffects = new LinkedHashSet<>(); - - for (MapleBuffStatValueHolder mse : effects.values()) { + Set updatedBuffs = new LinkedHashSet<>(); + Set activeEffects = new LinkedHashSet<>(); + + for (BuffStatValueHolder mse : effects.values()) { activeEffects.add(mse.effect); } - - for (Map buff : buffEffects.values()) { - MapleStatEffect mse = getEffectFromBuffSource(buff); + + for (Map buff : buffEffects.values()) { + StatEffect mse = getEffectFromBuffSource(buff); if (isUpdatingEffect(activeEffects, mse)) { - for (Pair p : mse.getStatups()) { + for (Pair p : mse.getStatups()) { updatedBuffs.add(p.getLeft()); } } } - - for (MapleBuffStat mbs : updatedBuffs) { + + for (BuffStat mbs : updatedBuffs) { effects.remove(mbs); } - + updateEffects(updatedBuffs); } finally { effLock.unlock(); } } - - private void updateEffects(Set removedStats) { + + private void updateEffects(Set removedStats) { effLock.lock(); chrLock.lock(); try { - Set retrievedStats = new LinkedHashSet<>(); - - for (MapleBuffStat mbs : removedStats) { + Set retrievedStats = new LinkedHashSet<>(); + + for (BuffStat mbs : removedStats) { fetchBestEffectFromItemEffectHolder(mbs); - - MapleBuffStatValueHolder mbsvh = effects.get(mbs); + + BuffStatValueHolder mbsvh = effects.get(mbs); if (mbsvh != null) { - for (Pair statup : mbsvh.effect.getStatups()) { + for (Pair statup : mbsvh.effect.getStatups()) { retrievedStats.add(statup.getLeft()); } } } - - propagateBuffEffectUpdates(new LinkedHashMap>(), retrievedStats, removedStats); + + propagateBuffEffectUpdates(new LinkedHashMap>(), retrievedStats, removedStats); } finally { chrLock.unlock(); effLock.unlock(); } } - - private boolean cancelEffect(MapleStatEffect effect, boolean overwrite, long startTime, boolean firstCancel) { - Set removedStats = new LinkedHashSet<>(); + + private boolean cancelEffect(StatEffect effect, boolean overwrite, long startTime, boolean firstCancel) { + Set removedStats = new LinkedHashSet<>(); dropBuffStats(cancelEffectInternal(effect, overwrite, startTime, removedStats)); updateLocalStats(); updateEffects(removedStats); - + return !removedStats.isEmpty(); } - - private List> cancelEffectInternal(MapleStatEffect effect, boolean overwrite, long startTime, Set removedStats) { - Map buffstats = null; - MapleBuffStat ombs; + + private List> cancelEffectInternal(StatEffect effect, boolean overwrite, long startTime, Set removedStats) { + Map buffstats = null; + BuffStat ombs; if (!overwrite) { // is removing the source effect, meaning every effect from this srcid is being purged buffstats = extractCurrentBuffStats(effect); } else if ((ombs = getSingletonStatupFromEffect(effect)) != null) { // removing all effects of a buff having non-shareable buff stat. - MapleBuffStatValueHolder mbsvh = effects.get(ombs); - if(mbsvh != null) { + BuffStatValueHolder mbsvh = effects.get(ombs); + if (mbsvh != null) { buffstats = extractCurrentBuffStats(mbsvh.effect); } } - + if (buffstats == null) { // all else, is dropping ALL current statups that uses same stats as the given effect buffstats = extractLeastRelevantStatEffectsIfFull(effect); } - + if (effect.isMapChair()) { stopChairTask(); } - - List> toCancel = deregisterBuffStats(buffstats); + + List> toCancel = deregisterBuffStats(buffstats); if (effect.isMonsterRiding()) { this.getClient().getWorldServer().unregisterMountHunger(this); this.getMount().setActive(false); } - + if (!overwrite) { removedStats.addAll(buffstats.keySet()); } - + return toCancel; } - public void cancelEffectFromBuffStat(MapleBuffStat stat) { - MapleBuffStatValueHolder effect; - + public void cancelEffectFromBuffStat(BuffStat stat) { + BuffStatValueHolder effect; + effLock.lock(); chrLock.lock(); try { @@ -3922,17 +3920,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { cancelEffect(effect.effect, false, -1); } } - - public void cancelBuffStats(MapleBuffStat stat) { + + public void cancelBuffStats(BuffStat stat) { effLock.lock(); try { - List> cancelList = new LinkedList<>(); - + List> cancelList = new LinkedList<>(); + chrLock.lock(); try { - for(Entry> bel : this.buffEffects.entrySet()) { - MapleBuffStatValueHolder beli = bel.getValue().get(stat); - if(beli != null) { + for (Entry> bel : this.buffEffects.entrySet()) { + BuffStatValueHolder beli = bel.getValue().get(stat); + if (beli != null) { cancelList.add(new Pair<>(bel.getKey(), beli)); } } @@ -3940,8 +3938,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } - Map buffStatList = new LinkedHashMap<>(); - for(Pair p : cancelList) { + Map buffStatList = new LinkedHashMap<>(); + for (Pair p : cancelList) { buffStatList.put(stat, p.getRight()); extractBuffValue(p.getLeft(), stat); dropBuffStats(deregisterBuffStats(buffStatList)); @@ -3949,45 +3947,45 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { effLock.unlock(); } - + cancelPlayerBuffs(Arrays.asList(stat)); } - - private Map extractCurrentBuffStats(MapleStatEffect effect) { + + private Map extractCurrentBuffStats(StatEffect effect) { chrLock.lock(); try { - Map stats = new LinkedHashMap<>(); - Map buffList = buffEffects.remove(effect.getBuffSourceId()); - - if(buffList != null) { - for (Entry stateffect : buffList.entrySet()) { + Map stats = new LinkedHashMap<>(); + Map buffList = buffEffects.remove(effect.getBuffSourceId()); + + if (buffList != null) { + for (Entry stateffect : buffList.entrySet()) { stats.put(stateffect.getKey(), stateffect.getValue()); - buffEffectsCount.put(stateffect.getKey(), (byte)(buffEffectsCount.get(stateffect.getKey()) - 1)); + buffEffectsCount.put(stateffect.getKey(), (byte) (buffEffectsCount.get(stateffect.getKey()) - 1)); } } - + return stats; } finally { chrLock.unlock(); } } - - private Map extractLeastRelevantStatEffectsIfFull(MapleStatEffect effect) { - Map extractedStatBuffs = new LinkedHashMap<>(); - + + private Map extractLeastRelevantStatEffectsIfFull(StatEffect effect) { + Map extractedStatBuffs = new LinkedHashMap<>(); + chrLock.lock(); try { - Map stats = new LinkedHashMap<>(); - Map minStatBuffs = new LinkedHashMap<>(); - - for(Entry> mbsvhi : buffEffects.entrySet()) { - for(Entry mbsvhe : mbsvhi.getValue().entrySet()) { - MapleBuffStat mbs = mbsvhe.getKey(); + Map stats = new LinkedHashMap<>(); + Map minStatBuffs = new LinkedHashMap<>(); + + for (Entry> mbsvhi : buffEffects.entrySet()) { + for (Entry mbsvhe : mbsvhi.getValue().entrySet()) { + BuffStat mbs = mbsvhe.getKey(); Byte b = stats.get(mbs); - - if(b != null) { + + if (b != null) { stats.put(mbs, (byte) (b + 1)); - if(mbsvhe.getValue().value < minStatBuffs.get(mbs).value) { + if (mbsvhe.getValue().value < minStatBuffs.get(mbs).value) { minStatBuffs.put(mbs, mbsvhe.getValue()); } } else { @@ -3996,23 +3994,23 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - Set effectStatups = new LinkedHashSet<>(); - for(Pair efstat : effect.getStatups()) { + + Set effectStatups = new LinkedHashSet<>(); + for (Pair efstat : effect.getStatups()) { effectStatups.add(efstat.getLeft()); } - - for(Entry it : stats.entrySet()) { + + for (Entry it : stats.entrySet()) { boolean uniqueBuff = isSingletonStatup(it.getKey()); - - if(it.getValue() >= (!uniqueBuff ? YamlConfig.config.server.MAX_MONITORED_BUFFSTATS : 1) && effectStatups.contains(it.getKey())) { - MapleBuffStatValueHolder mbsvh = minStatBuffs.get(it.getKey()); - - Map lpbe = buffEffects.get(mbsvh.effect.getBuffSourceId()); + + if (it.getValue() >= (!uniqueBuff ? YamlConfig.config.server.MAX_MONITORED_BUFFSTATS : 1) && effectStatups.contains(it.getKey())) { + BuffStatValueHolder mbsvh = minStatBuffs.get(it.getKey()); + + Map lpbe = buffEffects.get(mbsvh.effect.getBuffSourceId()); lpbe.remove(it.getKey()); - buffEffectsCount.put(it.getKey(), (byte)(buffEffectsCount.get(it.getKey()) - 1)); - - if(lpbe.isEmpty()) { + buffEffectsCount.put(it.getKey(), (byte) (buffEffectsCount.get(it.getKey()) - 1)); + + if (lpbe.isEmpty()) { buffEffects.remove(mbsvh.effect.getBuffSourceId()); } extractedStatBuffs.put(it.getKey(), mbsvh); @@ -4021,34 +4019,34 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { chrLock.unlock(); } - + return extractedStatBuffs; } - - private void cancelInactiveBuffStats(Set retrievedStats, Set removedStats) { - List inactiveStats = new LinkedList<>(); - for (MapleBuffStat mbs : removedStats) { + + private void cancelInactiveBuffStats(Set retrievedStats, Set removedStats) { + List inactiveStats = new LinkedList<>(); + for (BuffStat mbs : removedStats) { if (!retrievedStats.contains(mbs)) { inactiveStats.add(mbs); } } - + if (!inactiveStats.isEmpty()) { sendPacket(PacketCreator.cancelBuff(inactiveStats)); getMap().broadcastMessage(this, PacketCreator.cancelForeignBuff(getId(), inactiveStats), false); } } - - private static Map topologicalSortLeafStatCount(Map> buffStack) { - Map leafBuffCount = new LinkedHashMap<>(); - - for (Entry> e : buffStack.entrySet()) { - Stack mseStack = e.getValue(); + + private static Map topologicalSortLeafStatCount(Map> buffStack) { + Map leafBuffCount = new LinkedHashMap<>(); + + for (Entry> e : buffStack.entrySet()) { + Stack mseStack = e.getValue(); if (mseStack.isEmpty()) { continue; } - - MapleStatEffect mse = mseStack.peek(); + + StatEffect mse = mseStack.peek(); Integer count = leafBuffCount.get(mse); if (count == null) { leafBuffCount.put(mse, 1); @@ -4056,277 +4054,278 @@ public class MapleCharacter extends AbstractMapleCharacterObject { leafBuffCount.put(mse, count + 1); } } - + return leafBuffCount; } - - private static List topologicalSortRemoveLeafStats(Map> stackedBuffStats, Map> buffStack, Map leafStatCount) { - List clearedStatEffects = new LinkedList<>(); - Set clearedStats = new LinkedHashSet<>(); - - for (Entry e : leafStatCount.entrySet()) { - MapleStatEffect mse = e.getKey(); - + + private static List topologicalSortRemoveLeafStats(Map> stackedBuffStats, Map> buffStack, Map leafStatCount) { + List clearedStatEffects = new LinkedList<>(); + Set clearedStats = new LinkedHashSet<>(); + + for (Entry e : leafStatCount.entrySet()) { + StatEffect mse = e.getKey(); + if (stackedBuffStats.get(mse).size() <= e.getValue()) { clearedStatEffects.add(mse); - - for (MapleBuffStat mbs : stackedBuffStats.get(mse)) { + + for (BuffStat mbs : stackedBuffStats.get(mse)) { clearedStats.add(mbs); } } } - - for (MapleBuffStat mbs : clearedStats) { - MapleStatEffect mse = buffStack.get(mbs).pop(); + + for (BuffStat mbs : clearedStats) { + StatEffect mse = buffStack.get(mbs).pop(); stackedBuffStats.get(mse).remove(mbs); } - + return clearedStatEffects; } - - private static void topologicalSortRebaseLeafStats(Map> stackedBuffStats, Map> buffStack) { - for (Entry> e : buffStack.entrySet()) { - Stack mseStack = e.getValue(); - + + private static void topologicalSortRebaseLeafStats(Map> stackedBuffStats, Map> buffStack) { + for (Entry> e : buffStack.entrySet()) { + Stack mseStack = e.getValue(); + if (!mseStack.isEmpty()) { - MapleStatEffect mse = mseStack.pop(); + StatEffect mse = mseStack.pop(); stackedBuffStats.get(mse).remove(e.getKey()); } } } - - private static List topologicalSortEffects(Map>> buffEffects) { - Map> stackedBuffStats = new LinkedHashMap<>(); - Map> buffStack = new LinkedHashMap<>(); - - for (Entry>> e : buffEffects.entrySet()) { - MapleBuffStat mbs = e.getKey(); - - Stack mbsStack = new Stack<>(); + + private static List topologicalSortEffects(Map>> buffEffects) { + Map> stackedBuffStats = new LinkedHashMap<>(); + Map> buffStack = new LinkedHashMap<>(); + + for (Entry>> e : buffEffects.entrySet()) { + BuffStat mbs = e.getKey(); + + Stack mbsStack = new Stack<>(); buffStack.put(mbs, mbsStack); - - for (Pair emse : e.getValue()) { - MapleStatEffect mse = emse.getLeft(); + + for (Pair emse : e.getValue()) { + StatEffect mse = emse.getLeft(); mbsStack.push(mse); - - Set mbsStats = stackedBuffStats.get(mse); + + Set mbsStats = stackedBuffStats.get(mse); if (mbsStats == null) { mbsStats = new LinkedHashSet<>(); stackedBuffStats.put(mse, mbsStats); } - + mbsStats.add(mbs); } } - - List buffList = new LinkedList<>(); + + List buffList = new LinkedList<>(); while (true) { - Map leafStatCount = topologicalSortLeafStatCount(buffStack); - if (leafStatCount.isEmpty()) break; - - List clearedNodes = topologicalSortRemoveLeafStats(stackedBuffStats, buffStack, leafStatCount); + Map leafStatCount = topologicalSortLeafStatCount(buffStack); + if (leafStatCount.isEmpty()) { + break; + } + + List clearedNodes = topologicalSortRemoveLeafStats(stackedBuffStats, buffStack, leafStatCount); if (clearedNodes.isEmpty()) { topologicalSortRebaseLeafStats(stackedBuffStats, buffStack); } else { buffList.addAll(clearedNodes); } } - + return buffList; } - - private static List sortEffectsList(Map updateEffectsList) { - Map>> buffEffects = new LinkedHashMap<>(); - - for (Entry p : updateEffectsList.entrySet()) { - MapleStatEffect mse = p.getKey(); - - for (Pair statup : mse.getStatups()) { - MapleBuffStat stat = statup.getLeft(); - - List> statBuffs = buffEffects.get(stat); + + private static List sortEffectsList(Map updateEffectsList) { + Map>> buffEffects = new LinkedHashMap<>(); + + for (Entry p : updateEffectsList.entrySet()) { + StatEffect mse = p.getKey(); + + for (Pair statup : mse.getStatups()) { + BuffStat stat = statup.getLeft(); + + List> statBuffs = buffEffects.get(stat); if (statBuffs == null) { statBuffs = new ArrayList<>(); buffEffects.put(stat, statBuffs); } - + statBuffs.add(new Pair<>(mse, statup.getRight())); } } - - Comparator cmp = new Comparator>() { + + Comparator cmp = new Comparator>() { @Override - public int compare(Pair o1, Pair o2) - { + public int compare(Pair o1, Pair o2) { return o2.getRight().compareTo(o1.getRight()); } }; - - for (Entry>> statBuffs : buffEffects.entrySet()) { + + for (Entry>> statBuffs : buffEffects.entrySet()) { Collections.sort(statBuffs.getValue(), cmp); } - + return topologicalSortEffects(buffEffects); } - - private List>> propagatePriorityBuffEffectUpdates(Set retrievedStats) { - List>> priorityUpdateEffects = new LinkedList<>(); - Map yokeStats = new LinkedHashMap<>(); - + + private List>> propagatePriorityBuffEffectUpdates(Set retrievedStats) { + List>> priorityUpdateEffects = new LinkedList<>(); + Map yokeStats = new LinkedHashMap<>(); + // priority buffsources: override buffstats for the client to perceive those as "currently buffed" - Set mbsvhList = new LinkedHashSet<>(); - for (MapleBuffStatValueHolder mbsvh : getAllStatups()) { + Set mbsvhList = new LinkedHashSet<>(); + for (BuffStatValueHolder mbsvh : getAllStatups()) { mbsvhList.add(mbsvh); } - - for (MapleBuffStatValueHolder mbsvh : mbsvhList) { - MapleStatEffect mse = mbsvh.effect; + + for (BuffStatValueHolder mbsvh : mbsvhList) { + StatEffect mse = mbsvh.effect; int buffSourceId = mse.getBuffSourceId(); if (isPriorityBuffSourceid(buffSourceId) && !hasActiveBuff(buffSourceId)) { - for (Pair ps : mse.getStatups()) { - MapleBuffStat mbs = ps.getLeft(); + for (Pair ps : mse.getStatups()) { + BuffStat mbs = ps.getLeft(); if (retrievedStats.contains(mbs)) { - MapleBuffStatValueHolder mbsvhe = effects.get(mbs); - + BuffStatValueHolder mbsvhe = effects.get(mbs); + // this shouldn't even be null... //if (mbsvh != null) { - yokeStats.put(mbsvh, mbsvhe.effect); + yokeStats.put(mbsvh, mbsvhe.effect); //} } } } } - - for (Entry e : yokeStats.entrySet()) { - MapleBuffStatValueHolder mbsvhPriority = e.getKey(); - MapleStatEffect mseActive = e.getValue(); - + + for (Entry e : yokeStats.entrySet()) { + BuffStatValueHolder mbsvhPriority = e.getKey(); + StatEffect mseActive = e.getValue(); + priorityUpdateEffects.add(new Pair<>(mseActive.getBuffSourceId(), new Pair<>(mbsvhPriority.effect, mbsvhPriority.startTime))); } - + return priorityUpdateEffects; } - - private void propagateBuffEffectUpdates(Map> retrievedEffects, Set retrievedStats, Set removedStats) { + + private void propagateBuffEffectUpdates(Map> retrievedEffects, Set retrievedStats, Set removedStats) { cancelInactiveBuffStats(retrievedStats, removedStats); if (retrievedStats.isEmpty()) { return; } - - Map> maxBuffValue = new LinkedHashMap<>(); - for(MapleBuffStat mbs : retrievedStats) { - MapleBuffStatValueHolder mbsvh = effects.get(mbs); - if(mbsvh != null) { + + Map> maxBuffValue = new LinkedHashMap<>(); + for (BuffStat mbs : retrievedStats) { + BuffStatValueHolder mbsvh = effects.get(mbs); + if (mbsvh != null) { retrievedEffects.put(mbsvh.effect.getBuffSourceId(), new Pair<>(mbsvh.effect, mbsvh.startTime)); } - - maxBuffValue.put(mbs, new Pair<>(Integer.MIN_VALUE, (MapleStatEffect) null)); + + maxBuffValue.put(mbs, new Pair<>(Integer.MIN_VALUE, null)); } - - Map updateEffects = new LinkedHashMap<>(); - - List recalcMseList = new LinkedList<>(); - for(Entry> re : retrievedEffects.entrySet()) { + + Map updateEffects = new LinkedHashMap<>(); + + List recalcMseList = new LinkedList<>(); + for (Entry> re : retrievedEffects.entrySet()) { recalcMseList.add(re.getValue().getLeft()); } - - boolean mageJob = this.getJobStyle() == MapleJob.MAGICIAN; + + boolean mageJob = this.getJobStyle() == Job.MAGICIAN; do { - List mseList = recalcMseList; + List mseList = recalcMseList; recalcMseList = new LinkedList<>(); - - for(MapleStatEffect mse : mseList) { + + for (StatEffect mse : mseList) { int maxEffectiveStatup = Integer.MIN_VALUE; - for(Pair st : mse.getStatups()) { - MapleBuffStat mbs = st.getLeft(); - + for (Pair st : mse.getStatups()) { + BuffStat mbs = st.getLeft(); + boolean relevantStatup = true; - if(mbs == MapleBuffStat.WATK) { // not relevant for mages - if(mageJob) { + if (mbs == BuffStat.WATK) { // not relevant for mages + if (mageJob) { relevantStatup = false; } - } else if(mbs == MapleBuffStat.MATK) { // not relevant for non-mages - if(!mageJob) { + } else if (mbs == BuffStat.MATK) { // not relevant for non-mages + if (!mageJob) { relevantStatup = false; } } - - Pair mbv = maxBuffValue.get(mbs); - if(mbv == null) { + + Pair mbv = maxBuffValue.get(mbs); + if (mbv == null) { continue; } - - if(mbv.getLeft() < st.getRight()) { - MapleStatEffect msbe = mbv.getRight(); - if(msbe != null) { + + if (mbv.getLeft() < st.getRight()) { + StatEffect msbe = mbv.getRight(); + if (msbe != null) { recalcMseList.add(msbe); } - + maxBuffValue.put(mbs, new Pair<>(st.getRight(), mse)); - - if(relevantStatup) { - if(maxEffectiveStatup < st.getRight()) { + + if (relevantStatup) { + if (maxEffectiveStatup < st.getRight()) { maxEffectiveStatup = st.getRight(); } } } } - + updateEffects.put(mse, maxEffectiveStatup); } - } while(!recalcMseList.isEmpty()); - - List updateEffectsList = sortEffectsList(updateEffects); - - List>> toUpdateEffects = new LinkedList<>(); - for(MapleStatEffect mse : updateEffectsList) { + } while (!recalcMseList.isEmpty()); + + List updateEffectsList = sortEffectsList(updateEffects); + + List>> toUpdateEffects = new LinkedList<>(); + for (StatEffect mse : updateEffectsList) { toUpdateEffects.add(new Pair<>(mse.getBuffSourceId(), retrievedEffects.get(mse.getBuffSourceId()))); } - - List> activeStatups = new LinkedList<>(); - for(Pair> lmse: toUpdateEffects) { - Pair msel = lmse.getRight(); - - for(Pair statup : getActiveStatupsFromSourceid(lmse.getLeft())) { + + List> activeStatups = new LinkedList<>(); + for (Pair> lmse : toUpdateEffects) { + Pair msel = lmse.getRight(); + + for (Pair statup : getActiveStatupsFromSourceid(lmse.getLeft())) { activeStatups.add(statup); } - + msel.getLeft().updateBuffEffect(this, activeStatups, msel.getRight()); activeStatups.clear(); } - - List>> priorityEffects = propagatePriorityBuffEffectUpdates(retrievedStats); - for(Pair> lmse: priorityEffects) { - Pair msel = lmse.getRight(); - - for(Pair statup : getActiveStatupsFromSourceid(lmse.getLeft())) { + + List>> priorityEffects = propagatePriorityBuffEffectUpdates(retrievedStats); + for (Pair> lmse : priorityEffects) { + Pair msel = lmse.getRight(); + + for (Pair statup : getActiveStatupsFromSourceid(lmse.getLeft())) { activeStatups.add(statup); } - + msel.getLeft().updateBuffEffect(this, activeStatups, msel.getRight()); activeStatups.clear(); } - + if (this.isRidingBattleship()) { - List> statups = new ArrayList<>(1); - statups.add(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0)); + List> statups = new ArrayList<>(1); + statups.add(new Pair<>(BuffStat.MONSTER_RIDING, 0)); this.sendPacket(PacketCreator.giveBuff(1932000, 5221006, statups)); this.announceBattleshipHp(); } } - - private static MapleBuffStat getSingletonStatupFromEffect(MapleStatEffect mse) { - for(Pair mbs : mse.getStatups()) { - if(isSingletonStatup(mbs.getLeft())) { + + private static BuffStat getSingletonStatupFromEffect(StatEffect mse) { + for (Pair mbs : mse.getStatups()) { + if (isSingletonStatup(mbs.getLeft())) { return mbs.getLeft(); } } - + return null; } - - private static boolean isSingletonStatup(MapleBuffStat mbs) { - switch(mbs) { //HPREC and MPREC are supposed to be singleton + + private static boolean isSingletonStatup(BuffStat mbs) { + switch (mbs) { //HPREC and MPREC are supposed to be singleton case COUPON_EXP1: case COUPON_EXP2: case COUPON_EXP3: @@ -4349,25 +4348,25 @@ public class MapleCharacter extends AbstractMapleCharacterObject { case SPEED: case JUMP: return false; - + default: return true; } } - + private static boolean isPriorityBuffSourceid(int sourceid) { - switch(sourceid) { + switch (sourceid) { case -2022631: case -2022632: case -2022633: return true; - + default: return false; } } - - private void addItemEffectHolderCount(MapleBuffStat stat) { + + private void addItemEffectHolderCount(BuffStat stat) { Byte val = buffEffectsCount.get(stat); if (val != null) { val = (byte) (val + 1); @@ -4377,8 +4376,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { buffEffectsCount.put(stat, val); } - - public void registerEffect(MapleStatEffect effect, long starttime, long expirationtime, boolean isSilent) { + + public void registerEffect(StatEffect effect, long starttime, long expirationtime, boolean isSilent) { if (effect.isDragonBlood()) { prepareDragonBlood(effect); } else if (effect.isBerserk()) { @@ -4394,7 +4393,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { Skill bHealing = SkillFactory.getSkill(DarkKnight.AURA_OF_BEHOLDER); int bHealingLvl = getSkillLevel(bHealing); if (bHealingLvl > 0) { - final MapleStatEffect healEffect = bHealing.getEffect(bHealingLvl); + final StatEffect healEffect = bHealing.getEffect(bHealingLvl); int healInterval = healEffect.getX() * 1000; beholderHealingSchedule = TimerManager.getInstance().register(new Runnable() { @Override @@ -4402,17 +4401,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (awayFromWorld.get()) { return; } - + addHP(healEffect.getHp()); sendPacket(PacketCreator.showOwnBuffEffect(beholder, 2)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.summonSkill(getId(), beholder, 5), true); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showOwnBuffEffect(beholder, 2), false); + getMap().broadcastMessage(Character.this, PacketCreator.summonSkill(getId(), beholder, 5), true); + getMap().broadcastMessage(Character.this, PacketCreator.showOwnBuffEffect(beholder, 2), false); } }, healInterval, healInterval); } Skill bBuff = SkillFactory.getSkill(DarkKnight.HEX_OF_BEHOLDER); if (getSkillLevel(bBuff) > 0) { - final MapleStatEffect buffEffect = bBuff.getEffect(getSkillLevel(bBuff)); + final StatEffect buffEffect = bBuff.getEffect(getSkillLevel(bBuff)); int buffInterval = buffEffect.getX() * 1000; beholderBuffSchedule = TimerManager.getInstance().register(new Runnable() { @Override @@ -4420,28 +4419,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (awayFromWorld.get()) { return; } - - buffEffect.applyTo(MapleCharacter.this); + + buffEffect.applyTo(Character.this); sendPacket(PacketCreator.showOwnBuffEffect(beholder, 2)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.summonSkill(getId(), beholder, (int) (Math.random() * 3) + 6), true); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showBuffEffect(getId(), beholder, 2), false); + getMap().broadcastMessage(Character.this, PacketCreator.summonSkill(getId(), beholder, (int) (Math.random() * 3) + 6), true); + getMap().broadcastMessage(Character.this, PacketCreator.showBuffEffect(getId(), beholder, 2), false); } }, buffInterval, buffInterval); } } else if (effect.isRecovery()) { int healInterval = (YamlConfig.config.server.USE_ULTRA_RECOVERY) ? 2000 : 5000; final byte heal = (byte) effect.getX(); - + chrLock.lock(); try { - if(recoveryTask != null) { + if (recoveryTask != null) { recoveryTask.cancel(false); } - + recoveryTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - if (getBuffSource(MapleBuffStat.RECOVERY) == -1) { + if (getBuffSource(BuffStat.RECOVERY) == -1) { chrLock.lock(); try { if (recoveryTask != null) { @@ -4457,23 +4456,23 @@ public class MapleCharacter extends AbstractMapleCharacterObject { addHP(heal); sendPacket(PacketCreator.showOwnRecovery(heal)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showRecovery(id, heal), false); + getMap().broadcastMessage(Character.this, PacketCreator.showRecovery(id, heal), false); } }, healInterval, healInterval); } finally { chrLock.unlock(); } } else if (effect.getHpRRate() > 0 || effect.getMpRRate() > 0) { - if(effect.getHpRRate() > 0) { + if (effect.getHpRRate() > 0) { extraHpRec = effect.getHpR(); extraRecInterval = effect.getHpRRate(); } - - if(effect.getMpRRate() > 0) { + + if (effect.getMpRRate() > 0) { extraMpRec = effect.getMpR(); extraRecInterval = effect.getMpRRate(); } - + chrLock.lock(); try { stopExtraTask(); @@ -4481,81 +4480,81 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { chrLock.unlock(); } - + } else if (effect.isMapChair()) { startChairTask(); } - + prtLock.lock(); effLock.lock(); chrLock.lock(); try { Integer sourceid = effect.getBuffSourceId(); - Map toDeploy; - Map appliedStatups = new LinkedHashMap<>(); - - for(Pair ps : effect.getStatups()) { - appliedStatups.put(ps.getLeft(), new MapleBuffStatValueHolder(effect, starttime, ps.getRight())); + Map toDeploy; + Map appliedStatups = new LinkedHashMap<>(); + + for (Pair ps : effect.getStatups()) { + appliedStatups.put(ps.getLeft(), new BuffStatValueHolder(effect, starttime, ps.getRight())); } - + boolean active = effect.isActive(this); - if(YamlConfig.config.server.USE_BUFF_MOST_SIGNIFICANT) { + if (YamlConfig.config.server.USE_BUFF_MOST_SIGNIFICANT) { toDeploy = new LinkedHashMap<>(); - Map> retrievedEffects = new LinkedHashMap<>(); - Set retrievedStats = new LinkedHashSet<>(); - for (Entry statup : appliedStatups.entrySet()) { - MapleBuffStatValueHolder mbsvh = effects.get(statup.getKey()); - MapleBuffStatValueHolder statMbsvh = statup.getValue(); - - if(active) { - if(mbsvh == null || mbsvh.value < statMbsvh.value || (mbsvh.value == statMbsvh.value && mbsvh.effect.getStatups().size() <= statMbsvh.effect.getStatups().size())) { + Map> retrievedEffects = new LinkedHashMap<>(); + Set retrievedStats = new LinkedHashSet<>(); + for (Entry statup : appliedStatups.entrySet()) { + BuffStatValueHolder mbsvh = effects.get(statup.getKey()); + BuffStatValueHolder statMbsvh = statup.getValue(); + + if (active) { + if (mbsvh == null || mbsvh.value < statMbsvh.value || (mbsvh.value == statMbsvh.value && mbsvh.effect.getStatups().size() <= statMbsvh.effect.getStatups().size())) { toDeploy.put(statup.getKey(), statMbsvh); } else { - if(!isSingletonStatup(statup.getKey())) { - for(Pair mbs : mbsvh.effect.getStatups()) { + if (!isSingletonStatup(statup.getKey())) { + for (Pair mbs : mbsvh.effect.getStatups()) { retrievedStats.add(mbs.getLeft()); } } } } - + addItemEffectHolderCount(statup.getKey()); } - + // should also propagate update from buffs shared with priority sourceids - Set updated = appliedStatups.keySet(); - for (MapleBuffStatValueHolder mbsvh : this.getAllStatups()) { + Set updated = appliedStatups.keySet(); + for (BuffStatValueHolder mbsvh : this.getAllStatups()) { if (isPriorityBuffSourceid(mbsvh.effect.getBuffSourceId())) { - for (Pair p : mbsvh.effect.getStatups()) { + for (Pair p : mbsvh.effect.getStatups()) { if (updated.contains(p.getLeft())) { retrievedStats.add(p.getLeft()); } } } } - - if(!isSilent) { + + if (!isSilent) { addItemEffectHolder(sourceid, expirationtime, appliedStatups); - for (Entry statup : toDeploy.entrySet()) { + for (Entry statup : toDeploy.entrySet()) { effects.put(statup.getKey(), statup.getValue()); } - + if (active) { retrievedEffects.put(sourceid, new Pair<>(effect, starttime)); } - - propagateBuffEffectUpdates(retrievedEffects, retrievedStats, new LinkedHashSet()); + + propagateBuffEffectUpdates(retrievedEffects, retrievedStats, new LinkedHashSet()); } } else { - for (Entry statup : appliedStatups.entrySet()) { + for (Entry statup : appliedStatups.entrySet()) { addItemEffectHolderCount(statup.getKey()); } - - toDeploy = (active ? appliedStatups : new LinkedHashMap()); + + toDeploy = (active ? appliedStatups : new LinkedHashMap()); } - + addItemEffectHolder(sourceid, expirationtime, appliedStatups); - for (Entry statup : toDeploy.entrySet()) { + for (Entry statup : toDeploy.entrySet()) { effects.put(statup.getKey(), statup.getValue()); } } finally { @@ -4563,12 +4562,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); prtLock.unlock(); } - + updateLocalStats(); } - - private static int getJobMapChair(MapleJob job) { - switch(job.getId() / 1000) { + + private static int getJobMapChair(Job job) { + switch (job.getId() / 1000) { case 0: return Beginner.MAP_CHAIR; case 1: @@ -4577,72 +4576,72 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return Legend.MAP_CHAIR; } } - + public boolean unregisterChairBuff() { if (!YamlConfig.config.server.USE_CHAIR_EXTRAHEAL) { return false; } - + int skillId = getJobMapChair(job); int skillLv = getSkillLevel(skillId); - if(skillLv > 0) { - MapleStatEffect mapChairSkill = SkillFactory.getSkill(skillId).getEffect(skillLv); + if (skillLv > 0) { + StatEffect mapChairSkill = SkillFactory.getSkill(skillId).getEffect(skillLv); return cancelEffect(mapChairSkill, false, -1); } - + return false; } - + public boolean registerChairBuff() { if (!YamlConfig.config.server.USE_CHAIR_EXTRAHEAL) { return false; } - + int skillId = getJobMapChair(job); int skillLv = getSkillLevel(skillId); - if(skillLv > 0) { - MapleStatEffect mapChairSkill = SkillFactory.getSkill(skillId).getEffect(skillLv); + if (skillLv > 0) { + StatEffect mapChairSkill = SkillFactory.getSkill(skillId).getEffect(skillLv); mapChairSkill.applyTo(this); return true; } - + return false; } - + public int getChair() { return chair.get(); } - + public String getChalkboard() { return this.chalktext; } - - public MapleClient getClient() { + + public Client getClient() { return client; } - + public AbstractPlayerInteraction getAbstractPlayerInteraction() { return client.getAbstractPlayerInteraction(); } - - private List getQuests() { + + private List getQuests() { synchronized (quests) { return new ArrayList<>(quests.values()); } } - - public final List getCompletedQuests() { - List ret = new LinkedList<>(); - for (MapleQuestStatus qs : getQuests()) { - if (qs.getStatus().equals(MapleQuestStatus.Status.COMPLETED)) { + + public final List getCompletedQuests() { + List ret = new LinkedList<>(); + for (QuestStatus qs : getQuests()) { + if (qs.getStatus().equals(QuestStatus.Status.COMPLETED)) { ret.add(qs); } } return Collections.unmodifiableList(ret); } - - public List getCrushRings() { + + public List getCrushRings() { Collections.sort(crushRings); return crushRings; } @@ -4675,16 +4674,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return dojoStage; } - public Collection getDoors() { + public Collection getDoors() { prtLock.lock(); try { - return (party != null ? Collections.unmodifiableCollection(party.getDoors().values()) : (pdoor != null ? Collections.singleton(pdoor) : new LinkedHashSet())); + return (party != null ? Collections.unmodifiableCollection(party.getDoors().values()) : (pdoor != null ? Collections.singleton(pdoor) : new LinkedHashSet())); } finally { prtLock.unlock(); } } - - public MapleDoor getPlayerDoor() { + + public Door getPlayerDoor() { prtLock.lock(); try { return pdoor; @@ -4692,9 +4691,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { prtLock.unlock(); } } - - public MapleDoor getMainTownDoor() { - for (MapleDoor door : getDoors()) { + + public Door getMainTownDoor() { + for (Door door : getDoors()) { if (door.getTownPortal().getId() == 0x80) { return door; } @@ -4702,15 +4701,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return null; } - - public void applyPartyDoor(MapleDoor door, boolean partyUpdate) { - MapleParty chrParty; + + public void applyPartyDoor(Door door, boolean partyUpdate) { + Party chrParty; prtLock.lock(); try { if (!partyUpdate) { pdoor = door; } - + chrParty = getParty(); if (chrParty != null) { chrParty.addDoor(id, door); @@ -4718,21 +4717,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { prtLock.unlock(); } - + silentPartyUpdateInternal(chrParty); } - - public MapleDoor removePartyDoor(boolean partyUpdate) { - MapleDoor ret = null; - MapleParty chrParty; - + + public Door removePartyDoor(boolean partyUpdate) { + Door ret = null; + Party chrParty; + prtLock.lock(); try { chrParty = getParty(); if (chrParty != null) { chrParty.removeDoor(id); } - + if (!partyUpdate) { ret = pdoor; pdoor = null; @@ -4740,12 +4739,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { prtLock.unlock(); } - + silentPartyUpdateInternal(chrParty); return ret; } - - private void removePartyDoor(MapleParty formerParty) { // player is no longer registered at this party + + private void removePartyDoor(Party formerParty) { // player is no longer registered at this party formerParty.removeDoor(id); } @@ -4761,12 +4760,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { evtLock.unlock(); } } - - public MapleMarriage getMarriageInstance() { + + public Marriage getMarriageInstance() { EventInstanceManager eim = getEventInstance(); - - if (eim != null || !(eim instanceof MapleMarriage)) { - return (MapleMarriage) eim; + + if (eim != null || !(eim instanceof Marriage)) { + return (Marriage) eim; } else { return null; } @@ -4776,7 +4775,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.lock(); try { Set petExclude = excluded.get(petId); - + if (petExclude != null) { petExclude.clear(); } else { @@ -4786,7 +4785,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public void addExcluded(int petId, int x) { chrLock.lock(); try { @@ -4795,18 +4794,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public void commitExcludedItems() { Map> petExcluded = this.getExcluded(); - + chrLock.lock(); try { excludedItems.clear(); } finally { chrLock.unlock(); } - - for(Map.Entry> pe : petExcluded.entrySet()) { + + for (Map.Entry> pe : petExcluded.entrySet()) { byte petIndex = this.getPetIndex(pe.getKey()); if (petIndex < 0) { continue; @@ -4818,7 +4817,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.lock(); try { - for(Integer itemid: exclItems) { + for (Integer itemid : exclItems) { excludedItems.add(itemid); } } finally { @@ -4827,10 +4826,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - public void exportExcludedItems(MapleClient c) { + + public void exportExcludedItems(Client c) { Map> petExcluded = this.getExcluded(); - for(Map.Entry> pe : petExcluded.entrySet()) { + for (Map.Entry> pe : petExcluded.entrySet()) { byte petIndex = this.getPetIndex(pe.getKey()); if (petIndex < 0) { continue; @@ -4842,7 +4841,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + public Map> getExcluded() { chrLock.lock(); try { @@ -4851,7 +4850,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { chrLock.unlock(); } } - + public Set getExcludedItems() { chrLock.lock(); try { @@ -4872,84 +4871,84 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean hasNoviceExpRate() { return YamlConfig.config.server.USE_ENFORCE_NOVICE_EXPRATE && isBeginnerJob() && level < 11; } - + public int getExpRate() { if (hasNoviceExpRate()) { // base exp rate 1x for early levels idea thanks to Vcoc return 1; } - + return expRate; } - + public int getCouponExpRate() { return expCoupon; } - + public int getRawExpRate() { return expRate / (expCoupon * getWorldServer().getExpRate()); } - + public int getDropRate() { return dropRate; } - + public int getCouponDropRate() { return dropCoupon; } - + public int getRawDropRate() { return dropRate / (dropCoupon * getWorldServer().getDropRate()); } - + public int getBossDropRate() { World w = getWorldServer(); return (dropRate / w.getDropRate()) * w.getBossDropRate(); } - + public int getMesoRate() { return mesoRate; } - + public int getCouponMesoRate() { return mesoCoupon; } - + public int getRawMesoRate() { return mesoRate / (mesoCoupon * getWorldServer().getMesoRate()); } - + public int getQuestExpRate() { if (hasNoviceExpRate()) { return 1; } - + World w = getWorldServer(); return w.getExpRate() * w.getQuestRate(); } - + public int getQuestMesoRate() { World w = getWorldServer(); return w.getMesoRate() * w.getQuestRate(); } - + public float getCardRate(int itemid) { float rate = 100.0f; - + if (itemid == 0) { - MapleStatEffect mseMeso = getBuffEffect(MapleBuffStat.MESO_UP_BY_ITEM); + StatEffect mseMeso = getBuffEffect(BuffStat.MESO_UP_BY_ITEM); if (mseMeso != null) { rate += mseMeso.getCardRate(mapid, itemid); } } else { - MapleStatEffect mseItem = getBuffEffect(MapleBuffStat.ITEM_UP_BY_ITEM); + StatEffect mseItem = getBuffEffect(BuffStat.ITEM_UP_BY_ITEM); if (mseItem != null) { rate += mseItem.getCardRate(mapid, itemid); } } - + return rate / 100; } - + public int getFace() { return face; } @@ -4958,17 +4957,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return fame; } - public MapleFamily getFamily() { - if(familyEntry != null) return familyEntry.getFamily(); - else return null; + public Family getFamily() { + if (familyEntry != null) { + return familyEntry.getFamily(); + } else { + return null; + } } - - public MapleFamilyEntry getFamilyEntry() { + + public FamilyEntry getFamilyEntry() { return familyEntry; } - - public void setFamilyEntry(MapleFamilyEntry entry) { - if(entry != null) setFamilyId(entry.getFamily().getID()); + + public void setFamilyEntry(FamilyEntry entry) { + if (entry != null) { + setFamilyId(entry.getFamily().getID()); + } this.familyEntry = entry; } @@ -4979,12 +4983,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean getFinishedDojoTutorial() { return finishedDojoTutorial; } - + public void setUsedStorage() { usedStorage = true; } - - public List getFriendshipRings() { + + public List getFriendshipRings() { Collections.sort(friendshipRings); return friendshipRings; } @@ -4997,7 +5001,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return getGender() == 0; } - public MapleGuild getGuild() { + public Guild getGuild() { try { return Server.getInstance().getGuild(getGuildId(), getWorld(), this); } catch (Exception ex) { @@ -5005,16 +5009,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return null; } } - - public MapleAlliance getAlliance() { - if(mgc != null) { + + public Alliance getAlliance() { + if (mgc != null) { try { return Server.getInstance().getAlliance(getGuild().getAllianceId()); } catch (Exception ex) { ex.printStackTrace(); } } - + return null; } @@ -5030,7 +5034,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return hair; } - public MapleHiredMerchant getHiredMerchant() { + public HiredMerchant getHiredMerchant() { return hiredMerchant; } @@ -5055,7 +5059,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return -1; } - + public static int getIdByName(String name) { final int id; try (Connection con = DatabaseConnection.getConnection(); @@ -5096,7 +5100,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return initialSpawnPoint; } - public Inventory getInventory(MapleInventoryType type) { + public Inventory getInventory(InventoryType type) { return inventory[type.ordinal()]; } @@ -5106,16 +5110,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean haveItemWithId(int itemid, boolean checkEquipped) { return (inventory[ItemConstants.getInventoryType(itemid).ordinal()].findById(itemid) != null) - || (checkEquipped && inventory[MapleInventoryType.EQUIPPED.ordinal()].findById(itemid) != null); + || (checkEquipped && inventory[InventoryType.EQUIPPED.ordinal()].findById(itemid) != null); } - + public boolean haveItemEquipped(int itemid) { - return (inventory[MapleInventoryType.EQUIPPED.ordinal()].findById(itemid) != null); + return (inventory[InventoryType.EQUIPPED.ordinal()].findById(itemid) != null); } - + public boolean haveWeddingRing() { - int rings[] = {1112806, 1112803, 1112807, 1112809}; - + int[] rings = {1112806, 1112803, 1112807, 1112809}; + for (int ringid : rings) { if (haveItemWithId(ringid, true)) { return true; @@ -5124,24 +5128,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } - + public int getItemQuantity(int itemid, boolean checkEquipped) { int count = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countById(itemid); if (checkEquipped) { - count += inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid); - } - return count; - } - - public int getCleanItemQuantity(int itemid, boolean checkEquipped) { - int count = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countNotOwnedById(itemid); - if (checkEquipped) { - count += inventory[MapleInventoryType.EQUIPPED.ordinal()].countNotOwnedById(itemid); + count += inventory[InventoryType.EQUIPPED.ordinal()].countById(itemid); } return count; } - public MapleJob getJob() { + public int getCleanItemQuantity(int itemid, boolean checkEquipped) { + int count = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countNotOwnedById(itemid); + if (checkEquipped) { + count += inventory[InventoryType.EQUIPPED.ordinal()].countNotOwnedById(itemid); + } + return count; + } + + public Job getJob() { return job; } @@ -5157,7 +5161,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return job.getId() / 1000; } - public Map getKeymap() { + public Map getKeymap() { return keymap; } @@ -5172,11 +5176,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int getLevel() { return level; } - + public int getFh() { Point pos = this.getPosition(); pos.y -= 6; - + if (map.getFootholds().findBelow(pos) == null) { return 0; } else { @@ -5191,10 +5195,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return mapid; } - public MapleRing getMarriageRing() { + public Ring getMarriageRing() { return partnerId > 0 ? marriageRing : null; } - + public int getMasterLevel(int skill) { SkillEntry ret = skills.get(SkillFactory.getSkill(skill)); if (ret == null) { @@ -5209,7 +5213,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return skills.get(skill).masterlevel; } - + public int getTotalStr() { return localstr; } @@ -5229,23 +5233,23 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int getTotalMagic() { return localmagic; } - + public int getTotalWatk() { return localwatk; } - + public int getMaxClassLevel() { return isCygnus() ? 120 : 200; } - + public int getMaxLevel() { - if(!YamlConfig.config.server.USE_ENFORCE_JOB_LEVEL_RANGE || isGmJob()) { + if (!YamlConfig.config.server.USE_ENFORCE_JOB_LEVEL_RANGE || isGmJob()) { return getMaxClassLevel(); } - + return GameConstants.getJobMaxLevel(job); } - + public int getMeso() { return meso.get(); } @@ -5253,7 +5257,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int getMerchantMeso() { return merchantmeso; } - + public int getMerchantNetMeso() { int elapsedDays = 0; @@ -5274,7 +5278,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { elapsedDays = 100; } - long netMeso = (long) merchantmeso; // negative mesos issues found thanks to Flash, Vcoc + long netMeso = merchantmeso; // negative mesos issues found thanks to Flash, Vcoc netMeso = (netMeso * (100 - elapsedDays)) / 100; return (int) netMeso; } @@ -5287,56 +5291,56 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return messengerposition; } - public MapleGuildCharacter getMGC() { + public GuildCharacter getMGC() { return mgc; } - - public void setMGC(MapleGuildCharacter mgc) { + + public void setMGC(GuildCharacter mgc) { this.mgc = mgc; } - public MaplePartyCharacter getMPC() { + public PartyCharacter getMPC() { if (mpc == null) { - mpc = new MaplePartyCharacter(this); + mpc = new PartyCharacter(this); } return mpc; } - public void setMPC(MaplePartyCharacter mpc) { + public void setMPC(PartyCharacter mpc) { this.mpc = mpc; } - + public int getTargetHpBarHash() { return this.targetHpBarHash; } - + public void setTargetHpBarHash(int mobHash) { this.targetHpBarHash = mobHash; } - + public long getTargetHpBarTime() { return this.targetHpBarTime; } - + public void setTargetHpBarTime(long timeNow) { this.targetHpBarTime = timeNow; } - + public void setPlayerAggro(int mobHash) { setTargetHpBarHash(mobHash); setTargetHpBarTime(System.currentTimeMillis()); } - + public void resetPlayerAggro() { - if(getWorldServer().unregisterDisabledServerMessage(id)) { + if (getWorldServer().unregisterDisabledServerMessage(id)) { client.announceServerMessage(); } - + setTargetHpBarHash(0); setTargetHpBarTime(0); } - - public MapleMiniGame getMiniGame() { + + public MiniGame getMiniGame() { return miniGame; } @@ -5370,11 +5374,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return bookCover; } - public MapleMount getMount() { + public Mount getMount() { return maplemount; } - public MapleMessenger getMessenger() { + public Messenger getMessenger() { return messenger; } @@ -5411,7 +5415,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public MapleParty getParty() { + public Party getParty() { prtLock.lock(); try { return party; @@ -5428,15 +5432,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { prtLock.unlock(); } } - - public List getPartyMembersOnline() { - List list = new LinkedList<>(); - + + public List getPartyMembersOnline() { + List list = new LinkedList<>(); + prtLock.lock(); try { - if(party != null) { - for(MaplePartyCharacter mpc: party.getMembers()) { - MapleCharacter mc = mpc.getPlayer(); + if (party != null) { + for (PartyCharacter mpc : party.getMembers()) { + Character mc = mpc.getPlayer(); if (mc != null) { list.add(mc); } @@ -5445,22 +5449,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { prtLock.unlock(); } - + return list; } - - public List getPartyMembersOnSameMap() { - List list = new LinkedList<>(); + + public List getPartyMembersOnSameMap() { + List list = new LinkedList<>(); int thisMapHash = this.getMap().hashCode(); - + prtLock.lock(); try { - if(party != null) { - for(MaplePartyCharacter mpc: party.getMembers()) { - MapleCharacter chr = mpc.getPlayer(); + if (party != null) { + for (PartyCharacter mpc : party.getMembers()) { + Character chr = mpc.getPlayer(); if (chr != null) { MapleMap chrMap = chr.getMap(); - if(chrMap != null && chrMap.hashCode() == thisMapHash && chr.isLoggedinWorld()) { + if (chrMap != null && chrMap.hashCode() == thisMapHash && chr.isLoggedinWorld()) { list.add(chr); } } @@ -5469,49 +5473,49 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { prtLock.unlock(); } - + return list; } - - public boolean isPartyMember(MapleCharacter chr) { + + public boolean isPartyMember(Character chr) { return isPartyMember(chr.getId()); } - + public boolean isPartyMember(int cid) { prtLock.lock(); try { - if(party != null) { + if (party != null) { return party.getMemberById(cid) != null; } } finally { prtLock.unlock(); } - + return false; } - - public MaplePlayerShop getPlayerShop() { + + public PlayerShop getPlayerShop() { return playerShop; } - - public MapleRockPaperScissor getRPS() { // thanks inhyuk for suggesting RPS addition + + public RockPaperScissor getRPS() { // thanks inhyuk for suggesting RPS addition return rps; } - + public void setGMLevel(int level) { this.gmLevel = Math.min(level, 6); this.gmLevel = Math.max(level, 0); - + whiteChat = gmLevel >= 4; // thanks ozanrijen for suggesting default white chat } - + public void closePartySearchInteractions() { this.getWorldServer().getPartySearchCoordinator().unregisterPartyLeader(this); if (canRecvPartySearchInvite) { this.getWorldServer().getPartySearchCoordinator().detachPlayer(this); } } - + public void closePlayerInteractions() { closeNpcShop(); closeTrade(); @@ -5520,36 +5524,36 @@ public class MapleCharacter extends AbstractMapleCharacterObject { closeRPS(); closeHiredMerchant(false); closePlayerMessenger(); - + client.closePlayerScriptInteractions(); resetPlayerAggro(); } - + public void closeNpcShop() { setShop(null); } - + public void closeTrade() { - MapleTrade.cancelTrade(this, MapleTrade.TradeResult.PARTNER_CANCEL); + Trade.cancelTrade(this, Trade.TradeResult.PARTNER_CANCEL); } - + public void closePlayerShop() { - MaplePlayerShop mps = this.getPlayerShop(); + PlayerShop mps = this.getPlayerShop(); if (mps == null) { return; } - + if (mps.isOwner(this)) { mps.setOpen(false); getWorldServer().unregisterPlayerShop(mps); - - for (MaplePlayerShopItem mpsi : mps.getItems()) { + + for (PlayerShopItem mpsi : mps.getItems()) { if (mpsi.getBundles() >= 2) { Item iItem = mpsi.getItem().copy(); iItem.setQuantity((short) (mpsi.getBundles() * iItem.getQuantity())); - MapleInventoryManipulator.addFromDrop(this.getClient(), iItem, false); + InventoryManipulator.addFromDrop(this.getClient(), iItem, false); } else if (mpsi.isExist()) { - MapleInventoryManipulator.addFromDrop(this.getClient(), mpsi.getItem(), true); + InventoryManipulator.addFromDrop(this.getClient(), mpsi.getItem(), true); } } mps.closeShop(); @@ -5558,26 +5562,26 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } this.setPlayerShop(null); } - + public void closeMiniGame(boolean forceClose) { - MapleMiniGame game = this.getMiniGame(); + MiniGame game = this.getMiniGame(); if (game == null) { return; } - + if (game.isOwner(this)) { game.closeRoom(forceClose); } else { game.removeVisitor(forceClose, this); } } - + public void closeHiredMerchant(boolean closeMerchant) { - MapleHiredMerchant merchant = this.getHiredMerchant(); + HiredMerchant merchant = this.getHiredMerchant(); if (merchant == null) { return; } - + if (closeMerchant) { if (merchant.isOwner(this) && merchant.getItems().isEmpty()) { merchant.forceClose(); @@ -5599,22 +5603,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + public void closePlayerMessenger() { - MapleMessenger m = this.getMessenger(); + Messenger m = this.getMessenger(); if (m == null) { return; } - + World w = getWorldServer(); - MapleMessengerCharacter messengerplayer = new MapleMessengerCharacter(this, this.getMessengerPosition()); - + MessengerCharacter messengerplayer = new MessengerCharacter(this, this.getMessengerPosition()); + w.leaveMessenger(m.getId(), messengerplayer); this.setMessenger(null); this.setMessengerPosition(4); } - public MaplePet[] getPets() { + public Pet[] getPets() { petLock.lock(); try { return Arrays.copyOf(pets, pets.length); @@ -5623,11 +5627,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public MaplePet getPet(int index) { + public Pet getPet(int index) { if (index < 0) { return null; } - + petLock.lock(); try { return pets[index]; @@ -5651,8 +5655,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { petLock.unlock(); } } - - public byte getPetIndex(MaplePet pet) { + + public byte getPetIndex(Pet pet) { petLock.lock(); try { for (byte i = 0; i < 3; i++) { @@ -5674,7 +5678,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public final byte getQuestStatus(final int quest) { synchronized (quests) { - MapleQuestStatus mqs = quests.get((short) quest); + QuestStatus mqs = quests.get((short) quest); if (mqs != null) { return (byte) mqs.getStatus().getId(); } else { @@ -5682,39 +5686,39 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - public MapleQuestStatus getQuest(final int quest) { - return getQuest(MapleQuest.getInstance(quest)); + + public QuestStatus getQuest(final int quest) { + return getQuest(Quest.getInstance(quest)); } - - public MapleQuestStatus getQuest(MapleQuest quest) { + + public QuestStatus getQuest(Quest quest) { synchronized (quests) { short questid = quest.getId(); - MapleQuestStatus qs = quests.get(questid); + QuestStatus qs = quests.get(questid); if (qs == null) { - qs = new MapleQuestStatus(quest, MapleQuestStatus.Status.NOT_STARTED); + qs = new QuestStatus(quest, QuestStatus.Status.NOT_STARTED); quests.put(questid, qs); } return qs; } } - + //---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ---- - - public final void setQuestAdd(final MapleQuest quest, final byte status, final String customData) { + + public final void setQuestAdd(final Quest quest, final byte status, final String customData) { synchronized (quests) { if (!quests.containsKey(quest.getId())) { - final MapleQuestStatus stat = new MapleQuestStatus(quest, MapleQuestStatus.Status.getById((int)status)); + final QuestStatus stat = new QuestStatus(quest, QuestStatus.Status.getById(status)); stat.setCustomData(customData); quests.put(quest.getId(), stat); } } } - public final MapleQuestStatus getQuestNAdd(final MapleQuest quest) { + public final QuestStatus getQuestNAdd(final Quest quest) { synchronized (quests) { if (!quests.containsKey(quest.getId())) { - final MapleQuestStatus status = new MapleQuestStatus(quest, MapleQuestStatus.Status.NOT_STARTED); + final QuestStatus status = new QuestStatus(quest, QuestStatus.Status.NOT_STARTED); quests.put(quest.getId(), status); return status; } @@ -5722,40 +5726,40 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public final MapleQuestStatus getQuestNoAdd(final MapleQuest quest) { + public final QuestStatus getQuestNoAdd(final Quest quest) { synchronized (quests) { return quests.get(quest.getId()); } } - public final MapleQuestStatus getQuestRemove(final MapleQuest quest) { + public final QuestStatus getQuestRemove(final Quest quest) { synchronized (quests) { return quests.remove(quest.getId()); } } //---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ---- - + public boolean needQuestItem(int questid, int itemid) { if (questid <= 0) { //For non quest items :3 return true; } - + int amountNeeded, questStatus = this.getQuestStatus(questid); if (questStatus == 0) { - amountNeeded = MapleQuest.getInstance(questid).getStartItemAmountNeeded(itemid); + amountNeeded = Quest.getInstance(questid).getStartItemAmountNeeded(itemid); if (amountNeeded == Integer.MIN_VALUE) { return false; } } else if (questStatus != 1) { return false; } else { - amountNeeded = MapleQuest.getInstance(questid).getCompleteItemAmountNeeded(itemid); + amountNeeded = Quest.getInstance(questid).getCompleteItemAmountNeeded(itemid); if (amountNeeded == Integer.MAX_VALUE) { return true; } } - + return getInventory(ItemConstants.getInventoryType(itemid)).countById(itemid) < amountNeeded; } @@ -5770,7 +5774,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void clearSavedLocation(SavedLocationType type) { savedLocations[type.ordinal()] = null; } - + public int peekSavedLocation(String type) { SavedLocation sl = savedLocations[SavedLocationType.fromString(type).ordinal()]; if (sl == null) { @@ -5778,11 +5782,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return sl.getMapId(); } - + public int getSavedLocation(String type) { int m = peekSavedLocation(type); clearSavedLocation(SavedLocationType.fromString(type)); - + return m; } @@ -5790,14 +5794,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return search; } - public MapleShop getShop() { + public Shop getShop() { return shop; } public Map getSkills() { return Collections.unmodifiableMap(skills); } - + public int getSkillLevel(int skill) { SkillEntry ret = skills.get(SkillFactory.getSkill(skill)); if (ret == null) { @@ -5828,7 +5832,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return skills.get(skill).expiration; } - public MapleSkinColor getSkinColor() { + public SkinColor getSkinColor() { return skinColor; } @@ -5836,21 +5840,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return slots; } - public final List getStartedQuests() { - List ret = new LinkedList<>(); - for (MapleQuestStatus qs : getQuests()) { - if (qs.getStatus().equals(MapleQuestStatus.Status.STARTED)) { + public final List getStartedQuests() { + List ret = new LinkedList<>(); + for (QuestStatus qs : getQuests()) { + if (qs.getStatus().equals(QuestStatus.Status.STARTED)) { ret.add(qs); } } return Collections.unmodifiableList(ret); } - - public MapleStatEffect getStatForBuff(MapleBuffStat effect) { + + public StatEffect getStatForBuff(BuffStat effect) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(effect); + BuffStatValueHolder mbsvh = effects.get(effect); if (mbsvh == null) { return null; } @@ -5861,31 +5865,31 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public MapleStorage getStorage() { + public Storage getStorage() { return storage; } - public Collection getSummonsValues() { + public Collection getSummonsValues() { return summons.values(); } - + public void clearSummons() { summons.clear(); } - - public MapleSummon getSummonByKey(int id) { + + public Summon getSummonByKey(int id) { return summons.get(id); } - + public boolean isSummonsEmpty() { return summons.isEmpty(); } - - public boolean containsSummon(MapleSummon summon) { + + public boolean containsSummon(Summon summon) { return summons.containsValue(summon); } - public MapleTrade getTrade() { + public Trade getTrade() { return trade; } @@ -5897,14 +5901,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return vanquisherStage; } - public MapleMapObject[] getVisibleMapObjects() { - return visibleMapObjects.toArray(new MapleMapObject[visibleMapObjects.size()]); + public MapObject[] getVisibleMapObjects() { + return visibleMapObjects.toArray(new MapObject[visibleMapObjects.size()]); } public int getWorld() { return world; } - + public World getWorldServer() { return Server.getInstance().getWorld(world); } @@ -5919,7 +5923,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { addCooldown(skillid, timeNow, time); } } - + public int gmLevel() { return gmLevel; } @@ -5927,11 +5931,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private void guildUpdate() { mgc.setLevel(level); mgc.setJobId(job.getId()); - + if (this.guildid < 1) { return; } - + try { Server.getInstance().memberLevelJobUpdate(this.mgc); //Server.getInstance().getGuild(guildid, world, mgc).gainGP(40); @@ -5943,10 +5947,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { e.printStackTrace(); } } - + public void handleEnergyChargeGain() { // to get here energychargelevel has to be > 0 Skill energycharge = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.ENERGY_CHARGE) : SkillFactory.getSkill(Marauder.ENERGY_CHARGE); - MapleStatEffect ceffect; + StatEffect ceffect; ceffect = energycharge.getEffect(getSkillLevel(energycharge)); TimerManager tMan = TimerManager.getInstance(); if (energybar < 10000) { @@ -5954,8 +5958,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (energybar > 10000) { energybar = 10000; } - List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.ENERGY_CHARGE, energybar)); - setBuffedValue(MapleBuffStat.ENERGY_CHARGE, energybar); + List> stat = Collections.singletonList(new Pair<>(BuffStat.ENERGY_CHARGE, energybar)); + setBuffedValue(BuffStat.ENERGY_CHARGE, energybar); sendPacket(PacketCreator.giveBuff(energybar, 0, stat)); sendPacket(PacketCreator.showOwnBuffEffect(energycharge.getId(), 2)); getMap().broadcastPacket(this, PacketCreator.showBuffEffect(id, energycharge.getId(), 2)); @@ -5963,13 +5967,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (energybar >= 10000 && energybar < 11000) { energybar = 15000; - final MapleCharacter chr = this; + final Character chr = this; tMan.schedule(new Runnable() { @Override public void run() { energybar = 0; - List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.ENERGY_CHARGE, energybar)); - setBuffedValue(MapleBuffStat.ENERGY_CHARGE, energybar); + List> stat = Collections.singletonList(new Pair<>(BuffStat.ENERGY_CHARGE, energybar)); + setBuffedValue(BuffStat.ENERGY_CHARGE, energybar); sendPacket(PacketCreator.giveBuff(energybar, 0, stat)); getMap().broadcastPacket(chr, PacketCreator.cancelForeignFirstDebuff(id, ((long) 1) << 50)); } @@ -5980,9 +5984,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void handleOrbconsume() { int skillid = isCygnus() ? DawnWarrior.COMBO : Crusader.COMBO; Skill combo = SkillFactory.getSkill(skillid); - List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.COMBO, 1)); - setBuffedValue(MapleBuffStat.COMBO, 1); - sendPacket(PacketCreator.giveBuff(skillid, combo.getEffect(getSkillLevel(combo)).getDuration() + (int) ((getBuffedStarttime(MapleBuffStat.COMBO) - System.currentTimeMillis())), stat)); + List> stat = Collections.singletonList(new Pair<>(BuffStat.COMBO, 1)); + setBuffedValue(BuffStat.COMBO, 1); + sendPacket(PacketCreator.giveBuff(skillid, combo.getEffect(getSkillLevel(combo)).getDuration() + (int) ((getBuffedStarttime(BuffStat.COMBO) - System.currentTimeMillis())), stat)); getMap().broadcastMessage(this, PacketCreator.giveForeignBuff(getId(), stat), false); } @@ -6000,7 +6004,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return script.equals(e); } - public void hasGivenFame(MapleCharacter to) { + public void hasGivenFame(Character to) { lastfametime = System.currentTimeMillis(); lastmonthfameids.add(Integer.valueOf(to.getId())); try (Connection con = DatabaseConnection.getConnection(); @@ -6020,38 +6024,38 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean haveItem(int itemid) { return getItemQuantity(itemid, ItemConstants.isEquipment(itemid)) > 0; } - + public boolean haveCleanItem(int itemid) { return getCleanItemQuantity(itemid, ItemConstants.isEquipment(itemid)) > 0; } - + public boolean hasEmptySlot(int itemId) { return getInventory(ItemConstants.getInventoryType(itemId)).getNextFreeSlot() > -1; } - + public boolean hasEmptySlot(byte invType) { - return getInventory(MapleInventoryType.getByType(invType)).getNextFreeSlot() > -1; + return getInventory(InventoryType.getByType(invType)).getNextFreeSlot() > -1; } public void increaseGuildCapacity() { - int cost = MapleGuild.getIncreaseGuildCost(getGuild().getCapacity()); - + int cost = Guild.getIncreaseGuildCost(getGuild().getCapacity()); + if (getMeso() < cost) { dropMessage(1, "You don't have enough mesos."); return; } - - if(Server.getInstance().increaseGuildCapacity(guildid)) { + + if (Server.getInstance().increaseGuildCapacity(guildid)) { gainMeso(-cost, true, false, true); } else { dropMessage(1, "Your guild already reached the maximum capacity of players."); } } - + private boolean canBuyback(int fee, boolean usingMesos) { return (usingMesos ? this.getMeso() : cashshop.getCash(1)) >= fee; } - + private void applyBuybackFee(int fee, boolean usingMesos) { if (usingMesos) { this.gainMeso(-fee); @@ -6059,30 +6063,30 @@ public class MapleCharacter extends AbstractMapleCharacterObject { cashshop.gainCash(1, -fee); } } - + private long getNextBuybackTime() { return lastBuyback + YamlConfig.config.server.BUYBACK_COOLDOWN_MINUTES * 60 * 1000; } - + private boolean isBuybackInvincible() { return Server.getInstance().getCurrentTime() - lastBuyback < 4200; } - + private int getBuybackFee() { float fee = YamlConfig.config.server.BUYBACK_FEE; int grade = Math.min(Math.max(level, 30), 120) - 30; - + fee += (grade * YamlConfig.config.server.BUYBACK_LEVEL_STACK_FEE); if (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS) { fee *= YamlConfig.config.server.BUYBACK_MESO_MULTIPLIER; } - + return (int) Math.floor(fee); } - + public void showBuybackInfo() { String s = "#eBUYBACK STATUS#n\r\n\r\nCurrent buyback fee: #b" + getBuybackFee() + " " + (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS ? "mesos" : "NX") + "#k\r\n\r\n"; - + long timeNow = Server.getInstance().getCurrentTime(); boolean avail = true; if (!isAlive()) { @@ -6096,57 +6100,57 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } s += "\r\n"; } - + if (timeNow < getNextBuybackTime() && avail) { s += "Buyback available in #r" + getTimeRemaining(getNextBuybackTime() - timeNow) + "#k"; s += "\r\n"; } else { s += "Buyback #bavailable#k"; } - + this.showHint(s); } - + private static String getTimeRemaining(long timeLeft) { int seconds = (int) Math.floor(timeLeft / 1000) % 60; - int minutes = (int) Math.floor(timeLeft / (1000*60)) % 60; - + int minutes = (int) Math.floor(timeLeft / (1000 * 60)) % 60; + return (minutes > 0 ? (String.format("%02d", minutes) + " minutes, ") : "") + String.format("%02d", seconds) + " seconds"; } - + public boolean couldBuyback() { // Ronan's buyback system long timeNow = Server.getInstance().getCurrentTime(); - + if (timeNow - lastDeathtime > YamlConfig.config.server.BUYBACK_RETURN_MINUTES * 60 * 1000) { this.dropMessage(5, "The period of time to decide has expired, therefore you are unable to buyback."); return false; } - + long nextBuybacktime = getNextBuybackTime(); if (timeNow < nextBuybacktime) { long timeLeft = nextBuybacktime - timeNow; this.dropMessage(5, "Next buyback available in " + getTimeRemaining(timeLeft) + "."); return false; } - + boolean usingMesos = YamlConfig.config.server.USE_BUYBACK_WITH_MESOS; int fee = getBuybackFee(); - + if (!canBuyback(fee, usingMesos)) { this.dropMessage(5, "You don't have " + fee + " " + (usingMesos ? "mesos" : "NX") + " to buyback."); return false; } - + lastBuyback = timeNow; applyBuybackFee(fee, usingMesos); return true; } - public boolean isBuffFrom(MapleBuffStat stat, Skill skill) { + public boolean isBuffFrom(BuffStat stat, Skill skill) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(stat); + BuffStatValueHolder mbsvh = effects.get(stat); if (mbsvh == null) { return false; } @@ -6156,12 +6160,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public boolean isGmJob() { int jn = job.getJobNiche(); return jn >= 8 && jn <= 9; } - + public boolean isCygnus() { return getJobType() == 1; } @@ -6182,28 +6186,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return hidden; } - public boolean isMapObjectVisible(MapleMapObject mo) { + public boolean isMapObjectVisible(MapObject mo) { return visibleMapObjects.contains(mo); } public boolean isPartyLeader() { prtLock.lock(); try { - MapleParty party = getParty(); + Party party = getParty(); return party != null && party.getLeaderId() == getId(); } finally { prtLock.unlock(); } } - + public boolean isGuildLeader() { // true on guild master or jr. master return guildid > 0 && guildRank < 3; } - + public boolean attemptCatchFish(int baitLevel) { return YamlConfig.config.server.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel); } - + public void leaveMap() { releaseControlledMonsters(); visibleMapObjects.clear(); @@ -6211,91 +6215,91 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (hpDecreaseTask != null) { hpDecreaseTask.cancel(false); } - + AriantColiseum arena = this.getAriantColiseum(); if (arena != null) { arena.leaveArena(this); } } - - private int getChangedJobSp(MapleJob newJob) { + + private int getChangedJobSp(Job newJob) { int curSp = getUsedSp(newJob) + getJobRemainingSp(newJob); int spGain = 0; int expectedSp = getJobLevelSp(level - 10, newJob, GameConstants.getJobBranch(newJob)); if (curSp < expectedSp) { spGain += (expectedSp - curSp); } - + return getSpGain(spGain, curSp, newJob); } - - private int getUsedSp(MapleJob job) { + + private int getUsedSp(Job job) { int jobId = job.getId(); int spUsed = 0; - + for (Entry s : this.getSkills().entrySet()) { Skill skill = s.getKey(); if (GameConstants.isInJobTree(skill.getId(), jobId) && !skill.isBeginnerSkill()) { spUsed += s.getValue().skillevel; } } - + return spUsed; } - - private int getJobLevelSp(int level, MapleJob job, int jobBranch) { - if (getJobStyleInternal(job.getId(), (byte) 0x40) == MapleJob.MAGICIAN) { + + private int getJobLevelSp(int level, Job job, int jobBranch) { + if (getJobStyleInternal(job.getId(), (byte) 0x40) == Job.MAGICIAN) { level += 2; // starts earlier, level 8 } - + return 3 * level + GameConstants.getChangeJobSpUpgrade(jobBranch); } - - private int getJobMaxSp(MapleJob job) { + + private int getJobMaxSp(Job job) { int jobBranch = GameConstants.getJobBranch(job); int jobRange = GameConstants.getJobUpgradeLevelRange(jobBranch); return getJobLevelSp(jobRange, job, jobBranch); } - - private int getJobRemainingSp(MapleJob job) { + + private int getJobRemainingSp(Job job) { int skillBook = GameConstants.getSkillBook(job.getId()); - + int ret = 0; for (int i = 0; i <= skillBook; i++) { ret += this.getRemainingSp(i); } - + return ret; } - - private int getSpGain(int spGain, MapleJob job) { + + private int getSpGain(int spGain, Job job) { int curSp = getUsedSp(job) + getJobRemainingSp(job); return getSpGain(spGain, curSp, job); } - - private int getSpGain(int spGain, int curSp, MapleJob job) { + + private int getSpGain(int spGain, int curSp, Job job) { int maxSp = getJobMaxSp(job); spGain = Math.min(spGain, maxSp - curSp); int jobBranch = GameConstants.getJobBranch(job); return spGain; } - + private void levelUpGainSp() { if (GameConstants.getJobBranch(job) == 0) { return; } - + int spGain = 3; if (YamlConfig.config.server.USE_ENFORCE_JOB_SP_RANGE && !GameConstants.hasSPTable(job)) { spGain = getSpGain(spGain, job); } - + if (spGain > 0) { gainSp(spGain, GameConstants.getSkillBook(job.getId()), true); } } - + public synchronized void levelUp(boolean takeexp) { Skill improvingMaxHP = null; Skill improvingMaxMP = null; @@ -6308,7 +6312,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { statWlock.lock(); try { gainAp(5, true); - + int str = 0, dex = 0; if (level < 6) { str += 5; @@ -6324,7 +6328,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } else { int remainingAp = 5; - + if (isCygnus()) { if (level > 10) { if (level <= 17) { @@ -6334,7 +6338,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + gainAp(remainingAp, true); } @@ -6342,46 +6346,46 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (isBeginner) { addhp += Randomizer.rand(12, 16); addmp += Randomizer.rand(10, 12); - } else if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1)) { + } else if (job.isA(Job.WARRIOR) || job.isA(Job.DAWNWARRIOR1)) { improvingMaxHP = isCygnus() ? SkillFactory.getSkill(DawnWarrior.MAX_HP_INCREASE) : SkillFactory.getSkill(Warrior.IMPROVED_MAXHP); - if (job.isA(MapleJob.CRUSADER)) { + if (job.isA(Job.CRUSADER)) { improvingMaxMP = SkillFactory.getSkill(1210000); - } else if (job.isA(MapleJob.DAWNWARRIOR2)) { + } else if (job.isA(Job.DAWNWARRIOR2)) { improvingMaxMP = SkillFactory.getSkill(11110000); } improvingMaxHPLevel = getSkillLevel(improvingMaxHP); addhp += Randomizer.rand(24, 28); addmp += Randomizer.rand(4, 6); - } else if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) { + } else if (job.isA(Job.MAGICIAN) || job.isA(Job.BLAZEWIZARD1)) { improvingMaxMP = isCygnus() ? SkillFactory.getSkill(BlazeWizard.INCREASING_MAX_MP) : SkillFactory.getSkill(Magician.IMPROVED_MAX_MP_INCREASE); improvingMaxMPLevel = getSkillLevel(improvingMaxMP); addhp += Randomizer.rand(10, 14); addmp += Randomizer.rand(22, 24); - } else if (job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.THIEF) || (job.getId() > 1299 && job.getId() < 1500)) { + } else if (job.isA(Job.BOWMAN) || job.isA(Job.THIEF) || (job.getId() > 1299 && job.getId() < 1500)) { addhp += Randomizer.rand(20, 24); addmp += Randomizer.rand(14, 16); - } else if (job.isA(MapleJob.GM)) { + } else if (job.isA(Job.GM)) { addhp += 30000; addmp += 30000; - } else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) { + } else if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) { improvingMaxHP = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.IMPROVE_MAX_HP) : SkillFactory.getSkill(Brawler.IMPROVE_MAX_HP); improvingMaxHPLevel = getSkillLevel(improvingMaxHP); addhp += Randomizer.rand(22, 28); addmp += Randomizer.rand(18, 23); - } else if (job.isA(MapleJob.ARAN1)) { + } else if (job.isA(Job.ARAN1)) { addhp += Randomizer.rand(44, 48); int aids = Randomizer.rand(4, 8); addmp += aids + Math.floor(aids * 0.1); } - if (improvingMaxHPLevel > 0 && (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.PIRATE) || job.isA(MapleJob.DAWNWARRIOR1) || job.isA(MapleJob.THUNDERBREAKER1))) { + if (improvingMaxHPLevel > 0 && (job.isA(Job.WARRIOR) || job.isA(Job.PIRATE) || job.isA(Job.DAWNWARRIOR1) || job.isA(Job.THUNDERBREAKER1))) { addhp += improvingMaxHP.getEffect(improvingMaxHPLevel).getX(); } - if (improvingMaxMPLevel > 0 && (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.CRUSADER) || job.isA(MapleJob.BLAZEWIZARD1))) { + if (improvingMaxMPLevel > 0 && (job.isA(Job.MAGICIAN) || job.isA(Job.CRUSADER) || job.isA(Job.BLAZEWIZARD1))) { addmp += improvingMaxMP.getEffect(improvingMaxMPLevel).getX(); } if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { - if (getJobStyle() == MapleJob.MAGICIAN) { + if (getJobStyle() == Job.MAGICIAN) { addmp += localint_ / 20; } else { addmp += localint_ / 10; @@ -6408,7 +6412,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ThreadManager.getInstance().newTask(new Runnable() { @Override public void run() { - MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), MapleCharacter.this); + PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), Character.this); } }); } @@ -6420,27 +6424,27 @@ public class MapleCharacter extends AbstractMapleCharacterObject { level = maxClassLevel; //To prevent levels past the maximum } - + levelUpGainSp(); - + effLock.lock(); statWlock.lock(); try { recalcLocalStats(); changeHpMp(localmaxhp, localmaxmp, true); - List> statup = new ArrayList<>(10); - statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); - statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); - statup.add(new Pair<>(MapleStat.HP, hp)); - statup.add(new Pair<>(MapleStat.MP, mp)); - statup.add(new Pair<>(MapleStat.EXP, exp.get())); - statup.add(new Pair<>(MapleStat.LEVEL, level)); - statup.add(new Pair<>(MapleStat.MAXHP, clientmaxhp)); - statup.add(new Pair<>(MapleStat.MAXMP, clientmaxmp)); - statup.add(new Pair<>(MapleStat.STR, str)); - statup.add(new Pair<>(MapleStat.DEX, dex)); - + List> statup = new ArrayList<>(10); + statup.add(new Pair<>(Stat.AVAILABLEAP, remainingAp)); + statup.add(new Pair<>(Stat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); + statup.add(new Pair<>(Stat.HP, hp)); + statup.add(new Pair<>(Stat.MP, mp)); + statup.add(new Pair<>(Stat.EXP, exp.get())); + statup.add(new Pair<>(Stat.LEVEL, level)); + statup.add(new Pair<>(Stat.MAXHP, clientmaxhp)); + statup.add(new Pair<>(Stat.MAXMP, clientmaxmp)); + statup.add(new Pair<>(Stat.STR, str)); + statup.add(new Pair<>(Stat.DEX, dex)); + sendPacket(PacketCreator.updatePlayerStats(statup, true, this)); } finally { statWlock.unlock(); @@ -6448,7 +6452,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } getMap().broadcastMessage(this, PacketCreator.showForeignEffect(getId(), 0), false); - setMPC(new MaplePartyCharacter(this)); + setMPC(new PartyCharacter(this)); silentPartyUpdate(); if (this.guildid > 0) { @@ -6463,7 +6467,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } this.yellowMessage("You reached level " + level + ". Congratulations! As a token of your success, your inventory has been expanded a little bit."); - } + } } if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL == true) { //For the rate upgrade revertLastPlayerRates(); @@ -6474,8 +6478,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (YamlConfig.config.server.USE_PERFECT_PITCH && level >= 30) { //milestones? - if (MapleInventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { - MapleInventoryManipulator.addById(client, 4310000, (short) 1, "", -1); + if (InventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { + InventoryManipulator.addById(client, 4310000, (short) 1, "", -1); } } else if (level == 10) { Runnable r = new Runnable() { @@ -6492,20 +6496,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { levelUpMessages(); guildUpdate(); - - MapleFamilyEntry familyEntry = getFamilyEntry(); - if(familyEntry != null) { + + FamilyEntry familyEntry = getFamilyEntry(); + if (familyEntry != null) { familyEntry.giveReputationToSenior(YamlConfig.config.server.FAMILY_REP_PER_LEVELUP, true); - MapleFamilyEntry senior = familyEntry.getSenior(); - if(senior != null) { //only send the message to direct senior - MapleCharacter seniorChr = senior.getChr(); - if(seniorChr != null) seniorChr.sendPacket(PacketCreator.levelUpMessage(1, level, getName())); + FamilyEntry senior = familyEntry.getSenior(); + if (senior != null) { //only send the message to direct senior + Character seniorChr = senior.getChr(); + if (seniorChr != null) { + seniorChr.sendPacket(PacketCreator.levelUpMessage(1, level, getName())); + } } } } - + public boolean leaveParty() { - MapleParty party; + Party party; boolean partyLeader; prtLock.lock(); @@ -6517,8 +6523,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (party != null) { - if(partyLeader) party.assignNewLeader(client); - MapleParty.leaveParty(party, client); + if (partyLeader) { + party.assignNewLeader(client); + } + Party.leaveParty(party, client); return true; } else { @@ -6612,43 +6620,43 @@ public class MapleCharacter extends AbstractMapleCharacterObject { yellowMessage("Very nicely done! You have reached the so-long dreamed LEVEL 200!!! You are truly a hero among men, cheers upon you!"); } } - + public void setPlayerRates() { - this.expRate *= GameConstants.getPlayerBonusExpRate(this.level / 20); + this.expRate *= GameConstants.getPlayerBonusExpRate(this.level / 20); this.mesoRate *= GameConstants.getPlayerBonusMesoRate(this.level / 20); this.dropRate *= GameConstants.getPlayerBonusDropRate(this.level / 20); } public void revertLastPlayerRates() { - this.expRate /= GameConstants.getPlayerBonusExpRate((this.level - 1) / 20); + this.expRate /= GameConstants.getPlayerBonusExpRate((this.level - 1) / 20); this.mesoRate /= GameConstants.getPlayerBonusMesoRate((this.level - 1) / 20); this.dropRate /= GameConstants.getPlayerBonusDropRate((this.level - 1) / 20); } - + public void revertPlayerRates() { - this.expRate /= GameConstants.getPlayerBonusExpRate(this.level / 20); + this.expRate /= GameConstants.getPlayerBonusExpRate(this.level / 20); this.mesoRate /= GameConstants.getPlayerBonusMesoRate(this.level / 20); this.dropRate /= GameConstants.getPlayerBonusDropRate(this.level / 20); } - + public void setWorldRates() { World worldz = getWorldServer(); this.expRate *= worldz.getExpRate(); this.mesoRate *= worldz.getMesoRate(); this.dropRate *= worldz.getDropRate(); } - + public void revertWorldRates() { World worldz = getWorldServer(); this.expRate /= worldz.getExpRate(); this.mesoRate /= worldz.getMesoRate(); this.dropRate /= worldz.getDropRate(); } - + private void setCouponRates() { List couponEffects; - - Collection cashItems = this.getInventory(MapleInventoryType.CASH).list(); + + Collection cashItems = this.getInventory(InventoryType.CASH).list(); chrLock.lock(); try { setActiveCoupons(cashItems); @@ -6656,20 +6664,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { chrLock.unlock(); } - - for(Integer couponId: couponEffects) { + + for (Integer couponId : couponEffects) { commitBuffCoupon(couponId); } } - + private void revertCouponRates() { revertCouponsEffects(); } - + public void updateCouponRates() { - Inventory cashInv = this.getInventory(MapleInventoryType.CASH); - if (cashInv == null) return; - + Inventory cashInv = this.getInventory(InventoryType.CASH); + if (cashInv == null) { + return; + } + effLock.lock(); chrLock.lock(); cashInv.lockInventory(); @@ -6682,52 +6692,52 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public void resetPlayerRates() { expRate = 1; mesoRate = 1; dropRate = 1; - + expCoupon = 1; mesoCoupon = 1; dropCoupon = 1; } - + private int getCouponMultiplier(int couponId) { return activeCouponRates.get(couponId); } - + private void setExpCouponRate(int couponId, int couponQty) { this.expCoupon *= (getCouponMultiplier(couponId) * couponQty); } - + private void setDropCouponRate(int couponId, int couponQty) { this.dropCoupon *= (getCouponMultiplier(couponId) * couponQty); this.mesoCoupon *= (getCouponMultiplier(couponId) * couponQty); } - + private void revertCouponsEffects() { dispelBuffCoupons(); - + this.expRate /= this.expCoupon; this.dropRate /= this.dropCoupon; this.mesoRate /= this.mesoCoupon; - + this.expCoupon = 1; this.dropCoupon = 1; this.mesoCoupon = 1; } - + private List activateCouponsEffects() { List toCommitEffect = new LinkedList<>(); - - if(YamlConfig.config.server.USE_STACK_COUPON_RATES) { - for(Entry coupon: activeCoupons.entrySet()) { + + if (YamlConfig.config.server.USE_STACK_COUPON_RATES) { + for (Entry coupon : activeCoupons.entrySet()) { int couponId = coupon.getKey(); int couponQty = coupon.getValue(); toCommitEffect.add(couponId); - + if (ItemConstants.isExpCoupon(couponId)) { setExpCouponRate(couponId, couponQty); } else { @@ -6736,43 +6746,42 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } else { int maxExpRate = 1, maxDropRate = 1, maxExpCouponId = -1, maxDropCouponId = -1; - - for(Entry coupon: activeCoupons.entrySet()) { + + for (Entry coupon : activeCoupons.entrySet()) { int couponId = coupon.getKey(); - if(ItemConstants.isExpCoupon(couponId)) { - if(maxExpRate < getCouponMultiplier(couponId)) { + if (ItemConstants.isExpCoupon(couponId)) { + if (maxExpRate < getCouponMultiplier(couponId)) { maxExpCouponId = couponId; maxExpRate = getCouponMultiplier(couponId); } - } - else { - if(maxDropRate < getCouponMultiplier(couponId)) { + } else { + if (maxDropRate < getCouponMultiplier(couponId)) { maxDropCouponId = couponId; maxDropRate = getCouponMultiplier(couponId); } } } - + if (maxExpCouponId > -1) { toCommitEffect.add(maxExpCouponId); } if (maxDropCouponId > -1) { toCommitEffect.add(maxDropCouponId); } - + this.expCoupon = maxExpRate; this.dropCoupon = maxDropRate; this.mesoCoupon = maxDropRate; } - + this.expRate *= this.expCoupon; this.dropRate *= this.dropCoupon; this.mesoRate *= this.mesoCoupon; - + return toCommitEffect; } - + private void setActiveCoupons(Collection cashItems) { activeCoupons.clear(); activeCouponRates.clear(); @@ -6780,11 +6789,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { Map coupons = Server.getInstance().getCouponRates(); List active = Server.getInstance().getActiveCoupons(); - for (Item it: cashItems) { + for (Item it : cashItems) { if (ItemConstants.isRateCoupon(it.getItemId()) && active.contains(it.getItemId())) { Integer count = activeCoupons.get(it.getItemId()); - if(count != null) { + if (count != null) { activeCoupons.put(it.getItemId(), count + 1); } else { activeCoupons.put(it.getItemId(), 1); @@ -6793,36 +6802,36 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + private void commitBuffCoupon(int couponid) { if (!isLoggedin() || getCashShop().isOpened()) { return; } - - MapleStatEffect mse = ii.getItemEffect(couponid); + + StatEffect mse = ii.getItemEffect(couponid); mse.applyTo(this); } - + public void dispelBuffCoupons() { - List allBuffs = getAllStatups(); - - for (MapleBuffStatValueHolder mbsvh : allBuffs) { + List allBuffs = getAllStatups(); + + for (BuffStatValueHolder mbsvh : allBuffs) { if (ItemConstants.isRateCoupon(mbsvh.effect.getSourceId())) { cancelEffect(mbsvh.effect, false, mbsvh.startTime); } } } - + public Set getActiveCoupons() { chrLock.lock(); try { return Collections.unmodifiableSet(activeCoupons.keySet()); } finally { chrLock.unlock(); - } + } } - public void addPlayerRing(MapleRing ring) { + public void addPlayerRing(Ring ring) { int ringItemId = ring.getItemId(); if (ItemConstants.isWeddingRing(ringItemId)) { this.addMarriageRing(ring); @@ -6832,23 +6841,23 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.addCrushRing(ring); } } - - public static MapleCharacter loadCharacterEntryFromDB(ResultSet rs, List equipped) { - MapleCharacter ret = new MapleCharacter(); - + + public static Character loadCharacterEntryFromDB(ResultSet rs, List equipped) { + Character ret = new Character(); + try { ret.accountid = rs.getInt("accountid"); ret.id = rs.getInt("id"); ret.name = rs.getString("name"); ret.gender = rs.getInt("gender"); - ret.skinColor = MapleSkinColor.getById(rs.getInt("skincolor")); + ret.skinColor = SkinColor.getById(rs.getInt("skincolor")); ret.face = rs.getInt("face"); ret.hair = rs.getInt("hair"); // skipping pets, probably unneeded here ret.level = rs.getInt("level"); - ret.job = MapleJob.getById(rs.getInt("job")); + ret.job = Job.getById(rs.getInt("job")); ret.str = rs.getInt("str"); ret.dex = rs.getInt("dex"); ret.int_ = rs.getInt("int"); @@ -6870,9 +6879,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.rankMove = rs.getInt("rankMove"); ret.jobRank = rs.getInt("jobRank"); ret.jobRankMove = rs.getInt("jobRankMove"); - - if(equipped != null) { // players can have no equipped items at all, ofc - Inventory inv = ret.inventory[MapleInventoryType.EQUIPPED.ordinal()]; + + if (equipped != null) { // players can have no equipped items at all, ofc + Inventory inv = ret.inventory[InventoryType.EQUIPPED.ordinal()]; for (Item item : equipped) { inv.addItemFromDB(item); } @@ -6880,13 +6889,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } catch (SQLException sqle) { sqle.printStackTrace(); } - + return ret; } - - public MapleCharacter generateCharacterEntry() { - MapleCharacter ret = new MapleCharacter(); - + + public Character generateCharacterEntry() { + Character ret = new Character(); + ret.accountid = this.getAccountID(); ret.id = this.getId(); ret.name = this.getName(); @@ -6894,9 +6903,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.skinColor = this.getSkinColor(); ret.face = this.getFace(); ret.hair = this.getHair(); - + // skipping pets, probably unneeded here - + ret.level = this.getLevel(); ret.job = this.getJob(); ret.str = this.getStr(); @@ -6914,38 +6923,38 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.gachaexp.set(this.getGachaExp()); ret.mapid = this.getMapId(); ret.initialSpawnPoint = this.getInitialSpawnpoint(); - - ret.inventory[MapleInventoryType.EQUIPPED.ordinal()] = this.getInventory(MapleInventoryType.EQUIPPED); - + + ret.inventory[InventoryType.EQUIPPED.ordinal()] = this.getInventory(InventoryType.EQUIPPED); + ret.setGMLevel(this.gmLevel()); ret.world = this.getWorld(); ret.rank = this.getRank(); ret.rankMove = this.getRankMove(); ret.jobRank = this.getJobRank(); ret.jobRankMove = this.getJobRankMove(); - + return ret; } - + private void loadCharSkillPoints(String[] skillPoints) { - int sps[] = new int[skillPoints.length]; + int[] sps = new int[skillPoints.length]; for (int i = 0; i < skillPoints.length; i++) { sps[i] = Integer.parseInt(skillPoints[i]); } - + setRemainingSp(sps); } - + public int getRemainingSp() { return getRemainingSp(job.getId()); //default } - + public void updateRemainingSp(int remainingSp) { updateRemainingSp(remainingSp, GameConstants.getSkillBook(job.getId())); } - - public static MapleCharacter loadCharFromDB(final int charid, MapleClient client, boolean channelserver) throws SQLException { - MapleCharacter ret = new MapleCharacter(); + + public static Character loadCharFromDB(final int charid, Client client, boolean channelserver) throws SQLException { + Character ret = new Character(); ret.client = client; ret.id = charid; @@ -6985,9 +6994,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.meso.set(rs.getInt("meso")); ret.merchantmeso = rs.getInt("MerchantMesos"); ret.setGMLevel(rs.getInt("gm")); - ret.skinColor = MapleSkinColor.getById(rs.getInt("skincolor")); + ret.skinColor = SkinColor.getById(rs.getInt("skincolor")); ret.gender = rs.getInt("gender"); - ret.job = MapleJob.getById(rs.getInt("job")); + ret.job = Job.getById(rs.getInt("job")); ret.finishedDojoTutorial = rs.getInt("finishedDojoTutorial") == 1; ret.vanquisherKills = rs.getInt("vanquisherKills"); ret.omokwins = rs.getInt("omokwins"); @@ -7022,7 +7031,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ret.dojoPoints = rs.getInt("dojoPoints"); ret.dojoStage = rs.getInt("lastDojoStage"); ret.dataString = rs.getString("dataString"); - ret.mgc = new MapleGuildCharacter(ret); + ret.mgc = new GuildCharacter(ret); int buddyCapacity = rs.getInt("buddyCapacity"); ret.buddylist = new BuddyList(buddyCapacity); ret.lastExpGainTime = rs.getTimestamp("lastExpGainTime").getTime(); @@ -7030,31 +7039,31 @@ public class MapleCharacter extends AbstractMapleCharacterObject { wserv = Server.getInstance().getWorld(ret.world); - ret.getInventory(MapleInventoryType.EQUIP).setSlotLimit(rs.getByte("equipslots")); - ret.getInventory(MapleInventoryType.USE).setSlotLimit(rs.getByte("useslots")); - ret.getInventory(MapleInventoryType.SETUP).setSlotLimit(rs.getByte("setupslots")); - ret.getInventory(MapleInventoryType.ETC).setSlotLimit(rs.getByte("etcslots")); + ret.getInventory(InventoryType.EQUIP).setSlotLimit(rs.getByte("equipslots")); + ret.getInventory(InventoryType.USE).setSlotLimit(rs.getByte("useslots")); + ret.getInventory(InventoryType.SETUP).setSlotLimit(rs.getByte("setupslots")); + ret.getInventory(InventoryType.ETC).setSlotLimit(rs.getByte("etcslots")); short sandboxCheck = 0x0; - for (Pair item : ItemFactory.INVENTORY.loadItems(ret.id, !channelserver)) { + for (Pair item : ItemFactory.INVENTORY.loadItems(ret.id, !channelserver)) { sandboxCheck |= item.getLeft().getFlag(); ret.getInventory(item.getRight()).addItemFromDB(item.getLeft()); Item itemz = item.getLeft(); if (itemz.getPetId() > -1) { - MaplePet pet = itemz.getPet(); + Pet pet = itemz.getPet(); if (pet != null && pet.isSummoned()) { ret.addPet(pet); } continue; } - MapleInventoryType mit = item.getRight(); - if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) { + InventoryType mit = item.getRight(); + if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) { Equip equip = (Equip) item.getLeft(); if (equip.getRingId() > -1) { - MapleRing ring = MapleRing.loadFromDb(equip.getRingId()); - if (item.getRight().equals(MapleInventoryType.EQUIPPED)) { + Ring ring = Ring.loadFromDb(equip.getRingId()); + if (item.getRight().equals(InventoryType.EQUIPPED)) { ring.equip(); } @@ -7107,31 +7116,31 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (channelserver) { - MapleMapManager mapManager = client.getChannelServer().getMapFactory(); + MapManager mapManager = client.getChannelServer().getMapFactory(); ret.map = mapManager.getMap(ret.mapid); if (ret.map == null) { ret.map = mapManager.getMap(100000000); } - MaplePortal portal = ret.map.getPortal(ret.initialSpawnPoint); + Portal portal = ret.map.getPortal(ret.initialSpawnPoint); if (portal == null) { portal = ret.map.getPortal(0); ret.initialSpawnPoint = 0; } ret.setPosition(portal.getPosition()); int partyid = rs.getInt("party"); - MapleParty party = wserv.getParty(partyid); + Party party = wserv.getParty(partyid); if (party != null) { ret.mpc = party.getMemberById(ret.id); if (ret.mpc != null) { - ret.mpc = new MaplePartyCharacter(ret); + ret.mpc = new PartyCharacter(ret); ret.party = party; } } int messengerid = rs.getInt("messengerid"); int position = rs.getInt("messengerposition"); if (messengerid > 0 && position < 4 && position > -1) { - MapleMessenger messenger = wserv.getMessenger(messengerid); + Messenger messenger = wserv.getMessenger(messengerid); if (messenger != null) { ret.messenger = messenger; ret.messengerposition = position; @@ -7175,7 +7184,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (ResultSet rs = ps.executeQuery()) { if (rs.next()) { - MapleClient retClient = ret.getClient(); + Client retClient = ret.getClient(); retClient.setAccountName(rs.getString("name")); retClient.setCharacterSlots(rs.getByte("characterslots")); @@ -7226,7 +7235,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (channelserver) { - final Map loadedQuestStatus = new LinkedHashMap<>(); + final Map loadedQuestStatus = new LinkedHashMap<>(); // Quest status try (PreparedStatement ps = con.prepareStatement("SELECT * FROM queststatus WHERE characterid = ?")) { @@ -7234,8 +7243,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - MapleQuest q = MapleQuest.getInstance(rs.getShort("quest")); - MapleQuestStatus status = new MapleQuestStatus(q, MapleQuestStatus.Status.getById(rs.getInt("status"))); + Quest q = Quest.getInstance(rs.getShort("quest")); + QuestStatus status = new QuestStatus(q, QuestStatus.Status.getById(rs.getInt("status"))); long cTime = rs.getLong("time"); if (cTime > -1) { status.setCompletionTime(cTime * 1000); @@ -7260,7 +7269,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(1, charid); try (ResultSet rsProgress = ps.executeQuery()) { while (rsProgress.next()) { - MapleQuestStatus status = loadedQuestStatus.get(rsProgress.getInt("queststatusid")); + QuestStatus status = loadedQuestStatus.get(rsProgress.getInt("queststatusid")); if (status != null) { status.setProgress(rsProgress.getInt("progressid"), rsProgress.getString("progress")); } @@ -7273,7 +7282,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(1, charid); try (ResultSet rsMedalMaps = ps.executeQuery()) { while (rsMedalMaps.next()) { - MapleQuestStatus status = loadedQuestStatus.get(rsMedalMaps.getInt("queststatusid")); + QuestStatus status = loadedQuestStatus.get(rsMedalMaps.getInt("queststatusid")); if (status != null) { status.addMedalMap(rsMedalMaps.getInt("mapid")); } @@ -7321,14 +7330,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } // Debuffs (load) - Map> loadedDiseases = new LinkedHashMap<>(); + Map> loadedDiseases = new LinkedHashMap<>(); try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playerdiseases WHERE charid = ?")) { ps.setInt(1, ret.getId()); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - final MapleDisease disease = MapleDisease.ordinal(rs.getInt("disease")); - if (disease == MapleDisease.NULL) { + final Disease disease = Disease.ordinal(rs.getInt("disease")); + if (disease == Disease.NULL) { continue; } @@ -7376,7 +7385,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int key = rs.getInt("key"); int type = rs.getInt("type"); int action = rs.getInt("action"); - ret.keymap.put(key, new MapleKeyBinding(type, action)); + ret.keymap.put(key, new KeyBinding(type, action)); } } } @@ -7416,10 +7425,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } final int mountid = ret.getJobType() * 10000000 + 1004; - if (ret.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18) != null) { - ret.maplemount = new MapleMount(ret, ret.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18).getItemId(), mountid); + if (ret.getInventory(InventoryType.EQUIPPED).getItem((short) -18) != null) { + ret.maplemount = new Mount(ret, ret.getInventory(InventoryType.EQUIPPED).getItem((short) -18).getItemId(), mountid); } else { - ret.maplemount = new MapleMount(ret, 0, mountid); + ret.maplemount = new Mount(ret, 0, mountid); } ret.maplemount.setExp(mountexp); ret.maplemount.setLevel(mountlevel); @@ -7433,7 +7442,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (final ResultSet pResultSet = pSelectQuickslotKeyMapped.executeQuery()) { if (pResultSet.next()) { ret.m_aQuickslotLoaded = LongTool.LongToBytes(pResultSet.getLong(1)); - ret.m_pQuickslotKeyMapped = new MapleQuickslotBinding(ret.m_aQuickslotLoaded); + ret.m_pQuickslotKeyMapped = new QuickslotBinding(ret.m_aQuickslotLoaded); } } } @@ -7444,10 +7453,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return null; } - + public void reloadQuestExpirations() { - for(MapleQuestStatus mqs: getStartedQuests()) { - if(mqs.getExpirationTime() > 0) { + for (QuestStatus mqs : getStartedQuests()) { + if (mqs.getExpirationTime() > 0) { questTimeLimit2(mqs.getQuest(), mqs.getExpirationTime()); } } @@ -7459,18 +7468,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject { i = i.replace("rn", "Rn"); i = i.replace("vv", "Vv"); i = i.replace("VV", "Vv"); - + return i; } - private static class MapleBuffStatValueHolder { + private static class BuffStatValueHolder { - public MapleStatEffect effect; + public StatEffect effect; public long startTime; public int value; public boolean bestApplied; - public MapleBuffStatValueHolder(MapleStatEffect effect, long startTime, int value) { + public BuffStatValueHolder(StatEffect effect, long startTime, int value) { super(); this.effect = effect; this.startTime = startTime; @@ -7479,12 +7488,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public static class MapleCoolDownValueHolder { - + public static class CooldownValueHolder { + public int skillId; public long startTime, length; - public MapleCoolDownValueHolder(int skillId, long startTime, long length) { + public CooldownValueHolder(int skillId, long startTime, long length) { super(); this.skillId = skillId; this.startTime = startTime; @@ -7510,16 +7519,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } else if (id == 1140100 || id == 1140130) { raiseQuestMobCount(9101002); } - + int lastQuestProcessed = 0; try { synchronized (quests) { - for (MapleQuestStatus qs : getQuests()) { + for (QuestStatus qs : getQuests()) { lastQuestProcessed = qs.getQuest().getId(); - if (qs.getStatus() == MapleQuestStatus.Status.COMPLETED || qs.getQuest().canComplete(this, null)) { + if (qs.getStatus() == QuestStatus.Status.COMPLETED || qs.getQuest().canComplete(this, null)) { continue; } - + if (qs.progress(id)) { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, false); if (qs.getInfoNumber() > 0) { @@ -7529,12 +7538,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } catch (Exception e) { - FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, e, "MapleCharacter.mobKilled. CID: " + this.id + " last Quest Processed: " + lastQuestProcessed); + FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, e, "Character.mobKilled. CID: " + this.id + " last Quest Processed: " + lastQuestProcessed); } } - public MapleMount mount(int id, int skillid) { - MapleMount mount = maplemount; + public Mount mount(int id, int skillid) { + Mount mount = maplemount; mount.setItemId(id); mount.setSkillId(skillid); return mount; @@ -7550,11 +7559,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { gainCP(-losing); return; } - + cancelAllBuffs(false); dispelDebuffs(); lastDeathtime = Server.getInstance().getCurrentTime(); - + EventInstanceManager eim = getEventInstance(); if (eim != null) { eim.playerKilled(this); @@ -7571,12 +7580,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (possesed > 0 && !GameConstants.isDojo(getMapId())) { message("You have used a safety charm, so your EXP points have not been decreased."); - MapleInventoryManipulator.removeById(client, ItemConstants.getInventoryType(charmID[i]), charmID[i], 1, true, false); + InventoryManipulator.removeById(client, ItemConstants.getInventoryType(charmID[i]), charmID[i], 1, true, false); usedSafetyCharm = true; - } else if (getJob() != MapleJob.BEGINNER) { //Hmm... + } else if (getJob() != Job.BEGINNER) { //Hmm... if (!FieldLimit.NO_EXP_DECREASE.check(getMap().getFieldLimit())) { // thanks Conrad for noticing missing FieldLimit check int XPdummy = ExpTable.getExpNeededForLevel(getLevel()); - + if (getMap().isTown()) { // thanks MindLove, SIayerMonkey, HaItsNotOver for noting players only lose 1% on town maps XPdummy /= 100; } else { @@ -7586,7 +7595,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { XPdummy /= 20; } } - + int curExp = getExp(); if (curExp > XPdummy) { loseExp(XPdummy, false, false); @@ -7595,26 +7604,26 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - - if (getBuffedValue(MapleBuffStat.MORPH) != null) { - cancelEffectFromBuffStat(MapleBuffStat.MORPH); + + if (getBuffedValue(BuffStat.MORPH) != null) { + cancelEffectFromBuffStat(BuffStat.MORPH); } - if (getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) { - cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING); + if (getBuffedValue(BuffStat.MONSTER_RIDING) != null) { + cancelEffectFromBuffStat(BuffStat.MONSTER_RIDING); } unsitChairInternal(); sendPacket(PacketCreator.enableActions()); } - + private void unsitChairInternal() { int chairid = chair.get(); if (chairid >= 0) { if (ItemConstants.isFishingChair(chairid)) { this.getWorldServer().unregisterFisherPlayer(this); } - + setChair(-1); if (unregisterChairBuff()) { getMap().broadcastMessage(this, PacketCreator.cancelForeignChairSkillEffect(this.getId()), false); @@ -7625,7 +7634,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.cancelChair(-1)); } - + public void sitChair(int itemId) { if (this.isLoggedinWorld()) { if (itemId >= 1000000) { // sit on item chair @@ -7647,33 +7656,33 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + private void setChair(int chair) { this.chair.set(chair); } - + public void respawn(int returnMap) { respawn(null, returnMap); // unspecified EIM, don't force EIM unregister in this case } - + public void respawn(EventInstanceManager eim, int returnMap) { if (eim != null) { eim.unregisterPlayer(this); // some event scripts uses this... } changeMap(returnMap); - + cancelAllBuffs(false); // thanks Oblivium91 for finding out players still could revive in area and take damage before returning to town - + if (usedSafetyCharm) { // thanks kvmba for noticing safety charm not providing 30% HP/MP addMPHP((int) Math.ceil(this.getClientMaxHp() * 0.3), (int) Math.ceil(this.getClientMaxMp() * 0.3)); } else { updateHp(50); } - + setStance(0); } - private void prepareDragonBlood(final MapleStatEffect bloodEffect) { + private void prepareDragonBlood(final StatEffect bloodEffect) { if (dragonBloodSchedule != null) { dragonBloodSchedule.cancel(false); } @@ -7683,10 +7692,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (awayFromWorld.get()) { return; } - + addHP(-bloodEffect.getX()); sendPacket(PacketCreator.showOwnBuffEffect(bloodEffect.getSourceId(), 5)); - getMap().broadcastMessage(MapleCharacter.this, PacketCreator.showBuffEffect(getId(), bloodEffect.getSourceId(), 5), false); + getMap().broadcastMessage(Character.this, PacketCreator.showBuffEffect(getId(), bloodEffect.getSourceId(), 5), false); } }, 4000, 4000); } @@ -7703,8 +7712,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { equipwatk = 0; //equipspeed = 0; //equipjump = 0; - - for (Item item : getInventory(MapleInventoryType.EQUIPPED)) { + + for (Item item : getInventory(InventoryType.EQUIPPED)) { Equip equip = (Equip) item; equipmaxhp += equip.getHp(); equipmaxmp += equip.getMp(); @@ -7717,10 +7726,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { //equipspeed += equip.getSpeed(); //equipjump += equip.getJump(); } - + equipchanged = false; } - + localmaxhp += equipmaxhp; localmaxmp += equipmaxmp; localdex += equipdex; @@ -7730,7 +7739,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { localmagic += equipmagic; localwatk += equipwatk; } - + private void reapplyLocalStats() { effLock.lock(); chrLock.lock(); @@ -7750,11 +7759,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { localmagic = Math.min(localmagic, 2000); - Integer hbhp = getBuffedValue(MapleBuffStat.HYPERBODYHP); + Integer hbhp = getBuffedValue(BuffStat.HYPERBODYHP); if (hbhp != null) { localmaxhp += (hbhp.doubleValue() / 100) * localmaxhp; } - Integer hbmp = getBuffedValue(MapleBuffStat.HYPERBODYMP); + Integer hbmp = getBuffedValue(BuffStat.HYPERBODYMP); if (hbmp != null) { localmaxmp += (hbmp.doubleValue() / 100) * localmaxmp; } @@ -7762,29 +7771,29 @@ public class MapleCharacter extends AbstractMapleCharacterObject { localmaxhp = Math.min(30000, localmaxhp); localmaxmp = Math.min(30000, localmaxmp); - MapleStatEffect combo = getBuffEffect(MapleBuffStat.ARAN_COMBO); + StatEffect combo = getBuffEffect(BuffStat.ARAN_COMBO); if (combo != null) { localwatk += combo.getX(); } if (energybar == 15000) { Skill energycharge = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.ENERGY_CHARGE) : SkillFactory.getSkill(Marauder.ENERGY_CHARGE); - MapleStatEffect ceffect = energycharge.getEffect(getSkillLevel(energycharge)); + StatEffect ceffect = energycharge.getEffect(getSkillLevel(energycharge)); localwatk += ceffect.getWatk(); } - Integer mwarr = getBuffedValue(MapleBuffStat.MAPLE_WARRIOR); + Integer mwarr = getBuffedValue(BuffStat.MAPLE_WARRIOR); if (mwarr != null) { localstr += getStr() * mwarr / 100; localdex += getDex() * mwarr / 100; localint_ += getInt() * mwarr / 100; localluk += getLuk() * mwarr / 100; } - if (job.isA(MapleJob.BOWMAN)) { + if (job.isA(Job.BOWMAN)) { Skill expert = null; - if (job.isA(MapleJob.MARKSMAN)) { + if (job.isA(Job.MARKSMAN)) { expert = SkillFactory.getSkill(3220004); - } else if (job.isA(MapleJob.BOWMASTER)) { + } else if (job.isA(Job.BOWMASTER)) { expert = SkillFactory.getSkill(3120005); } if (expert != null) { @@ -7795,21 +7804,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - Integer watkbuff = getBuffedValue(MapleBuffStat.WATK); + Integer watkbuff = getBuffedValue(BuffStat.WATK); if (watkbuff != null) { localwatk += watkbuff.intValue(); } - Integer matkbuff = getBuffedValue(MapleBuffStat.MATK); + Integer matkbuff = getBuffedValue(BuffStat.MATK); if (matkbuff != null) { localmagic += matkbuff.intValue(); } /* - Integer speedbuff = getBuffedValue(MapleBuffStat.SPEED); + Integer speedbuff = getBuffedValue(BuffStat.SPEED); if (speedbuff != null) { localspeed += speedbuff.intValue(); } - Integer jumpbuff = getBuffedValue(MapleBuffStat.JUMP); + Integer jumpbuff = getBuffedValue(BuffStat.JUMP); if (jumpbuff != null) { localjump += jumpbuff.intValue(); } @@ -7821,17 +7830,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { localmagic += blessing * 2; } - if (job.isA(MapleJob.THIEF) || job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.PIRATE) || job.isA(MapleJob.NIGHTWALKER1) || job.isA(MapleJob.WINDARCHER1)) { - Item weapon_item = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11); + if (job.isA(Job.THIEF) || job.isA(Job.BOWMAN) || job.isA(Job.PIRATE) || job.isA(Job.NIGHTWALKER1) || job.isA(Job.WINDARCHER1)) { + Item weapon_item = getInventory(InventoryType.EQUIPPED).getItem((short) -11); if (weapon_item != null) { - MapleWeaponType weapon = ii.getWeaponType(weapon_item.getItemId()); - boolean bow = weapon == MapleWeaponType.BOW; - boolean crossbow = weapon == MapleWeaponType.CROSSBOW; - boolean claw = weapon == MapleWeaponType.CLAW; - boolean gun = weapon == MapleWeaponType.GUN; + WeaponType weapon = ii.getWeaponType(weapon_item.getItemId()); + boolean bow = weapon == WeaponType.BOW; + boolean crossbow = weapon == WeaponType.CROSSBOW; + boolean claw = weapon == WeaponType.CLAW; + boolean gun = weapon == WeaponType.GUN; if (bow || crossbow || claw || gun) { // Also calc stars into this. - Inventory inv = getInventory(MapleInventoryType.USE); + Inventory inv = getInventory(InventoryType.USE); for (short i = 1; i <= inv.getSlotLimit(); i++) { Item item = inv.getItem(i); if (item != null) { @@ -7854,21 +7863,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - - private List> recalcLocalStats() { + + private List> recalcLocalStats() { effLock.lock(); chrLock.lock(); statWlock.lock(); try { - List> hpmpupdate = new ArrayList<>(2); + List> hpmpupdate = new ArrayList<>(2); int oldlocalmaxhp = localmaxhp; int oldlocalmaxmp = localmaxmp; - + reapplyLocalStats(); - + if (YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { if (localmaxhp != oldlocalmaxhp) { - Pair hpUpdate; + Pair hpUpdate; if (transienthp == Float.NEGATIVE_INFINITY) { hpUpdate = calcHpRatioUpdate(localmaxhp, oldlocalmaxhp); @@ -7880,7 +7889,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (localmaxmp != oldlocalmaxmp) { - Pair mpUpdate; + Pair mpUpdate; if (transientmp == Float.NEGATIVE_INFINITY) { mpUpdate = calcMpRatioUpdate(localmaxmp, oldlocalmaxmp); @@ -7899,14 +7908,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + private void updateLocalStats() { prtLock.lock(); effLock.lock(); statWlock.lock(); try { int oldmaxhp = localmaxhp; - List> hpmpupdate = recalcLocalStats(); + List> hpmpupdate = recalcLocalStats(); enforceMaxHpMp(); if (!hpmpupdate.isEmpty()) { @@ -7927,7 +7936,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { prtLock.lock(); try { if (party != null) { - for (MapleCharacter partychar : this.getPartyMembersOnSameMap()) { + for (Character partychar : this.getPartyMembersOnSameMap()) { sendPacket(PacketCreator.updatePartyMemberHP(partychar.getId(), partychar.getHp(), partychar.getCurrentMaxHp())); } } @@ -7940,8 +7949,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.lock(); chrLock.lock(); try { - ArrayList list = new ArrayList<>(coolDowns.values()); - for (MapleCoolDownValueHolder mcvh : list) { + ArrayList list = new ArrayList<>(coolDowns.values()); + for (CooldownValueHolder mcvh : list) { if (mcvh.skillId != id) { coolDowns.remove(mcvh.skillId); if (packet) { @@ -7964,16 +7973,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.lock(); chrLock.lock(); try { - if (this.coolDowns.containsKey(skillId)) { - this.coolDowns.remove(skillId); - } + this.coolDowns.remove(skillId); } finally { chrLock.unlock(); effLock.unlock(); } } - public void removePet(MaplePet pet, boolean shift_left) { + public void removePet(Pet pet, boolean shift_left) { petLock.lock(); try { int slot = -1; @@ -8002,15 +8009,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public void removeVisibleMapObject(MapleMapObject mo) { + public void removeVisibleMapObject(MapObject mo) { visibleMapObjects.remove(mo); } public synchronized void resetStats() { - if(!YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) { + if (!YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) { return; } - + effLock.lock(); statWlock.lock(); try { @@ -8058,12 +8065,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { effLock.unlock(); } } - + public void resetBattleshipHp() { int bshipLevel = Math.max(getLevel() - 120, 0); // thanks alex12 for noticing battleship HP issues for low-level players this.battleshipHp = 400 * getSkillLevel(SkillFactory.getSkill(Corsair.BATTLE_SHIP)) + (bshipLevel * 200); } - + public void resetEnteredScript() { entered.remove(map.getId()); } @@ -8082,7 +8089,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public synchronized void saveCooldowns() { List listcd = getAllCooldowns(); - + if (!listcd.isEmpty()) { try (Connection con = DatabaseConnection.getConnection()) { deleteWhereCharacterId(con, "DELETE FROM cooldowns WHERE charid = ?"); @@ -8100,24 +8107,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { se.printStackTrace(); } } - - Map> listds = getAllDiseases(); + + Map> listds = getAllDiseases(); if (!listds.isEmpty()) { try (Connection con = DatabaseConnection.getConnection()) { deleteWhereCharacterId(con, "DELETE FROM playerdiseases WHERE charid = ?"); try (PreparedStatement ps = con.prepareStatement("INSERT INTO playerdiseases (charid, disease, mobskillid, mobskilllv, length) VALUES (?, ?, ?, ?, ?)")) { ps.setInt(1, getId()); - - for (Entry> e : listds.entrySet()) { + + for (Entry> e : listds.entrySet()) { ps.setInt(2, e.getKey().ordinal()); - + MobSkill ms = e.getValue().getRight(); ps.setInt(3, ms.getSkillId()); ps.setInt(4, ms.getSkillLevel()); ps.setInt(5, e.getValue().getLeft().intValue()); ps.addBatch(); } - + ps.executeBatch(); } } catch (SQLException se) { @@ -8140,21 +8147,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void saveLocationOnWarp() { // suggestion to remember the map before warp command thanks to Lei - MaplePortal closest = map.findClosestPortal(getPosition()); + Portal closest = map.findClosestPortal(getPosition()); int curMapid = getMapId(); - + for (int i = 0; i < savedLocations.length; i++) { if (savedLocations[i] == null) { savedLocations[i] = new SavedLocation(curMapid, closest != null ? closest.getId() : 0); } } } - + public void saveLocation(String type) { - MaplePortal closest = map.findClosestPortal(getPosition()); + Portal closest = map.findClosestPortal(getPosition()); savedLocations[SavedLocationType.fromString(type).ordinal()] = new SavedLocation(getMapId(), closest != null ? closest.getId() : 0); } - + public final boolean insertNewChar(CharacterFactoryRecipe recipe) { str = recipe.getStr(); dex = recipe.getDex(); @@ -8176,8 +8183,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.changeSkillLevel(skill, skEntry.getRight().byteValue(), skill.getMaxLevel(), -1); } - List> itemsWithType = recipe.getStartingItems(); - for (Pair itEntry : itemsWithType) { + List> itemsWithType = recipe.getStartingItems(); + for (Pair itEntry : itemsWithType) { this.getInventory(itEntry.getRight()).addItem(itEntry.getLeft()); } @@ -8304,7 +8311,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { con.commit(); return true; - } catch (Exception e) { + } catch (Exception e) { con.rollback(); throw e; } finally { @@ -8319,21 +8326,21 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void saveCharToDB() { - if(YamlConfig.config.server.USE_AUTOSAVE) { + if (YamlConfig.config.server.USE_AUTOSAVE) { Runnable r = new Runnable() { @Override public void run() { saveCharToDB(true); } }; - + CharacterSaveService service = (CharacterSaveService) getWorldServer().getServiceAccess(WorldServices.SAVE_CHARACTER); service.registerSaveCharacter(this.getId(), r); } else { saveCharToDB(true); } } - + //ItemFactory saveItems and monsterbook.saveCards are the most time consuming here. public synchronized void saveCharToDB(boolean notAutosave) { if (!loggedIn) { @@ -8343,9 +8350,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject { Calendar c = Calendar.getInstance(); if (notAutosave) { - FilePrinter.print(FilePrinter.SAVING_CHARACTER, "Attempting to save " + name + " at " + c.getTime().toString()); + FilePrinter.print(FilePrinter.SAVING_CHARACTER, "Attempting to save " + name + " at " + c.getTime()); } else { - FilePrinter.print(FilePrinter.AUTOSAVING_CHARACTER, "Attempting to autosave " + name + " at " + c.getTime().toString()); + FilePrinter.print(FilePrinter.AUTOSAVING_CHARACTER, "Attempting to autosave " + name + " at " + c.getTime()); } Server.getInstance().updateCharacterEntry(this); @@ -8407,7 +8414,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (map == null || map.getId() == 610020000 || map.getId() == 610020001) { // reset to first spawnpoint on those maps ps.setInt(24, 0); } else { - MaplePortal closest = map.findClosestPlayerSpawnpoint(getPosition()); + Portal closest = map.findClosestPlayerSpawnpoint(getPosition()); if (closest != null) { ps.setInt(24, closest.getId()); } else { @@ -8477,7 +8484,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - List petList = new LinkedList<>(); + List petList = new LinkedList<>(); petLock.lock(); try { for (int i = 0; i < 3; i++) { @@ -8489,7 +8496,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { petLock.unlock(); } - for (MaplePet pet : petList) { + for (Pet pet : petList) { pet.saveToDb(); } @@ -8514,8 +8521,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (PreparedStatement psKey = con.prepareStatement("INSERT INTO keymap (characterid, `key`, `type`, `action`) VALUES (?, ?, ?, ?)")) { psKey.setInt(1, id); - Set> keybindingItems = Collections.unmodifiableSet(keymap.entrySet()); - for (Entry keybinding : keybindingItems) { + Set> keybindingItems = Collections.unmodifiableSet(keymap.entrySet()); + for (Entry keybinding : keybindingItems) { psKey.setInt(2, keybinding.getKey()); psKey.setInt(3, keybinding.getValue().getType()); psKey.setInt(4, keybinding.getValue().getAction()); @@ -8556,7 +8563,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { psMacro.executeBatch(); } - List> itemsWithType = new ArrayList<>(); + List> itemsWithType = new ArrayList<>(); for (Inventory iv : inventory) { for (Item item : iv.list()) { itemsWithType.add(new Pair<>(item, iv.getType())); @@ -8653,7 +8660,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { try (PreparedStatement psEvent = con.prepareStatement("INSERT INTO eventstats (characterid, name, info) VALUES (?, ?, ?)")) { psEvent.setInt(1, id); - for (Map.Entry entry : events.entrySet()) { + for (Map.Entry entry : events.entrySet()) { psEvent.setString(2, entry.getKey()); psEvent.setInt(3, entry.getValue().getInfo()); psEvent.addBatch(); @@ -8670,7 +8677,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { PreparedStatement psMedal = con.prepareStatement("INSERT INTO medalmaps VALUES (DEFAULT, ?, ?, ?)")) { psStatus.setInt(1, id); - for (MapleQuestStatus qs : getQuests()) { + for (QuestStatus qs : getQuests()) { psStatus.setInt(2, qs.getQuest().getId()); psStatus.setInt(3, qs.getStatus().getId()); psStatus.setInt(4, (int) (qs.getCompletionTime() / 1000)); @@ -8701,12 +8708,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - MapleFamilyEntry familyEntry = getFamilyEntry(); //save family rep + FamilyEntry familyEntry = getFamilyEntry(); //save family rep if (familyEntry != null) { if (familyEntry.saveReputation(con)) { familyEntry.savedSuccessfully(); } - MapleFamilyEntry senior = familyEntry.getSenior(); + FamilyEntry senior = familyEntry.getSenior(); if (senior != null && senior.getChr() == null) { //only save for offline family members if (senior.saveReputation(con)) { senior.savedSuccessfully(); @@ -8777,13 +8784,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void sendKeymap() { sendPacket(PacketCreator.getKeymap(keymap)); } - + public void sendQuickmap() { // send quickslots to user - MapleQuickslotBinding pQuickslotKeyMapped = this.m_pQuickslotKeyMapped; + QuickslotBinding pQuickslotKeyMapped = this.m_pQuickslotKeyMapped; if (pQuickslotKeyMapped == null) { - pQuickslotKeyMapped = new MapleQuickslotBinding(MapleQuickslotBinding.DEFAULT_QUICKSLOTS); + pQuickslotKeyMapped = new QuickslotBinding(QuickslotBinding.DEFAULT_QUICKSLOTS); } this.sendPacket(PacketCreator.QuickslotMappedInit(pQuickslotKeyMapped)); @@ -8793,7 +8800,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { // Always send the macro packet to fix a client side bug when switching characters. sendPacket(PacketCreator.getMacros(skillMacros)); } - + public SkillMacro[] getMacros() { return skillMacros; } @@ -8801,7 +8808,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void sendNote(String to, String msg, byte fame) throws SQLException { sendNote(to, this.getName(), msg, fame); } - + public static void sendNote(String to, String from, String msg, byte fame) throws SQLException { try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`, `fame`) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { @@ -8831,11 +8838,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { sendPacket(PacketCreator.updateBuddyCapacity(capacity)); } - public void setBuffedValue(MapleBuffStat effect, int value) { + public void setBuffedValue(BuffStat effect, int value) { effLock.lock(); chrLock.lock(); try { - MapleBuffStatValueHolder mbsvh = effects.get(effect); + BuffStatValueHolder mbsvh = effects.get(effect); if (mbsvh == null) { return; } @@ -8849,7 +8856,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setChalkboard(String text) { this.chalktext = text; } - + public void setDojoEnergy(int x) { this.dojoEnergy = Math.min(x, 10000); } @@ -8914,7 +8921,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setGuildRank(int _rank) { guildRank = _rank; } - + public void setAllianceRank(int _rank) { allianceRank = _rank; } @@ -8962,14 +8969,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } merchantmeso = set; } - + public synchronized void withdrawMerchantMesos() { int merchantMeso = this.getMerchantNetMeso(); int playerMeso = this.getMeso(); - + if (merchantMeso > 0) { int possible = Integer.MAX_VALUE - playerMeso; - + if (possible > 0) { if (possible < merchantMeso) { this.gainMeso(possible, false); @@ -8981,7 +8988,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } else { int nextMeso = playerMeso + merchantMeso; - + if (nextMeso < 0) { this.gainMeso(-playerMeso, false); this.setMerchantMeso(merchantMeso + playerMeso); @@ -8992,22 +8999,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public void setHiredMerchant(MapleHiredMerchant merchant) { + public void setHiredMerchant(HiredMerchant merchant) { this.hiredMerchant = merchant; } - + private void hpChangeAction(int oldHp) { boolean playerDied = false; if (hp <= 0) { if (oldHp > hp) { - if(!isBuybackInvincible()) { + if (!isBuybackInvincible()) { playerDied = true; } else { hp = 1; } } } - + final boolean chrDied = playerDied; Runnable r = new Runnable() { @Override @@ -9023,65 +9030,65 @@ public class MapleCharacter extends AbstractMapleCharacterObject { }; if (map != null) { map.registerCharacterStatUpdate(r); - } + } } - - private Pair calcHpRatioUpdate(int newHp, int oldHp) { + + private Pair calcHpRatioUpdate(int newHp, int oldHp) { int delta = newHp - oldHp; this.hp = calcHpRatioUpdate(hp, oldHp, delta); - + hpChangeAction(Short.MIN_VALUE); - return new Pair<>(MapleStat.HP, hp); + return new Pair<>(Stat.HP, hp); } - - private Pair calcMpRatioUpdate(int newMp, int oldMp) { + + private Pair calcMpRatioUpdate(int newMp, int oldMp) { int delta = newMp - oldMp; this.mp = calcMpRatioUpdate(mp, oldMp, delta); - return new Pair<>(MapleStat.MP, mp); + return new Pair<>(Stat.MP, mp); } - + private static int calcTransientRatio(float transientpoint) { int ret = (int) transientpoint; return !(ret <= 0 && transientpoint > 0.0f) ? ret : 1; } - - private Pair calcHpRatioTransient() { + + private Pair calcHpRatioTransient() { this.hp = calcTransientRatio(transienthp * localmaxhp); - + hpChangeAction(Short.MIN_VALUE); - return new Pair<>(MapleStat.HP, hp); + return new Pair<>(Stat.HP, hp); } - - private Pair calcMpRatioTransient() { + + private Pair calcMpRatioTransient() { this.mp = calcTransientRatio(transientmp * localmaxmp); - return new Pair<>(MapleStat.MP, mp); + return new Pair<>(Stat.MP, mp); } - + private int calcHpRatioUpdate(int curpoint, int maxpoint, int diffpoint) { int curMax = maxpoint; int nextMax = Math.min(30000, maxpoint + diffpoint); - + float temp = curpoint * nextMax; int ret = (int) Math.ceil(temp / curMax); - + transienthp = (maxpoint > nextMax) ? ((float) curpoint) / maxpoint : ((float) ret) / nextMax; return ret; } - + private int calcMpRatioUpdate(int curpoint, int maxpoint, int diffpoint) { int curMax = maxpoint; int nextMax = Math.min(30000, maxpoint + diffpoint); - + float temp = curpoint * nextMax; int ret = (int) Math.ceil(temp / curMax); - + transientmp = (maxpoint > nextMax) ? ((float) curpoint) / maxpoint : ((float) ret) / nextMax; return ret; } - + public boolean applyHpMpChange(int hpCon, int hpchange, int mpchange) { - boolean zombify = hasDisease(MapleDisease.ZOMBIFY); - + boolean zombify = hasDisease(Disease.ZOMBIFY); + effLock.lock(); statWlock.lock(); try { @@ -9104,15 +9111,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { statWlock.unlock(); effLock.unlock(); } - + // autopot on HPMP deplete... thanks shavit for finding out D. Roar doesn't trigger autopot request if (hpchange < 0) { - MapleKeyBinding autohpPot = this.getKeymap().get(91); + KeyBinding autohpPot = this.getKeymap().get(91); if (autohpPot != null) { int autohpItemid = autohpPot.getAction(); float autohpAlert = this.getAutopotHpAlert(); if (((float) this.getHp()) / this.getCurrentMaxHp() <= autohpAlert) { // try within user settings... thanks Lame, Optimist, Stealth2800 - Item autohpItem = this.getInventory(MapleInventoryType.USE).findById(autohpItemid); + Item autohpItem = this.getInventory(InventoryType.USE).findById(autohpItemid); if (autohpItem != null) { this.setAutopotHpAlert(0.9f * autohpAlert); PetAutopotProcessor.runAutopotAction(client, autohpItem.getPosition(), autohpItemid); @@ -9120,14 +9127,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + if (mpchange < 0) { - MapleKeyBinding autompPot = this.getKeymap().get(92); + KeyBinding autompPot = this.getKeymap().get(92); if (autompPot != null) { int autompItemid = autompPot.getAction(); float autompAlert = this.getAutopotMpAlert(); if (((float) this.getMp()) / this.getCurrentMaxMp() <= autompAlert) { - Item autompItem = this.getInventory(MapleInventoryType.USE).findById(autompItemid); + Item autompItem = this.getInventory(InventoryType.USE).findById(autompItemid); if (autompItem != null) { this.setAutopotMpAlert(0.9f * autompAlert); // autoMP would stick to using pots at every depletion in some cases... thanks Rohenn PetAutopotProcessor.runAutopotAction(client, autompItem.getPosition(), autompItemid); @@ -9135,11 +9142,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + return true; } - - public void setInventory(MapleInventoryType type, Inventory inv) { + + public void setInventory(InventoryType type, Inventory inv) { inventory[type.ordinal()] = inv; } @@ -9147,7 +9154,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.itemEffect = itemEffect; } - public void setJob(MapleJob job) { + public void setJob(Job job) { this.job = job; } @@ -9162,12 +9169,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setLevel(int level) { this.level = level; } - + public void setMap(int PmapId) { this.mapid = PmapId; } - - public void setMessenger(MapleMessenger messenger) { + + public void setMessenger(Messenger messenger) { this.messenger = messenger; } @@ -9175,11 +9182,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.messengerposition = position; } - public void setMiniGame(MapleMiniGame miniGame) { + public void setMiniGame(MiniGame miniGame) { this.miniGame = miniGame; } - public void setMiniGamePoints(MapleCharacter visitor, int winnerslot, boolean omok) { + public void setMiniGamePoints(Character visitor, int winnerslot, boolean omok) { if (omok) { if (winnerslot == 1) { this.omokwins++; @@ -9212,13 +9219,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setName(String name) { this.name = name; } - - public void setRPS(MapleRockPaperScissor rps) { + + public void setRPS(RockPaperScissor rps) { this.rps = rps; } - + public void closeRPS() { - MapleRockPaperScissor rps = this.rps; + RockPaperScissor rps = this.rps; if (rps != null) { rps.dispose(client); setRPS(null); @@ -9238,14 +9245,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { e.printStackTrace(); } } - + public int getDoorSlot() { - if(doorSlot != -1) { + if (doorSlot != -1) { return doorSlot; } return fetchDoorSlot(); } - + public int fetchDoorSlot() { prtLock.lock(); try { @@ -9255,8 +9262,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { prtLock.unlock(); } } - - public void setParty(MapleParty p) { + + public void setParty(Party p) { prtLock.lock(); try { if (p == null) { @@ -9272,27 +9279,27 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } - public void setPlayerShop(MaplePlayerShop playerShop) { + public void setPlayerShop(PlayerShop playerShop) { this.playerShop = playerShop; } - + public void setSearch(String find) { search = find; } - public void setSkinColor(MapleSkinColor skinColor) { + public void setSkinColor(SkinColor skinColor) { this.skinColor = skinColor; } public byte getSlots(int type) { - return type == MapleInventoryType.CASH.getType() ? 96 : inventory[type].getSlotLimit(); + return type == InventoryType.CASH.getType() ? 96 : inventory[type].getSlotLimit(); } - + public boolean canGainSlots(int type, int slots) { slots += inventory[type].getSlotLimit(); return slots <= 96; } - + public boolean gainSlots(int type, int slots) { return gainSlots(type, slots, true); } @@ -9309,7 +9316,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + private int gainSlotsInternal(int type, int slots) { inventory[type].lockInventory(); try { @@ -9324,32 +9331,32 @@ public class MapleCharacter extends AbstractMapleCharacterObject { inventory[type].unlockInventory(); } } - + public int sellAllItemsFromName(byte invTypeId, String name) { //player decides from which inventory items should be sold. - MapleInventoryType type = MapleInventoryType.getByType(invTypeId); - + InventoryType type = InventoryType.getByType(invTypeId); + Inventory inv = getInventory(type); inv.lockInventory(); try { Item it = inv.findByName(name); - if(it == null) { - return(-1); + if (it == null) { + return (-1); } - return(sellAllItemsFromPosition(ii, type, it.getPosition())); + return (sellAllItemsFromPosition(ii, type, it.getPosition())); } finally { inv.unlockInventory(); } } - - public int sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) { + + public int sellAllItemsFromPosition(ItemInformationProvider ii, InventoryType type, short pos) { int mesoGain = 0; - + Inventory inv = getInventory(type); inv.lockInventory(); try { - for(short i = pos; i <= inv.getSlotLimit(); i++) { + for (short i = pos; i <= inv.getSlotLimit(); i++) { if (inv.getItem(i) == null) { continue; } @@ -9358,32 +9365,32 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } finally { inv.unlockInventory(); } - - return(mesoGain); + + return (mesoGain); } - private int standaloneSell(MapleClient c, MapleItemInformationProvider ii, MapleInventoryType type, short slot, short quantity) { + private int standaloneSell(Client c, ItemInformationProvider ii, InventoryType type, short slot, short quantity) { if (quantity == 0xFFFF || quantity == 0) { quantity = 1; } - + Inventory inv = getInventory(type); inv.lockInventory(); try { - Item item = inv.getItem((short) slot); - if (item == null){ //Basic check - return(0); + Item item = inv.getItem(slot); + if (item == null) { //Basic check + return (0); } int itemid = item.getItemId(); if (ItemConstants.isRechargeable(itemid)) { quantity = item.getQuantity(); } else if (ItemConstants.isWeddingToken(itemid) || ItemConstants.isWeddingRing(itemid)) { - return(0); + return (0); } if (quantity < 0) { - return(0); + return (0); } short iQuant = item.getQuantity(); if (iQuant == 0xFFFF) { @@ -9391,63 +9398,63 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (quantity <= iQuant && iQuant > 0) { - MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); + InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); int recvMesos = ii.getPrice(itemid, quantity); if (recvMesos > 0) { gainMeso(recvMesos, false); - return(recvMesos); + return (recvMesos); } } - return(0); + return (0); } finally { inv.unlockInventory(); } } - + private static boolean hasMergeFlag(Item item) { return (item.getFlag() & ItemConstants.MERGE_UNTRADEABLE) == ItemConstants.MERGE_UNTRADEABLE; } - + private static void setMergeFlag(Item item) { short flag = item.getFlag(); flag |= ItemConstants.MERGE_UNTRADEABLE; flag |= ItemConstants.UNTRADEABLE; item.setFlag(flag); } - + private List getUpgradeableEquipped() { List list = new LinkedList<>(); - - for (Item item : getInventory(MapleInventoryType.EQUIPPED)) { + + for (Item item : getInventory(InventoryType.EQUIPPED)) { if (ii.isUpgradeable(item.getItemId())) { list.add((Equip) item); } } - + return list; } - + private static List getEquipsWithStat(List>> equipped, StatUpgrade stat) { List equippedWithStat = new LinkedList<>(); - + for (Pair> eq : equipped) { if (eq.getRight().containsKey(stat)) { equippedWithStat.add(eq.getLeft()); } } - + return equippedWithStat; } - + public boolean mergeAllItemsFromName(String name) { - MapleInventoryType type = MapleInventoryType.EQUIP; - + InventoryType type = InventoryType.EQUIP; + Inventory inv = getInventory(type); inv.lockInventory(); try { Item it = inv.findByName(name); - if(it == null) { + if (it == null) { return false; } @@ -9472,7 +9479,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { Set extraEquipped = new LinkedHashSet<>(equipUpgrades.keySet()); List statEquipped = getEquipsWithStat(upgradeableEquipped, e.getKey()); - float extraRate = (float)(0.2 * Math.random()); + float extraRate = (float) (0.2 * Math.random()); if (!statEquipped.isEmpty()) { float statRate = 1.0f - extraRate; @@ -9501,7 +9508,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { Equip eqp = eqpUpg.getKey(); setMergeFlag(eqp); - String showStr = " '" + MapleItemInformationProvider.getInstance().getName(eqp.getItemId()) + "': "; + String showStr = " '" + ItemInformationProvider.getInstance().getName(eqp.getItemId()) + "': "; String upgdStr = eqp.gainStats(eqpStatups).getLeft(); this.forceUpdateItem(eqp); @@ -9510,35 +9517,35 @@ public class MapleCharacter extends AbstractMapleCharacterObject { dropMessage(6, showStr); } } - + return true; } finally { inv.unlockInventory(); } } - + public void mergeAllItemsFromPosition(Map statups, short pos) { - Inventory inv = getInventory(MapleInventoryType.EQUIP); + Inventory inv = getInventory(InventoryType.EQUIP); inv.lockInventory(); try { - for(short i = pos; i <= inv.getSlotLimit(); i++) { - standaloneMerge(statups, getClient(), MapleInventoryType.EQUIP, i, inv.getItem(i)); + for (short i = pos; i <= inv.getSlotLimit(); i++) { + standaloneMerge(statups, getClient(), InventoryType.EQUIP, i, inv.getItem(i)); } } finally { inv.unlockInventory(); } } - private void standaloneMerge(Map statups, MapleClient c, MapleInventoryType type, short slot, Item item) { + private void standaloneMerge(Map statups, Client c, InventoryType type, short slot, Item item) { short quantity; - if (item == null || (quantity = item.getQuantity()) < 1 || ii.isCash(item.getItemId()) || !ii.isUpgradeable(item.getItemId()) || hasMergeFlag(item)){ + if (item == null || (quantity = item.getQuantity()) < 1 || ii.isCash(item.getItemId()) || !ii.isUpgradeable(item.getItemId()) || hasMergeFlag(item)) { return; } - + Equip e = (Equip) item; for (Entry s : e.getStats().entrySet()) { Float newVal = statups.get(s.getKey()); - + float incVal = s.getValue().floatValue(); switch (s.getKey()) { case incPAD: @@ -9548,28 +9555,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject { incVal = (float) Math.log(incVal); break; } - + if (newVal != null) { newVal += incVal; } else { newVal = incVal; } - + statups.put(s.getKey(), newVal); } - - MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); + + InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); } - - public void setShop(MapleShop shop) { + + public void setShop(Shop shop) { this.shop = shop; } public void setSlot(int slotid) { slots = slotid; } - - public void setTrade(MapleTrade trade) { + + public void setTrade(Trade trade) { this.trade = trade; } @@ -9601,47 +9608,47 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private long getDojoTimeLeft() { return client.getChannelServer().getDojoFinishTime(map.getId()) - Server.getInstance().getCurrentTime(); } - + public void showDojoClock() { if (GameConstants.isDojoBossArea(map.getId())) { sendPacket(PacketCreator.getClock((int) (getDojoTimeLeft() / 1000))); } } - - public void showUnderleveledInfo(MapleMonster mob) { + + public void showUnderleveledInfo(Monster mob) { long curTime = Server.getInstance().getCurrentTime(); - if(nextWarningTime < curTime) { + if (nextWarningTime < curTime) { nextWarningTime = curTime + (60 * 1000); // show underlevel info again after 1 minute - + showHint("You have gained #rno experience#k from defeating #e#b" + mob.getName() + "#k#n (lv. #b" + mob.getLevel() + "#k)! Take note you must have around the same level as the mob to start earning EXP from it."); } } - - public void showMapOwnershipInfo(MapleCharacter mapOwner) { + + public void showMapOwnershipInfo(Character mapOwner) { long curTime = Server.getInstance().getCurrentTime(); - if(nextWarningTime < curTime) { + if (nextWarningTime < curTime) { nextWarningTime = curTime + (60 * 1000); // show underlevel info again after 1 minute - + String medal = ""; - Item medalItem = mapOwner.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49); + Item medalItem = mapOwner.getInventory(InventoryType.EQUIPPED).getItem((short) -49); if (medalItem != null) { medal = "<" + ii.getName(medalItem.getItemId()) + "> "; } - + List strLines = new LinkedList<>(); strLines.add(""); strLines.add(""); strLines.add(""); strLines.add(this.getClient().getChannelServer().getServerMessage().isEmpty() ? 0 : 1, "Get off my lawn!!"); - + this.sendPacket(PacketCreator.getAvatarMega(mapOwner, medal, this.getClient().getChannel(), 5390006, strLines, true)); } } - + public void showHint(String msg) { showHint(msg, 500); } - + public void showHint(String msg, int length) { client.announceHint(msg, length); } @@ -9671,8 +9678,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void silentPartyUpdate() { silentPartyUpdateInternal(getParty()); } - - private void silentPartyUpdateInternal(MapleParty chrParty) { + + private void silentPartyUpdateInternal(Party chrParty) { if (chrParty != null) { getWorldServer().updateParty(chrParty.getId(), PartyOperation.SILENT_UPDATE, getMPC()); } @@ -9708,11 +9715,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void runFullnessSchedule(int petSlot) { - MaplePet pet = getPet(petSlot); + Pet pet = getPet(petSlot); if (pet == null) { return; } - + int newFullness = pet.getFullness() - PetDataFactory.getHunger(pet.getItemId()); if (newFullness <= 5) { pet.setFullness(15); @@ -9722,17 +9729,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } else { pet.setFullness(newFullness); pet.saveToDb(); - Item petz = getInventory(MapleInventoryType.CASH).getItem(pet.getPosition()); + Item petz = getInventory(InventoryType.CASH).getItem(pet.getPosition()); if (petz != null) { forceUpdateItem(petz); } } } - + public boolean runTirednessSchedule() { - if(maplemount != null) { + if (maplemount != null) { int tiredness = maplemount.incrementAndGetTiredness(); - + this.getMap().broadcastMessage(PacketCreator.updateMount(this.getId(), maplemount, false)); if (tiredness > 99) { maplemount.setTiredness(99); @@ -9741,7 +9748,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + return true; } @@ -9750,7 +9757,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void startMapEffect(String msg, int itemId, int duration) { - final MapleMapEffect mapEffect = new MapleMapEffect(msg, itemId); + final MapEffect mapEffect = new MapEffect(msg, itemId); sendPacket(mapEffect.makeStartData()); TimerManager.getInstance().schedule(new Runnable() { @Override @@ -9759,35 +9766,35 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } }, duration); } - + public void unequipAllPets() { for (int i = 0; i < 3; i++) { - MaplePet pet = getPet(i); + Pet pet = getPet(i); if (pet != null) { unequipPet(pet, true); } } } - public void unequipPet(MaplePet pet, boolean shift_left) { + public void unequipPet(Pet pet, boolean shift_left) { unequipPet(pet, shift_left, false); } - public void unequipPet(MaplePet pet, boolean shift_left, boolean hunger) { + public void unequipPet(Pet pet, boolean shift_left, boolean hunger) { byte petIdx = this.getPetIndex(pet); - MaplePet chrPet = this.getPet(petIdx); - + Pet chrPet = this.getPet(petIdx); + if (chrPet != null) { chrPet.setSummoned(false); chrPet.saveToDb(); } - + this.getClient().getWorldServer().unregisterPetHunger(this, petIdx); getMap().broadcastMessage(this, PacketCreator.showPet(this, pet, true, hunger), true); - + removePet(pet, shift_left); commitExcludedItems(); - + sendPacket(PacketCreator.petStatUpdate(this)); sendPacket(PacketCreator.enableActions()); } @@ -9804,24 +9811,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject { prtLock.unlock(); } } - + private void updatePartyMemberHPInternal() { if (party != null) { int curmaxhp = getCurrentMaxHp(); int curhp = getHp(); - for (MapleCharacter partychar : this.getPartyMembersOnSameMap()) { + for (Character partychar : this.getPartyMembersOnSameMap()) { partychar.sendPacket(PacketCreator.updatePartyMemberHP(getId(), curhp, curmaxhp)); } } } - + public void setQuestProgress(int id, int infoNumber, String progress) { - MapleQuest q = MapleQuest.getInstance(id); - MapleQuestStatus qs = getQuest(q); - + Quest q = Quest.getInstance(id); + QuestStatus qs = getQuest(q); + if (qs.getInfoNumber() == infoNumber && infoNumber > 0) { - MapleQuest iq = MapleQuest.getInstance(infoNumber); - MapleQuestStatus iqs = getQuest(iq); + Quest iq = Quest.getInstance(infoNumber); + QuestStatus iqs = getQuest(iq); iqs.setProgress(0, progress); } else { qs.setProgress(infoNumber, progress); // quest progress is thoroughly a string match, infoNumber is actually another questid @@ -9832,55 +9839,55 @@ public class MapleCharacter extends AbstractMapleCharacterObject { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, true); } } - + public void awardQuestPoint(int awardedPoints) { if (YamlConfig.config.server.QUEST_POINT_REQUIREMENT < 1 || awardedPoints < 1) { return; } - + int delta; synchronized (quests) { quest_fame += awardedPoints; - + delta = quest_fame / YamlConfig.config.server.QUEST_POINT_REQUIREMENT; quest_fame %= YamlConfig.config.server.QUEST_POINT_REQUIREMENT; } - - if(delta > 0) { + + if (delta > 0) { gainFame(delta); } } - + public enum DelayedQuestUpdate { // quest updates allow player actions during NPC talk... UPDATE, FORFEIT, COMPLETE, INFO } - - private void announceUpdateQuestInternal(MapleCharacter chr, Pair questUpdate) { + + private void announceUpdateQuestInternal(Character chr, Pair questUpdate) { Object[] objs = questUpdate.getRight(); - + switch (questUpdate.getLeft()) { case UPDATE: - sendPacket(PacketCreator.updateQuest(chr, (MapleQuestStatus) objs[0], (Boolean) objs[1])); + sendPacket(PacketCreator.updateQuest(chr, (QuestStatus) objs[0], (Boolean) objs[1])); break; - + case FORFEIT: sendPacket(PacketCreator.forfeitQuest((Short) objs[0])); break; - + case COMPLETE: sendPacket(PacketCreator.completeQuest((Short) objs[0], (Long) objs[1])); break; - + case INFO: - MapleQuestStatus qs = (MapleQuestStatus) objs[0]; + QuestStatus qs = (QuestStatus) objs[0]; sendPacket(PacketCreator.updateQuestInfo(qs.getQuest().getId(), qs.getNpc())); break; } } - + public void announceUpdateQuest(DelayedQuestUpdate questUpdateType, Object... params) { Pair p = new Pair<>(questUpdateType, params); - MapleClient c = this.getClient(); + Client c = this.getClient(); if (c.getQM() != null || c.getCM() != null) { synchronized (npcUpdateQuests) { npcUpdateQuests.add(p); @@ -9889,41 +9896,41 @@ public class MapleCharacter extends AbstractMapleCharacterObject { announceUpdateQuestInternal(this, p); } } - + public void flushDelayedUpdateQuests() { List> qmQuestUpdateList; - + synchronized (npcUpdateQuests) { qmQuestUpdateList = new ArrayList<>(npcUpdateQuests); npcUpdateQuests.clear(); } - + for (Pair q : qmQuestUpdateList) { announceUpdateQuestInternal(this, q); } } - - public void updateQuestStatus(MapleQuestStatus qs) { + + public void updateQuestStatus(QuestStatus qs) { synchronized (quests) { quests.put(qs.getQuestID(), qs); } - if (qs.getStatus().equals(MapleQuestStatus.Status.STARTED)) { + if (qs.getStatus().equals(QuestStatus.Status.STARTED)) { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, false); if (qs.getInfoNumber() > 0) { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, true); } announceUpdateQuest(DelayedQuestUpdate.INFO, qs); - } else if (qs.getStatus().equals(MapleQuestStatus.Status.COMPLETED)) { - MapleQuest mquest = qs.getQuest(); + } else if (qs.getStatus().equals(QuestStatus.Status.COMPLETED)) { + Quest mquest = qs.getQuest(); short questid = mquest.getId(); - if (!mquest.isSameDayRepeatable() && !MapleQuest.isExploitableQuest(questid)) { + if (!mquest.isSameDayRepeatable() && !Quest.isExploitableQuest(questid)) { awardQuestPoint(YamlConfig.config.server.QUEST_POINT_PER_QUEST_COMPLETE); } qs.setCompleted(qs.getCompleted() + 1); // Jayd's idea - count quest completed announceUpdateQuest(DelayedQuestUpdate.COMPLETE, questid, qs.getCompletionTime()); //announceUpdateQuest(DelayedQuestUpdate.INFO, qs); // happens after giving rewards, for non-next quests only - } else if (qs.getStatus().equals(MapleQuestStatus.Status.NOT_STARTED)) { + } else if (qs.getStatus().equals(QuestStatus.Status.NOT_STARTED)) { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, false); if (qs.getInfoNumber() > 0) { announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, true); @@ -9931,13 +9938,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { // reminder: do not reset quest progress of infoNumbers, some quests cannot backtrack } } - - private void expireQuest(MapleQuest quest) { + + private void expireQuest(Quest quest) { if (quest.forfeit(this)) { sendPacket(PacketCreator.questExpire(quest.getId())); } } - + public void cancelQuestExpirationTask() { evtLock.lock(); try { @@ -9949,25 +9956,25 @@ public class MapleCharacter extends AbstractMapleCharacterObject { evtLock.unlock(); } } - + public void forfeitExpirableQuests() { evtLock.lock(); try { - for(MapleQuest quest : questExpirations.keySet()) { + for (Quest quest : questExpirations.keySet()) { quest.forfeit(this); } - + questExpirations.clear(); } finally { evtLock.unlock(); } } - + public void questExpirationTask() { evtLock.lock(); try { - if(!questExpirations.isEmpty()) { - if(questExpireTask == null) { + if (!questExpirations.isEmpty()) { + if (questExpireTask == null) { questExpireTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { @@ -9980,26 +9987,26 @@ public class MapleCharacter extends AbstractMapleCharacterObject { evtLock.unlock(); } } - + private void runQuestExpireTask() { evtLock.lock(); try { long timeNow = Server.getInstance().getCurrentTime(); - List expireList = new LinkedList<>(); - - for(Entry qe : questExpirations.entrySet()) { - if(qe.getValue() <= timeNow) { + List expireList = new LinkedList<>(); + + for (Entry qe : questExpirations.entrySet()) { + if (qe.getValue() <= timeNow) { expireList.add(qe.getKey()); } } - - if(!expireList.isEmpty()) { - for(MapleQuest quest : expireList) { + + if (!expireList.isEmpty()) { + for (Quest quest : expireList) { expireQuest(quest); questExpirations.remove(quest); } - - if(questExpirations.isEmpty()) { + + if (questExpirations.isEmpty()) { questExpireTask.cancel(false); questExpireTask = null; } @@ -10008,11 +10015,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { evtLock.unlock(); } } - - private void registerQuestExpire(MapleQuest quest, long time) { + + private void registerQuestExpire(Quest quest, long time) { evtLock.lock(); try { - if(questExpireTask == null) { + if (questExpireTask == null) { questExpireTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { @@ -10020,33 +10027,33 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } }, 10 * 1000); } - + questExpirations.put(quest, Server.getInstance().getCurrentTime() + time); } finally { evtLock.unlock(); } } - - public void questTimeLimit(final MapleQuest quest, int seconds) { + + public void questTimeLimit(final Quest quest, int seconds) { registerQuestExpire(quest, seconds * 1000); sendPacket(PacketCreator.addQuestTimeLimit(quest.getId(), seconds * 1000)); } - - public void questTimeLimit2(final MapleQuest quest, long expires) { + + public void questTimeLimit2(final Quest quest, long expires) { long timeLeft = expires - System.currentTimeMillis(); - - if(timeLeft <= 0) { + + if (timeLeft <= 0) { expireQuest(quest); } else { registerQuestExpire(quest, timeLeft); } } - public void updateSingleStat(MapleStat stat, int newval) { + public void updateSingleStat(Stat stat, int newval) { updateSingleStat(stat, newval, false); } - private void updateSingleStat(MapleStat stat, int newval, boolean itemReaction) { + private void updateSingleStat(Stat stat, int newval, boolean itemReaction) { sendPacket(PacketCreator.updatePlayerStats(Collections.singletonList(new Pair<>(stat, Integer.valueOf(newval))), itemReaction, this)); } @@ -10060,27 +10067,27 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } @Override - public MapleMapObjectType getType() { - return MapleMapObjectType.PLAYER; + public MapObjectType getType() { + return MapObjectType.PLAYER; } @Override - public void sendDestroyData(MapleClient client) { + public void sendDestroyData(Client client) { client.sendPacket(PacketCreator.removePlayerFromMap(this.getObjectId())); } @Override - public void sendSpawnData(MapleClient client) { + public void sendSpawnData(Client client) { if (!this.isHidden() || client.getPlayer().gmLevel() > 1) { client.sendPacket(PacketCreator.spawnPlayerMapObject(client, this, false)); - + if (buffEffects.containsKey(getJobMapChair(job))) { // mustn't effLock, chrLock sendSpawnData client.sendPacket(PacketCreator.giveForeignChairSkillEffect(id)); } } if (this.isHidden()) { - List> dsstat = Collections.singletonList(new Pair<>(MapleBuffStat.DARKSIGHT, 0)); + List> dsstat = Collections.singletonList(new Pair<>(BuffStat.DARKSIGHT, 0)); getMap().broadcastGMMessage(this, PacketCreator.giveForeignBuff(getId(), dsstat), false); } } @@ -10104,37 +10111,37 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public CashShop getCashShop() { return cashshop; } - + public Set getNewYearRecords() { return newyears; } - + public Set getReceivedNewYearRecords() { Set received = new LinkedHashSet<>(); - - for(NewYearCardRecord nyc : newyears) { - if(nyc.isReceiverCardReceived()) { + + for (NewYearCardRecord nyc : newyears) { + if (nyc.isReceiverCardReceived()) { received.add(nyc); } } - + return received; } - + public NewYearCardRecord getNewYearRecord(int cardid) { - for(NewYearCardRecord nyc : newyears) { - if(nyc.getId() == cardid) { + for (NewYearCardRecord nyc : newyears) { + if (nyc.getId() == cardid) { return nyc; } } - + return null; } - + public void addNewYearRecord(NewYearCardRecord newyear) { newyears.add(newyear); } - + public void removeNewYearRecord(NewYearCardRecord newyear) { newyears.remove(newyear); } @@ -10186,10 +10193,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void autoban(String reason) { - if (this.isGM() || this.isBanned()){ // thanks RedHat for noticing GM's being able to get banned + if (this.isGM() || this.isBanned()) { // thanks RedHat for noticing GM's being able to get banned return; } - + this.ban(reason); sendPacket(PacketCreator.sendPolice(String.format("You have been blocked by the#b %s Police for HACK reason.#k", "Cosmic"))); TimerManager.getInstance().schedule(new Runnable() { @@ -10198,8 +10205,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { client.disconnect(false, false); } }, 5000); - - Server.getInstance().broadcastGMMessage(this.getWorld(), PacketCreator.serverNotice(6, MapleCharacter.makeMapleReadable(this.name) + " was autobanned for " + reason)); + + Server.getInstance().broadcastGMMessage(this.getWorld(), PacketCreator.serverNotice(6, Character.makeMapleReadable(this.name) + " was autobanned for " + reason)); } public void block(int reason, int days, String desc) { @@ -10256,11 +10263,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean isTrockMap(int id) { int index = trockmaps.indexOf(id); - if (index != -1) { - return true; - } - - return false; + return index != -1; } public int getVipTrockSize() { @@ -10289,20 +10292,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean isVipTrockMap(int id) { int index = viptrockmaps.indexOf(id); - if (index != -1) { - return true; - } - - return false; + return index != -1; } - + public AutobanManager getAutobanManager() { return autoban; } - + public void equippedItem(Equip equip) { int itemid = equip.getItemId(); - + if (itemid == 1122017) { this.equipPendantOfSpirit(); } else if (itemid == 1812000) { // meso magnet @@ -10313,10 +10312,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { equippedPetItemIgnore = true; } } - + public void unequippedItem(Equip equip) { int itemid = equip.getItemId(); - + if (itemid == 1122017) { this.unequipPendantOfSpirit(); } else if (itemid == 1812000) { // meso magnet @@ -10327,19 +10326,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { equippedPetItemIgnore = false; } } - + public boolean isEquippedMesoMagnet() { return equippedMesoMagnet; } - + public boolean isEquippedItemPouch() { return equippedItemPouch; } - + public boolean isEquippedPetItemIgnore() { return equippedPetItemIgnore; } - + private void equipPendantOfSpirit() { if (pendantOfSpirit == null) { pendantOfSpirit = TimerManager.getInstance().register(new Runnable() { @@ -10363,13 +10362,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } pendantExp = 0; } - + private Collection getUpgradeableEquipList() { - Collection fullList = getInventory(MapleInventoryType.EQUIPPED).list(); + Collection fullList = getInventory(InventoryType.EQUIPPED).list(); if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_CASH) { return fullList; } - + Collection eqpList = new LinkedHashSet<>(); for (Item it : fullList) { if (!ii.isCash(it.getItemId())) { @@ -10379,10 +10378,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return eqpList; } - + public void increaseEquipExp(int expGain) { if (allowExpGain) { // thanks Vcoc for suggesting equip EXP gain conditionally - if(expGain < 0) { + if (expGain < 0) { expGain = Integer.MAX_VALUE; } @@ -10397,38 +10396,38 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } } } - + public void showAllEquipFeatures() { String showMsg = ""; - - for (Item item : getInventory(MapleInventoryType.EQUIPPED).list()) { + + for (Item item : getInventory(InventoryType.EQUIPPED).list()) { Equip nEquip = (Equip) item; String itemName = ii.getName(nEquip.getItemId()); if (itemName == null) { continue; } - + showMsg += nEquip.showEquipFeatures(client); } - - if(!showMsg.isEmpty()) { + + if (!showMsg.isEmpty()) { this.showHint("#ePLAYER EQUIPMENTS:#n\r\n\r\n" + showMsg, 400); } } - + public void broadcastMarriageMessage() { - MapleGuild guild = this.getGuild(); - if(guild != null) { + Guild guild = this.getGuild(); + if (guild != null) { guild.broadcast(PacketCreator.marriageMessage(0, name)); } - - MapleFamily family = this.getFamily(); - if(family != null) { + + Family family = this.getFamily(); + if (family != null) { family.broadcast(PacketCreator.marriageMessage(1, name)); } } - public Map getEvents() { + public Map getEvents() { return events; } @@ -10443,26 +10442,38 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setCpqTimer(ScheduledFuture timer) { this.cpqSchedule = timer; } - + public void clearCpqTimer() { - if (cpqSchedule != null) { cpqSchedule.cancel(true); } + if (cpqSchedule != null) { + cpqSchedule.cancel(true); + } cpqSchedule = null; } - + public final void empty(final boolean remove) { - if (dragonBloodSchedule != null) { dragonBloodSchedule.cancel(true); } + if (dragonBloodSchedule != null) { + dragonBloodSchedule.cancel(true); + } dragonBloodSchedule = null; - if (hpDecreaseTask != null) { hpDecreaseTask.cancel(true); } + if (hpDecreaseTask != null) { + hpDecreaseTask.cancel(true); + } hpDecreaseTask = null; - if (beholderHealingSchedule != null) { beholderHealingSchedule.cancel(true); } + if (beholderHealingSchedule != null) { + beholderHealingSchedule.cancel(true); + } beholderHealingSchedule = null; - if (beholderBuffSchedule != null) { beholderBuffSchedule.cancel(true); } + if (beholderBuffSchedule != null) { + beholderBuffSchedule.cancel(true); + } beholderBuffSchedule = null; - if (berserkSchedule != null) { berserkSchedule.cancel(true); } + if (berserkSchedule != null) { + berserkSchedule.cancel(true); + } berserkSchedule = null; unregisterChairBuff(); @@ -10471,37 +10482,45 @@ public class MapleCharacter extends AbstractMapleCharacterObject { cancelSkillCooldownTask(); cancelExpirationTask(); - if (questExpireTask != null) { questExpireTask.cancel(true); } + if (questExpireTask != null) { + questExpireTask.cancel(true); + } questExpireTask = null; - if (recoveryTask != null) { recoveryTask.cancel(true); } + if (recoveryTask != null) { + recoveryTask.cancel(true); + } recoveryTask = null; - if (extraRecoveryTask != null) { extraRecoveryTask.cancel(true); } + if (extraRecoveryTask != null) { + extraRecoveryTask.cancel(true); + } extraRecoveryTask = null; // already done on unregisterChairBuff /* if (chairRecoveryTask != null) { chairRecoveryTask.cancel(true); } chairRecoveryTask = null; */ - if (pendantOfSpirit != null) { pendantOfSpirit.cancel(true); } + if (pendantOfSpirit != null) { + pendantOfSpirit.cancel(true); + } pendantOfSpirit = null; - + clearCpqTimer(); - + evtLock.lock(); try { if (questExpireTask != null) { questExpireTask.cancel(false); questExpireTask = null; - + questExpirations.clear(); questExpirations = null; } } finally { evtLock.unlock(); } - + if (maplemount != null) { maplemount.empty(); maplemount = null; @@ -10512,19 +10531,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { mpc = null; mgc = null; party = null; - MapleFamilyEntry familyEntry = getFamilyEntry(); - if(familyEntry != null) { + FamilyEntry familyEntry = getFamilyEntry(); + if (familyEntry != null) { familyEntry.setCharacter(null); setFamilyEntry(null); } - + getWorldServer().registerTimedMapObject(new Runnable() { @Override public void run() { client = null; // clients still triggers handlers a few times after disconnecting map = null; setListener(null); - + // thanks Shavit for noticing a memory leak with inventories holding owner object for (int i = 0; i < inventory.length; i++) { inventory[i].dispose(); @@ -10547,15 +10566,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { e.printStackTrace(); } } - + public void setLoginTime(long time) { this.loginTime = time; } - + public long getLoginTime() { return loginTime; } - + public long getLoggedInTime() { return System.currentTimeMillis() - loginTime; } @@ -10569,7 +10588,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean getWhiteChat() { - return !isGM() ? false : whiteChat; + return isGM() && whiteChat; } public void toggleWhiteChat() { @@ -10598,55 +10617,55 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void createDragon() { - dragon = new MapleDragon(this); + dragon = new Dragon(this); } - public MapleDragon getDragon() { + public Dragon getDragon() { return dragon; } - public void setDragon(MapleDragon dragon) { + public void setDragon(Dragon dragon) { this.dragon = dragon; } - + public void setAutopotHpAlert(float hpPortion) { autopotHpAlert = hpPortion; } - + public float getAutopotHpAlert() { return autopotHpAlert; } - + public void setAutopotMpAlert(float mpPortion) { autopotMpAlert = mpPortion; } - + public float getAutopotMpAlert() { return autopotMpAlert; } - + public long getJailExpirationTimeLeft() { return jailExpiration - System.currentTimeMillis(); } - + private void setFutureJailExpiration(long time) { jailExpiration = System.currentTimeMillis() + time; } - + public void addJailExpirationTime(long time) { long timeLeft = getJailExpirationTimeLeft(); - if(timeLeft <= 0) { + if (timeLeft <= 0) { setFutureJailExpiration(time); } else { setFutureJailExpiration(timeLeft + time); } } - + public void removeJailExpirationTime() { jailExpiration = 0; } - + public boolean registerNameChange(String newName) { try (Connection con = DatabaseConnection.getConnection()) { //check for pending name change @@ -10703,7 +10722,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + public void doPendingNameChange() { //called on logout if (!pendingNameChange) { return; @@ -10731,7 +10750,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (!success) { con.rollback(); } else { - FilePrinter.print(FilePrinter.CHANGE_CHARACTER_NAME, "Name change applied : from \"" + getName() + "\" to \"" + newName + "\" at " + Calendar.getInstance().getTime().toString()); + FilePrinter.print(FilePrinter.CHANGE_CHARACTER_NAME, "Name change applied : from \"" + getName() + "\" to \"" + newName + "\" at " + Calendar.getInstance().getTime()); } con.setAutoCommit(true); } catch (SQLException e) { @@ -10739,7 +10758,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e, "Failed to get DB connection."); } } - + public static void doNameChange(int characterId, String oldName, String newName, int nameChangeId) { //Don't do this while player is online try (Connection con = DatabaseConnection.getConnection()) { con.setAutoCommit(false); @@ -10753,7 +10772,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e, "Failed to get DB connection."); } } - + public static boolean doNameChange(Connection con, int characterId, String oldName, String newName, int nameChangeId) { try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET name = ? WHERE id = ?")) { ps.setString(1, newName); @@ -10897,36 +10916,48 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return true; } - + public int checkWorldTransferEligibility() { - if(getLevel() < 20) { + if (getLevel() < 20) { return 2; - } else if(getClient().getTempBanCalendar() != null && getClient().getTempBanCalendar().getTimeInMillis() + (30*24*60*60*1000) < Calendar.getInstance().getTimeInMillis()) { + } else if (getClient().getTempBanCalendar() != null && getClient().getTempBanCalendar().getTimeInMillis() + (30 * 24 * 60 * 60 * 1000) < Calendar.getInstance().getTimeInMillis()) { return 3; - } else if(isMarried()) { + } else if (isMarried()) { return 4; - } else if(getGuildRank() < 2) { + } else if (getGuildRank() < 2) { return 5; - } else if(getFamily() != null) { + } else if (getFamily() != null) { return 8; } else { return 0; } } - + public static String checkWorldTransferEligibility(Connection con, int characterId, int oldWorld, int newWorld) { - if(!YamlConfig.config.server.ALLOW_CASHSHOP_WORLD_TRANSFER) return "World transfers disabled."; + if (!YamlConfig.config.server.ALLOW_CASHSHOP_WORLD_TRANSFER) { + return "World transfers disabled."; + } int accountId = -1; try (PreparedStatement ps = con.prepareStatement("SELECT accountid, level, guildid, guildrank, partnerId, familyId FROM characters WHERE id = ?")) { ps.setInt(1, characterId); ResultSet rs = ps.executeQuery(); - if(!rs.next()) return "Character does not exist."; + if (!rs.next()) { + return "Character does not exist."; + } accountId = rs.getInt("accountid"); - if(rs.getInt("level") < 20) return "Character is under level 20."; - if(rs.getInt("familyId") != -1) return "Character is in family."; - if(rs.getInt("partnerId") != 0) return "Character is married."; - if(rs.getInt("guildid") != 0 && rs.getInt("guildrank") < 2) return "Character is the leader of a guild."; - } catch(SQLException e) { + if (rs.getInt("level") < 20) { + return "Character is under level 20."; + } + if (rs.getInt("familyId") != -1) { + return "Character is in family."; + } + if (rs.getInt("partnerId") != 0) { + return "Character is married."; + } + if (rs.getInt("guildid") != 0 && rs.getInt("guildrank") < 2) { + return "Character is the leader of a guild."; + } + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e); return "SQL Error"; @@ -10938,10 +10969,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return "Account does not exist."; } LocalDateTime tempban = rs.getTimestamp("tempban").toLocalDateTime(); - if(!tempban.equals(DefaultDates.getTempban())) { + if (!tempban.equals(DefaultDates.getTempban())) { return "Account has been banned."; } - } catch(SQLException e) { + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e); return "SQL Error"; @@ -10950,16 +10981,20 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(1, accountId); ps.setInt(2, newWorld); ResultSet rs = ps.executeQuery(); - if(!rs.next()) return "SQL Error"; - if(rs.getInt("rowcount") >= 3) return "Too many characters on destination world."; - } catch(SQLException e) { + if (!rs.next()) { + return "SQL Error"; + } + if (rs.getInt("rowcount") >= 3) { + return "Too many characters on destination world."; + } + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e); return "SQL Error"; } return null; } - + public boolean registerWorldTransfer(int newWorld) { try (Connection con = DatabaseConnection.getConnection()) { //check for pending world transfer @@ -10997,7 +11032,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return false; } - + public boolean cancelPendingWorldTranfer() { try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM worldtransfers WHERE characterid=? AND completionTime IS NULL")) { @@ -11010,18 +11045,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } } - + public static boolean doWorldTransfer(Connection con, int characterId, int oldWorld, int newWorld, int worldTransferId) { int mesos = 0; try (PreparedStatement ps = con.prepareStatement("SELECT meso FROM characters WHERE id = ?")) { ps.setInt(1, characterId); ResultSet rs = ps.executeQuery(); - if(!rs.next()) { + if (!rs.next()) { FilePrinter.printError(FilePrinter.WORLD_TRANSFER, "Character data invalid? (charid " + characterId + ")"); return false; } mesos = rs.getInt("meso"); - } catch(SQLException e) { + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Character ID : " + characterId); return false; @@ -11033,7 +11068,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(4, 5); ps.setInt(5, characterId); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Character ID : " + characterId); return false; @@ -11042,17 +11077,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { ps.setInt(1, characterId); ps.setInt(2, characterId); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Character ID : " + characterId); return false; } - if(worldTransferId != -1) { + if (worldTransferId != -1) { try (PreparedStatement ps = con.prepareStatement("UPDATE worldtransfers SET completionTime = ? WHERE id = ?")) { ps.setTimestamp(1, new Timestamp(System.currentTimeMillis())); ps.setInt(2, worldTransferId); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Character ID : " + characterId); return false; @@ -11060,11 +11095,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } return true; } - + public String getLastCommandMessage() { return this.commandtext; } - + public void setLastCommandMessage(String text) { this.commandtext = text; } @@ -11145,17 +11180,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return; } addReborns(); - changeJob(MapleJob.BEGINNER); + changeJob(Job.BEGINNER); setLevel(0); levelUp(true); } - + //EVENTS private byte team = 0; - private MapleFitness fitness; - private MapleOla ola; + private Fitness fitness; + private Ola ola; private long snowballattack; - + public byte getTeam() { return team; } @@ -11164,19 +11199,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.team = (byte) team; } - public MapleOla getOla() { + public Ola getOla() { return ola; } - public void setOla(MapleOla ola) { + public void setOla(Ola ola) { this.ola = ola; } - public MapleFitness getFitness() { + public Fitness getFitness() { return fitness; } - public void setFitness(MapleFitness fit) { + public void setFitness(Fitness fit) { this.fitness = fit; } @@ -11187,19 +11222,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setLastSnowballAttack(long time) { this.snowballattack = time; } - + // MCPQ - + public AriantColiseum ariantColiseum; private MonsterCarnival monsterCarnival; private MonsterCarnivalParty monsterCarnivalParty = null; - + private int cp = 0; private int totCP = 0; private int FestivalPoints; private boolean challenged = false; public short totalCP, availableCP; - + public void gainFestivalPoints(int gain) { this.FestivalPoints += gain; } @@ -11277,7 +11312,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setMonsterCarnival(MonsterCarnival monsterCarnival) { this.monsterCarnival = monsterCarnival; } - + public AriantColiseum getAriantColiseum() { return ariantColiseum; } @@ -11285,11 +11320,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setAriantColiseum(AriantColiseum ariantColiseum) { this.ariantColiseum = ariantColiseum; } - + public MonsterCarnivalParty getMonsterCarnivalParty() { return this.monsterCarnivalParty; } - + public void setMonsterCarnivalParty(MonsterCarnivalParty mcp) { this.monsterCarnivalParty = mcp; } @@ -11301,11 +11336,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void setChallenged(boolean challenged) { this.challenged = challenged; } - + public void gainAriantPoints(int points) { this.ariantPoints += points; } - + public int getAriantPoints() { return this.ariantPoints; } diff --git a/src/main/java/client/MapleClient.java b/src/main/java/client/Client.java similarity index 93% rename from src/main/java/client/MapleClient.java rename to src/main/java/client/Client.java index 6c2842fbd2..97542ef771 100644 --- a/src/main/java/client/MapleClient.java +++ b/src/main/java/client/Client.java @@ -21,7 +21,7 @@ along with this program. If not, see . */ package client; -import client.inventory.MapleInventoryType; +import client.inventory.InventoryType; import config.YamlConfig; import constants.game.GameConstants; import io.netty.channel.ChannelHandlerContext; @@ -38,14 +38,14 @@ import net.server.Server; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; import net.server.channel.Channel; -import net.server.coordinator.login.MapleLoginBypassCoordinator; +import net.server.coordinator.login.LoginBypassCoordinator; import net.server.coordinator.session.Hwid; import net.server.coordinator.session.IpAddresses; import net.server.coordinator.session.SessionCoordinator; import net.server.coordinator.session.SessionCoordinator.AntiMulticlientResult; +import net.server.guild.Guild; +import net.server.guild.GuildCharacter; import net.server.guild.GuildPackets; -import net.server.guild.MapleGuild; -import net.server.guild.MapleGuildCharacter; import net.server.world.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,10 +58,10 @@ import scripting.quest.QuestActionManager; import scripting.quest.QuestScriptManager; import server.ThreadManager; import server.TimerManager; -import server.life.MapleMonster; +import server.life.Monster; import server.maps.FieldLimit; import server.maps.MapleMap; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; import tools.*; import javax.script.ScriptEngine; @@ -78,8 +78,8 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; -public class MapleClient extends ChannelInboundHandlerAdapter { - private static final Logger log = LoggerFactory.getLogger(MapleClient.class); +public class Client extends ChannelInboundHandlerAdapter { + private static final Logger log = LoggerFactory.getLogger(Client.class); public static final int LOGIN_NOTLOGGEDIN = 0; public static final int LOGIN_SERVER_TRANSITION = 1; @@ -94,7 +94,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { private volatile boolean inTransition; private io.netty.channel.Channel ioChannel; - private MapleCharacter player; + private Character player; private int channel = 1; private int accId = -4; private boolean loggedIn = false; @@ -133,7 +133,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { CHANNEL } - public MapleClient(Type type, long sessionId, String remoteAddress, PacketProcessor packetProcessor, int world, int channel) { + public Client(Type type, long sessionId, String remoteAddress, PacketProcessor packetProcessor, int world, int channel) { this.type = type; this.sessionId = sessionId; this.remoteAddress = remoteAddress; @@ -142,18 +142,18 @@ public class MapleClient extends ChannelInboundHandlerAdapter { this.channel = channel; } - public static MapleClient createLoginClient(long sessionId, String remoteAddress, PacketProcessor packetProcessor, - int world, int channel) { - return new MapleClient(Type.LOGIN, sessionId, remoteAddress, packetProcessor, world, channel); + public static Client createLoginClient(long sessionId, String remoteAddress, PacketProcessor packetProcessor, + int world, int channel) { + return new Client(Type.LOGIN, sessionId, remoteAddress, packetProcessor, world, channel); } - public static MapleClient createChannelClient(long sessionId, String remoteAddress, PacketProcessor packetProcessor, - int world, int channel) { - return new MapleClient(Type.CHANNEL, sessionId, remoteAddress, packetProcessor, world, channel); + public static Client createChannelClient(long sessionId, String remoteAddress, PacketProcessor packetProcessor, + int world, int channel) { + return new Client(Type.CHANNEL, sessionId, remoteAddress, packetProcessor, world, channel); } - public static MapleClient createMock() { - return new MapleClient(null, -1,null, null, -123, -123); + public static Client createMock() { + return new Client(null, -1,null, null, -123, -123); } @Override @@ -288,11 +288,11 @@ public class MapleClient extends ChannelInboundHandlerAdapter { return getChannelServer().getEventSM().getEventManager(event); } - public MapleCharacter getPlayer() { + public Character getPlayer() { return player; } - public void setPlayer(MapleCharacter player) { + public void setPlayer(Character player) { this.player = player; } @@ -304,11 +304,11 @@ public class MapleClient extends ChannelInboundHandlerAdapter { this.sendPacket(PacketCreator.getCharList(this, server, 0)); } - public List loadCharacters(int serverId) { - List chars = new ArrayList<>(15); + public List loadCharacters(int serverId) { + List chars = new ArrayList<>(15); try { for (CharNameAndId cni : loadCharactersInternal(serverId)) { - chars.add(MapleCharacter.loadCharFromDB(cni.id, this, false)); + chars.add(Character.loadCharFromDB(cni.id, this, false)); } } catch (Exception e) { e.printStackTrace(); @@ -543,7 +543,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { loggedIn = false; return 7; } - updateLoginState(MapleClient.LOGIN_LOGGEDIN); + updateLoginState(Client.LOGIN_LOGGEDIN); } finally { encoderLock.unlock(); } @@ -578,7 +578,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } if (pin.equals(other)) { pinattempt = 0; - MapleLoginBypassCoordinator.getInstance().registerLoginBypassEntry(hwid, accId, false); + LoginBypassCoordinator.getInstance().registerLoginBypassEntry(hwid, accId, false); return true; } return false; @@ -611,7 +611,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } if (pic.equals(other)) { // thanks ryantpayton (HeavenClient) for noticing null pics being checked here picattempt = 0; - MapleLoginBypassCoordinator.getInstance().registerLoginBypassEntry(hwid, accId, true); + LoginBypassCoordinator.getInstance().registerLoginBypassEntry(hwid, accId, true); return true; } return false; @@ -834,7 +834,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { - throw new RuntimeException("getLoginState - MapleClient AccID: " + getAccID()); + throw new RuntimeException("getLoginState - Client AccID: " + getAccID()); } birthday = Calendar.getInstance(); @@ -848,7 +848,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { if (rs.getTimestamp("lastlogin").getTime() + 30000 < Server.getInstance().getCurrentTime()) { int accountId = accId; state = LOGIN_NOTLOGGEDIN; - updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); // ACCID = 0, issue found thanks to Tochi & K u ssss o & Thora & Omo Oppa + updateLoginState(Client.LOGIN_NOTLOGGEDIN); // ACCID = 0, issue found thanks to Tochi & K u ssss o & Thora & Omo Oppa this.setAccID(accountId); } } @@ -878,16 +878,16 @@ public class MapleClient extends ChannelInboundHandlerAdapter { private void removePartyPlayer(World wserv) { MapleMap map = player.getMap(); - final MapleParty party = player.getParty(); + final Party party = player.getParty(); final int idz = player.getId(); if (party != null) { - final MaplePartyCharacter chrp = new MaplePartyCharacter(player); + final PartyCharacter chrp = new PartyCharacter(player); chrp.setOnline(false); wserv.updateParty(party.getId(), PartyOperation.LOG_ONOFF, chrp); if (party.getLeader().getId() == idz && map != null) { - MaplePartyCharacter lchr = null; - for (MaplePartyCharacter pchr : party.getMembers()) { + PartyCharacter lchr = null; + for (PartyCharacter pchr : party.getMembers()) { if (pchr != null && pchr.getId() != idz && (lchr == null || lchr.getLevel() <= pchr.getLevel()) && map.getCharacterById(pchr.getId()) != null) { lchr = pchr; } @@ -960,14 +960,14 @@ public class MapleClient extends ChannelInboundHandlerAdapter { return true; } - private void disconnectInternal(boolean shutdown, boolean cashshop) {//once per MapleClient instance + private void disconnectInternal(boolean shutdown, boolean cashshop) {//once per Client instance if (player != null && player.isLoggedin() && player.getClient() != null) { final int messengerid = player.getMessenger() == null ? 0 : player.getMessenger().getId(); //final int fid = player.getFamilyId(); final BuddyList bl = player.getBuddylist(); - final MapleMessengerCharacter chrm = new MapleMessengerCharacter(player, 0); - final MapleGuildCharacter chrg = player.getMGC(); - final MapleGuild guild = player.getGuild(); + final MessengerCharacter chrm = new MessengerCharacter(player, 0); + final GuildCharacter chrg = player.getMGC(); + final Guild guild = player.getGuild(); player.cancelMagicDoor(); @@ -983,7 +983,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } /* if (fid > 0) { - final MapleFamily family = worlda.getFamily(fid); + final Family family = worlda.getFamily(fid); family. } */ @@ -1039,12 +1039,12 @@ public class MapleClient extends ChannelInboundHandlerAdapter { SessionCoordinator.getInstance().closeSession(this, false); if (!serverTransition && isLoggedIn()) { - updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); + updateLoginState(Client.LOGIN_NOTLOGGEDIN); clear(); } else { if (!Server.getInstance().hasCharacteridInTransition(this)) { - updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); + updateLoginState(Client.LOGIN_NOTLOGGEDIN); } engines = null; // thanks Tochi for pointing out a NPE here @@ -1068,7 +1068,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } public void setCharacterOnSessionTransitionState(int cid) { - this.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION); + this.updateLoginState(Client.LOGIN_SERVER_TRANSITION); this.inTransition = true; Server.getInstance().setCharacteridInTransition(this, cid); } @@ -1091,13 +1091,13 @@ public class MapleClient extends ChannelInboundHandlerAdapter { public boolean deleteCharacter(int cid, int senderAccId) { try { - MapleCharacter chr = MapleCharacter.loadCharFromDB(cid, this, false); + Character chr = Character.loadCharFromDB(cid, this, false); Integer partyid = chr.getWorldServer().getCharacterPartyid(cid); if (partyid != null) { this.setPlayer(chr); - MapleParty party = chr.getWorldServer().getParty(partyid); + Party party = chr.getWorldServer().getParty(partyid); chr.setParty(party); chr.getMPC(); chr.leaveParty(); // thanks Vcoc for pointing out deleted characters would still stay in a party @@ -1105,7 +1105,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { this.setPlayer(null); } - return MapleCharacter.deleteCharFromDB(chr, senderAccId); + return Character.deleteCharFromDB(chr, senderAccId); } catch (SQLException ex) { ex.printStackTrace(); return false; @@ -1144,7 +1144,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { if (lastPong < pingedAt) { if (ioChannel.isActive()) { log.info("Disconnected {} due to idling. Reason: {}", remoteAddress, event.state()); - updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); + updateLoginState(Client.LOGIN_NOTLOGGEDIN); disconnectSession(); } } @@ -1221,7 +1221,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } for (World w : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : w.getPlayerStorage().getAllCharacters()) { + for (Character chr : w.getPlayerStorage().getAllCharacters()) { if (accid == chr.getAccountID()) { FilePrinter.print(FilePrinter.EXPLOITS, "Player: " + chr.getName() + " has been removed from " + GameConstants.WORLD_NAMES[w.getId()] + ". Possible Dupe attempt."); chr.getClient().forceDisconnect(); @@ -1416,7 +1416,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { sendPacket(PacketCreator.serverMessage(this.getChannelServer().getServerMessage())); } - public synchronized void announceBossHpBar(MapleMonster mm, final int mobHash, Packet packet) { + public synchronized void announceBossHpBar(Monster mm, final int mobHash, Packet packet) { long timeNow = System.currentTimeMillis(); int targetHash = player.getTargetHpBarHash(); @@ -1460,7 +1460,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { sendPacket(PacketCreator.enableActions()); return; - } else if (MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) { + } else if (MiniDungeonInfo.isDungeonMap(player.getMapId())) { sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); sendPacket(PacketCreator.enableActions()); return; @@ -1491,7 +1491,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter { //Cancelling magicdoor? Nope //Cancelling mounts? Noty - player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test + player.getInventory(InventoryType.EQUIPPED).checked(false); //test player.getMap().removePlayer(player); player.clearBanishPlayerData(); player.getClient().getChannelServer().removePlayer(player); @@ -1560,11 +1560,11 @@ public class MapleClient extends ChannelInboundHandlerAdapter { } public boolean canBypassPin() { - return MapleLoginBypassCoordinator.getInstance().canLoginBypass(hwid, accId, false); + return LoginBypassCoordinator.getInstance().canLoginBypass(hwid, accId, false); } public boolean canBypassPic() { - return MapleLoginBypassCoordinator.getInstance().canLoginBypass(hwid, accId, true); + return LoginBypassCoordinator.getInstance().canLoginBypass(hwid, accId, true); } public int getLanguage() { diff --git a/src/main/java/client/MapleDisease.java b/src/main/java/client/Disease.java similarity index 76% rename from src/main/java/client/MapleDisease.java rename to src/main/java/client/Disease.java index 4dd866f050..6e8d4ec7be 100644 --- a/src/main/java/client/MapleDisease.java +++ b/src/main/java/client/Disease.java @@ -23,7 +23,7 @@ package client; import constants.game.GameConstants; -public enum MapleDisease { +public enum Disease { NULL(0x0), SLOW(0x1, 126), SEDUCE(0x80, 128), @@ -36,25 +36,25 @@ public enum MapleDisease { DARKNESS(0x10000000000000L, 121), WEAKEN(0x4000000000000000L, 122), CURSE(0x8000000000000000L, 124); - - private long i; - private boolean first; - private int mobskill; - - private MapleDisease(long i) { + + private final long i; + private final boolean first; + private final int mobskill; + + Disease(long i) { this(i, false, 0); } - private MapleDisease(long i, int skill) { + Disease(long i, int skill) { this(i, false, skill); } - - private MapleDisease(long i, boolean first, int skill) { + + Disease(long i, boolean first, int skill) { this.i = i; this.first = first; this.mobskill = skill; } - + public long getValue() { return i; } @@ -62,31 +62,31 @@ public enum MapleDisease { public boolean isFirst() { return first; } - + public int getDisease() { return mobskill; } - - public static MapleDisease ordinal(int ord) { + + public static Disease ordinal(int ord) { try { - return MapleDisease.values()[ord]; + return Disease.values()[ord]; } catch (IndexOutOfBoundsException io) { return NULL; } } - - public static final MapleDisease getRandom() { - MapleDisease[] diseases = GameConstants.CPQ_DISEASES; + + public static final Disease getRandom() { + Disease[] diseases = GameConstants.CPQ_DISEASES; return diseases[(int) (Math.random() * diseases.length)]; } - - public static final MapleDisease getBySkill(final int skill) { - for (MapleDisease d : MapleDisease.values()) { + + public static final Disease getBySkill(final int skill) { + for (Disease d : Disease.values()) { if (d.getDisease() == skill && d.getDisease() != 0) { return d; } } return null; } - + } \ No newline at end of file diff --git a/src/main/java/client/MapleDiseaseValueHolder.java b/src/main/java/client/DiseaseValueHolder.java similarity index 91% rename from src/main/java/client/MapleDiseaseValueHolder.java rename to src/main/java/client/DiseaseValueHolder.java index a7feab5530..38780c265b 100644 --- a/src/main/java/client/MapleDiseaseValueHolder.java +++ b/src/main/java/client/DiseaseValueHolder.java @@ -21,13 +21,12 @@ package client; /** - * * @author anybody can do this */ -public class MapleDiseaseValueHolder { +public class DiseaseValueHolder { public long startTime, length; - - public MapleDiseaseValueHolder(long start, long length) { + + public DiseaseValueHolder(long start, long length) { this.startTime = start; this.length = length; } diff --git a/src/main/java/client/MapleFamily.java b/src/main/java/client/Family.java similarity index 76% rename from src/main/java/client/MapleFamily.java rename to src/main/java/client/Family.java index b0a295f5b4..7c0c3a9ec8 100644 --- a/src/main/java/client/MapleFamily.java +++ b/src/main/java/client/Family.java @@ -41,26 +41,25 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; /** - * * @author Jay Estrella - Mr.Trash :3 * @author Ubaware */ -public class MapleFamily { +public class Family { private static final AtomicInteger familyIDCounter = new AtomicInteger(); private final int id, world; - private final Map members = new ConcurrentHashMap<>(); - private MapleFamilyEntry leader; + private final Map members = new ConcurrentHashMap<>(); + private FamilyEntry leader; private String name; private String preceptsMessage = ""; private int totalGenerations; - public MapleFamily(int id, int world) { + public Family(int id, int world) { int newId = id; - if(id == -1) { + if (id == -1) { // get next available family id - while(idInUse(newId = familyIDCounter.incrementAndGet())) { + while (idInUse(newId = familyIDCounter.incrementAndGet())) { } } this.id = newId; @@ -68,8 +67,10 @@ public class MapleFamily { } private static boolean idInUse(int id) { - for(World world : Server.getInstance().getWorlds()) { - if(world.getFamily(id) != null) return true; + for (World world : Server.getInstance().getWorlds()) { + if (world.getFamily(id) != null) { + return true; + } } return false; } @@ -82,12 +83,12 @@ public class MapleFamily { return world; } - public void setLeader(MapleFamilyEntry leader) { + public void setLeader(FamilyEntry leader) { this.leader = leader; setName(leader.getName()); } - public MapleFamilyEntry getLeader() { + public FamilyEntry getLeader() { return leader; } @@ -98,11 +99,11 @@ public class MapleFamily { public int getTotalMembers() { return members.size(); } - + public int getTotalGenerations() { return totalGenerations; } - + public void setTotalGenerations(int generations) { this.totalGenerations = generations; } @@ -113,13 +114,13 @@ public class MapleFamily { public void setMessage(String message, boolean save) { this.preceptsMessage = message; - if(save) { + if (save) { try (Connection con = DatabaseConnection.getConnection(); - PreparedStatement ps = con.prepareStatement("UPDATE family_character SET precepts = ? WHERE cid = ?")) { + PreparedStatement ps = con.prepareStatement("UPDATE family_character SET precepts = ? WHERE cid = ?")) { ps.setString(1, message); ps.setInt(2, getLeader().getChrId()); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not save new precepts for family " + getID() + "."); e.printStackTrace(); } @@ -130,25 +131,29 @@ public class MapleFamily { return preceptsMessage; } - public void addEntry(MapleFamilyEntry entry) { + public void addEntry(FamilyEntry entry) { members.put(entry.getChrId(), entry); } - public void removeEntryBranch(MapleFamilyEntry root) { + public void removeEntryBranch(FamilyEntry root) { members.remove(root.getChrId()); - for(MapleFamilyEntry junior : root.getJuniors()) { - if(junior != null) removeEntryBranch(junior); - } - } - - public void addEntryTree(MapleFamilyEntry root) { - members.put(root.getChrId(), root); - for(MapleFamilyEntry junior : root.getJuniors()) { - if(junior != null) addEntryTree(junior); + for (FamilyEntry junior : root.getJuniors()) { + if (junior != null) { + removeEntryBranch(junior); + } } } - public MapleFamilyEntry getEntryByID(int cid) { + public void addEntryTree(FamilyEntry root) { + members.put(root.getChrId(), root); + for (FamilyEntry junior : root.getJuniors()) { + if (junior != null) { + addEntryTree(junior); + } + } + } + + public FamilyEntry getEntryByID(int cid) { return members.get(cid); } @@ -157,26 +162,28 @@ public class MapleFamily { } public void broadcast(Packet packet, int ignoreID) { - for(MapleFamilyEntry entry : members.values()) { - MapleCharacter chr = entry.getChr(); - if(chr != null) { - if(chr.getId() == ignoreID) continue; + for (FamilyEntry entry : members.values()) { + Character chr = entry.getChr(); + if (chr != null) { + if (chr.getId() == ignoreID) { + continue; + } chr.sendPacket(packet); } } } - + public void broadcastFamilyInfoUpdate() { - for(MapleFamilyEntry entry : members.values()) { - MapleCharacter chr = entry.getChr(); - if(chr != null) { + for (FamilyEntry entry : members.values()) { + Character chr = entry.getChr(); + if (chr != null) { chr.sendPacket(PacketCreator.getFamilyInfo(entry)); } } } - + public void resetDailyReps() { - for(MapleFamilyEntry entry : members.values()) { + for (FamilyEntry entry : members.values()) { entry.setTodaysRep(0); entry.setRepsToSenior(0); entry.resetEntitlementUsages(); @@ -184,7 +191,7 @@ public class MapleFamily { } public static void loadAllFamilies(Connection con) { - List, MapleFamilyEntry>> unmatchedJuniors = new ArrayList<>(200); // < familyEntry> + List, FamilyEntry>> unmatchedJuniors = new ArrayList<>(200); // < familyEntry> try (PreparedStatement psEntries = con.prepareStatement("SELECT * FROM family_character")) { ResultSet rsEntries = psEntries.executeQuery(); while (rsEntries.next()) { // can be optimized @@ -221,18 +228,18 @@ public class MapleFamily { if (wserv == null) { continue; } - MapleFamily family = wserv.getFamily(familyid); + Family family = wserv.getFamily(familyid); if (family == null) { - family = new MapleFamily(familyid, world); + family = new Family(familyid, world); Server.getInstance().getWorld(world).addFamily(familyid, family); } - MapleFamilyEntry familyEntry = new MapleFamilyEntry(family, cid, name, level, MapleJob.getById(jobID)); + FamilyEntry familyEntry = new FamilyEntry(family, cid, name, level, Job.getById(jobID)); family.addEntry(familyEntry); if (seniorid <= 0) { family.setLeader(familyEntry); family.setMessage(precepts, false); } - MapleFamilyEntry senior = family.getEntryByID(seniorid); + FamilyEntry senior = family.getEntryByID(seniorid); if (senior != null) { familyEntry.setSenior(family.getEntryByID(seniorid), false); } else { @@ -258,11 +265,11 @@ public class MapleFamily { e.printStackTrace(); } // link missing ones (out of order) - for (Pair, MapleFamilyEntry> unmatchedJunior : unmatchedJuniors) { + for (Pair, FamilyEntry> unmatchedJunior : unmatchedJuniors) { int world = unmatchedJunior.getLeft().getLeft(); int seniorid = unmatchedJunior.getLeft().getRight(); - MapleFamilyEntry junior = unmatchedJunior.getRight(); - MapleFamilyEntry senior = Server.getInstance().getWorld(world).getFamily(junior.getFamily().getID()).getEntryByID(seniorid); + FamilyEntry junior = unmatchedJunior.getRight(); + FamilyEntry senior = Server.getInstance().getWorld(world).getFamily(junior.getFamily().getID()).getEntryByID(seniorid); if (senior != null) { junior.setSenior(senior, false); } else { @@ -271,30 +278,32 @@ public class MapleFamily { } for (World world : Server.getInstance().getWorlds()) { - for (MapleFamily family : world.getFamilies()) { + for (Family family : world.getFamilies()) { family.getLeader().doFullCount(); } } } public void saveAllMembersRep() { //was used for autosave task, but character autosave should be enough - try(Connection con = DatabaseConnection.getConnection()) { + try (Connection con = DatabaseConnection.getConnection()) { con.setAutoCommit(false); boolean success = true; - for(MapleFamilyEntry entry : members.values()) { + for (FamilyEntry entry : members.values()) { success = entry.saveReputation(con); - if(!success) break; + if (!success) { + break; + } } - if(!success) { + if (!success) { con.rollback(); - FilePrinter.printError(FilePrinter.FAMILY_ERROR, "Family rep autosave failed for family " + getID() + " on " + Calendar.getInstance().getTime().toString() + "."); + FilePrinter.printError(FilePrinter.FAMILY_ERROR, "Family rep autosave failed for family " + getID() + " on " + Calendar.getInstance().getTime() + "."); } con.setAutoCommit(true); //reset repChanged after successful save - for(MapleFamilyEntry entry : members.values()) { + for (FamilyEntry entry : members.values()) { entry.savedSuccessfully(); } - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB."); e.printStackTrace(); } diff --git a/src/main/java/client/MapleFamilyEntitlement.java b/src/main/java/client/FamilyEntitlement.java similarity index 94% rename from src/main/java/client/MapleFamilyEntitlement.java rename to src/main/java/client/FamilyEntitlement.java index fed32c302f..458b09b93c 100644 --- a/src/main/java/client/MapleFamilyEntitlement.java +++ b/src/main/java/client/FamilyEntitlement.java @@ -1,6 +1,6 @@ package client; -public enum MapleFamilyEntitlement { +public enum FamilyEntitlement { FAMILY_REUINION(1, 300, "Family Reunion", "[Target] Me\\n[Effect] Teleport directly to the Family member of your choice."), SUMMON_FAMILY(1, 500, "Summon Family", "[Target] 1 Family member\\n[Effect] Summon a Family member of choice to the map you're in."), SELF_DROP_1_5(1, 700, "My Drop Rate 1.5x (15 min)", "[Target] Me\\n[Time] 15 min.\\n[Effect] Monster drop rate will be increased #c1.5x#.\\n* If the Drop Rate event is in progress, this will be nullified."), @@ -12,29 +12,29 @@ public enum MapleFamilyEntitlement { SELF_EXP_2_30MIN(1, 2500, "My EXP 2x (30 min)", "[Target] Me\\n[Time] 30 min.\\n[Effect] EXP earned from hunting will be increased #c2x#. \\n* If the EXP event is in progress, this will be nullified."), PARTY_DROP_2_30MIN(1, 4000, "My Party Drop Rate 2x (30 min)", "[Target] My party\\n[Time] 30 min.\\n[Effect] Monster drop rate will be increased #c2x#.\\n* If the Drop Rate event is in progress, this will be nullified."), PARTY_EXP_2_30MIN(1, 5000, "My Party EXP 2x (30 min)", "[Target] My party\\n[Time] 30 min.\\n[Effect] EXP earned from hunting will be increased #c2x#.\\n* If the EXP event is in progress, this will be nullified."); - + private final int usageLimit, repCost; private final String name, description; - - private MapleFamilyEntitlement(int usageLimit, int repCost, String name, String description) { + + FamilyEntitlement(int usageLimit, int repCost, String name, String description) { this.usageLimit = usageLimit; this.repCost = repCost; this.name = name; this.description = description; } - + public int getUsageLimit() { return usageLimit; } - + public int getRepCost() { return repCost; } - + public String getName() { return name; } - + public String getDescription() { return description; } diff --git a/src/main/java/client/MapleFamilyEntry.java b/src/main/java/client/FamilyEntry.java similarity index 61% rename from src/main/java/client/MapleFamilyEntry.java rename to src/main/java/client/FamilyEntry.java index f42cf3d540..5eb525dee6 100644 --- a/src/main/java/client/MapleFamilyEntry.java +++ b/src/main/java/client/FamilyEntry.java @@ -37,28 +37,28 @@ import java.util.List; * @author Ubaware */ -public class MapleFamilyEntry { +public class FamilyEntry { private final int characterID; - private volatile MapleFamily family; - private volatile MapleCharacter character; + private volatile Family family; + private volatile Character character; - private volatile MapleFamilyEntry senior; - private final MapleFamilyEntry[] juniors = new MapleFamilyEntry[2]; + private volatile FamilyEntry senior; + private final FamilyEntry[] juniors = new FamilyEntry[2]; private final int[] entitlements = new int[11]; private volatile int reputation, totalReputation; private volatile int todaysRep, repsToSenior; //both are daily values private volatile int totalJuniors, totalSeniors; - + private volatile int generation; - + private volatile boolean repChanged; //used to ignore saving unchanged rep values // cached values for offline players private String charName; private int level; - private MapleJob job; + private Job job; - public MapleFamilyEntry(MapleFamily family, int characterID, String charName, int level, MapleJob job) { + public FamilyEntry(Family family, int characterID, String charName, int level, Job job) { this.family = family; this.characterID = characterID; this.charName = charName; @@ -66,66 +66,73 @@ public class MapleFamilyEntry { this.job = job; } - public MapleCharacter getChr() { + public Character getChr() { return character; } - public void setCharacter(MapleCharacter newCharacter) { - if(newCharacter == null) cacheOffline(newCharacter); - else newCharacter.setFamilyEntry(this); + public void setCharacter(Character newCharacter) { + if (newCharacter == null) { + cacheOffline(newCharacter); + } else { + newCharacter.setFamilyEntry(this); + } this.character = newCharacter; } - private void cacheOffline(MapleCharacter chr) { - if(chr != null) { + private void cacheOffline(Character chr) { + if (chr != null) { charName = chr.getName(); level = chr.getLevel(); job = chr.getJob(); } } - - public synchronized void join(MapleFamilyEntry senior) { - if(senior == null || getSenior() != null) return; - MapleFamily oldFamily = getFamily(); - MapleFamily newFamily = senior.getFamily(); + + public synchronized void join(FamilyEntry senior) { + if (senior == null || getSenior() != null) { + return; + } + Family oldFamily = getFamily(); + Family newFamily = senior.getFamily(); setSenior(senior, false); addSeniorCount(newFamily.getTotalGenerations(), newFamily); //count will be overwritten by doFullCount() newFamily.getLeader().doFullCount(); //easier than keeping track of numbers oldFamily.setMessage(null, true); newFamily.addEntryTree(this); Server.getInstance().getWorld(oldFamily.getWorld()).removeFamily(oldFamily.getID()); - + //db - try(Connection con = DatabaseConnection.getConnection()) { + try (Connection con = DatabaseConnection.getConnection()) { con.setAutoCommit(false); boolean success = updateDBChangeFamily(con, getChrId(), newFamily.getID(), senior.getChrId()); - for(MapleFamilyEntry junior : juniors) { // better to duplicate this than the SQL code - if(junior != null) { + for (FamilyEntry junior : juniors) { // better to duplicate this than the SQL code + if (junior != null) { success = junior.updateNewFamilyDB(con); // recursively updates juniors in db - if(!success) break; + if (!success) { + break; + } } } - if(!success) { + if (!success) { con.rollback(); FilePrinter.printError(FilePrinter.FAMILY_ERROR, "Could not absorb " + oldFamily.getName() + " family into " + newFamily.getName() + " family. (SQL ERROR)"); } con.setAutoCommit(true); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB."); e.printStackTrace(); } } public synchronized void fork() { - MapleFamily oldFamily = getFamily(); - MapleFamilyEntry oldSenior = getSenior(); - family = new MapleFamily(-1, oldFamily.getWorld()); + Family oldFamily = getFamily(); + FamilyEntry oldSenior = getSenior(); + family = new Family(-1, oldFamily.getWorld()); Server.getInstance().getWorld(family.getWorld()).addFamily(family.getID(), family); setSenior(null, false); family.setLeader(this); addSeniorCount(-getTotalSeniors(), family); setTotalSeniors(0); - if(oldSenior != null) { + if (oldSenior != null) { oldSenior.addJuniorCount(-getTotalJuniors()); oldSenior.removeJunior(this); oldFamily.getLeader().doFullCount(); @@ -137,47 +144,55 @@ public class MapleFamilyEntry { family.setMessage("", true); doFullCount(); //to make sure all counts are correct // update db - try(Connection con = DatabaseConnection.getConnection()) { + try (Connection con = DatabaseConnection.getConnection()) { con.setAutoCommit(false); boolean success = updateDBChangeFamily(con, getChrId(), getFamily().getID(), 0); - for(MapleFamilyEntry junior : juniors) { // better to duplicate this than the SQL code - if(junior != null) { + for (FamilyEntry junior : juniors) { // better to duplicate this than the SQL code + if (junior != null) { success = junior.updateNewFamilyDB(con); // recursively updates juniors in db - if(!success) break; + if (!success) { + break; + } } } - if(!success) { + if (!success) { con.rollback(); FilePrinter.printError(FilePrinter.FAMILY_ERROR, "Could not fork family with new leader " + getName() + ". (Old senior : " + oldSenior.getName() + ", leader :" + oldFamily.getLeader().getName() + ")"); } con.setAutoCommit(true); - - } catch(SQLException e) { + + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB."); e.printStackTrace(); } } private synchronized boolean updateNewFamilyDB(Connection con) { - if(!updateFamilyEntryDB(con, getChrId(), getFamily().getID())) return false; - if(!updateCharacterFamilyDB(con, getChrId(), getFamily().getID(), true)) return false; + if (!updateFamilyEntryDB(con, getChrId(), getFamily().getID())) { + return false; + } + if (!updateCharacterFamilyDB(con, getChrId(), getFamily().getID(), true)) { + return false; + } - for(MapleFamilyEntry junior : juniors) { - if(junior != null) { - if(!junior.updateNewFamilyDB(con)) return false; + for (FamilyEntry junior : juniors) { + if (junior != null) { + if (!junior.updateNewFamilyDB(con)) { + return false; + } } } return true; } private static boolean updateFamilyEntryDB(Connection con, int cid, int familyid) { - try(PreparedStatement ps = con.prepareStatement("UPDATE family_character SET familyid = ? WHERE cid = ?")) { + try (PreparedStatement ps = con.prepareStatement("UPDATE family_character SET familyid = ? WHERE cid = ?")) { ps.setInt(1, familyid); ps.setInt(2, cid); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not update family id in 'family_character' for character id " + cid + ". (fork)"); e.printStackTrace(); return false; @@ -185,22 +200,28 @@ public class MapleFamilyEntry { return true; } - private synchronized void addSeniorCount(int seniorCount, MapleFamily newFamily) { // traverses tree and subtracts seniors and updates family - if(newFamily != null) this.family = newFamily; + private synchronized void addSeniorCount(int seniorCount, Family newFamily) { // traverses tree and subtracts seniors and updates family + if (newFamily != null) { + this.family = newFamily; + } setTotalSeniors(getTotalSeniors() + seniorCount); this.generation += seniorCount; - for(MapleFamilyEntry junior : juniors) { - if(junior != null) junior.addSeniorCount(seniorCount, newFamily); + for (FamilyEntry junior : juniors) { + if (junior != null) { + junior.addSeniorCount(seniorCount, newFamily); + } } } private synchronized void addJuniorCount(int juniorCount) { // climbs tree and adds junior count setTotalJuniors(getTotalJuniors() + juniorCount); - MapleFamilyEntry senior = getSenior(); - if(senior != null) senior.addJuniorCount(juniorCount); + FamilyEntry senior = getSenior(); + if (senior != null) { + senior.addJuniorCount(juniorCount); + } } - public MapleFamily getFamily() { + public Family getFamily() { return family; } @@ -209,21 +230,30 @@ public class MapleFamilyEntry { } public String getName() { - MapleCharacter chr = character; - if(chr != null) return chr.getName(); - else return charName; + Character chr = character; + if (chr != null) { + return chr.getName(); + } else { + return charName; + } } public int getLevel() { - MapleCharacter chr = character; - if(chr != null) return chr.getLevel(); - else return level; + Character chr = character; + if (chr != null) { + return chr.getLevel(); + } else { + return level; + } } - public MapleJob getJob() { - MapleCharacter chr = character; - if(chr != null) return chr.getJob(); - else return job; + public Job getJob() { + Character chr = character; + if (chr != null) { + return chr.getJob(); + } else { + return job; + } } public int getReputation() { @@ -235,52 +265,64 @@ public class MapleFamilyEntry { } public void setReputation(int reputation) { - if(reputation != this.reputation) this.repChanged = true; + if (reputation != this.reputation) { + this.repChanged = true; + } this.reputation = reputation; } public void setTodaysRep(int today) { - if(today != todaysRep) this.repChanged = true; + if (today != todaysRep) { + this.repChanged = true; + } this.todaysRep = today; } - + public int getRepsToSenior() { return repsToSenior; } - + public void setRepsToSenior(int reputation) { - if(reputation != this.repsToSenior) this.repChanged = true; + if (reputation != this.repsToSenior) { + this.repChanged = true; + } this.repsToSenior = reputation; } - + public void gainReputation(int gain, boolean countTowardsTotal) { gainReputation(gain, countTowardsTotal, this); } - - private void gainReputation(int gain, boolean countTowardsTotal, MapleFamilyEntry from) { - if(gain != 0) repChanged = true; + + private void gainReputation(int gain, boolean countTowardsTotal, FamilyEntry from) { + if (gain != 0) { + repChanged = true; + } this.reputation += gain; this.todaysRep += gain; - if(gain > 0 && countTowardsTotal) { + if (gain > 0 && countTowardsTotal) { this.totalReputation += gain; } - MapleCharacter chr = getChr(); - if(chr != null) chr.sendPacket(PacketCreator.sendGainRep(gain, from != null ? from.getName() : "")); + Character chr = getChr(); + if (chr != null) { + chr.sendPacket(PacketCreator.sendGainRep(gain, from != null ? from.getName() : "")); + } } public void giveReputationToSenior(int gain, boolean includeSuperSenior) { int actualGain = gain; - MapleFamilyEntry senior = getSenior(); - if(senior != null && senior.getLevel() < getLevel() && gain > 0) actualGain /= 2; //don't halve negative values - if(senior != null) { + FamilyEntry senior = getSenior(); + if (senior != null && senior.getLevel() < getLevel() && gain > 0) { + actualGain /= 2; //don't halve negative values + } + if (senior != null) { senior.gainReputation(actualGain, true, this); - if(actualGain > 0) { + if (actualGain > 0) { this.repsToSenior += actualGain; this.repChanged = true; } - if(includeSuperSenior) { + if (includeSuperSenior) { senior = senior.getSenior(); - if(senior != null) { + if (senior != null) { senior.gainReputation(actualGain, true, this); } } @@ -292,31 +334,37 @@ public class MapleFamilyEntry { } public void setTotalReputation(int totalReputation) { - if(totalReputation != this.totalReputation) this.repChanged = true; + if (totalReputation != this.totalReputation) { + this.repChanged = true; + } this.totalReputation = totalReputation; } - public MapleFamilyEntry getSenior() { + public FamilyEntry getSenior() { return senior; } - public synchronized boolean setSenior(MapleFamilyEntry senior, boolean save) { - if(this.senior == senior) return false; - MapleFamilyEntry oldSenior = this.senior; + public synchronized boolean setSenior(FamilyEntry senior, boolean save) { + if (this.senior == senior) { + return false; + } + FamilyEntry oldSenior = this.senior; this.senior = senior; - if(senior != null) { - if(senior.addJunior(this)) { - if(save) { + if (senior != null) { + if (senior.addJunior(this)) { + if (save) { updateDBChangeFamily(getChrId(), senior.getFamily().getID(), senior.getChrId()); } - if(this.repsToSenior != 0) this.repChanged = true; - this.repsToSenior = 0; + if (this.repsToSenior != 0) { + this.repChanged = true; + } + this.repsToSenior = 0; this.addSeniorCount(1, null); this.setTotalSeniors(senior.getTotalSeniors() + 1); return true; } } else { - if(oldSenior != null) { + if (oldSenior != null) { oldSenior.removeJunior(this); } } @@ -324,9 +372,9 @@ public class MapleFamilyEntry { } private static boolean updateDBChangeFamily(int cid, int familyid, int seniorid) { - try(Connection con = DatabaseConnection.getConnection()) { + try (Connection con = DatabaseConnection.getConnection()) { return updateDBChangeFamily(con, cid, familyid, seniorid); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB."); e.printStackTrace(); return false; @@ -334,12 +382,12 @@ public class MapleFamilyEntry { } private static boolean updateDBChangeFamily(Connection con, int cid, int familyid, int seniorid) { - try(PreparedStatement ps = con.prepareStatement("UPDATE family_character SET familyid = ?, seniorid = ?, reptosenior = 0 WHERE cid = ?")) { + try (PreparedStatement ps = con.prepareStatement("UPDATE family_character SET familyid = ?, seniorid = ?, reptosenior = 0 WHERE cid = ?")) { ps.setInt(1, familyid); ps.setInt(2, seniorid); ps.setInt(3, cid); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not update seniorid in 'family_character' for character id " + cid + "."); e.printStackTrace(); return false; @@ -348,11 +396,11 @@ public class MapleFamilyEntry { } private static boolean updateCharacterFamilyDB(Connection con, int charid, int familyid, boolean fork) { - try(PreparedStatement ps = con.prepareStatement("UPDATE characters SET familyid = ? WHERE id = ?")) { + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET familyid = ? WHERE id = ?")) { ps.setInt(1, familyid); ps.setInt(2, charid); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not update familyid in 'characters' for character id " + charid + " when changing family. " + (fork ? "(fork)" : "")); e.printStackTrace(); return false; @@ -360,26 +408,33 @@ public class MapleFamilyEntry { return true; } - public List getJuniors() { + public List getJuniors() { return Collections.unmodifiableList(Arrays.asList(juniors)); } - - public MapleFamilyEntry getOtherJunior(MapleFamilyEntry junior) { - if(juniors[0] == junior) return juniors[1]; - else if(juniors[1] == junior) return juniors[0]; + + public FamilyEntry getOtherJunior(FamilyEntry junior) { + if (juniors[0] == junior) { + return juniors[1]; + } else if (juniors[1] == junior) { + return juniors[0]; + } return null; } public int getJuniorCount() { //close enough to be relatively consistent to multiple threads (and the result is not vital) int juniorCount = 0; - if(juniors[0] != null) juniorCount++; - if(juniors[1] != null) juniorCount++; + if (juniors[0] != null) { + juniorCount++; + } + if (juniors[1] != null) { + juniorCount++; + } return juniorCount; } - public synchronized boolean addJunior(MapleFamilyEntry newJunior) { - for(int i = 0; i < juniors.length; i++) { - if(juniors[i] == null) { // successfully add new junior to family + public synchronized boolean addJunior(FamilyEntry newJunior) { + for (int i = 0; i < juniors.length; i++) { + if (juniors[i] == null) { // successfully add new junior to family juniors[i] = newJunior; addJuniorCount(1); getFamily().addEntry(newJunior); @@ -389,15 +444,15 @@ public class MapleFamilyEntry { return false; } - public synchronized boolean isJunior(MapleFamilyEntry entry) { //require locking since result accuracy is vital - if(juniors[0] == entry) return true; - else if(juniors[1] == entry) return true; - return false; + public synchronized boolean isJunior(FamilyEntry entry) { //require locking since result accuracy is vital + if (juniors[0] == entry) { + return true; + } else return juniors[1] == entry; } - public synchronized boolean removeJunior(MapleFamilyEntry junior) { - for(int i = 0; i < juniors.length; i++) { - if(juniors[i] == junior) { + public synchronized boolean removeJunior(FamilyEntry junior) { + for (int i = 0; i < juniors.length; i++) { + if (juniors[i] == junior) { juniors[i] = null; return true; } @@ -420,29 +475,37 @@ public class MapleFamilyEntry { public void setTotalJuniors(int totalJuniors) { this.totalJuniors = totalJuniors; } - + public void announceToSenior(Packet packet, boolean includeSuperSenior) { - MapleFamilyEntry senior = getSenior(); - if(senior != null) { - MapleCharacter seniorChr = senior.getChr(); - if(seniorChr != null) seniorChr.sendPacket(packet); + FamilyEntry senior = getSenior(); + if (senior != null) { + Character seniorChr = senior.getChr(); + if (seniorChr != null) { + seniorChr.sendPacket(packet); + } senior = senior.getSenior(); - if(includeSuperSenior && senior != null) { + if (includeSuperSenior && senior != null) { seniorChr = senior.getChr(); - if(seniorChr != null) seniorChr.sendPacket(packet); + if (seniorChr != null) { + seniorChr.sendPacket(packet); + } } } } - + public void updateSeniorFamilyInfo(boolean includeSuperSenior) { - MapleFamilyEntry senior = getSenior(); - if(senior != null) { - MapleCharacter seniorChr = senior.getChr(); - if(seniorChr != null) seniorChr.sendPacket(PacketCreator.getFamilyInfo(senior)); + FamilyEntry senior = getSenior(); + if (senior != null) { + Character seniorChr = senior.getChr(); + if (seniorChr != null) { + seniorChr.sendPacket(PacketCreator.getFamilyInfo(senior)); + } senior = senior.getSenior(); - if(includeSuperSenior && senior != null) { + if (includeSuperSenior && senior != null) { seniorChr = senior.getChr(); - if(seniorChr != null) seniorChr.sendPacket(PacketCreator.getFamilyInfo(senior)); + if (seniorChr != null) { + seniorChr.sendPacket(PacketCreator.getFamilyInfo(senior)); + } } } } @@ -460,40 +523,44 @@ public class MapleFamilyEntry { this.generation = seniors; int juniorCount = 0; int highestGeneration = this.generation; - for(MapleFamilyEntry entry : juniors) { - if(entry != null) { + for (FamilyEntry entry : juniors) { + if (entry != null) { Pair counts = entry.traverseAndUpdateCounts(seniors + 1); juniorCount += counts.getRight(); //total juniors - if(counts.getLeft() > highestGeneration) highestGeneration = counts.getLeft(); + if (counts.getLeft() > highestGeneration) { + highestGeneration = counts.getLeft(); + } } } setTotalJuniors(juniorCount); return new Pair<>(highestGeneration, juniorCount); //creating new objects to return is a bit inefficient, but cleaner than packing into a long } - public boolean useEntitlement(MapleFamilyEntitlement entitlement) { + public boolean useEntitlement(FamilyEntitlement entitlement) { int id = entitlement.ordinal(); - if(entitlements[id] >= 1) return false; - try(Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO family_entitlement (entitlementid, charid, timestamp) VALUES (?, ?, ?)")) { + if (entitlements[id] >= 1) { + return false; + } + try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO family_entitlement (entitlementid, charid, timestamp) VALUES (?, ?, ?)")) { ps.setInt(1, id); ps.setInt(2, getChrId()); ps.setLong(3, System.currentTimeMillis()); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not insert new row in 'family_entitlement' for character " + getName() + "."); e.printStackTrace(); } entitlements[id]++; return true; } - - public boolean refundEntitlement(MapleFamilyEntitlement entitlement) { + + public boolean refundEntitlement(FamilyEntitlement entitlement) { int id = entitlement.ordinal(); - try(Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM family_entitlement WHERE entitlementid = ? AND charid = ?")) { + try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM family_entitlement WHERE entitlementid = ? AND charid = ?")) { ps.setInt(1, id); ps.setInt(2, getChrId()); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not refund family entitlement \"" + entitlement.getName() + "\" for character " + getName() + "."); e.printStackTrace(); } @@ -501,37 +568,41 @@ public class MapleFamilyEntry { return true; } - public boolean isEntitlementUsed(MapleFamilyEntitlement entitlement) { + public boolean isEntitlementUsed(FamilyEntitlement entitlement) { return entitlements[entitlement.ordinal()] >= 1; } - - public int getEntitlementUsageCount(MapleFamilyEntitlement entitlement) { + + public int getEntitlementUsageCount(FamilyEntitlement entitlement) { return entitlements[entitlement.ordinal()]; } - + public void setEntitlementUsed(int id) { entitlements[id]++; } - + public void resetEntitlementUsages() { - for(MapleFamilyEntitlement entitlement : MapleFamilyEntitlement.values()) { + for (FamilyEntitlement entitlement : FamilyEntitlement.values()) { entitlements[entitlement.ordinal()] = 0; } } - + public boolean saveReputation() { - if(!repChanged) return true; - try(Connection con = DatabaseConnection.getConnection()) { + if (!repChanged) { + return true; + } + try (Connection con = DatabaseConnection.getConnection()) { return saveReputation(con); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB."); e.printStackTrace(); return false; } } - + public boolean saveReputation(Connection con) { - if(!repChanged) return true; + if (!repChanged) { + return true; + } try (PreparedStatement ps = con.prepareStatement("UPDATE family_character SET reputation = ?, todaysrep = ?, totalreputation = ?, reptosenior = ? WHERE cid = ?")) { ps.setInt(1, getReputation()); ps.setInt(2, getTodaysRep()); @@ -539,14 +610,14 @@ public class MapleFamilyEntry { ps.setInt(4, getRepsToSenior()); ps.setInt(5, getChrId()); ps.executeUpdate(); - } catch(SQLException e) { + } catch (SQLException e) { FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Failed to autosave rep to 'family_character' for charid " + getChrId()); e.printStackTrace(); return false; } return true; } - + public void savedSuccessfully() { this.repChanged = false; } diff --git a/src/main/java/client/MapleJob.java b/src/main/java/client/Job.java similarity index 92% rename from src/main/java/client/MapleJob.java rename to src/main/java/client/Job.java index 25511ef139..a1fd4bd585 100644 --- a/src/main/java/client/MapleJob.java +++ b/src/main/java/client/Job.java @@ -21,7 +21,7 @@ */ package client; -public enum MapleJob { +public enum Job { BEGINNER(0), WARRIOR(100), @@ -58,17 +58,17 @@ public enum MapleJob { LEGEND(2000), EVAN(2001), ARAN1(2100), ARAN2(2110), ARAN3(2111), ARAN4(2112), - + EVAN1(2200), EVAN2(2210), EVAN3(2211), EVAN4(2212), EVAN5(2213), EVAN6(2214), EVAN7(2215), EVAN8(2216), EVAN9(2217), EVAN10(2218); final int jobid; final static int maxId = 22; // maxId = (EVAN / 100); - - private MapleJob(int id) { + + Job(int id) { jobid = id; } - + public static int getMax() { return maxId; } @@ -77,8 +77,8 @@ public enum MapleJob { return jobid; } - public static MapleJob getById(int id) { - for (MapleJob l : MapleJob.values()) { + public static Job getById(int id) { + for (Job l : Job.values()) { if (l.getId() == id) { return l; } @@ -86,7 +86,7 @@ public enum MapleJob { return null; } - public static MapleJob getBy5ByteEncoding(int encoded) { + public static Job getBy5ByteEncoding(int encoded) { switch (encoded) { case 2: return WARRIOR; @@ -114,12 +114,12 @@ public enum MapleJob { return BEGINNER; } } - - public boolean isA(MapleJob basejob) { // thanks Steve (kaito1410) for pointing out an improvement here + + public boolean isA(Job basejob) { // thanks Steve (kaito1410) for pointing out an improvement here int basebranch = basejob.getId() / 10; return (getId() / 10 == basebranch && getId() >= basejob.getId()) || (basebranch % 10 == 0 && getId() / 100 == basejob.getId() / 100); } - + public int getJobNiche() { return (jobid / 100) % 10; diff --git a/src/main/java/client/MonsterBook.java b/src/main/java/client/MonsterBook.java index d0c7465883..461c51f0ba 100644 --- a/src/main/java/client/MonsterBook.java +++ b/src/main/java/client/MonsterBook.java @@ -53,7 +53,7 @@ public final class MonsterBook { } } - public void addCard(final MapleClient c, final int cardid) { + public void addCard(final Client c, final int cardid) { c.getPlayer().getMap().broadcastMessage(c.getPlayer(), PacketCreator.showForeignCardEffect(c.getPlayer().getId()), false); Integer qty; diff --git a/src/main/java/client/MapleMount.java b/src/main/java/client/Mount.java similarity index 92% rename from src/main/java/client/MapleMount.java rename to src/main/java/client/Mount.java index 242b711a7c..c360fab006 100644 --- a/src/main/java/client/MapleMount.java +++ b/src/main/java/client/Mount.java @@ -24,16 +24,16 @@ package client; /** * @author PurpleMadness < Patrick :O > */ -public class MapleMount { +public class Mount { private int itemid; private int skillid; private int tiredness; private int exp; private int level; - private MapleCharacter owner; + private Character owner; private boolean active; - public MapleMount(MapleCharacter owner, int id, int skillid) { + public Mount(Character owner, int id, int skillid) { this.itemid = id; this.skillid = skillid; this.tiredness = 0; @@ -63,6 +63,7 @@ public class MapleMount { * 1902010 - Frog * 1902011 - Turtle * 1902012 - Yeti + * * @return the id */ public int getId() { @@ -90,7 +91,7 @@ public class MapleMount { tiredness = 0; } } - + public int incrementAndGetTiredness() { this.tiredness++; return this.tiredness; @@ -107,7 +108,7 @@ public class MapleMount { public void setItemId(int newitemid) { this.itemid = newitemid; } - + public void setSkillId(int newskillid) { this.skillid = newskillid; } @@ -119,9 +120,11 @@ public class MapleMount { public boolean isActive() { return active; } - + public void empty() { - if(owner != null) owner.getClient().getWorldServer().unregisterMountHunger(owner); + if (owner != null) { + owner.getClient().getWorldServer().unregisterMountHunger(owner); + } this.owner = null; - } + } } diff --git a/src/main/java/client/MapleQuestStatus.java b/src/main/java/client/QuestStatus.java similarity index 88% rename from src/main/java/client/MapleQuestStatus.java rename to src/main/java/client/QuestStatus.java index 3a24cb1063..4e681f23c0 100644 --- a/src/main/java/client/MapleQuestStatus.java +++ b/src/main/java/client/QuestStatus.java @@ -21,16 +21,15 @@ */ package client; -import server.quest.MapleQuest; +import server.quest.Quest; import tools.StringUtil; import java.util.*; /** - * * @author Matze */ -public class MapleQuestStatus { +public class QuestStatus { public enum Status { UNDEFINED(-1), NOT_STARTED(0), @@ -38,7 +37,7 @@ public class MapleQuestStatus { COMPLETED(2); final int status; - private Status(int id) { + Status(int id) { status = id; } @@ -55,7 +54,8 @@ public class MapleQuestStatus { return null; } } - private short questID; + + private final short questID; private Status status; //private boolean updated; //maybe this can be of use for someone? private final Map progress = new LinkedHashMap<>(); @@ -65,17 +65,18 @@ public class MapleQuestStatus { private int forfeited = 0, completed = 0; private String customData; - public MapleQuestStatus(MapleQuest quest, Status status) { + public QuestStatus(Quest quest, Status status) { this.questID = quest.getId(); this.setStatus(status); this.completionTime = System.currentTimeMillis(); this.expirationTime = 0; //this.updated = true; - if (status == Status.STARTED) - registerMobs(); + if (status == Status.STARTED) { + registerMobs(); + } } - public MapleQuestStatus(MapleQuest quest, Status status, int npc) { + public QuestStatus(Quest quest, Status status, int npc) { this.questID = quest.getId(); this.setStatus(status); this.setNpc(npc); @@ -87,10 +88,10 @@ public class MapleQuestStatus { } } - public MapleQuest getQuest() { - return MapleQuest.getInstance(questID); + public Quest getQuest() { + return Quest.getInstance(questID); } - + public short getQuestID() { return questID; } @@ -126,14 +127,16 @@ public class MapleQuestStatus { } private void registerMobs() { - for (int i : MapleQuest.getInstance(questID).getRelevantMobs()) { + for (int i : Quest.getInstance(questID).getRelevantMobs()) { progress.put(i, "000"); } //this.setUpdated(); } public boolean addMedalMap(int mapid) { - if (medalProgress.contains(mapid)) return false; + if (medalProgress.contains(mapid)) { + return false; + } medalProgress.add(mapid); //this.setUpdated(); return true; @@ -152,12 +155,12 @@ public class MapleQuestStatus { if (currentStr == null) { return false; } - + int current = Integer.parseInt(currentStr); if (current >= this.getQuest().getMobAmountNeeded(id)) { return false; } - + String str = StringUtil.getLeftPaddedStr(Integer.toString(++current), '0', 3); progress.put(id, str); //this.setUpdated(); @@ -172,7 +175,7 @@ public class MapleQuestStatus { public boolean madeProgress() { return progress.size() > 0; } - + public String getProgress(int id) { String ret = progress.get(id); if (ret == null) { @@ -181,13 +184,13 @@ public class MapleQuestStatus { return ret; } } - + public void resetProgress(int id) { setProgress(id, "000"); } - + public void resetAllProgress() { - for(Map.Entry entry : progress.entrySet()) { + for (Map.Entry entry : progress.entrySet()) { setProgress(entry.getKey(), "000"); } } @@ -195,25 +198,25 @@ public class MapleQuestStatus { public Map getProgress() { return Collections.unmodifiableMap(progress); } - + public short getInfoNumber() { - MapleQuest q = this.getQuest(); + Quest q = this.getQuest(); Status s = this.getStatus(); - + return q.getInfoNumber(s); } - + public String getInfoEx(int index) { - MapleQuest q = this.getQuest(); + Quest q = this.getQuest(); Status s = this.getStatus(); - + return q.getInfoEx(s, index); } - + public List getInfoEx() { - MapleQuest q = this.getQuest(); + Quest q = this.getQuest(); Status s = this.getStatus(); - + return q.getInfoEx(s); } @@ -224,11 +227,11 @@ public class MapleQuestStatus { public void setCompletionTime(long completionTime) { this.completionTime = completionTime; } - + public long getExpirationTime() { return expirationTime; } - + public void setExpirationTime(long expirationTime) { this.expirationTime = expirationTime; } @@ -236,7 +239,7 @@ public class MapleQuestStatus { public int getForfeited() { return forfeited; } - + public int getCompleted() { return completed; } @@ -248,7 +251,7 @@ public class MapleQuestStatus { throw new IllegalArgumentException("Can't set forfeits to something lower than before."); } } - + public void setCompleted(int completed) { if (completed >= this.completed) { this.completed = completed; @@ -264,7 +267,7 @@ public class MapleQuestStatus { public final String getCustomData() { return customData; } - + public String getProgressData() { StringBuilder str = new StringBuilder(); for (String ps : progress.values()) { diff --git a/src/main/java/client/MapleRing.java b/src/main/java/client/Ring.java similarity index 81% rename from src/main/java/client/MapleRing.java rename to src/main/java/client/Ring.java index a7634b2f7f..2219f41db9 100644 --- a/src/main/java/client/MapleRing.java +++ b/src/main/java/client/Ring.java @@ -21,7 +21,7 @@ */ package client; -import client.inventory.manipulator.MapleCashidGenerator; +import client.inventory.manipulator.CashIdGenerator; import tools.DatabaseConnection; import tools.Pair; @@ -31,18 +31,17 @@ import java.sql.ResultSet; import java.sql.SQLException; /** - * * @author Danny */ -public class MapleRing implements Comparable { - private int ringId; - private int ringId2; - private int partnerId; - private int itemId; - private String partnerName; +public class Ring implements Comparable { + private final int ringId; + private final int ringId2; + private final int partnerId; + private final int itemId; + private final String partnerName; private boolean equipped = false; - public MapleRing(int id, int id2, int partnerId, int itemid, String partnername) { + public Ring(int id, int id2, int partnerId, int itemid, String partnername) { this.ringId = id; this.ringId2 = id2; this.partnerId = partnerId; @@ -50,15 +49,15 @@ public class MapleRing implements Comparable { this.partnerName = partnername; } - public static MapleRing loadFromDb(int ringId) { - MapleRing ret = null; + public static Ring loadFromDb(int ringId) { + Ring ret = null; try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM rings WHERE id = ?")) { ps.setInt(1, ringId); try (ResultSet rs = ps.executeQuery()) { if (rs.next()) { - ret = new MapleRing(ringId, rs.getInt("partnerRingId"), rs.getInt("partnerChrId"), rs.getInt("itemid"), rs.getString("partnerName")); + ret = new Ring(ringId, rs.getInt("partnerRingId"), rs.getInt("partnerChrId"), rs.getInt("itemid"), rs.getString("partnerName")); } } return ret; @@ -68,12 +67,12 @@ public class MapleRing implements Comparable { } } - public static void removeRing(final MapleRing ring) { + public static void removeRing(final Ring ring) { try { if (ring == null) { return; } - + try (Connection con = DatabaseConnection.getConnection()) { try (PreparedStatement ps = con.prepareStatement("DELETE FROM rings WHERE id=?")) { ps.setInt(1, ring.getRingId()); @@ -85,8 +84,8 @@ public class MapleRing implements Comparable { ps.executeBatch(); } - MapleCashidGenerator.freeCashId(ring.getRingId()); - MapleCashidGenerator.freeCashId(ring.getPartnerRingId()); + CashIdGenerator.freeCashId(ring.getRingId()); + CashIdGenerator.freeCashId(ring.getPartnerRingId()); try (PreparedStatement ps = con.prepareStatement("UPDATE inventoryequipment SET ringid=-1 WHERE ringid=?")) { ps.setInt(1, ring.getRingId()); @@ -102,8 +101,8 @@ public class MapleRing implements Comparable { ex.printStackTrace(); } } - - public static Pair createRing(int itemid, final MapleCharacter partner1, final MapleCharacter partner2) { + + public static Pair createRing(int itemid, final Character partner1, final Character partner2) { try { if (partner1 == null) { return new Pair<>(-3, -3); @@ -112,8 +111,8 @@ public class MapleRing implements Comparable { } int[] ringID = new int[2]; - ringID[0] = MapleCashidGenerator.generateCashId(); - ringID[1] = MapleCashidGenerator.generateCashId(); + ringID[0] = CashIdGenerator.generateCashId(); + ringID[1] = CashIdGenerator.generateCashId(); try (Connection con = DatabaseConnection.getConnection()) { try (PreparedStatement ps = con.prepareStatement("INSERT INTO rings (id, itemid, partnerRingId, partnerChrId, partnername) VALUES (?, ?, ?, ?, ?)")) { @@ -175,12 +174,8 @@ public class MapleRing implements Comparable { @Override public boolean equals(Object o) { - if (o instanceof MapleRing) { - if (((MapleRing) o).getRingId() == getRingId()) { - return true; - } else { - return false; - } + if (o instanceof Ring) { + return ((Ring) o).getRingId() == getRingId(); } return false; } @@ -193,7 +188,7 @@ public class MapleRing implements Comparable { } @Override - public int compareTo(MapleRing other) { + public int compareTo(Ring other) { if (ringId < other.getRingId()) { return -1; } else if (ringId == other.getRingId()) { diff --git a/src/main/java/client/Skill.java b/src/main/java/client/Skill.java index 36643f8d98..95d1ab5062 100644 --- a/src/main/java/client/Skill.java +++ b/src/main/java/client/Skill.java @@ -21,14 +21,15 @@ */ package client; +import server.StatEffect; +import server.life.Element; + import java.util.ArrayList; import java.util.List; -import server.MapleStatEffect; -import server.life.Element; public class Skill { private int id; - private List effects = new ArrayList<>(); + private List effects = new ArrayList<>(); private Element element; private int animationTime; private int job; @@ -43,7 +44,7 @@ public class Skill { return id; } - public MapleStatEffect getEffect(int level) { + public StatEffect getEffect(int level) { return effects.get(level - 1); } @@ -93,7 +94,7 @@ public class Skill { return action; } - public void addLevelEffect(MapleStatEffect effect) { + public void addLevelEffect(StatEffect effect) { effects.add(effect); } } \ No newline at end of file diff --git a/src/main/java/client/SkillFactory.java b/src/main/java/client/SkillFactory.java index 4100e1552a..16dd09841d 100644 --- a/src/main/java/client/SkillFactory.java +++ b/src/main/java/client/SkillFactory.java @@ -24,7 +24,7 @@ package client; import constants.skills.*; import provider.*; import provider.wz.WZFiles; -import server.MapleStatEffect; +import server.StatEffect; import server.life.Element; import java.util.HashMap; @@ -32,7 +32,7 @@ import java.util.Map; public class SkillFactory { private static volatile Map skills = new HashMap<>(); - private static final MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(WZFiles.SKILL); + private static final DataProvider datasource = DataProviderFactory.getDataProvider(WZFiles.SKILL); public static Skill getSkill(int id) { return skills.get(id); @@ -40,12 +40,12 @@ public class SkillFactory { public static void loadAllSkills() { final Map loadedSkills = new HashMap<>(); - final MapleDataDirectoryEntry root = datasource.getRoot(); - for (MapleDataFileEntry topDir : root.getFiles()) { // Loop thru jobs + final DataDirectoryEntry root = datasource.getRoot(); + for (DataFileEntry topDir : root.getFiles()) { // Loop thru jobs if (topDir.getName().length() <= 8) { - for (MapleData data : datasource.getData(topDir.getName())) { // Loop thru each jobs + for (Data data : datasource.getData(topDir.getName())) { // Loop thru each jobs if (data.getName().equals("skill")) { - for (MapleData data2 : data) { // Loop thru each jobs + for (Data data2 : data) { // Loop thru each jobs if (data2 != null) { int skillId = Integer.parseInt(data2.getName()); loadedSkills.put(skillId, loadFromData(skillId, data2)); @@ -59,23 +59,23 @@ public class SkillFactory { skills = loadedSkills; } - private static Skill loadFromData(int id, MapleData data) { + private static Skill loadFromData(int id, Data data) { Skill ret = new Skill(id); boolean isBuff = false; - int skillType = MapleDataTool.getInt("skillType", data, -1); - String elem = MapleDataTool.getString("elemAttr", data, null); + int skillType = DataTool.getInt("skillType", data, -1); + String elem = DataTool.getString("elemAttr", data, null); if (elem != null) { ret.setElement(Element.getFromChar(elem.charAt(0))); } else { ret.setElement(Element.NEUTRAL); } - MapleData effect = data.getChildByPath("effect"); + Data effect = data.getChildByPath("effect"); if (skillType != -1) { if (skillType == 2) { isBuff = true; } } else { - MapleData action_ = data.getChildByPath("action"); + Data action_ = data.getChildByPath("action"); boolean action = false; if (action_ == null) { if (data.getChildByPath("prepare/action") != null) { @@ -92,10 +92,10 @@ public class SkillFactory { action = true; } ret.setAction(action); - MapleData hit = data.getChildByPath("hit"); - MapleData ball = data.getChildByPath("ball"); + Data hit = data.getChildByPath("hit"); + Data ball = data.getChildByPath("ball"); isBuff = effect != null && hit == null && ball == null; - isBuff |= action_ != null && MapleDataTool.getString("0", action_, "").equals("alert2"); + isBuff |= action_ != null && DataTool.getString("0", action_, "").equals("alert2"); switch (id) { case Hero.RUSH: case Paladin.RUSH: @@ -317,20 +317,20 @@ public class SkillFactory { } } - for (MapleData level : data.getChildByPath("level")) { - ret.addLevelEffect(MapleStatEffect.loadSkillEffectFromData(level, id, isBuff)); + for (Data level : data.getChildByPath("level")) { + ret.addLevelEffect(StatEffect.loadSkillEffectFromData(level, id, isBuff)); } ret.setAnimationTime(0); if (effect != null) { - for (MapleData effectEntry : effect) { - ret.incAnimationTime(MapleDataTool.getIntConvert("delay", effectEntry, 0)); + for (Data effectEntry : effect) { + ret.incAnimationTime(DataTool.getIntConvert("delay", effectEntry, 0)); } } return ret; } public static String getSkillName(int skillid) { - MapleData data = MapleDataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img"); + Data data = DataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img"); StringBuilder skill = new StringBuilder(); skill.append(skillid); if (skill.length() == 4) { @@ -338,9 +338,9 @@ public class SkillFactory { skill.append("000").append(skillid); } if (data.getChildByPath(skill.toString()) != null) { - for (MapleData skilldata : data.getChildByPath(skill.toString()).getChildren()) { + for (Data skilldata : data.getChildByPath(skill.toString()).getChildren()) { if (skilldata.getName().equals("name")) - return MapleDataTool.getString(skilldata, null); + return DataTool.getString(skilldata, null); } } diff --git a/src/main/java/client/MapleSkinColor.java b/src/main/java/client/SkinColor.java similarity index 82% rename from src/main/java/client/MapleSkinColor.java rename to src/main/java/client/SkinColor.java index 7014c40bb9..9c16ad0cc7 100644 --- a/src/main/java/client/MapleSkinColor.java +++ b/src/main/java/client/SkinColor.java @@ -21,11 +21,19 @@ */ package client; -public enum MapleSkinColor { - NORMAL(0), DARK(1), BLACK(2), PALE(3), BLUE(4), GREEN(5), WHITE(9), PINK(10); +public enum SkinColor { + NORMAL(0), + DARK(1), + BLACK(2), + PALE(3), + BLUE(4), + GREEN(5), + WHITE(9), + PINK(10); + final int id; - private MapleSkinColor(int id) { + SkinColor(int id) { this.id = id; } @@ -33,8 +41,8 @@ public enum MapleSkinColor { return id; } - public static MapleSkinColor getById(int id) { - for (MapleSkinColor l : MapleSkinColor.values()) { + public static SkinColor getById(int id) { + for (SkinColor l : SkinColor.values()) { if (l.getId() == id) { return l; } diff --git a/src/main/java/client/MapleStat.java b/src/main/java/client/Stat.java similarity index 91% rename from src/main/java/client/MapleStat.java rename to src/main/java/client/Stat.java index dcaea31167..940d5b139b 100644 --- a/src/main/java/client/MapleStat.java +++ b/src/main/java/client/Stat.java @@ -21,8 +21,7 @@ along with this program. If not, see . */ package client; -public enum MapleStat { - +public enum Stat { SKIN(0x1), FACE(0x2), HAIR(0x4), @@ -45,7 +44,7 @@ public enum MapleStat { GACHAEXP(0x200000); private final int i; - private MapleStat(int i) { + Stat(int i) { this.i = i; } @@ -53,8 +52,8 @@ public enum MapleStat { return i; } - public static MapleStat getByValue(int value) { - for (MapleStat stat : MapleStat.values()) { + public static Stat getByValue(int value) { + for (Stat stat : Stat.values()) { if (stat.getValue() == value) { return stat; } @@ -62,7 +61,7 @@ public enum MapleStat { return null; } - public static MapleStat getBy5ByteEncoding(int encoded) { + public static Stat getBy5ByteEncoding(int encoded) { switch (encoded) { case 64: return STR; @@ -76,7 +75,7 @@ public enum MapleStat { return null; } - public static MapleStat getByString(String type) { + public static Stat getByString(String type) { if (type.equals("SKIN")) { return SKIN; } else if (type.equals("FACE")) { diff --git a/src/main/java/client/autoban/AutobanFactory.java b/src/main/java/client/autoban/AutobanFactory.java index 481a7a0ee4..2fba4249a7 100644 --- a/src/main/java/client/autoban/AutobanFactory.java +++ b/src/main/java/client/autoban/AutobanFactory.java @@ -22,7 +22,7 @@ along with this program. If not, see . package client.autoban; -import client.MapleCharacter; +import client.Character; import config.YamlConfig; import net.packet.logging.MapleLogger; import net.server.Server; @@ -83,19 +83,19 @@ public enum AutobanFactory { ban.addPoint(this, reason); } - public void alert(MapleCharacter chr, String reason) { + public void alert(Character chr, String reason) { if(YamlConfig.config.server.USE_AUTOBAN == true) { if (chr != null && MapleLogger.ignored.contains(chr.getId())){ return; } - Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), PacketCreator.sendYellowTip((chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason)); + Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), PacketCreator.sendYellowTip((chr != null ? Character.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason)); } if (YamlConfig.config.server.USE_AUTOBAN_LOG) { - FilePrinter.print(FilePrinter.AUTOBAN_WARNING, (chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason); + FilePrinter.print(FilePrinter.AUTOBAN_WARNING, (chr != null ? Character.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason); } } - public void autoban(MapleCharacter chr, String value) { + public void autoban(Character chr, String value) { if(YamlConfig.config.server.USE_AUTOBAN == true) { chr.autoban("Autobanned for (" + this.name() + ": " + value + ")"); //chr.sendPolice("You will be disconnected for (" + this.name() + ": " + value + ")"); diff --git a/src/main/java/client/autoban/AutobanManager.java b/src/main/java/client/autoban/AutobanManager.java index e348fcfa29..1a3b782b20 100644 --- a/src/main/java/client/autoban/AutobanManager.java +++ b/src/main/java/client/autoban/AutobanManager.java @@ -5,7 +5,7 @@ package client.autoban; -import client.MapleCharacter; +import client.Character; import config.YamlConfig; import net.server.Server; import tools.FilePrinter; @@ -18,7 +18,7 @@ import java.util.Map; * @author kevintjuh93 */ public class AutobanManager { - private MapleCharacter chr; + private Character chr; private Map points = new HashMap<>(); private Map lastTime = new HashMap<>(); private int misses = 0; @@ -29,7 +29,7 @@ public class AutobanManager { private byte[] timestampcounter = new byte[20]; - public AutobanManager(MapleCharacter chr) { + public AutobanManager(Character chr) { this.chr = chr; } @@ -58,7 +58,7 @@ public class AutobanManager { } if (YamlConfig.config.server.USE_AUTOBAN_LOG) { // Lets log every single point too. - FilePrinter.print(FilePrinter.AUTOBAN_WARNING, MapleCharacter.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason); + FilePrinter.print(FilePrinter.AUTOBAN_WARNING, Character.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason); } } diff --git a/src/main/java/client/command/Command.java b/src/main/java/client/command/Command.java index fcbe89eb7c..79966530c6 100644 --- a/src/main/java/client/command/Command.java +++ b/src/main/java/client/command/Command.java @@ -23,14 +23,14 @@ */ package client.command; -import client.MapleClient; +import client.Client; public abstract class Command { protected int rank; protected String description; - public abstract void execute(MapleClient client, String[] params); + public abstract void execute(Client client, String[] params); public String getDescription() { return description; diff --git a/src/main/java/client/command/CommandsExecutor.java b/src/main/java/client/command/CommandsExecutor.java index a439dbbcb0..d80b48aac5 100644 --- a/src/main/java/client/command/CommandsExecutor.java +++ b/src/main/java/client/command/CommandsExecutor.java @@ -23,7 +23,7 @@ */ package client.command; -import client.MapleClient; +import client.Client; import client.command.commands.gm0.*; import client.command.commands.gm1.*; import client.command.commands.gm2.*; @@ -48,7 +48,7 @@ public class CommandsExecutor { private static final char USER_HEADING = '@'; private static final char GM_HEADING = '!'; - public static boolean isCommand(MapleClient client, String content){ + public static boolean isCommand(Client client, String content){ char heading = content.charAt(0); if (client.getPlayer().isGM()){ return heading == USER_HEADING || heading == GM_HEADING; @@ -74,7 +74,7 @@ public class CommandsExecutor { return commandsNameDesc; } - public void handle(MapleClient client, String message){ + public void handle(Client client, String message){ if (client.tryacquireClient()) { try { handleInternal(client, message); @@ -86,7 +86,7 @@ public class CommandsExecutor { } } - private void handleInternal(MapleClient client, String message){ + private void handleInternal(Client client, String message){ if (client.getPlayer().getMapId() == 300000012) { client.getPlayer().yellowMessage("You do not have permission to use commands while in jail."); return; @@ -121,7 +121,7 @@ public class CommandsExecutor { writeLog(client, message); } - private void writeLog(MapleClient client, String command){ + private void writeLog(Client client, String command){ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm"); FilePrinter.print(FilePrinter.USED_COMMANDS, client.getPlayer().getName() + " used: " + command + " on " + sdf.format(Calendar.getInstance().getTime())); diff --git a/src/main/java/client/command/commands/gm0/BuyBackCommand.java b/src/main/java/client/command/commands/gm0/BuyBackCommand.java index d63df2fe20..0fc257f5fb 100644 --- a/src/main/java/client/command/commands/gm0/BuyBackCommand.java +++ b/src/main/java/client/command/commands/gm0/BuyBackCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; import client.processor.action.BuybackProcessor; @@ -33,7 +33,7 @@ public class BuyBackCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { if (params.length < 1) { c.getPlayer().yellowMessage("Syntax: @buyback "); return; diff --git a/src/main/java/client/command/commands/gm0/ChangeLanguageCommand.java b/src/main/java/client/command/commands/gm0/ChangeLanguageCommand.java index df9cc0ecb7..d953d4c11a 100644 --- a/src/main/java/client/command/commands/gm0/ChangeLanguageCommand.java +++ b/src/main/java/client/command/commands/gm0/ChangeLanguageCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; public class ChangeLanguageCommand extends Command { @@ -32,7 +32,7 @@ public class ChangeLanguageCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { if (params.length < 1) { c.getPlayer().yellowMessage("Syntax: !changel <0=ptb, 1=esp, 2=eng>"); return; diff --git a/src/main/java/client/command/commands/gm0/DisposeCommand.java b/src/main/java/client/command/commands/gm0/DisposeCommand.java index 0593943e0f..091d434dfc 100644 --- a/src/main/java/client/command/commands/gm0/DisposeCommand.java +++ b/src/main/java/client/command/commands/gm0/DisposeCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; import scripting.npc.NPCScriptManager; import scripting.quest.QuestScriptManager; @@ -35,7 +35,7 @@ public class DisposeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { NPCScriptManager.getInstance().dispose(c); QuestScriptManager.getInstance().dispose(c); c.sendPacket(PacketCreator.enableActions()); diff --git a/src/main/java/client/command/commands/gm0/DropLimitCommand.java b/src/main/java/client/command/commands/gm0/DropLimitCommand.java index a344a06bcb..8bcdf92d02 100644 --- a/src/main/java/client/command/commands/gm0/DropLimitCommand.java +++ b/src/main/java/client/command/commands/gm0/DropLimitCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -33,7 +33,7 @@ public class DropLimitCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { int dropCount = c.getPlayer().getMap().getDroppedItemCount(); if(((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) { c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300); diff --git a/src/main/java/client/command/commands/gm0/EnableAuthCommand.java b/src/main/java/client/command/commands/gm0/EnableAuthCommand.java index 97f6ffd366..5ce7e71692 100644 --- a/src/main/java/client/command/commands/gm0/EnableAuthCommand.java +++ b/src/main/java/client/command/commands/gm0/EnableAuthCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; -import net.server.coordinator.login.MapleLoginBypassCoordinator; +import net.server.coordinator.login.LoginBypassCoordinator; public class EnableAuthCommand extends Command { { @@ -33,10 +33,10 @@ public class EnableAuthCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { if (c.tryacquireClient()) { try { - MapleLoginBypassCoordinator.getInstance().unregisterLoginBypassEntry(c.getHwid(), c.getAccID()); + LoginBypassCoordinator.getInstance().unregisterLoginBypassEntry(c.getHwid(), c.getAccID()); } finally { c.releaseClient(); } diff --git a/src/main/java/client/command/commands/gm0/EquipLvCommand.java b/src/main/java/client/command/commands/gm0/EquipLvCommand.java index 496fed1170..beafd307df 100644 --- a/src/main/java/client/command/commands/gm0/EquipLvCommand.java +++ b/src/main/java/client/command/commands/gm0/EquipLvCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; public class EquipLvCommand extends Command { @@ -32,7 +32,7 @@ public class EquipLvCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getPlayer().showAllEquipFeatures(); } } diff --git a/src/main/java/client/command/commands/gm0/GachaCommand.java b/src/main/java/client/command/commands/gm0/GachaCommand.java index 32de6eda95..95856616dc 100644 --- a/src/main/java/client/command/commands/gm0/GachaCommand.java +++ b/src/main/java/client/command/commands/gm0/GachaCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; -import server.MapleItemInformationProvider; -import server.gachapon.MapleGachapon; +import server.ItemInformationProvider; +import server.gachapon.Gachapon; public class GachaCommand extends Command { { @@ -34,8 +34,8 @@ public class GachaCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleGachapon.Gachapon gacha = null; + public void execute(Client c, String[] params) { + Gachapon.GachaponType gacha = null; String search = c.getPlayer().getLastCommandMessage(); String gachaName = ""; String [] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"}; @@ -43,7 +43,7 @@ public class GachaCommand extends Command { for (int i = 0; i < names.length; i++){ if (search.equalsIgnoreCase(names[i])){ gachaName = names[i]; - gacha = MapleGachapon.Gachapon.getByNpcId(ids[i]); + gacha = Gachapon.GachaponType.getByNpcId(ids[i]); } } if (gacha == null){ @@ -56,7 +56,7 @@ public class GachaCommand extends Command { String talkStr = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n"; for (int i = 0; i < 2; i++){ for (int id : gacha.getItems(i)){ - talkStr += "-" + MapleItemInformationProvider.getInstance().getName(id) + "\r\n"; + talkStr += "-" + ItemInformationProvider.getInstance().getName(id) + "\r\n"; } } talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here."; diff --git a/src/main/java/client/command/commands/gm0/GmCommand.java b/src/main/java/client/command/commands/gm0/GmCommand.java index 9c2a94105f..53810d3f4f 100644 --- a/src/main/java/client/command/commands/gm0/GmCommand.java +++ b/src/main/java/client/command/commands/gm0/GmCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import tools.FilePrinter; @@ -37,7 +37,7 @@ public class GmCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { String[] tips = { "Please only use @gm in emergencies or to report somebody.", "To report a bug or make a suggestion, use the forum.", @@ -45,15 +45,15 @@ public class GmCommand extends Command { "Do not ask if you can receive help, just state your issue.", "Do not say 'I have a bug to report', just state it.", }; - MapleCharacter player = c.getPlayer(); + Character player = c.getPlayer(); if (params.length < 1 || params[0].length() < 3) { // #goodbye 'hi' player.dropMessage(5, "Your message was too short. Please provide as much detail as possible."); return; } String message = player.getLastCommandMessage(); - Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.sendYellowTip("[GM Message]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); + Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.sendYellowTip("[GM Message]:" + Character.makeMapleReadable(player.getName()) + ": " + message)); Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.serverNotice(1, message)); - FilePrinter.printError(FilePrinter.COMMAND_GM, MapleCharacter.makeMapleReadable(player.getName()) + ": " + message); + FilePrinter.printError(FilePrinter.COMMAND_GM, Character.makeMapleReadable(player.getName()) + ": " + message); player.dropMessage(5, "Your message '" + message + "' was sent to GMs."); player.dropMessage(5, tips[Randomizer.nextInt(tips.length)]); } diff --git a/src/main/java/client/command/commands/gm0/HelpCommand.java b/src/main/java/client/command/commands/gm0/HelpCommand.java index f6a3b0bae9..2c32f1d80a 100644 --- a/src/main/java/client/command/commands/gm0/HelpCommand.java +++ b/src/main/java/client/command/commands/gm0/HelpCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; public class HelpCommand extends Command { @@ -32,7 +32,7 @@ public class HelpCommand extends Command { } @Override - public void execute(MapleClient client, String[] params) { + public void execute(Client client, String[] params) { client.getAbstractPlayerInteraction().openNpc(9201143, "commands"); } } diff --git a/src/main/java/client/command/commands/gm0/JoinEventCommand.java b/src/main/java/client/command/commands/gm0/JoinEventCommand.java index b0dc8e6be0..0a9b50b348 100644 --- a/src/main/java/client/command/commands/gm0/JoinEventCommand.java +++ b/src/main/java/client/command/commands/gm0/JoinEventCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.events.gm.MapleEvent; +import server.events.gm.Event; import server.maps.FieldLimit; public class JoinEventCommand extends Command { @@ -35,10 +35,10 @@ public class JoinEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if(!FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { - MapleEvent event = c.getChannelServer().getEvent(); + Event event = c.getChannelServer().getEvent(); if(event != null) { if(event.getMapId() != player.getMapId()) { if(event.getLimit() > 0) { diff --git a/src/main/java/client/command/commands/gm0/LeaveEventCommand.java b/src/main/java/client/command/commands/gm0/LeaveEventCommand.java index c8c5ef215d..d1457efa33 100644 --- a/src/main/java/client/command/commands/gm0/LeaveEventCommand.java +++ b/src/main/java/client/command/commands/gm0/LeaveEventCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class LeaveEventCommand extends Command { @@ -33,8 +33,8 @@ public class LeaveEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int returnMap = player.getSavedLocation("EVENT"); if(returnMap != -1) { if(player.getOla() != null) { diff --git a/src/main/java/client/command/commands/gm0/MapOwnerClaimCommand.java b/src/main/java/client/command/commands/gm0/MapOwnerClaimCommand.java index 18f74f02aa..960f0c82dd 100644 --- a/src/main/java/client/command/commands/gm0/MapOwnerClaimCommand.java +++ b/src/main/java/client/command/commands/gm0/MapOwnerClaimCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; import server.maps.MapleMap; @@ -35,10 +35,10 @@ public class MapOwnerClaimCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { if (c.tryacquireClient()) { try { - MapleCharacter chr = c.getPlayer(); + Character chr = c.getPlayer(); if (YamlConfig.config.server.USE_MAP_OWNERSHIP_SYSTEM) { if (chr.getEventInstance() == null) { diff --git a/src/main/java/client/command/commands/gm0/OnlineCommand.java b/src/main/java/client/command/commands/gm0/OnlineCommand.java index 683ac3e4ad..1b9a2f7e10 100644 --- a/src/main/java/client/command/commands/gm0/OnlineCommand.java +++ b/src/main/java/client/command/commands/gm0/OnlineCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.channel.Channel; @@ -35,13 +35,13 @@ public class OnlineCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) { player.yellowMessage("Players in Channel " + ch.getId() + ":"); - for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { + for (Character chr : ch.getPlayerStorage().getAllCharacters()) { if (!chr.isGM()) { - player.message(" >> " + MapleCharacter.makeMapleReadable(chr.getName()) + " is at " + chr.getMap().getMapName() + "."); + player.message(" >> " + Character.makeMapleReadable(chr.getName()) + " is at " + chr.getMap().getMapName() + "."); } } } diff --git a/src/main/java/client/command/commands/gm0/RanksCommand.java b/src/main/java/client/command/commands/gm0/RanksCommand.java index 8e517fae34..55a66364ce 100644 --- a/src/main/java/client/command/commands/gm0/RanksCommand.java +++ b/src/main/java/client/command/commands/gm0/RanksCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.guild.GuildPackets; @@ -38,8 +38,8 @@ public class RanksCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); List> worldRanking = Server.getInstance().getWorldPlayerRanking(player.getWorld()); player.sendPacket(GuildPackets.showPlayerRanks(9010000, worldRanking)); diff --git a/src/main/java/client/command/commands/gm0/RatesCommand.java b/src/main/java/client/command/commands/gm0/RatesCommand.java index 6052922a67..00f14cddfa 100644 --- a/src/main/java/client/command/commands/gm0/RatesCommand.java +++ b/src/main/java/client/command/commands/gm0/RatesCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class RatesCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); // travel rates not applicable since it's intrinsically a server/environment rate rather than a character rate String showMsg_ = "#eCHARACTER RATES#n" + "\r\n\r\n"; diff --git a/src/main/java/client/command/commands/gm0/ReadPointsCommand.java b/src/main/java/client/command/commands/gm0/ReadPointsCommand.java index f05ab1666d..e71afb2269 100644 --- a/src/main/java/client/command/commands/gm0/ReadPointsCommand.java +++ b/src/main/java/client/command/commands/gm0/ReadPointsCommand.java @@ -1,7 +1,7 @@ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class ReadPointsCommand extends Command { @@ -10,9 +10,9 @@ public class ReadPointsCommand extends Command { } @Override - public void execute(MapleClient client, String[] params) { + public void execute(Client client, String[] params) { - MapleCharacter player = client.getPlayer(); + Character player = client.getPlayer(); if (params.length > 2) { player.yellowMessage("Syntax: @points (rp|vp|all)"); return; diff --git a/src/main/java/client/command/commands/gm0/ReportBugCommand.java b/src/main/java/client/command/commands/gm0/ReportBugCommand.java index 7085dc730d..dc2f539dba 100644 --- a/src/main/java/client/command/commands/gm0/ReportBugCommand.java +++ b/src/main/java/client/command/commands/gm0/ReportBugCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import tools.FilePrinter; @@ -36,17 +36,17 @@ public class ReportBugCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Message too short and not sent. Please do @bug "); return; } String message = player.getLastCommandMessage(); - Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.sendYellowTip("[Bug]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); + Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.sendYellowTip("[Bug]:" + Character.makeMapleReadable(player.getName()) + ": " + message)); Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.serverNotice(1, message)); - FilePrinter.printError(FilePrinter.COMMAND_BUG, MapleCharacter.makeMapleReadable(player.getName()) + ": " + message); + FilePrinter.printError(FilePrinter.COMMAND_BUG, Character.makeMapleReadable(player.getName()) + ": " + message); player.dropMessage(5, "Your bug '" + message + "' was submitted successfully to our developers. Thank you!"); } diff --git a/src/main/java/client/command/commands/gm0/ShowRatesCommand.java b/src/main/java/client/command/commands/gm0/ShowRatesCommand.java index 4ab627330b..6dd5c93b78 100644 --- a/src/main/java/client/command/commands/gm0/ShowRatesCommand.java +++ b/src/main/java/client/command/commands/gm0/ShowRatesCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class ShowRatesCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); String showMsg = "#eEXP RATE#n" + "\r\n"; showMsg += "World EXP Rate: #k" + c.getWorldServer().getExpRate() + "x#k" + "\r\n"; showMsg += "Player EXP Rate: #k" + player.getRawExpRate() + "x#k" + "\r\n"; diff --git a/src/main/java/client/command/commands/gm0/StaffCommand.java b/src/main/java/client/command/commands/gm0/StaffCommand.java index 465b455f3e..0ebc6d0e59 100644 --- a/src/main/java/client/command/commands/gm0/StaffCommand.java +++ b/src/main/java/client/command/commands/gm0/StaffCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; public class StaffCommand extends Command { @@ -32,7 +32,7 @@ public class StaffCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getAbstractPlayerInteraction().openNpc(2010007, "credits"); } } diff --git a/src/main/java/client/command/commands/gm0/StatDexCommand.java b/src/main/java/client/command/commands/gm0/StatDexCommand.java index fa93c26a8e..59660c1a9b 100644 --- a/src/main/java/client/command/commands/gm0/StatDexCommand.java +++ b/src/main/java/client/command/commands/gm0/StatDexCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class StatDexCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int remainingAp = player.getRemainingAp(); int amount; diff --git a/src/main/java/client/command/commands/gm0/StatIntCommand.java b/src/main/java/client/command/commands/gm0/StatIntCommand.java index b40e4581ac..abfb761e71 100644 --- a/src/main/java/client/command/commands/gm0/StatIntCommand.java +++ b/src/main/java/client/command/commands/gm0/StatIntCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class StatIntCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int remainingAp = player.getRemainingAp(); int amount; diff --git a/src/main/java/client/command/commands/gm0/StatLukCommand.java b/src/main/java/client/command/commands/gm0/StatLukCommand.java index 4d7718eb89..20cab06e2d 100644 --- a/src/main/java/client/command/commands/gm0/StatLukCommand.java +++ b/src/main/java/client/command/commands/gm0/StatLukCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class StatLukCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int remainingAp = player.getRemainingAp(); int amount; diff --git a/src/main/java/client/command/commands/gm0/StatStrCommand.java b/src/main/java/client/command/commands/gm0/StatStrCommand.java index c83fdac3b4..128ce5a825 100644 --- a/src/main/java/client/command/commands/gm0/StatStrCommand.java +++ b/src/main/java/client/command/commands/gm0/StatStrCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm0; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class StatStrCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int remainingAp = player.getRemainingAp(); int amount; if (params.length > 0) { diff --git a/src/main/java/client/command/commands/gm0/TimeCommand.java b/src/main/java/client/command/commands/gm0/TimeCommand.java index 5d80f02c84..69990f5c80 100644 --- a/src/main/java/client/command/commands/gm0/TimeCommand.java +++ b/src/main/java/client/command/commands/gm0/TimeCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; import java.text.DateFormat; @@ -37,7 +37,7 @@ public class TimeCommand extends Command { } @Override - public void execute(MapleClient client, String[] params) { + public void execute(Client client, String[] params) { DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); dateFormat.setTimeZone(TimeZone.getDefault()); client.getPlayer().yellowMessage("Cosmic Server Time: " + dateFormat.format(new Date())); diff --git a/src/main/java/client/command/commands/gm0/ToggleExpCommand.java b/src/main/java/client/command/commands/gm0/ToggleExpCommand.java index 5e7d466718..42ff35c9db 100644 --- a/src/main/java/client/command/commands/gm0/ToggleExpCommand.java +++ b/src/main/java/client/command/commands/gm0/ToggleExpCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; public class ToggleExpCommand extends Command { @@ -32,7 +32,7 @@ public class ToggleExpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { if (c.tryacquireClient()) { try { c.getPlayer().toggleExpGain(); // Vcoc's idea diff --git a/src/main/java/client/command/commands/gm0/UptimeCommand.java b/src/main/java/client/command/commands/gm0/UptimeCommand.java index db98755aa5..75fece3174 100644 --- a/src/main/java/client/command/commands/gm0/UptimeCommand.java +++ b/src/main/java/client/command/commands/gm0/UptimeCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm0; -import client.MapleClient; +import client.Client; import client.command.Command; import net.server.Server; @@ -33,7 +33,7 @@ public class UptimeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { long milliseconds = System.currentTimeMillis() - Server.uptime; int seconds = (int) (milliseconds / 1000) % 60 ; int minutes = (int) ((milliseconds / (1000*60)) % 60); diff --git a/src/main/java/client/command/commands/gm1/BossHpCommand.java b/src/main/java/client/command/commands/gm1/BossHpCommand.java index da24831dd1..930528d2a8 100644 --- a/src/main/java/client/command/commands/gm1/BossHpCommand.java +++ b/src/main/java/client/command/commands/gm1/BossHpCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleMonster; +import server.life.Monster; public class BossHpCommand extends Command { { @@ -34,9 +34,9 @@ public class BossHpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for(MapleMonster monster : player.getMap().getAllMonsters()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for(Monster monster : player.getMap().getAllMonsters()) { if(monster != null && monster.isBoss() && monster.getHp() > 0) { long percent = monster.getHp() * 100L / monster.getMaxHp(); String bar = "["; diff --git a/src/main/java/client/command/commands/gm1/BuffMeCommand.java b/src/main/java/client/command/commands/gm1/BuffMeCommand.java index ae9629d9e0..ce2afba245 100644 --- a/src/main/java/client/command/commands/gm1/BuffMeCommand.java +++ b/src/main/java/client/command/commands/gm1/BuffMeCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.SkillFactory; import client.command.Command; @@ -34,8 +34,8 @@ public class BuffMeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(player); SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(player); SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(player); diff --git a/src/main/java/client/command/commands/gm1/GotoCommand.java b/src/main/java/client/command/commands/gm1/GotoCommand.java index 3568bd8250..83d0725b78 100644 --- a/src/main/java/client/command/commands/gm1/GotoCommand.java +++ b/src/main/java/client/command/commands/gm1/GotoCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import constants.game.GameConstants; import server.maps.*; @@ -47,13 +47,13 @@ public class GotoCommand extends Command { // thanks shavit for noticing goto areas getting loaded from wz needlessly only for the name retrieval for (Map.Entry e : towns) { - GOTO_TOWNS_INFO += ("'" + e.getKey() + "' - #b" + (MapleMapFactory.loadPlaceName(e.getValue())) + "#k\r\n"); + GOTO_TOWNS_INFO += ("'" + e.getKey() + "' - #b" + (MapFactory.loadPlaceName(e.getValue())) + "#k\r\n"); } List> areas = new ArrayList<>(GameConstants.GOTO_AREAS.entrySet()); sortGotoEntries(areas); for (Map.Entry e : areas) { - GOTO_AREAS_INFO += ("'" + e.getKey() + "' - #b" + (MapleMapFactory.loadPlaceName(e.getValue())) + "#k\r\n"); + GOTO_AREAS_INFO += ("'" + e.getKey() + "' - #b" + (MapFactory.loadPlaceName(e.getValue())) + "#k\r\n"); } } catch (Exception e) { e.printStackTrace(); @@ -72,8 +72,8 @@ public class GotoCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1){ String sendStr = "Syntax: #b@goto #k. Available areas:\r\n\r\n#rTowns:#k\r\n" + GOTO_TOWNS_INFO; if (player.isGM()) { @@ -90,7 +90,7 @@ public class GotoCommand extends Command { } if (!player.isGM()) { - if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { + if (player.getEventInstance() != null || MiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { player.dropMessage(1, "This command can not be used in this map."); return; } @@ -108,7 +108,7 @@ public class GotoCommand extends Command { MapleMap target = c.getChannelServer().getMapFactory().getMap(gotomaps.get(params[0])); // expedition issue with this command detected thanks to Masterrulax - MaplePortal targetPortal = target.getRandomPlayerSpawnpoint(); + Portal targetPortal = target.getRandomPlayerSpawnpoint(); player.saveLocationOnWarp(); player.changeMap(target, targetPortal); } else { diff --git a/src/main/java/client/command/commands/gm1/MobHpCommand.java b/src/main/java/client/command/commands/gm1/MobHpCommand.java index 085cba6cd0..9db3a19a4b 100644 --- a/src/main/java/client/command/commands/gm1/MobHpCommand.java +++ b/src/main/java/client/command/commands/gm1/MobHpCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleMonster; +import server.life.Monster; public class MobHpCommand extends Command { { @@ -34,9 +34,9 @@ public class MobHpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for(MapleMonster monster : player.getMap().getAllMonsters()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for(Monster monster : player.getMap().getAllMonsters()) { if (monster != null && monster.getHp() > 0) { player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP."); diff --git a/src/main/java/client/command/commands/gm1/WhatDropsFromCommand.java b/src/main/java/client/command/commands/gm1/WhatDropsFromCommand.java index 8b502268fc..1f00375b58 100644 --- a/src/main/java/client/command/commands/gm1/WhatDropsFromCommand.java +++ b/src/main/java/client/command/commands/gm1/WhatDropsFromCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.MapleItemInformationProvider; -import server.life.MapleMonsterInformationProvider; +import server.ItemInformationProvider; import server.life.MonsterDropEntry; +import server.life.MonsterInformationProvider; import tools.Pair; import java.util.Iterator; @@ -39,8 +39,8 @@ public class WhatDropsFromCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Please do @whatdropsfrom "); return; @@ -48,20 +48,20 @@ public class WhatDropsFromCommand extends Command { String monsterName = player.getLastCommandMessage(); String output = ""; int limit = 3; - Iterator> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator(); + Iterator> listIterator = MonsterInformationProvider.getMobsIDsFromName(monsterName).iterator(); for (int i = 0; i < limit; i++) { if(listIterator.hasNext()) { Pair data = listIterator.next(); int mobId = data.getLeft(); String mobName = data.getRight(); output += mobName + " drops the following items:\r\n\r\n"; - for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){ + for (MonsterDropEntry drop : MonsterInformationProvider.getInstance().retrieveDrop(mobId)){ try { - String name = MapleItemInformationProvider.getInstance().getName(drop.itemId); + String name = ItemInformationProvider.getInstance().getName(drop.itemId); if (name == null || name.equals("null") || drop.chance == 0){ continue; } - float chance = Math.max(1000000 / drop.chance / (!MapleMonsterInformationProvider.getInstance().isBoss(mobId) ? player.getDropRate() : player.getBossDropRate()), 1); + float chance = Math.max(1000000 / drop.chance / (!MonsterInformationProvider.getInstance().isBoss(mobId) ? player.getDropRate() : player.getBossDropRate()), 1); output += "- " + name + " (1/" + (int) chance + ")\r\n"; } catch (Exception ex){ ex.printStackTrace(); diff --git a/src/main/java/client/command/commands/gm1/WhoDropsCommand.java b/src/main/java/client/command/commands/gm1/WhoDropsCommand.java index c26c72acbf..42cfad698c 100644 --- a/src/main/java/client/command/commands/gm1/WhoDropsCommand.java +++ b/src/main/java/client/command/commands/gm1/WhoDropsCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm1; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.MapleItemInformationProvider; -import server.life.MapleMonsterInformationProvider; +import server.ItemInformationProvider; +import server.life.MonsterInformationProvider; import tools.DatabaseConnection; import tools.Pair; @@ -42,8 +42,8 @@ public class WhoDropsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Please do @whodrops "); return; @@ -53,7 +53,7 @@ public class WhoDropsCommand extends Command { try { String searchString = player.getLastCommandMessage(); String output = ""; - Iterator> listIterator = MapleItemInformationProvider.getInstance().getItemDataByName(searchString).iterator(); + Iterator> listIterator = ItemInformationProvider.getInstance().getItemDataByName(searchString).iterator(); if (listIterator.hasNext()) { int count = 1; while (listIterator.hasNext() && count <= 3) { @@ -65,7 +65,7 @@ public class WhoDropsCommand extends Command { try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - String resultName = MapleMonsterInformationProvider.getInstance().getMobNameFromId(rs.getInt("dropperid")); + String resultName = MonsterInformationProvider.getInstance().getMobNameFromId(rs.getInt("dropperid")); if (resultName != null) { output += resultName + ", "; } diff --git a/src/main/java/client/command/commands/gm2/ApCommand.java b/src/main/java/client/command/commands/gm2/ApCommand.java index d8891d6f3b..ca08e7f24c 100644 --- a/src/main/java/client/command/commands/gm2/ApCommand.java +++ b/src/main/java/client/command/commands/gm2/ApCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class ApCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !ap [] "); return; @@ -48,7 +48,7 @@ public class ApCommand extends Command { player.changeRemainingAp(newAp, false); } else { - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { int newAp = Integer.parseInt(params[1]); if (newAp < 0) newAp = 0; diff --git a/src/main/java/client/command/commands/gm2/BombCommand.java b/src/main/java/client/command/commands/gm2/BombCommand.java index 46d3f36f5a..9ba92f3274 100644 --- a/src/main/java/client/command/commands/gm2/BombCommand.java +++ b/src/main/java/client/command/commands/gm2/BombCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +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 { @@ -36,18 +36,18 @@ public class BombCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length > 0) { - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[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()); } } } diff --git a/src/main/java/client/command/commands/gm2/BuffCommand.java b/src/main/java/client/command/commands/gm2/BuffCommand.java index efd8fc97aa..ed18d151c1 100644 --- a/src/main/java/client/command/commands/gm2/BuffCommand.java +++ b/src/main/java/client/command/commands/gm2/BuffCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.Skill; import client.SkillFactory; import client.command.Command; @@ -35,8 +35,8 @@ public class BuffCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !buff "); return; diff --git a/src/main/java/client/command/commands/gm2/BuffMapCommand.java b/src/main/java/client/command/commands/gm2/BuffMapCommand.java index 7cce5456d0..c1433d30c8 100644 --- a/src/main/java/client/command/commands/gm2/BuffMapCommand.java +++ b/src/main/java/client/command/commands/gm2/BuffMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.SkillFactory; import client.command.Command; @@ -34,8 +34,8 @@ public class BuffMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(player, true); SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(player, true); SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(player, true); diff --git a/src/main/java/client/command/commands/gm2/ClearDropsCommand.java b/src/main/java/client/command/commands/gm2/ClearDropsCommand.java index d2c19b69ae..05c8e009fa 100644 --- a/src/main/java/client/command/commands/gm2/ClearDropsCommand.java +++ b/src/main/java/client/command/commands/gm2/ClearDropsCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class ClearDropsCommand extends Command { @@ -33,8 +33,8 @@ public class ClearDropsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); player.getMap().clearDrops(player); player.dropMessage(5, "Cleared dropped items"); } diff --git a/src/main/java/client/command/commands/gm2/ClearSavedLocationsCommand.java b/src/main/java/client/command/commands/gm2/ClearSavedLocationsCommand.java index a6f152c50a..2fd76f829b 100644 --- a/src/main/java/client/command/commands/gm2/ClearSavedLocationsCommand.java +++ b/src/main/java/client/command/commands/gm2/ClearSavedLocationsCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.SavedLocationType; @@ -34,8 +34,8 @@ public class ClearSavedLocationsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(), victim; + public void execute(Client c, String[] params) { + Character player = c.getPlayer(), victim; if (params.length > 0) { victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); diff --git a/src/main/java/client/command/commands/gm2/ClearSlotCommand.java b/src/main/java/client/command/commands/gm2/ClearSlotCommand.java index a8e1e87ed7..e53ef46090 100644 --- a/src/main/java/client/command/commands/gm2/ClearSlotCommand.java +++ b/src/main/java/client/command/commands/gm2/ClearSlotCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; +import client.inventory.InventoryType; import client.inventory.Item; -import client.inventory.MapleInventoryType; -import client.inventory.manipulator.MapleInventoryManipulator; +import client.inventory.manipulator.InventoryManipulator; public class ClearSlotCommand extends Command { { @@ -36,8 +36,8 @@ public class ClearSlotCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !clearslot "); return; @@ -46,79 +46,79 @@ public class ClearSlotCommand extends Command { switch (type) { case "all": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false); } for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false); } for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false); } for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false); } for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("All Slots Cleared."); break; case "equip": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("Equipment Slot Cleared."); break; case "use": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("Use Slot Cleared."); break; case "setup": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("Set-Up Slot Cleared."); break; case "etc": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("ETC Slot Cleared."); break; case "cash": for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); + Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i); if (tempItem == null) continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false); + InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false); } player.yellowMessage("Cash Slot Cleared."); break; diff --git a/src/main/java/client/command/commands/gm2/DcCommand.java b/src/main/java/client/command/commands/gm2/DcCommand.java index ef333e9981..1ae5f093d3 100644 --- a/src/main/java/client/command/commands/gm2/DcCommand.java +++ b/src/main/java/client/command/commands/gm2/DcCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class DcCommand extends Command { @@ -33,14 +33,14 @@ public class DcCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !dc "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { diff --git a/src/main/java/client/command/commands/gm2/EmpowerMeCommand.java b/src/main/java/client/command/commands/gm2/EmpowerMeCommand.java index a02c8dcfa3..58c52b9b47 100644 --- a/src/main/java/client/command/commands/gm2/EmpowerMeCommand.java +++ b/src/main/java/client/command/commands/gm2/EmpowerMeCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.SkillFactory; import client.command.Command; @@ -34,8 +34,8 @@ public class EmpowerMeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); final int[] array = {2311003, 2301004, 1301007, 4101004, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002}; for (int i : array) { SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(player); diff --git a/src/main/java/client/command/commands/gm2/GachaListCommand.java b/src/main/java/client/command/commands/gm2/GachaListCommand.java index dbd06fa38f..4c7b416857 100644 --- a/src/main/java/client/command/commands/gm2/GachaListCommand.java +++ b/src/main/java/client/command/commands/gm2/GachaListCommand.java @@ -19,7 +19,7 @@ */ package client.command.commands.gm2; -import client.MapleClient; +import client.Client; import client.command.Command; /** @@ -32,7 +32,7 @@ public class GachaListCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getAbstractPlayerInteraction().openNpc(10000, "gachaponInfo"); } } diff --git a/src/main/java/client/command/commands/gm2/GmShopCommand.java b/src/main/java/client/command/commands/gm2/GmShopCommand.java index dd9cfd6043..ea286f3261 100644 --- a/src/main/java/client/command/commands/gm2/GmShopCommand.java +++ b/src/main/java/client/command/commands/gm2/GmShopCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm2; -import client.MapleClient; +import client.Client; import client.command.Command; -import server.MapleShopFactory; +import server.ShopFactory; public class GmShopCommand extends Command { { @@ -33,7 +33,7 @@ public class GmShopCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleShopFactory.getInstance().getShop(1337).sendShop(c); + public void execute(Client c, String[] params) { + ShopFactory.getInstance().getShop(1337).sendShop(c); } } diff --git a/src/main/java/client/command/commands/gm2/HealCommand.java b/src/main/java/client/command/commands/gm2/HealCommand.java index 71356dc5ff..620c7ddf06 100644 --- a/src/main/java/client/command/commands/gm2/HealCommand.java +++ b/src/main/java/client/command/commands/gm2/HealCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class HealCommand extends Command { @@ -33,8 +33,8 @@ public class HealCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); player.healHpMp(); } diff --git a/src/main/java/client/command/commands/gm2/HideCommand.java b/src/main/java/client/command/commands/gm2/HideCommand.java index d806c97879..33a5f9b2c3 100644 --- a/src/main/java/client/command/commands/gm2/HideCommand.java +++ b/src/main/java/client/command/commands/gm2/HideCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.SkillFactory; import client.command.Command; @@ -34,8 +34,8 @@ public class HideCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); } diff --git a/src/main/java/client/command/commands/gm2/IdCommand.java b/src/main/java/client/command/commands/gm2/IdCommand.java index d37d84f4a8..4896357499 100644 --- a/src/main/java/client/command/commands/gm2/IdCommand.java +++ b/src/main/java/client/command/commands/gm2/IdCommand.java @@ -1,7 +1,7 @@ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.ThreadManager; import tools.exceptions.IdTypeNotSupportedException; @@ -30,8 +30,8 @@ public class IdCommand extends Command { } @Override - public void execute(MapleClient client, final String[] params) { - final MapleCharacter player = client.getPlayer(); + public void execute(Client client, final String[] params) { + final Character player = client.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !id "); return; diff --git a/src/main/java/client/command/commands/gm2/ItemCommand.java b/src/main/java/client/command/commands/gm2/ItemCommand.java index 452e8babc6..f1e696f76d 100644 --- a/src/main/java/client/command/commands/gm2/ItemCommand.java +++ b/src/main/java/client/command/commands/gm2/ItemCommand.java @@ -23,14 +23,14 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import client.inventory.MaplePet; -import client.inventory.manipulator.MapleInventoryManipulator; +import client.inventory.Pet; +import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class ItemCommand extends Command { { @@ -38,8 +38,8 @@ public class ItemCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !item "); @@ -47,7 +47,7 @@ public class ItemCommand extends Command { } int itemId = Integer.parseInt(params[0]); - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + ItemInformationProvider ii = ItemInformationProvider.getInstance(); if(ii.getName(itemId) == null) { player.yellowMessage("Item id '" + params[0] + "' does not exist."); @@ -67,9 +67,9 @@ public class ItemCommand extends Command { quantity = 1; long days = Math.max(1, Integer.parseInt(params[1])); long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000); - int petid = MaplePet.createPet(itemId); + int petid = Pet.createPet(itemId); - MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration); + InventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration); return; } else { player.yellowMessage("Pet Syntax: !item "); @@ -83,6 +83,6 @@ public class ItemCommand extends Command { flag |= ItemConstants.UNTRADEABLE; } - MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1); + InventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1); } } diff --git a/src/main/java/client/command/commands/gm2/ItemDropCommand.java b/src/main/java/client/command/commands/gm2/ItemDropCommand.java index 2b58ecd421..c276f6477c 100644 --- a/src/main/java/client/command/commands/gm2/ItemDropCommand.java +++ b/src/main/java/client/command/commands/gm2/ItemDropCommand.java @@ -23,15 +23,15 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; +import client.inventory.InventoryType; import client.inventory.Item; -import client.inventory.MapleInventoryType; -import client.inventory.MaplePet; +import client.inventory.Pet; import config.YamlConfig; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class ItemDropCommand extends Command { { @@ -39,8 +39,8 @@ public class ItemDropCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !drop "); @@ -48,7 +48,7 @@ public class ItemDropCommand extends Command { } int itemId = Integer.parseInt(params[0]); - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + ItemInformationProvider ii = ItemInformationProvider.getInstance(); if(ii.getName(itemId) == null) { player.yellowMessage("Item id '" + params[0] + "' does not exist."); @@ -68,7 +68,7 @@ public class ItemDropCommand extends Command { quantity = 1; long days = Math.max(1, Integer.parseInt(params[1])); long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000); - int petid = MaplePet.createPet(itemId); + int petid = Pet.createPet(itemId); Item toDrop = new Item(itemId, (short) 0, quantity, petid); toDrop.setExpiration(expiration); @@ -94,7 +94,7 @@ public class ItemDropCommand extends Command { } Item toDrop; - if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) { + if (ItemConstants.getInventoryType(itemId) == InventoryType.EQUIP) { toDrop = ii.getEquipById(itemId); } else { toDrop = new Item(itemId, (short) 0, quantity); diff --git a/src/main/java/client/command/commands/gm2/JailCommand.java b/src/main/java/client/command/commands/gm2/JailCommand.java index 55c5ae82f7..0219229741 100644 --- a/src/main/java/client/command/commands/gm2/JailCommand.java +++ b/src/main/java/client/command/commands/gm2/JailCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; -import server.maps.MaplePortal; +import server.maps.Portal; public class JailCommand extends Command { { @@ -35,8 +35,8 @@ public class JailCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !jail []"); return; @@ -51,7 +51,7 @@ public class JailCommand extends Command { } } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.addJailExpirationTime(minutesJailed * 60 * 1000); @@ -59,7 +59,7 @@ public class JailCommand extends Command { if (victim.getMapId() != mapid) { // those gone to jail won't be changing map anyway MapleMap target = c.getChannelServer().getMapFactory().getMap(mapid); - MaplePortal targetPortal = target.getPortal(0); + Portal targetPortal = target.getPortal(0); victim.saveLocationOnWarp(); victim.changeMap(target, targetPortal); player.message(victim.getName() + " was jailed for " + minutesJailed + " minutes."); diff --git a/src/main/java/client/command/commands/gm2/JobCommand.java b/src/main/java/client/command/commands/gm2/JobCommand.java index 7edf328f17..c233499e40 100644 --- a/src/main/java/client/command/commands/gm2/JobCommand.java +++ b/src/main/java/client/command/commands/gm2/JobCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleJob; +import client.Character; +import client.Client; +import client.Job; import client.command.Command; public class JobCommand extends Command { @@ -34,8 +34,8 @@ public class JobCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length == 1) { int jobid = Integer.parseInt(params[0]); if (jobid < 0 || jobid >= 2200) { @@ -43,10 +43,10 @@ public class JobCommand extends Command { return; } - player.changeJob(MapleJob.getById(jobid)); + player.changeJob(Job.getById(jobid)); player.equipChanged(); } else if (params.length == 2) { - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { int jobid = Integer.parseInt(params[1]); @@ -55,7 +55,7 @@ public class JobCommand extends Command { return; } - victim.changeJob(MapleJob.getById(jobid)); + victim.changeJob(Job.getById(jobid)); player.equipChanged(); } else { player.message("Player '" + params[0] + "' could not be found."); diff --git a/src/main/java/client/command/commands/gm2/LevelCommand.java b/src/main/java/client/command/commands/gm2/LevelCommand.java index 6074fb4161..65e4051f96 100644 --- a/src/main/java/client/command/commands/gm2/LevelCommand.java +++ b/src/main/java/client/command/commands/gm2/LevelCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class LevelCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !level "); return; diff --git a/src/main/java/client/command/commands/gm2/LevelProCommand.java b/src/main/java/client/command/commands/gm2/LevelProCommand.java index 4a86e7e017..20afd63b50 100644 --- a/src/main/java/client/command/commands/gm2/LevelProCommand.java +++ b/src/main/java/client/command/commands/gm2/LevelProCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class LevelProCommand extends Command { @@ -33,8 +33,8 @@ public class LevelProCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !levelpro "); return; diff --git a/src/main/java/client/command/commands/gm2/LootCommand.java b/src/main/java/client/command/commands/gm2/LootCommand.java index 845962ebf7..6ad115e34d 100644 --- a/src/main/java/client/command/commands/gm2/LootCommand.java +++ b/src/main/java/client/command/commands/gm2/LootCommand.java @@ -23,13 +23,14 @@ */ package client.command.commands.gm2; -import client.MapleClient; +import client.Client; import client.command.Command; +import server.maps.MapItem; +import server.maps.MapObject; +import server.maps.MapObjectType; + import java.util.Arrays; import java.util.List; -import server.maps.MapleMapItem; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; public class LootCommand extends Command { @@ -38,10 +39,10 @@ public class LootCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - List items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : items) { - MapleMapItem mapItem = (MapleMapItem) item; + public void execute(Client c, String[] params) { + List items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM)); + for (MapObject item : items) { + MapItem mapItem = (MapItem) item; if (mapItem.getOwnerId() == c.getPlayer().getId() || mapItem.getOwnerId() == c.getPlayer().getPartyId()) { c.getPlayer().pickupItem(mapItem); } diff --git a/src/main/java/client/command/commands/gm2/MaxSkillCommand.java b/src/main/java/client/command/commands/gm2/MaxSkillCommand.java index e78b96c482..99ac7d4bdf 100644 --- a/src/main/java/client/command/commands/gm2/MaxSkillCommand.java +++ b/src/main/java/client/command/commands/gm2/MaxSkillCommand.java @@ -23,10 +23,11 @@ */ package client.command.commands.gm2; +import client.Character; import client.*; import client.command.Command; -import provider.MapleData; -import provider.MapleDataProviderFactory; +import provider.Data; +import provider.DataProviderFactory; import provider.wz.WZFiles; public class MaxSkillCommand extends Command { @@ -35,9 +36,9 @@ public class MaxSkillCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img").getChildren()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for (Data skill_ : DataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img").getChildren()) { try { Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); player.changeSkillLevel(skill, (byte) skill.getMaxLevel(), skill.getMaxLevel(), -1); @@ -47,7 +48,7 @@ public class MaxSkillCommand extends Command { } catch (NullPointerException npe) { } } - if (player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { + if (player.getJob().isA(Job.ARAN1) || player.getJob().isA(Job.LEGEND)) { Skill skill = SkillFactory.getSkill(5001005); player.changeSkillLevel(skill, (byte) -1, -1, -1); } else { diff --git a/src/main/java/client/command/commands/gm2/MaxStatCommand.java b/src/main/java/client/command/commands/gm2/MaxStatCommand.java index cadf709fec..66dfa410e9 100644 --- a/src/main/java/client/command/commands/gm2/MaxStatCommand.java +++ b/src/main/java/client/command/commands/gm2/MaxStatCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleStat; +import client.Character; +import client.Client; +import client.Stat; import client.command.Command; import config.YamlConfig; @@ -35,8 +35,8 @@ public class MaxStatCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); player.loseExp(player.getExp(), false, false); player.setLevel(255); player.resetPlayerRates(); @@ -45,8 +45,8 @@ public class MaxStatCommand extends Command { player.updateStrDexIntLuk(Short.MAX_VALUE); player.setFame(13337); player.updateMaxHpMaxMp(30000, 30000); - player.updateSingleStat(MapleStat.LEVEL, 255); - player.updateSingleStat(MapleStat.FAME, 13337); + player.updateSingleStat(Stat.LEVEL, 255); + player.updateSingleStat(Stat.FAME, 13337); player.yellowMessage("Stats maxed out."); } } diff --git a/src/main/java/client/command/commands/gm2/ReachCommand.java b/src/main/java/client/command/commands/gm2/ReachCommand.java index 36c55c2768..41b3bb3a6b 100644 --- a/src/main/java/client/command/commands/gm2/ReachCommand.java +++ b/src/main/java/client/command/commands/gm2/ReachCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; @@ -34,14 +34,14 @@ public class ReachCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !reach "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null && victim.isLoggedin()) { if (player.getClient().getChannel() != victim.getClient().getChannel()) { player.dropMessage(5, "Player '" + victim.getName() + "' is at channel " + victim.getClient().getChannel() + "."); diff --git a/src/main/java/client/command/commands/gm2/RechargeCommand.java b/src/main/java/client/command/commands/gm2/RechargeCommand.java index 017494b79b..1597bc714f 100644 --- a/src/main/java/client/command/commands/gm2/RechargeCommand.java +++ b/src/main/java/client/command/commands/gm2/RechargeCommand.java @@ -23,13 +23,13 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; +import client.inventory.InventoryType; import client.inventory.Item; -import client.inventory.MapleInventoryType; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class RechargeCommand extends Command { { @@ -37,10 +37,10 @@ public class RechargeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); - for (Item torecharge : c.getPlayer().getInventory(MapleInventoryType.USE).list()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + ItemInformationProvider ii = ItemInformationProvider.getInstance(); + for (Item torecharge : c.getPlayer().getInventory(InventoryType.USE).list()) { if (ItemConstants.isThrowingStar(torecharge.getItemId())){ torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId())); c.getPlayer().forceUpdateItem(torecharge); diff --git a/src/main/java/client/command/commands/gm2/ResetSkillCommand.java b/src/main/java/client/command/commands/gm2/ResetSkillCommand.java index 2c194c0ad6..a1724f5d4a 100644 --- a/src/main/java/client/command/commands/gm2/ResetSkillCommand.java +++ b/src/main/java/client/command/commands/gm2/ResetSkillCommand.java @@ -23,10 +23,11 @@ */ package client.command.commands.gm2; +import client.Character; import client.*; import client.command.Command; -import provider.MapleData; -import provider.MapleDataProviderFactory; +import provider.Data; +import provider.DataProviderFactory; import provider.wz.WZFiles; public class ResetSkillCommand extends Command { @@ -35,9 +36,9 @@ public class ResetSkillCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img").getChildren()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for (Data skill_ : DataProviderFactory.getDataProvider(WZFiles.STRING).getData("Skill.img").getChildren()) { try { Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); player.changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1); @@ -48,7 +49,7 @@ public class ResetSkillCommand extends Command { } } - if (player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { + if (player.getJob().isA(Job.ARAN1) || player.getJob().isA(Job.LEGEND)) { Skill skill = SkillFactory.getSkill(5001005); player.changeSkillLevel(skill, (byte) -1, -1, -1); } else { diff --git a/src/main/java/client/command/commands/gm2/SearchCommand.java b/src/main/java/client/command/commands/gm2/SearchCommand.java index e37eb609c0..42044d4357 100644 --- a/src/main/java/client/command/commands/gm2/SearchCommand.java +++ b/src/main/java/client/command/commands/gm2/SearchCommand.java @@ -23,28 +23,28 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import provider.MapleData; -import provider.MapleDataProvider; -import provider.MapleDataProviderFactory; -import provider.MapleDataTool; +import provider.Data; +import provider.DataProvider; +import provider.DataProviderFactory; +import provider.DataTool; import provider.wz.WZFiles; -import server.MapleItemInformationProvider; -import server.quest.MapleQuest; +import server.ItemInformationProvider; +import server.quest.Quest; import tools.Pair; public class SearchCommand extends Command { - private static MapleData npcStringData; - private static MapleData mobStringData; - private static MapleData skillStringData; - private static MapleData mapStringData; + private static Data npcStringData; + private static Data mobStringData; + private static Data skillStringData; + private static Data mapStringData; { setDescription("Search String.wz."); - MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(WZFiles.STRING); + DataProvider dataProvider = DataProviderFactory.getDataProvider(WZFiles.STRING); npcStringData = dataProvider.getData("Npc.img"); mobStringData = dataProvider.getData("Mob.img"); skillStringData = dataProvider.getData("Skill.img"); @@ -52,8 +52,8 @@ public class SearchCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !search "); return; @@ -62,7 +62,7 @@ public class SearchCommand extends Command { String search = joinStringFrom(params,1); long start = System.currentTimeMillis();//for the lulz - MapleData data = null; + Data data = null; if (!params[0].equalsIgnoreCase("ITEM")) { int searchType = 0; @@ -85,8 +85,8 @@ public class SearchCommand extends Command { String name; if (searchType == 0) { - for (MapleData searchData : data.getChildren()) { - name = MapleDataTool.getString(searchData.getChildByPath("name"), "NO-NAME"); + for (Data searchData : data.getChildren()) { + name = DataTool.getString(searchData.getChildByPath("name"), "NO-NAME"); if (name.toLowerCase().contains(search.toLowerCase())) { sb.append("#b").append(Integer.parseInt(searchData.getName())).append("#k - #r").append(name).append("\r\n"); } @@ -94,10 +94,10 @@ public class SearchCommand extends Command { } else if (searchType == 1) { String mapName, streetName; - for (MapleData searchDataDir : data.getChildren()) { - for (MapleData searchData : searchDataDir.getChildren()) { - mapName = MapleDataTool.getString(searchData.getChildByPath("mapName"), "NO-NAME"); - streetName = MapleDataTool.getString(searchData.getChildByPath("streetName"), "NO-NAME"); + for (Data searchDataDir : data.getChildren()) { + for (Data searchData : searchDataDir.getChildren()) { + mapName = DataTool.getString(searchData.getChildByPath("mapName"), "NO-NAME"); + streetName = DataTool.getString(searchData.getChildByPath("streetName"), "NO-NAME"); if (mapName.toLowerCase().contains(search.toLowerCase()) || streetName.toLowerCase().contains(search.toLowerCase())) { sb.append("#b").append(Integer.parseInt(searchData.getName())).append("#k - #r").append(streetName).append(" - ").append(mapName).append("\r\n"); @@ -105,7 +105,7 @@ public class SearchCommand extends Command { } } } else { - for (MapleQuest mq : MapleQuest.getMatchedQuests(search)) { + for (Quest mq : Quest.getMatchedQuests(search)) { sb.append("#b").append(mq.getId()).append("#k - #r"); String parentName = mq.getParentName(); @@ -117,7 +117,7 @@ public class SearchCommand extends Command { } } } else { - for (Pair itemPair : MapleItemInformationProvider.getInstance().getAllItems()) { + for (Pair itemPair : ItemInformationProvider.getInstance().getAllItems()) { if (sb.length() < 32654) {//ohlol if (itemPair.getRight().toLowerCase().contains(search.toLowerCase())) { sb.append("#b").append(itemPair.getLeft()).append("#k - #r").append(itemPair.getRight()).append("\r\n"); diff --git a/src/main/java/client/command/commands/gm2/SetSlotCommand.java b/src/main/java/client/command/commands/gm2/SetSlotCommand.java index af8a6b7ec8..b27c2b031d 100644 --- a/src/main/java/client/command/commands/gm2/SetSlotCommand.java +++ b/src/main/java/client/command/commands/gm2/SetSlotCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class SetSlotCommand extends Command { @@ -33,8 +33,8 @@ public class SetSlotCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !setslot "); return; diff --git a/src/main/java/client/command/commands/gm2/SetStatCommand.java b/src/main/java/client/command/commands/gm2/SetStatCommand.java index 72807331f9..d78f4d7ace 100644 --- a/src/main/java/client/command/commands/gm2/SetStatCommand.java +++ b/src/main/java/client/command/commands/gm2/SetStatCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class SetStatCommand extends Command { @@ -33,8 +33,8 @@ public class SetStatCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !setstat "); return; diff --git a/src/main/java/client/command/commands/gm2/SpCommand.java b/src/main/java/client/command/commands/gm2/SpCommand.java index 2ff1314d1e..44f62967e6 100644 --- a/src/main/java/client/command/commands/gm2/SpCommand.java +++ b/src/main/java/client/command/commands/gm2/SpCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -34,8 +34,8 @@ public class SpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !sp [] "); return; @@ -48,7 +48,7 @@ public class SpCommand extends Command { player.updateRemainingSp(newSp); } else { - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { int newSp = Integer.parseInt(params[1]); if (newSp < 0) newSp = 0; diff --git a/src/main/java/client/command/commands/gm2/SummonCommand.java b/src/main/java/client/command/commands/gm2/SummonCommand.java index f18d39920c..261cfa7b4e 100644 --- a/src/main/java/client/command/commands/gm2/SummonCommand.java +++ b/src/main/java/client/command/commands/gm2/SummonCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.channel.Channel; @@ -36,14 +36,14 @@ public class SummonCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !warphere "); return; } - MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { //If victim isn't on current channel, loop all channels on current world. diff --git a/src/main/java/client/command/commands/gm2/UnBugCommand.java b/src/main/java/client/command/commands/gm2/UnBugCommand.java index 50ec7eaf45..fb175c540d 100644 --- a/src/main/java/client/command/commands/gm2/UnBugCommand.java +++ b/src/main/java/client/command/commands/gm2/UnBugCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm2; -import client.MapleClient; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -33,7 +33,7 @@ public class UnBugCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getPlayer().getMap().broadcastMessage(PacketCreator.enableActions()); } } diff --git a/src/main/java/client/command/commands/gm2/UnHideCommand.java b/src/main/java/client/command/commands/gm2/UnHideCommand.java index a4652349ad..1e2cd29cef 100644 --- a/src/main/java/client/command/commands/gm2/UnHideCommand.java +++ b/src/main/java/client/command/commands/gm2/UnHideCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.SkillFactory; import client.command.Command; @@ -34,8 +34,8 @@ public class UnHideCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); } diff --git a/src/main/java/client/command/commands/gm2/UnJailCommand.java b/src/main/java/client/command/commands/gm2/UnJailCommand.java index 36b8c8aa66..41843f38e1 100644 --- a/src/main/java/client/command/commands/gm2/UnJailCommand.java +++ b/src/main/java/client/command/commands/gm2/UnJailCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class UnJailCommand extends Command { @@ -33,14 +33,14 @@ public class UnJailCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !unjail "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { if (victim.getJailExpirationTimeLeft() <= 0) { player.message("This player is already free."); diff --git a/src/main/java/client/command/commands/gm2/WarpAreaCommand.java b/src/main/java/client/command/commands/gm2/WarpAreaCommand.java index 44817456b0..391737af17 100644 --- a/src/main/java/client/command/commands/gm2/WarpAreaCommand.java +++ b/src/main/java/client/command/commands/gm2/WarpAreaCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; @@ -37,8 +37,8 @@ public class WarpAreaCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !warparea "); return; @@ -53,9 +53,9 @@ public class WarpAreaCommand extends Command { Point pos = player.getPosition(); - Collection characters = player.getMap().getAllPlayers(); + Collection characters = player.getMap().getAllPlayers(); - for (MapleCharacter victim : characters) { + for (Character victim : characters) { if (victim.getPosition().distanceSq(pos) <= 50000) { victim.saveLocationOnWarp(); victim.changeMap(target, target.getRandomPlayerSpawnpoint()); diff --git a/src/main/java/client/command/commands/gm2/WarpCommand.java b/src/main/java/client/command/commands/gm2/WarpCommand.java index 776da6e327..423da33013 100644 --- a/src/main/java/client/command/commands/gm2/WarpCommand.java +++ b/src/main/java/client/command/commands/gm2/WarpCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.FieldLimit; import server.maps.MapleMap; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; public class WarpCommand extends Command { { @@ -36,8 +36,8 @@ public class WarpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !warp "); return; @@ -56,7 +56,7 @@ public class WarpCommand extends Command { } if (!player.isGM()) { - if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { + if (player.getEventInstance() != null || MiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { player.dropMessage(1, "This command cannot be used in this map."); return; } diff --git a/src/main/java/client/command/commands/gm2/WarpMapCommand.java b/src/main/java/client/command/commands/gm2/WarpMapCommand.java index 6ea1da3515..33a19d6af0 100644 --- a/src/main/java/client/command/commands/gm2/WarpMapCommand.java +++ b/src/main/java/client/command/commands/gm2/WarpMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; @@ -36,8 +36,8 @@ public class WarpMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !warpmap "); return; @@ -50,9 +50,9 @@ public class WarpMapCommand extends Command { return; } - Collection characters = player.getMap().getAllPlayers(); + Collection characters = player.getMap().getAllPlayers(); - for (MapleCharacter victim : characters) { + for (Character victim : characters) { victim.saveLocationOnWarp(); victim.changeMap(target, target.getRandomPlayerSpawnpoint()); } diff --git a/src/main/java/client/command/commands/gm2/WhereaMiCommand.java b/src/main/java/client/command/commands/gm2/WhereaMiCommand.java index b0635c99cc..e80e70933d 100644 --- a/src/main/java/client/command/commands/gm2/WhereaMiCommand.java +++ b/src/main/java/client/command/commands/gm2/WhereaMiCommand.java @@ -23,13 +23,13 @@ */ package client.command.commands.gm2; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleMonster; -import server.life.MapleNPC; -import server.life.MaplePlayerNPC; -import server.maps.MapleMapObject; +import server.life.Monster; +import server.life.NPC; +import server.life.PlayerNPC; +import server.maps.MapObject; import java.util.HashSet; @@ -39,28 +39,28 @@ public class WhereaMiCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); - HashSet chars = new HashSet<>(); - HashSet npcs = new HashSet<>(); - HashSet playernpcs = new HashSet<>(); - HashSet mobs = new HashSet<>(); + HashSet chars = new HashSet<>(); + HashSet npcs = new HashSet<>(); + HashSet playernpcs = new HashSet<>(); + HashSet mobs = new HashSet<>(); - for (MapleMapObject mmo : player.getMap().getMapObjects()) { - if (mmo instanceof MapleNPC) { - MapleNPC npc = (MapleNPC) mmo; + for (MapObject mmo : player.getMap().getMapObjects()) { + if (mmo instanceof NPC) { + NPC npc = (NPC) mmo; npcs.add(npc); - } else if (mmo instanceof MapleCharacter) { - MapleCharacter mc = (MapleCharacter) mmo; + } else if (mmo instanceof Character) { + Character mc = (Character) mmo; chars.add(mc); - } else if (mmo instanceof MapleMonster) { - MapleMonster mob = (MapleMonster) mmo; + } else if (mmo instanceof Monster) { + Monster mob = (Monster) mmo; if (mob.isAlive()) { mobs.add(mob); } - } else if (mmo instanceof MaplePlayerNPC) { - MaplePlayerNPC npc = (MaplePlayerNPC) mmo; + } else if (mmo instanceof PlayerNPC) { + PlayerNPC npc = (PlayerNPC) mmo; playernpcs.add(npc); } } @@ -68,27 +68,27 @@ public class WhereaMiCommand extends Command { player.yellowMessage("Map ID: " + player.getMap().getId()); player.yellowMessage("Players on this map:"); - for (MapleCharacter chr : chars) { + for (Character chr : chars) { player.dropMessage(5, ">> " + chr.getName() + " - " + chr.getId() + " - Oid: " + chr.getObjectId()); } if (!playernpcs.isEmpty()) { player.yellowMessage("PlayerNPCs on this map:"); - for (MaplePlayerNPC pnpc : playernpcs) { + for (PlayerNPC pnpc : playernpcs) { player.dropMessage(5, ">> " + pnpc.getName() + " - Scriptid: " + pnpc.getScriptId() + " - Oid: " + pnpc.getObjectId()); } } if (!npcs.isEmpty()) { player.yellowMessage("NPCs on this map:"); - for (MapleNPC npc : npcs) { + for (NPC npc : npcs) { player.dropMessage(5, ">> " + npc.getName() + " - " + npc.getId() + " - Oid: " + npc.getObjectId()); } } if (!mobs.isEmpty()) { player.yellowMessage("Monsters on this map:"); - for (MapleMonster mob : mobs) { + for (Monster mob : mobs) { if (mob.isAlive()) { player.dropMessage(5, ">> " + mob.getName() + " - " + mob.getId() + " - Oid: " + mob.getObjectId()); } diff --git a/src/main/java/client/command/commands/gm3/BanCommand.java b/src/main/java/client/command/commands/gm3/BanCommand.java index a6524147e9..f24ff3316b 100644 --- a/src/main/java/client/command/commands/gm3/BanCommand.java +++ b/src/main/java/client/command/commands/gm3/BanCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.TimerManager; @@ -41,17 +41,17 @@ public class BanCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !ban (Please be descriptive)"); return; } String ign = params[0]; String reason = joinStringFrom(params, 1); - MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(ign); + Character target = c.getChannelServer().getPlayerStorage().getCharacterByName(ign); if (target != null) { - String readableTargetName = MapleCharacter.makeMapleReadable(target.getName()); + String readableTargetName = Character.makeMapleReadable(target.getName()); String ip = target.getClient().getRemoteAddress(); //Ban ip try (Connection con = DatabaseConnection.getConnection()) { @@ -74,10 +74,10 @@ public class BanCommand extends Command { target.yellowMessage("You have been banned by #b" + c.getPlayer().getName() + " #k."); target.yellowMessage("Reason: " + reason); c.sendPacket(PacketCreator.getGMEffect(4, (byte) 0)); - final MapleCharacter rip = target; + final Character rip = target; TimerManager.getInstance().schedule(() -> rip.getClient().disconnect(false, false), 5000); //5 Seconds Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); - } else if (MapleCharacter.ban(ign, reason, false)) { + } else if (Character.ban(ign, reason, false)) { c.sendPacket(PacketCreator.getGMEffect(4, (byte) 0)); Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); } else { diff --git a/src/main/java/client/command/commands/gm3/ChatCommand.java b/src/main/java/client/command/commands/gm3/ChatCommand.java index 8931b55fd0..0ea9c36637 100644 --- a/src/main/java/client/command/commands/gm3/ChatCommand.java +++ b/src/main/java/client/command/commands/gm3/ChatCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class ChatCommand extends Command { @@ -33,8 +33,8 @@ public class ChatCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); player.toggleWhiteChat(); player.message("Your chat is now " + (player.getWhiteChat() ? " white" : "normal") + "."); } diff --git a/src/main/java/client/command/commands/gm3/CheckDmgCommand.java b/src/main/java/client/command/commands/gm3/CheckDmgCommand.java index 1f7ad273c5..9ec879ce1b 100644 --- a/src/main/java/client/command/commands/gm3/CheckDmgCommand.java +++ b/src/main/java/client/command/commands/gm3/CheckDmgCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm3; -import client.MapleBuffStat; -import client.MapleCharacter; -import client.MapleClient; +import client.BuffStat; +import client.Character; +import client.Client; import client.command.Command; public class CheckDmgCommand extends Command { @@ -34,13 +34,13 @@ public class CheckDmgCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { int maxBase = victim.calculateMaxBaseDamage(victim.getTotalWatk()); - Integer watkBuff = victim.getBuffedValue(MapleBuffStat.WATK); - Integer matkBuff = victim.getBuffedValue(MapleBuffStat.MATK); + Integer watkBuff = victim.getBuffedValue(BuffStat.WATK); + Integer matkBuff = victim.getBuffedValue(BuffStat.MATK); int blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12); if (watkBuff == null) watkBuff = 0; if (matkBuff == null) matkBuff = 0; diff --git a/src/main/java/client/command/commands/gm3/ClosePortalCommand.java b/src/main/java/client/command/commands/gm3/ClosePortalCommand.java index 5e0b5d6709..32f55c53c3 100644 --- a/src/main/java/client/command/commands/gm3/ClosePortalCommand.java +++ b/src/main/java/client/command/commands/gm3/ClosePortalCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class ClosePortalCommand extends Command { @@ -33,8 +33,8 @@ public class ClosePortalCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !closeportal "); return; diff --git a/src/main/java/client/command/commands/gm3/DebuffCommand.java b/src/main/java/client/command/commands/gm3/DebuffCommand.java index c60e006b3d..aed248286d 100644 --- a/src/main/java/client/command/commands/gm3/DebuffCommand.java +++ b/src/main/java/client/command/commands/gm3/DebuffCommand.java @@ -23,14 +23,14 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleDisease; +import client.Character; +import client.Client; +import client.Disease; import client.command.Command; import server.life.MobSkill; import server.life.MobSkillFactory; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; +import server.maps.MapObject; +import server.maps.MapObjectType; import java.util.Arrays; @@ -40,64 +40,64 @@ public class DebuffCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); return; } - MapleDisease disease = null; + Disease disease = null; MobSkill skill = null; switch (params[0].toUpperCase()) { case "SLOW": - disease = MapleDisease.SLOW; + disease = Disease.SLOW; skill = MobSkillFactory.getMobSkill(126, 7); break; case "SEDUCE": - disease = MapleDisease.SEDUCE; + disease = Disease.SEDUCE; skill = MobSkillFactory.getMobSkill(128, 7); break; case "ZOMBIFY": - disease = MapleDisease.ZOMBIFY; + disease = Disease.ZOMBIFY; skill = MobSkillFactory.getMobSkill(133, 1); break; case "CONFUSE": - disease = MapleDisease.CONFUSE; + disease = Disease.CONFUSE; skill = MobSkillFactory.getMobSkill(132, 2); break; case "STUN": - disease = MapleDisease.STUN; + disease = Disease.STUN; skill = MobSkillFactory.getMobSkill(123, 7); break; case "POISON": - disease = MapleDisease.POISON; + disease = Disease.POISON; skill = MobSkillFactory.getMobSkill(125, 5); break; case "SEAL": - disease = MapleDisease.SEAL; + disease = Disease.SEAL; skill = MobSkillFactory.getMobSkill(120, 1); break; case "DARKNESS": - disease = MapleDisease.DARKNESS; + disease = Disease.DARKNESS; skill = MobSkillFactory.getMobSkill(121, 1); break; case "WEAKEN": - disease = MapleDisease.WEAKEN; + disease = Disease.WEAKEN; skill = MobSkillFactory.getMobSkill(122, 1); break; case "CURSE": - disease = MapleDisease.CURSE; + disease = Disease.CURSE; skill = MobSkillFactory.getMobSkill(124, 1); break; } @@ -107,8 +107,8 @@ public class DebuffCommand extends Command { return; } - for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) { - MapleCharacter chr = (MapleCharacter) mmo; + for (MapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapObjectType.PLAYER))) { + Character chr = (Character) mmo; if (chr.getId() != player.getId()) { chr.giveDebuff(disease, skill); diff --git a/src/main/java/client/command/commands/gm3/EndEventCommand.java b/src/main/java/client/command/commands/gm3/EndEventCommand.java index 3ccfb23c7a..ceb13efd91 100644 --- a/src/main/java/client/command/commands/gm3/EndEventCommand.java +++ b/src/main/java/client/command/commands/gm3/EndEventCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class EndEventCommand extends Command { @@ -33,8 +33,8 @@ public class EndEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); c.getChannelServer().setEvent(null); player.dropMessage(5, "You have ended the event. No more players may join."); } diff --git a/src/main/java/client/command/commands/gm3/ExpedsCommand.java b/src/main/java/client/command/commands/gm3/ExpedsCommand.java index 45e3ac2ff6..ed54ea911f 100644 --- a/src/main/java/client/command/commands/gm3/ExpedsCommand.java +++ b/src/main/java/client/command/commands/gm3/ExpedsCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.channel.Channel; -import server.expeditions.MapleExpedition; +import server.expeditions.Expedition; import java.util.List; import java.util.Map.Entry; @@ -39,17 +39,17 @@ public class ExpedsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (Channel ch : Server.getInstance().getChannelsFromWorld(c.getWorld())) { - List expeds = ch.getExpeditions(); + List expeds = ch.getExpeditions(); if (expeds.isEmpty()) { player.yellowMessage("No Expeditions in Channel " + ch.getId()); continue; } player.yellowMessage("Expeditions in Channel " + ch.getId()); int id = 0; - for (MapleExpedition exped : expeds) { + for (Expedition exped : expeds) { id++; player.yellowMessage("> Expedition " + id); player.yellowMessage(">> Type: " + exped.getType().toString()); diff --git a/src/main/java/client/command/commands/gm3/FaceCommand.java b/src/main/java/client/command/commands/gm3/FaceCommand.java index e225159e69..ccf8e1bf45 100644 --- a/src/main/java/client/command/commands/gm3/FaceCommand.java +++ b/src/main/java/client/command/commands/gm3/FaceCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleStat; +import client.Character; +import client.Client; +import client.Stat; import client.command.Command; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class FaceCommand extends Command { { @@ -36,8 +36,8 @@ public class FaceCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !face [] "); return; @@ -46,24 +46,24 @@ public class FaceCommand extends Command { try { if (params.length == 1) { int itemId = Integer.parseInt(params[0]); - if (!ItemConstants.isFace(itemId) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + if (!ItemConstants.isFace(itemId) || ItemInformationProvider.getInstance().getName(itemId) == null) { player.yellowMessage("Face id '" + params[0] + "' does not exist."); return; } player.setFace(itemId); - player.updateSingleStat(MapleStat.FACE, itemId); + player.updateSingleStat(Stat.FACE, itemId); player.equipChanged(); } else { int itemId = Integer.parseInt(params[1]); - if (!ItemConstants.isFace(itemId) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + if (!ItemConstants.isFace(itemId) || ItemInformationProvider.getInstance().getName(itemId) == null) { player.yellowMessage("Face id '" + params[1] + "' does not exist."); } - MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { victim.setFace(itemId); - victim.updateSingleStat(MapleStat.FACE, itemId); + victim.updateSingleStat(Stat.FACE, itemId); victim.equipChanged(); } else { player.yellowMessage("Player '" + params[0] + "' has not been found on this channel."); diff --git a/src/main/java/client/command/commands/gm3/FameCommand.java b/src/main/java/client/command/commands/gm3/FameCommand.java index 6d38c9dfb8..3cd2819e0b 100644 --- a/src/main/java/client/command/commands/gm3/FameCommand.java +++ b/src/main/java/client/command/commands/gm3/FameCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleStat; +import client.Character; +import client.Client; +import client.Stat; import client.command.Command; public class FameCommand extends Command { @@ -34,17 +34,17 @@ public class FameCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !fame "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.setFame(Integer.parseInt(params[1])); - victim.updateSingleStat(MapleStat.FAME, victim.getFame()); + victim.updateSingleStat(Stat.FAME, victim.getFame()); player.message("FAME given."); } else { player.message("Player '" + params[0] + "' could not be found."); diff --git a/src/main/java/client/command/commands/gm3/FlyCommand.java b/src/main/java/client/command/commands/gm3/FlyCommand.java index 138dd9bdb6..788fe43512 100644 --- a/src/main/java/client/command/commands/gm3/FlyCommand.java +++ b/src/main/java/client/command/commands/gm3/FlyCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; @@ -34,8 +34,8 @@ public class FlyCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { // fly option will become available for any character of that account - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { // fly option will become available for any character of that account + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !fly "); return; diff --git a/src/main/java/client/command/commands/gm3/GiveMesosCommand.java b/src/main/java/client/command/commands/gm3/GiveMesosCommand.java index 3d86c8ee06..1b5a4f8c0d 100644 --- a/src/main/java/client/command/commands/gm3/GiveMesosCommand.java +++ b/src/main/java/client/command/commands/gm3/GiveMesosCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class GiveMesosCommand extends Command { @@ -33,8 +33,8 @@ public class GiveMesosCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !givems [] "); return; @@ -66,7 +66,7 @@ public class GiveMesosCommand extends Command { } } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(recv_); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(recv_); if (victim != null) { victim.gainMeso((int) mesos_, true); player.message("MESO given."); diff --git a/src/main/java/client/command/commands/gm3/GiveNxCommand.java b/src/main/java/client/command/commands/gm3/GiveNxCommand.java index b04b2de021..c68ac18e94 100644 --- a/src/main/java/client/command/commands/gm3/GiveNxCommand.java +++ b/src/main/java/client/command/commands/gm3/GiveNxCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class GiveNxCommand extends Command { @@ -33,8 +33,8 @@ public class GiveNxCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !givenx [nx, mp, np] [] "); return; @@ -72,7 +72,7 @@ public class GiveNxCommand extends Command { value = Integer.parseInt(params[0]); } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(recv); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(recv); if (victim != null) { victim.getCashShop().gainCash(type, value); player.message(typeStr.toUpperCase() + " given."); diff --git a/src/main/java/client/command/commands/gm3/GiveRpCommand.java b/src/main/java/client/command/commands/gm3/GiveRpCommand.java index f43d8753b1..da5cb5d65d 100644 --- a/src/main/java/client/command/commands/gm3/GiveRpCommand.java +++ b/src/main/java/client/command/commands/gm3/GiveRpCommand.java @@ -1,7 +1,7 @@ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class GiveRpCommand extends Command { @@ -10,14 +10,14 @@ public class GiveRpCommand extends Command { } @Override - public void execute(MapleClient client, String[] params) { - MapleCharacter player = client.getPlayer(); + public void execute(Client client, String[] params) { + Character player = client.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !giverp "); return; } - MapleCharacter victim = client.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = client.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.setRewardPoints(victim.getRewardPoints() + Integer.parseInt(params[1])); player.message("RP given. Player " + params[0] + " now has " + victim.getRewardPoints() diff --git a/src/main/java/client/command/commands/gm3/GiveVpCommand.java b/src/main/java/client/command/commands/gm3/GiveVpCommand.java index f677e874cd..6bad23706a 100644 --- a/src/main/java/client/command/commands/gm3/GiveVpCommand.java +++ b/src/main/java/client/command/commands/gm3/GiveVpCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class GiveVpCommand extends Command { @@ -33,14 +33,14 @@ public class GiveVpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !givevp "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.getClient().addVotePoints(Integer.parseInt(params[1])); player.message("VP given."); diff --git a/src/main/java/client/command/commands/gm3/HairCommand.java b/src/main/java/client/command/commands/gm3/HairCommand.java index 22f01cf49a..eaaebaae65 100644 --- a/src/main/java/client/command/commands/gm3/HairCommand.java +++ b/src/main/java/client/command/commands/gm3/HairCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleStat; +import client.Character; +import client.Client; +import client.Stat; import client.command.Command; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class HairCommand extends Command { { @@ -36,8 +36,8 @@ public class HairCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !hair [] "); return; @@ -46,25 +46,25 @@ public class HairCommand extends Command { try { if (params.length == 1) { int itemId = Integer.parseInt(params[0]); - if (!ItemConstants.isHair(itemId) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + if (!ItemConstants.isHair(itemId) || ItemInformationProvider.getInstance().getName(itemId) == null) { player.yellowMessage("Hair id '" + params[0] + "' does not exist."); return; } player.setHair(itemId); - player.updateSingleStat(MapleStat.HAIR, itemId); + player.updateSingleStat(Stat.HAIR, itemId); player.equipChanged(); } else { int itemId = Integer.parseInt(params[1]); - if (!ItemConstants.isHair(itemId) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + if (!ItemConstants.isHair(itemId) || ItemInformationProvider.getInstance().getName(itemId) == null) { player.yellowMessage("Hair id '" + params[1] + "' does not exist."); return; } - MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.setHair(itemId); - victim.updateSingleStat(MapleStat.HAIR, itemId); + victim.updateSingleStat(Stat.HAIR, itemId); victim.equipChanged(); } else { player.yellowMessage("Player '" + params[0] + "' has not been found on this channel."); diff --git a/src/main/java/client/command/commands/gm3/HealMapCommand.java b/src/main/java/client/command/commands/gm3/HealMapCommand.java index 8a870350ea..295e46f633 100644 --- a/src/main/java/client/command/commands/gm3/HealMapCommand.java +++ b/src/main/java/client/command/commands/gm3/HealMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class HealMapCommand extends Command { @@ -33,9 +33,9 @@ public class HealMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for (MapleCharacter mch : player.getMap().getCharacters()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for (Character mch : player.getMap().getCharacters()) { if (mch != null) { mch.healHpMp(); } diff --git a/src/main/java/client/command/commands/gm3/HealPersonCommand.java b/src/main/java/client/command/commands/gm3/HealPersonCommand.java index 9c2cde8e38..50dcd17601 100644 --- a/src/main/java/client/command/commands/gm3/HealPersonCommand.java +++ b/src/main/java/client/command/commands/gm3/HealPersonCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class HealPersonCommand extends Command { @@ -33,9 +33,9 @@ public class HealPersonCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.healHpMp(); } else { diff --git a/src/main/java/client/command/commands/gm3/HpMpCommand.java b/src/main/java/client/command/commands/gm3/HpMpCommand.java index c67a199faa..520886bdb0 100644 --- a/src/main/java/client/command/commands/gm3/HpMpCommand.java +++ b/src/main/java/client/command/commands/gm3/HpMpCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class HpMpCommand extends Command { @@ -33,9 +33,9 @@ public class HpMpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleCharacter victim = player; + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Character victim = player; int statUpdate = 1; if (params.length == 2) { diff --git a/src/main/java/client/command/commands/gm3/HurtCommand.java b/src/main/java/client/command/commands/gm3/HurtCommand.java index 6eb93ca6c3..ee4dc87ce0 100644 --- a/src/main/java/client/command/commands/gm3/HurtCommand.java +++ b/src/main/java/client/command/commands/gm3/HurtCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class HurtCommand extends Command { @@ -33,9 +33,9 @@ public class HurtCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.updateHp(1); } else { diff --git a/src/main/java/client/command/commands/gm3/IgnoreCommand.java b/src/main/java/client/command/commands/gm3/IgnoreCommand.java index d935639104..ccd141a04a 100644 --- a/src/main/java/client/command/commands/gm3/IgnoreCommand.java +++ b/src/main/java/client/command/commands/gm3/IgnoreCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.packet.logging.MapleLogger; import net.server.Server; @@ -36,13 +36,13 @@ public class IgnoreCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !ignore "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { player.message("Player '" + params[0] + "' could not be found on this world."); return; diff --git a/src/main/java/client/command/commands/gm3/IgnoredCommand.java b/src/main/java/client/command/commands/gm3/IgnoredCommand.java index daf704699d..a3849c78df 100644 --- a/src/main/java/client/command/commands/gm3/IgnoredCommand.java +++ b/src/main/java/client/command/commands/gm3/IgnoredCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.packet.logging.MapleLogger; @@ -34,10 +34,10 @@ public class IgnoredCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (Integer cid : MapleLogger.ignored) { - player.yellowMessage(MapleCharacter.getNameById(cid) + " is being ignored."); + player.yellowMessage(Character.getNameById(cid) + " is being ignored."); } } } diff --git a/src/main/java/client/command/commands/gm3/InMapCommand.java b/src/main/java/client/command/commands/gm3/InMapCommand.java index ef66e72085..e7173b755c 100644 --- a/src/main/java/client/command/commands/gm3/InMapCommand.java +++ b/src/main/java/client/command/commands/gm3/InMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class InMapCommand extends Command { @@ -33,10 +33,10 @@ public class InMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); String st = ""; - for (MapleCharacter chr : player.getMap().getCharacters()) { + for (Character chr : player.getMap().getCharacters()) { st += chr.getName() + " "; } player.message(st); diff --git a/src/main/java/client/command/commands/gm3/KillAllCommand.java b/src/main/java/client/command/commands/gm3/KillAllCommand.java index db5e0cc40c..aec2c83bab 100644 --- a/src/main/java/client/command/commands/gm3/KillAllCommand.java +++ b/src/main/java/client/command/commands/gm3/KillAllCommand.java @@ -23,13 +23,13 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleMonster; +import server.life.Monster; +import server.maps.MapObject; +import server.maps.MapObjectType; import server.maps.MapleMap; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; import java.util.Arrays; import java.util.List; @@ -40,13 +40,13 @@ public class KillAllCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); MapleMap map = player.getMap(); - List monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); + List monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER)); int count = 0; - for (MapleMapObject monstermo : monsters) { - MapleMonster monster = (MapleMonster) monstermo; + for (MapObject monstermo : monsters) { + Monster monster = (Monster) monstermo; if (!monster.getStats().isFriendly() && !(monster.getId() >= 8810010 && monster.getId() <= 8810018)) { map.damageMonster(player, monster, Integer.MAX_VALUE); count++; diff --git a/src/main/java/client/command/commands/gm3/KillCommand.java b/src/main/java/client/command/commands/gm3/KillCommand.java index 135474b096..aefb43e55a 100644 --- a/src/main/java/client/command/commands/gm3/KillCommand.java +++ b/src/main/java/client/command/commands/gm3/KillCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import tools.PacketCreator; @@ -35,14 +35,14 @@ public class KillCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !kill "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { victim.updateHpMp(0); Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.serverNotice(5, player.getName() + " used !kill on " + victim.getName())); diff --git a/src/main/java/client/command/commands/gm3/KillMapCommand.java b/src/main/java/client/command/commands/gm3/KillMapCommand.java index 486bf8e628..babcb59807 100644 --- a/src/main/java/client/command/commands/gm3/KillMapCommand.java +++ b/src/main/java/client/command/commands/gm3/KillMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class KillMapCommand extends Command { @@ -33,9 +33,9 @@ public class KillMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - for (MapleCharacter mch : player.getMap().getCharacters()) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + for (Character mch : player.getMap().getCharacters()) { mch.updateHp(0); } } diff --git a/src/main/java/client/command/commands/gm3/MaxEnergyCommand.java b/src/main/java/client/command/commands/gm3/MaxEnergyCommand.java index f43b066c05..977bb5f19f 100644 --- a/src/main/java/client/command/commands/gm3/MaxEnergyCommand.java +++ b/src/main/java/client/command/commands/gm3/MaxEnergyCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class MaxEnergyCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); c.getPlayer().setDojoEnergy(10000); c.sendPacket(PacketCreator.getEnergy("energy", 10000)); } diff --git a/src/main/java/client/command/commands/gm3/MaxHpMpCommand.java b/src/main/java/client/command/commands/gm3/MaxHpMpCommand.java index 7100dcbf84..6f31badb81 100644 --- a/src/main/java/client/command/commands/gm3/MaxHpMpCommand.java +++ b/src/main/java/client/command/commands/gm3/MaxHpMpCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class MaxHpMpCommand extends Command { @@ -33,9 +33,9 @@ public class MaxHpMpCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleCharacter victim = player; + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Character victim = player; int statUpdate = 1; if (params.length >= 2) { diff --git a/src/main/java/client/command/commands/gm3/MonitorCommand.java b/src/main/java/client/command/commands/gm3/MonitorCommand.java index 7f05db7521..fd026d7894 100644 --- a/src/main/java/client/command/commands/gm3/MonitorCommand.java +++ b/src/main/java/client/command/commands/gm3/MonitorCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.packet.logging.MapleLogger; import net.server.Server; @@ -36,13 +36,13 @@ public class MonitorCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !monitor "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim == null) { player.message("Player '" + params[0] + "' could not be found on this world."); return; diff --git a/src/main/java/client/command/commands/gm3/MonitorsCommand.java b/src/main/java/client/command/commands/gm3/MonitorsCommand.java index 97fd37a9d4..da604fb0ae 100644 --- a/src/main/java/client/command/commands/gm3/MonitorsCommand.java +++ b/src/main/java/client/command/commands/gm3/MonitorsCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.packet.logging.MapleLogger; @@ -34,10 +34,10 @@ public class MonitorsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (Integer cid : MapleLogger.monitored) { - player.yellowMessage(MapleCharacter.getNameById(cid) + " is being monitored."); + player.yellowMessage(Character.getNameById(cid) + " is being monitored."); } } } diff --git a/src/main/java/client/command/commands/gm3/MusicCommand.java b/src/main/java/client/command/commands/gm3/MusicCommand.java index bca318bb10..1f3f4f4557 100644 --- a/src/main/java/client/command/commands/gm3/MusicCommand.java +++ b/src/main/java/client/command/commands/gm3/MusicCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import constants.game.GameConstants; import tools.PacketCreator; @@ -44,9 +44,9 @@ public class MusicCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { - MapleCharacter player = c.getPlayer(); + Character player = c.getPlayer(); if (params.length < 1) { String sendMsg = ""; diff --git a/src/main/java/client/command/commands/gm3/MuteMapCommand.java b/src/main/java/client/command/commands/gm3/MuteMapCommand.java index 90dd6062ef..f442723bef 100644 --- a/src/main/java/client/command/commands/gm3/MuteMapCommand.java +++ b/src/main/java/client/command/commands/gm3/MuteMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class MuteMapCommand extends Command { @@ -33,8 +33,8 @@ public class MuteMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (player.getMap().isMuted()) { player.getMap().setMuted(false); player.dropMessage(5, "The map you are in has been un-muted."); diff --git a/src/main/java/client/command/commands/gm3/NightCommand.java b/src/main/java/client/command/commands/gm3/NightCommand.java index fa17256f5a..3dfaeb5fe3 100644 --- a/src/main/java/client/command/commands/gm3/NightCommand.java +++ b/src/main/java/client/command/commands/gm3/NightCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class NightCommand extends Command { @@ -33,8 +33,8 @@ public class NightCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); player.getMap().broadcastNightEffect(); player.yellowMessage("Done."); } diff --git a/src/main/java/client/command/commands/gm3/NoticeCommand.java b/src/main/java/client/command/commands/gm3/NoticeCommand.java index f321d170d0..083365c9af 100644 --- a/src/main/java/client/command/commands/gm3/NoticeCommand.java +++ b/src/main/java/client/command/commands/gm3/NoticeCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import tools.PacketCreator; @@ -35,8 +35,8 @@ public class NoticeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.serverNotice(6, "[Notice] " + player.getLastCommandMessage())); } } diff --git a/src/main/java/client/command/commands/gm3/NpcCommand.java b/src/main/java/client/command/commands/gm3/NpcCommand.java index 28c937a591..9fe52f77bf 100644 --- a/src/main/java/client/command/commands/gm3/NpcCommand.java +++ b/src/main/java/client/command/commands/gm3/NpcCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; -import server.life.MapleNPC; +import server.life.LifeFactory; +import server.life.NPC; import tools.PacketCreator; public class NpcCommand extends Command { @@ -36,13 +36,13 @@ public class NpcCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !npc "); return; } - MapleNPC npc = MapleLifeFactory.getNPC(Integer.parseInt(params[0])); + NPC npc = LifeFactory.getNPC(Integer.parseInt(params[0])); if (npc != null) { npc.setPosition(player.getPosition()); npc.setCy(player.getPosition().y); diff --git a/src/main/java/client/command/commands/gm3/OnlineTwoCommand.java b/src/main/java/client/command/commands/gm3/OnlineTwoCommand.java index 103439efcf..cdba346eb3 100644 --- a/src/main/java/client/command/commands/gm3/OnlineTwoCommand.java +++ b/src/main/java/client/command/commands/gm3/OnlineTwoCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.channel.Channel; @@ -35,16 +35,16 @@ public class OnlineTwoCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int total = 0; for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) { int size = ch.getPlayerStorage().getAllCharacters().size(); total += size; String s = "(Channel " + ch.getId() + " Online: " + size + ") : "; if (ch.getPlayerStorage().getAllCharacters().size() < 50) { - for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { - s += MapleCharacter.makeMapleReadable(chr.getName()) + ", "; + for (Character chr : ch.getPlayerStorage().getAllCharacters()) { + s += Character.makeMapleReadable(chr.getName()) + ", "; } player.dropMessage(6, s.substring(0, s.length() - 2)); } diff --git a/src/main/java/client/command/commands/gm3/OpenPortalCommand.java b/src/main/java/client/command/commands/gm3/OpenPortalCommand.java index 46810f587e..41400b5158 100644 --- a/src/main/java/client/command/commands/gm3/OpenPortalCommand.java +++ b/src/main/java/client/command/commands/gm3/OpenPortalCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class OpenPortalCommand extends Command { @@ -33,8 +33,8 @@ public class OpenPortalCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !openportal "); return; diff --git a/src/main/java/client/command/commands/gm3/PeCommand.java b/src/main/java/client/command/commands/gm3/PeCommand.java index e9a5e61de7..479a72ca99 100644 --- a/src/main/java/client/command/commands/gm3/PeCommand.java +++ b/src/main/java/client/command/commands/gm3/PeCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import io.netty.buffer.Unpooled; import net.PacketHandler; @@ -45,8 +45,8 @@ public class PeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); String packet = ""; try { InputStreamReader is = new FileReader("pe.txt"); diff --git a/src/main/java/client/command/commands/gm3/PosCommand.java b/src/main/java/client/command/commands/gm3/PosCommand.java index f4ebc8d758..5928a351e5 100644 --- a/src/main/java/client/command/commands/gm3/PosCommand.java +++ b/src/main/java/client/command/commands/gm3/PosCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class PosCommand extends Command { @@ -33,8 +33,8 @@ public class PosCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); float xpos = player.getPosition().x; float ypos = player.getPosition().y; float fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId(); diff --git a/src/main/java/client/command/commands/gm3/QuestCompleteCommand.java b/src/main/java/client/command/commands/gm3/QuestCompleteCommand.java index eb8bb787e0..85403e4e7e 100644 --- a/src/main/java/client/command/commands/gm3/QuestCompleteCommand.java +++ b/src/main/java/client/command/commands/gm3/QuestCompleteCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.quest.MapleQuest; +import server.quest.Quest; public class QuestCompleteCommand extends Command { { @@ -34,8 +34,8 @@ public class QuestCompleteCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1){ player.yellowMessage("Syntax: !completequest "); @@ -45,7 +45,7 @@ public class QuestCompleteCommand extends Command { int questId = Integer.parseInt(params[0]); if (player.getQuestStatus(questId) == 1) { - MapleQuest quest = MapleQuest.getInstance(questId); + Quest quest = Quest.getInstance(questId); if (quest != null && quest.getNpcRequirement(true) != -1) { c.getAbstractPlayerInteraction().forceCompleteQuest(questId, quest.getNpcRequirement(true)); } else { diff --git a/src/main/java/client/command/commands/gm3/QuestResetCommand.java b/src/main/java/client/command/commands/gm3/QuestResetCommand.java index 99fa79a106..7cd3cc8c41 100644 --- a/src/main/java/client/command/commands/gm3/QuestResetCommand.java +++ b/src/main/java/client/command/commands/gm3/QuestResetCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.quest.MapleQuest; +import server.quest.Quest; public class QuestResetCommand extends Command { { @@ -34,8 +34,8 @@ public class QuestResetCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1){ player.yellowMessage("Syntax: !resetquest "); @@ -45,7 +45,7 @@ public class QuestResetCommand extends Command { int questid_ = Integer.parseInt(params[0]); if (player.getQuestStatus(questid_) != 0) { - MapleQuest quest = MapleQuest.getInstance(questid_); + Quest quest = Quest.getInstance(questid_); if (quest != null) { quest.reset(player); player.dropMessage(5, "QUEST " + questid_ + " reseted."); diff --git a/src/main/java/client/command/commands/gm3/QuestStartCommand.java b/src/main/java/client/command/commands/gm3/QuestStartCommand.java index 70e3c5b6f4..5e11e27622 100644 --- a/src/main/java/client/command/commands/gm3/QuestStartCommand.java +++ b/src/main/java/client/command/commands/gm3/QuestStartCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.quest.MapleQuest; +import server.quest.Quest; public class QuestStartCommand extends Command { { @@ -34,8 +34,8 @@ public class QuestStartCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1){ player.yellowMessage("Syntax: !startquest "); @@ -45,7 +45,7 @@ public class QuestStartCommand extends Command { int questid = Integer.parseInt(params[0]); if (player.getQuestStatus(questid) == 0) { - MapleQuest quest = MapleQuest.getInstance(questid); + Quest quest = Quest.getInstance(questid); if (quest != null && quest.getNpcRequirement(false) != -1) { c.getAbstractPlayerInteraction().forceStartQuest(questid, quest.getNpcRequirement(false)); } else { diff --git a/src/main/java/client/command/commands/gm3/ReloadDropsCommand.java b/src/main/java/client/command/commands/gm3/ReloadDropsCommand.java index 71c3cd66e2..da88d321b8 100644 --- a/src/main/java/client/command/commands/gm3/ReloadDropsCommand.java +++ b/src/main/java/client/command/commands/gm3/ReloadDropsCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleMonsterInformationProvider; +import server.life.MonsterInformationProvider; public class ReloadDropsCommand extends Command { { @@ -34,9 +34,9 @@ public class ReloadDropsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleMonsterInformationProvider.getInstance().clearDrops(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + MonsterInformationProvider.getInstance().clearDrops(); player.dropMessage(5, "Reloaded Drops"); } } diff --git a/src/main/java/client/command/commands/gm3/ReloadEventsCommand.java b/src/main/java/client/command/commands/gm3/ReloadEventsCommand.java index 5eda37558d..4feeeffa1b 100644 --- a/src/main/java/client/command/commands/gm3/ReloadEventsCommand.java +++ b/src/main/java/client/command/commands/gm3/ReloadEventsCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.channel.Channel; @@ -35,8 +35,8 @@ public class ReloadEventsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (Channel ch : Server.getInstance().getAllChannels()) { ch.reloadEventScriptManager(); } diff --git a/src/main/java/client/command/commands/gm3/ReloadMapCommand.java b/src/main/java/client/command/commands/gm3/ReloadMapCommand.java index ed1910c45a..99ea41e5db 100644 --- a/src/main/java/client/command/commands/gm3/ReloadMapCommand.java +++ b/src/main/java/client/command/commands/gm3/ReloadMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; @@ -36,14 +36,14 @@ public class ReloadMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId()); int callerid = c.getPlayer().getId(); - Collection characters = player.getMap().getAllPlayers(); + Collection characters = player.getMap().getAllPlayers(); - for (MapleCharacter chr : characters) { + for (Character chr : characters) { chr.saveLocationOnWarp(); chr.changeMap(newMap); if (chr.getId() != callerid) diff --git a/src/main/java/client/command/commands/gm3/ReloadPortalsCommand.java b/src/main/java/client/command/commands/gm3/ReloadPortalsCommand.java index 42722196a6..44f593c801 100644 --- a/src/main/java/client/command/commands/gm3/ReloadPortalsCommand.java +++ b/src/main/java/client/command/commands/gm3/ReloadPortalsCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import scripting.portal.PortalScriptManager; @@ -34,8 +34,8 @@ public class ReloadPortalsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); PortalScriptManager.getInstance().reloadPortalScripts(); player.dropMessage(5, "Reloaded Portals"); } diff --git a/src/main/java/client/command/commands/gm3/ReloadShopsCommand.java b/src/main/java/client/command/commands/gm3/ReloadShopsCommand.java index 6bc761a7a5..f98daf3e20 100644 --- a/src/main/java/client/command/commands/gm3/ReloadShopsCommand.java +++ b/src/main/java/client/command/commands/gm3/ReloadShopsCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm3; -import client.MapleClient; +import client.Client; import client.command.Command; -import server.MapleShopFactory; +import server.ShopFactory; public class ReloadShopsCommand extends Command { @@ -34,7 +34,7 @@ public class ReloadShopsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleShopFactory.getInstance().reloadShops(); + public void execute(Client c, String[] params) { + ShopFactory.getInstance().reloadShops(); } } diff --git a/src/main/java/client/command/commands/gm3/RipCommand.java b/src/main/java/client/command/commands/gm3/RipCommand.java index 06cbb73c9e..0d17b6d41f 100644 --- a/src/main/java/client/command/commands/gm3/RipCommand.java +++ b/src/main/java/client/command/commands/gm3/RipCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import tools.PacketCreator; @@ -35,8 +35,8 @@ public class RipCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.serverNotice(6, "[RIP]: " + joinStringFrom(params, 1))); } } diff --git a/src/main/java/client/command/commands/gm3/SeedCommand.java b/src/main/java/client/command/commands/gm3/SeedCommand.java index 9824d4518a..9dc32d4b68 100644 --- a/src/main/java/client/command/commands/gm3/SeedCommand.java +++ b/src/main/java/client/command/commands/gm3/SeedCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import client.inventory.Item; @@ -36,8 +36,8 @@ public class SeedCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (player.getMapId() != 910010000) { player.yellowMessage("This command can only be used in HPQ."); return; diff --git a/src/main/java/client/command/commands/gm3/SpawnCommand.java b/src/main/java/client/command/commands/gm3/SpawnCommand.java index f9ec285b69..cc490d75be 100644 --- a/src/main/java/client/command/commands/gm3/SpawnCommand.java +++ b/src/main/java/client/command/commands/gm3/SpawnCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; -import server.life.MapleMonster; +import server.life.LifeFactory; +import server.life.Monster; public class SpawnCommand extends Command { { @@ -35,23 +35,23 @@ public class SpawnCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !spawn []"); return; } - MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(params[0])); + Monster 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()); } } } diff --git a/src/main/java/client/command/commands/gm3/StartEventCommand.java b/src/main/java/client/command/commands/gm3/StartEventCommand.java index 855fa36843..aaadb2f5a8 100644 --- a/src/main/java/client/command/commands/gm3/StartEventCommand.java +++ b/src/main/java/client/command/commands/gm3/StartEventCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; -import server.events.gm.MapleEvent; +import server.events.gm.Event; import tools.PacketCreator; public class StartEventCommand extends Command { @@ -36,12 +36,12 @@ public class StartEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int players = 50; if (params.length > 1) players = Integer.parseInt(params[0]); - c.getChannelServer().setEvent(new MapleEvent(player.getMapId(), players)); + c.getChannelServer().setEvent(new Event(player.getMapId(), players)); Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.earnTitleMessage( "[Event] An event has started on " + player.getMap().getMapName() diff --git a/src/main/java/client/command/commands/gm3/StartMapEventCommand.java b/src/main/java/client/command/commands/gm3/StartMapEventCommand.java index 202df0ab36..b269c04be6 100644 --- a/src/main/java/client/command/commands/gm3/StartMapEventCommand.java +++ b/src/main/java/client/command/commands/gm3/StartMapEventCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm3; -import client.MapleClient; +import client.Client; import client.command.Command; public class StartMapEventCommand extends Command { @@ -32,7 +32,7 @@ public class StartMapEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getPlayer().getMap().startEvent(c.getPlayer()); } } diff --git a/src/main/java/client/command/commands/gm3/StopMapEventCommand.java b/src/main/java/client/command/commands/gm3/StopMapEventCommand.java index 2046857b29..8b541c6996 100644 --- a/src/main/java/client/command/commands/gm3/StopMapEventCommand.java +++ b/src/main/java/client/command/commands/gm3/StopMapEventCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm3; -import client.MapleClient; +import client.Client; import client.command.Command; public class StopMapEventCommand extends Command { @@ -32,7 +32,7 @@ public class StopMapEventCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { c.getPlayer().getMap().setEventStarted(false); } } diff --git a/src/main/java/client/command/commands/gm3/TimerAllCommand.java b/src/main/java/client/command/commands/gm3/TimerAllCommand.java index f58898dd43..18d0d3a954 100644 --- a/src/main/java/client/command/commands/gm3/TimerAllCommand.java +++ b/src/main/java/client/command/commands/gm3/TimerAllCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,21 +34,21 @@ public class TimerAllCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !timerall |remove"); return; } if (params[0].equalsIgnoreCase("remove")) { - for (MapleCharacter victim : player.getWorldServer().getPlayerStorage().getAllCharacters()) { + for (Character victim : player.getWorldServer().getPlayerStorage().getAllCharacters()) { victim.sendPacket(PacketCreator.removeClock()); } } else { try { int seconds = Integer.parseInt(params[0]); - for (MapleCharacter victim : player.getWorldServer().getPlayerStorage().getAllCharacters()) { + for (Character victim : player.getWorldServer().getPlayerStorage().getAllCharacters()) { victim.sendPacket(PacketCreator.getClock(seconds)); } } catch (NumberFormatException e) { diff --git a/src/main/java/client/command/commands/gm3/TimerCommand.java b/src/main/java/client/command/commands/gm3/TimerCommand.java index 927dc40571..9c7a5cfb54 100644 --- a/src/main/java/client/command/commands/gm3/TimerCommand.java +++ b/src/main/java/client/command/commands/gm3/TimerCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,14 +34,14 @@ public class TimerCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !timer |remove"); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { if (params[1].equalsIgnoreCase("remove")) { victim.sendPacket(PacketCreator.removeClock()); diff --git a/src/main/java/client/command/commands/gm3/TimerMapCommand.java b/src/main/java/client/command/commands/gm3/TimerMapCommand.java index 6b10b51092..2456dd682b 100644 --- a/src/main/java/client/command/commands/gm3/TimerMapCommand.java +++ b/src/main/java/client/command/commands/gm3/TimerMapCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,21 +34,21 @@ public class TimerMapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !timermap |remove"); return; } if (params[0].equalsIgnoreCase("remove")) { - for (MapleCharacter victim : player.getMap().getCharacters()) { + for (Character victim : player.getMap().getCharacters()) { victim.sendPacket(PacketCreator.removeClock()); } } else { try { int seconds = Integer.parseInt(params[0]); - for (MapleCharacter victim : player.getMap().getCharacters()) { + for (Character victim : player.getMap().getCharacters()) { victim.sendPacket(PacketCreator.getClock(seconds)); } } catch (NumberFormatException e) { diff --git a/src/main/java/client/command/commands/gm3/ToggleCouponCommand.java b/src/main/java/client/command/commands/gm3/ToggleCouponCommand.java index e5bba02906..03046c04ba 100644 --- a/src/main/java/client/command/commands/gm3/ToggleCouponCommand.java +++ b/src/main/java/client/command/commands/gm3/ToggleCouponCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; @@ -34,8 +34,8 @@ public class ToggleCouponCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !togglecoupon "); return; diff --git a/src/main/java/client/command/commands/gm3/UnBanCommand.java b/src/main/java/client/command/commands/gm3/UnBanCommand.java index 1a67ecc59b..7f9cf7fe34 100644 --- a/src/main/java/client/command/commands/gm3/UnBanCommand.java +++ b/src/main/java/client/command/commands/gm3/UnBanCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm3; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.DatabaseConnection; @@ -37,15 +37,15 @@ public class UnBanCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !unban "); return; } try (Connection con = DatabaseConnection.getConnection()) { - int aid = MapleCharacter.getAccountIdByName(params[0]); + int aid = Character.getAccountIdByName(params[0]); try (PreparedStatement p = con.prepareStatement("UPDATE accounts SET banned = -1 WHERE id = " + aid)) { p.executeUpdate(); diff --git a/src/main/java/client/command/commands/gm4/BossDropRateCommand.java b/src/main/java/client/command/commands/gm4/BossDropRateCommand.java index 14cc40935a..4cfddda6be 100644 --- a/src/main/java/client/command/commands/gm4/BossDropRateCommand.java +++ b/src/main/java/client/command/commands/gm4/BossDropRateCommand.java @@ -19,8 +19,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class BossDropRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !bossdroprate "); return; diff --git a/src/main/java/client/command/commands/gm4/CakeCommand.java b/src/main/java/client/command/commands/gm4/CakeCommand.java index 248c55361e..670223cd11 100644 --- a/src/main/java/client/command/commands/gm4/CakeCommand.java +++ b/src/main/java/client/command/commands/gm4/CakeCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; -import server.life.MapleMonster; +import server.life.LifeFactory; +import server.life.Monster; public class CakeCommand extends Command { { @@ -35,9 +35,9 @@ public class CakeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleMonster monster = MapleLifeFactory.getMonster(9400606); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Monster 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); diff --git a/src/main/java/client/command/commands/gm4/DropRateCommand.java b/src/main/java/client/command/commands/gm4/DropRateCommand.java index 1dda95d9a9..1a94e3d77e 100644 --- a/src/main/java/client/command/commands/gm4/DropRateCommand.java +++ b/src/main/java/client/command/commands/gm4/DropRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class DropRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !droprate "); return; diff --git a/src/main/java/client/command/commands/gm4/ExpRateCommand.java b/src/main/java/client/command/commands/gm4/ExpRateCommand.java index a1fe479708..5b363c6927 100644 --- a/src/main/java/client/command/commands/gm4/ExpRateCommand.java +++ b/src/main/java/client/command/commands/gm4/ExpRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class ExpRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !exprate "); return; diff --git a/src/main/java/client/command/commands/gm4/FishingRateCommand.java b/src/main/java/client/command/commands/gm4/FishingRateCommand.java index 768d896533..532d94f649 100644 --- a/src/main/java/client/command/commands/gm4/FishingRateCommand.java +++ b/src/main/java/client/command/commands/gm4/FishingRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class FishingRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !fishrate "); return; diff --git a/src/main/java/client/command/commands/gm4/ForceVacCommand.java b/src/main/java/client/command/commands/gm4/ForceVacCommand.java index 2369efc487..170c856b46 100644 --- a/src/main/java/client/command/commands/gm4/ForceVacCommand.java +++ b/src/main/java/client/command/commands/gm4/ForceVacCommand.java @@ -23,14 +23,14 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import client.inventory.MaplePet; -import client.inventory.manipulator.MapleInventoryManipulator; -import server.maps.MapleMapItem; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; +import client.inventory.Pet; +import client.inventory.manipulator.InventoryManipulator; +import server.maps.MapItem; +import server.maps.MapObject; +import server.maps.MapObjectType; import tools.PacketCreator; import java.util.Arrays; @@ -42,11 +42,11 @@ public class ForceVacCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : items) { - MapleMapItem mapItem = (MapleMapItem) item; + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM)); + for (MapObject item : items) { + MapItem mapItem = (MapItem) item; mapItem.lockItem(); try { @@ -59,12 +59,12 @@ public class ForceVacCommand extends Command { // Add NX to account, show effect and make item disappear player.getCashShop().gainCash(1, mapItem.getItemId() == 4031865 ? 100 : 250); } else if (mapItem.getItem().getItemId() >= 5000000 && mapItem.getItem().getItemId() <= 5000100) { - int petId = MaplePet.createPet(mapItem.getItem().getItemId()); + int petId = Pet.createPet(mapItem.getItem().getItemId()); if (petId == -1) { continue; } - MapleInventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); - } else if (MapleInventoryManipulator.addFromDrop(c, mapItem.getItem(), true)) { + InventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); + } else if (InventoryManipulator.addFromDrop(c, mapItem.getItem(), true)) { if (mapItem.getItemId() == 4031868) { player.updateAriantScore(); } diff --git a/src/main/java/client/command/commands/gm4/HorntailCommand.java b/src/main/java/client/command/commands/gm4/HorntailCommand.java index 0a1282b05f..dffe66d390 100644 --- a/src/main/java/client/command/commands/gm4/HorntailCommand.java +++ b/src/main/java/client/command/commands/gm4/HorntailCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import server.maps.MapleMap; @@ -36,8 +36,8 @@ public class HorntailCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); final Point targetPoint = player.getPosition(); final MapleMap targetMap = player.getMap(); diff --git a/src/main/java/client/command/commands/gm4/ItemVacCommand.java b/src/main/java/client/command/commands/gm4/ItemVacCommand.java index dc4dfe425b..a0bf4238bb 100644 --- a/src/main/java/client/command/commands/gm4/ItemVacCommand.java +++ b/src/main/java/client/command/commands/gm4/ItemVacCommand.java @@ -23,11 +23,11 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; +import server.maps.MapObject; +import server.maps.MapObjectType; import java.util.Arrays; import java.util.List; @@ -38,10 +38,10 @@ public class ItemVacCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - List list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : list) { + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + List list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM)); + for (MapObject item : list) { player.pickupItem(item); } } diff --git a/src/main/java/client/command/commands/gm4/MesoRateCommand.java b/src/main/java/client/command/commands/gm4/MesoRateCommand.java index 944a6bef9d..4680c0cefc 100644 --- a/src/main/java/client/command/commands/gm4/MesoRateCommand.java +++ b/src/main/java/client/command/commands/gm4/MesoRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class MesoRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !mesorate "); return; diff --git a/src/main/java/client/command/commands/gm4/PapCommand.java b/src/main/java/client/command/commands/gm4/PapCommand.java index 7e51fb8da5..e89a01b1d1 100644 --- a/src/main/java/client/command/commands/gm4/PapCommand.java +++ b/src/main/java/client/command/commands/gm4/PapCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; +import server.life.LifeFactory; public class PapCommand extends Command { { @@ -34,10 +34,10 @@ public class PapCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + 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()); } } diff --git a/src/main/java/client/command/commands/gm4/PianusCommand.java b/src/main/java/client/command/commands/gm4/PianusCommand.java index a16cd355ee..4c498c6ba8 100644 --- a/src/main/java/client/command/commands/gm4/PianusCommand.java +++ b/src/main/java/client/command/commands/gm4/PianusCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; +import server.life.LifeFactory; public class PianusCommand extends Command { { @@ -34,8 +34,8 @@ public class PianusCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition()); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8510000), player.getPosition()); } } diff --git a/src/main/java/client/command/commands/gm4/PinkbeanCommand.java b/src/main/java/client/command/commands/gm4/PinkbeanCommand.java index eb7fb8a38f..e1bb7655e0 100644 --- a/src/main/java/client/command/commands/gm4/PinkbeanCommand.java +++ b/src/main/java/client/command/commands/gm4/PinkbeanCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; +import server.life.LifeFactory; public class PinkbeanCommand extends Command { { @@ -34,9 +34,9 @@ public class PinkbeanCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8820001), player.getPosition()); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8820001), player.getPosition()); } } diff --git a/src/main/java/client/command/commands/gm4/PlayerNpcCommand.java b/src/main/java/client/command/commands/gm4/PlayerNpcCommand.java index 264287d45f..d4d5ae0316 100644 --- a/src/main/java/client/command/commands/gm4/PlayerNpcCommand.java +++ b/src/main/java/client/command/commands/gm4/PlayerNpcCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MaplePlayerNPC; +import server.life.PlayerNPC; public class PlayerNpcCommand extends Command { { @@ -34,14 +34,14 @@ public class PlayerNpcCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !playernpc "); return; } - if (!MaplePlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]))) { + if (!PlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]))) { player.dropMessage(5, "Could not deploy PlayerNPC. Either there's no room available here or depleted out scriptids to use."); } } diff --git a/src/main/java/client/command/commands/gm4/PlayerNpcRemoveCommand.java b/src/main/java/client/command/commands/gm4/PlayerNpcRemoveCommand.java index 6654b2b0c2..68616156ba 100644 --- a/src/main/java/client/command/commands/gm4/PlayerNpcRemoveCommand.java +++ b/src/main/java/client/command/commands/gm4/PlayerNpcRemoveCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MaplePlayerNPC; +import server.life.PlayerNPC; public class PlayerNpcRemoveCommand extends Command { { @@ -34,12 +34,12 @@ public class PlayerNpcRemoveCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !playernpcremove "); return; } - MaplePlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(params[0])); + PlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(params[0])); } } diff --git a/src/main/java/client/command/commands/gm4/PmobCommand.java b/src/main/java/client/command/commands/gm4/PmobCommand.java index 0b416980c8..7b918a8d94 100644 --- a/src/main/java/client/command/commands/gm4/PmobCommand.java +++ b/src/main/java/client/command/commands/gm4/PmobCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.channel.Channel; -import server.life.MapleLifeFactory; -import server.life.MapleMonster; +import server.life.LifeFactory; +import server.life.Monster; import server.maps.MapleMap; import tools.DatabaseConnection; @@ -43,8 +43,8 @@ public class PmobCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !pmob []"); return; @@ -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); + Monster mob = LifeFactory.getMonster(mobId); if (mob != null && !mob.getName().equals("MISSINGNO")) { mob.setPosition(checkpos); mob.setCy(ypos); diff --git a/src/main/java/client/command/commands/gm4/PmobRemoveCommand.java b/src/main/java/client/command/commands/gm4/PmobRemoveCommand.java index 98ea14acf5..f2abbea2a0 100644 --- a/src/main/java/client/command/commands/gm4/PmobRemoveCommand.java +++ b/src/main/java/client/command/commands/gm4/PmobRemoveCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.channel.Channel; import server.maps.MapleMap; @@ -45,8 +45,8 @@ public class PmobRemoveCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int mapId = player.getMapId(); int mobId = params.length > 0 ? Integer.parseInt(params[0]) : -1; diff --git a/src/main/java/client/command/commands/gm4/PnpcCommand.java b/src/main/java/client/command/commands/gm4/PnpcCommand.java index 1b15f81832..e6212b27c4 100644 --- a/src/main/java/client/command/commands/gm4/PnpcCommand.java +++ b/src/main/java/client/command/commands/gm4/PnpcCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.channel.Channel; -import server.life.MapleLifeFactory; -import server.life.MapleNPC; +import server.life.LifeFactory; +import server.life.NPC; import server.maps.MapleMap; import tools.DatabaseConnection; import tools.PacketCreator; @@ -44,8 +44,8 @@ public class PnpcCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !pnpc "); return; @@ -59,7 +59,7 @@ public class PnpcCommand extends Command { return; } - MapleNPC npc = MapleLifeFactory.getNPC(npcId); + NPC 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); diff --git a/src/main/java/client/command/commands/gm4/PnpcRemoveCommand.java b/src/main/java/client/command/commands/gm4/PnpcRemoveCommand.java index f441a95774..bf41fee68a 100644 --- a/src/main/java/client/command/commands/gm4/PnpcRemoveCommand.java +++ b/src/main/java/client/command/commands/gm4/PnpcRemoveCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.channel.Channel; import server.maps.MapleMap; @@ -45,8 +45,8 @@ public class PnpcRemoveCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); int mapId = player.getMapId(); int npcId = params.length > 0 ? Integer.parseInt(params[0]) : -1; diff --git a/src/main/java/client/command/commands/gm4/ProItemCommand.java b/src/main/java/client/command/commands/gm4/ProItemCommand.java index 96a0d5466d..e9808bafca 100644 --- a/src/main/java/client/command/commands/gm4/ProItemCommand.java +++ b/src/main/java/client/command/commands/gm4/ProItemCommand.java @@ -23,15 +23,15 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import client.inventory.Equip; +import client.inventory.InventoryType; import client.inventory.Item; -import client.inventory.MapleInventoryType; -import client.inventory.manipulator.MapleInventoryManipulator; +import client.inventory.manipulator.InventoryManipulator; import constants.inventory.ItemConstants; -import server.MapleItemInformationProvider; +import server.ItemInformationProvider; public class ProItemCommand extends Command { { @@ -39,14 +39,14 @@ public class ProItemCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !proitem []"); return; } - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + ItemInformationProvider ii = ItemInformationProvider.getInstance(); int itemid = Integer.parseInt(params[0]); if(ii.getName(itemid) == null) { @@ -57,13 +57,13 @@ public class ProItemCommand extends Command { short stat = (short) Math.max(0, Short.parseShort(params[1])); short spdjmp = params.length >= 3 ? (short) Math.max(0, Short.parseShort(params[2])) : 0; - MapleInventoryType type = ItemConstants.getInventoryType(itemid); - if (type.equals(MapleInventoryType.EQUIP)) { + InventoryType type = ItemConstants.getInventoryType(itemid); + if (type.equals(InventoryType.EQUIP)) { Item it = ii.getEquipById(itemid); it.setOwner(player.getName()); hardsetItemStats((Equip) it, stat, spdjmp); - MapleInventoryManipulator.addFromDrop(c, it); + InventoryManipulator.addFromDrop(c, it); } else { player.dropMessage(6, "Make sure it's an equippable item."); } diff --git a/src/main/java/client/command/commands/gm4/QuestRateCommand.java b/src/main/java/client/command/commands/gm4/QuestRateCommand.java index 855fe1caa8..c880d7a166 100644 --- a/src/main/java/client/command/commands/gm4/QuestRateCommand.java +++ b/src/main/java/client/command/commands/gm4/QuestRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class QuestRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !questrate "); return; diff --git a/src/main/java/client/command/commands/gm4/ServerMessageCommand.java b/src/main/java/client/command/commands/gm4/ServerMessageCommand.java index a58e4d5466..2fd43e483c 100644 --- a/src/main/java/client/command/commands/gm4/ServerMessageCommand.java +++ b/src/main/java/client/command/commands/gm4/ServerMessageCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class ServerMessageCommand extends Command { @@ -33,8 +33,8 @@ public class ServerMessageCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); c.getWorldServer().setServerMessage(player.getLastCommandMessage()); } } diff --git a/src/main/java/client/command/commands/gm4/SetEqStatCommand.java b/src/main/java/client/command/commands/gm4/SetEqStatCommand.java index c9fc51298d..b4b1832871 100644 --- a/src/main/java/client/command/commands/gm4/SetEqStatCommand.java +++ b/src/main/java/client/command/commands/gm4/SetEqStatCommand.java @@ -23,12 +23,12 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import client.inventory.Equip; import client.inventory.Inventory; -import client.inventory.MapleInventoryType; +import client.inventory.InventoryType; import constants.inventory.ItemConstants; public class SetEqStatCommand extends Command { @@ -37,8 +37,8 @@ public class SetEqStatCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !seteqstat []"); return; @@ -46,7 +46,7 @@ public class SetEqStatCommand extends Command { short newStat = (short) Math.max(0, Integer.parseInt(params[0])); short newSpdJmp = params.length >= 2 ? (short) Integer.parseInt(params[1]) : 0; - Inventory equip = player.getInventory(MapleInventoryType.EQUIP); + Inventory equip = player.getInventory(InventoryType.EQUIP); for (byte i = 1; i <= equip.getSlotLimit(); i++) { try { diff --git a/src/main/java/client/command/commands/gm4/TravelRateCommand.java b/src/main/java/client/command/commands/gm4/TravelRateCommand.java index 14da01f08f..aabb8605aa 100644 --- a/src/main/java/client/command/commands/gm4/TravelRateCommand.java +++ b/src/main/java/client/command/commands/gm4/TravelRateCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import tools.PacketCreator; @@ -34,8 +34,8 @@ public class TravelRateCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !travelrate "); return; diff --git a/src/main/java/client/command/commands/gm4/ZakumCommand.java b/src/main/java/client/command/commands/gm4/ZakumCommand.java index 2dbbfa1207..6d647acc08 100644 --- a/src/main/java/client/command/commands/gm4/ZakumCommand.java +++ b/src/main/java/client/command/commands/gm4/ZakumCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm4; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.life.MapleLifeFactory; +import server.life.LifeFactory; public class ZakumCommand extends Command { { @@ -34,11 +34,11 @@ public class ZakumCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - player.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8800000), player.getPosition()); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + 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()); } } } diff --git a/src/main/java/client/command/commands/gm5/DebugCommand.java b/src/main/java/client/command/commands/gm5/DebugCommand.java index 019f703912..3d9da3d52a 100644 --- a/src/main/java/client/command/commands/gm5/DebugCommand.java +++ b/src/main/java/client/command/commands/gm5/DebugCommand.java @@ -23,17 +23,17 @@ */ package client.command.commands.gm5; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.TimerManager; -import server.life.MapleMonster; +import server.life.Monster; import server.life.SpawnPoint; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; -import server.maps.MaplePortal; -import server.maps.MapleReactor; +import server.maps.MapObject; +import server.maps.MapObjectType; +import server.maps.Portal; +import server.maps.Reactor; import java.awt.*; import java.util.Arrays; @@ -47,8 +47,8 @@ public class DebugCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !debug "); @@ -67,10 +67,10 @@ public class DebugCommand extends Command { break; case "monster": - List monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); - for (MapleMapObject monstermo : monsters) { - MapleMonster monster = (MapleMonster) monstermo; - MapleCharacter controller = monster.getController(); + List monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER)); + for (MapObject monstermo : monsters) { + Monster monster = (Monster) monstermo; + Character controller = monster.getController(); player.message("Monster ID: " + monster.getId() + " Aggro target: " + ((controller != null) ? controller.getName() + " Has aggro: " + monster.isControllerHasAggro() + " Knowns aggro: " + monster.isControllerKnowsAboutAggro() : "")); } break; @@ -80,7 +80,7 @@ public class DebugCommand extends Command { break; case "portal": - MaplePortal portal = player.getMap().findClosestPortal(player.getPosition()); + Portal portal = player.getMap().findClosestPortal(player.getPosition()); if (portal != null) player.dropMessage(6, "Closest portal: " + portal.getId() + " '" + portal.getName() + "' Type: " + portal.getType() + " --> toMap: " + portal.getTargetMapId() + " scriptname: '" + portal.getScriptName() + "' state: " + (portal.getPortalState() ? 1 : 0) + "."); else player.dropMessage(6, "There is no portal on this map."); @@ -123,8 +123,8 @@ public class DebugCommand extends Command { case "reactors": player.dropMessage(6, "Current reactor states on map " + player.getMapId() + ":"); - for (MapleMapObject mmo : player.getMap().getReactors()) { - MapleReactor mr = (MapleReactor) mmo; + for (MapObject mmo : player.getMap().getReactors()) { + Reactor mr = (Reactor) mmo; player.dropMessage(6, "Id: " + mr.getId() + " Oid: " + mr.getObjectId() + " name: '" + mr.getName() + "' -> Type: " + mr.getReactorType() + " State: " + mr.getState() + " Event State: " + mr.getEventState() + " Position: x " + mr.getPosition().getX() + " y " + mr.getPosition().getY() + "."); } break; diff --git a/src/main/java/client/command/commands/gm5/IpListCommand.java b/src/main/java/client/command/commands/gm5/IpListCommand.java index c7ae291fbd..3d3a8bfd00 100644 --- a/src/main/java/client/command/commands/gm5/IpListCommand.java +++ b/src/main/java/client/command/commands/gm5/IpListCommand.java @@ -19,8 +19,8 @@ */ package client.command.commands.gm5; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import constants.game.GameConstants; import net.server.Server; @@ -40,16 +40,16 @@ public class IpListCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { String str = "Player-IP relation:"; for (World w : Server.getInstance().getWorlds()) { - Collection chars = w.getPlayerStorage().getAllCharacters(); + Collection chars = w.getPlayerStorage().getAllCharacters(); if (!chars.isEmpty()) { str += "\r\n" + GameConstants.WORLD_NAMES[w.getId()] + "\r\n"; - for (MapleCharacter chr : chars) { + for (Character chr : chars) { str += " " + chr.getName() + " - " + chr.getClient().getRemoteAddress() + "\r\n"; } } diff --git a/src/main/java/client/command/commands/gm5/SetCommand.java b/src/main/java/client/command/commands/gm5/SetCommand.java index f45a853011..f42dd1fb1b 100644 --- a/src/main/java/client/command/commands/gm5/SetCommand.java +++ b/src/main/java/client/command/commands/gm5/SetCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm5; -import client.MapleClient; +import client.Client; import client.command.Command; import constants.net.ServerConstants; @@ -33,7 +33,7 @@ public class SetCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { for (int i = 0; i < params.length; i++) { ServerConstants.DEBUG_VALUES[i] = Integer.parseInt(params[i]); } diff --git a/src/main/java/client/command/commands/gm5/ShowMoveLifeCommand.java b/src/main/java/client/command/commands/gm5/ShowMoveLifeCommand.java index 6ec83ce001..d269cc956f 100644 --- a/src/main/java/client/command/commands/gm5/ShowMoveLifeCommand.java +++ b/src/main/java/client/command/commands/gm5/ShowMoveLifeCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm5; -import client.MapleClient; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -33,7 +33,7 @@ public class ShowMoveLifeCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE; } } diff --git a/src/main/java/client/command/commands/gm5/ShowPacketsCommand.java b/src/main/java/client/command/commands/gm5/ShowPacketsCommand.java index 8e955e8043..03bf3bf49e 100644 --- a/src/main/java/client/command/commands/gm5/ShowPacketsCommand.java +++ b/src/main/java/client/command/commands/gm5/ShowPacketsCommand.java @@ -23,7 +23,7 @@ */ package client.command.commands.gm5; -import client.MapleClient; +import client.Client; import client.command.Command; import config.YamlConfig; @@ -33,7 +33,7 @@ public class ShowPacketsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET; } } diff --git a/src/main/java/client/command/commands/gm5/ShowSessionsCommand.java b/src/main/java/client/command/commands/gm5/ShowSessionsCommand.java index 71d31c9982..6116f99d21 100644 --- a/src/main/java/client/command/commands/gm5/ShowSessionsCommand.java +++ b/src/main/java/client/command/commands/gm5/ShowSessionsCommand.java @@ -19,7 +19,7 @@ */ package client.command.commands.gm5; -import client.MapleClient; +import client.Client; import client.command.Command; import net.server.coordinator.session.SessionCoordinator; @@ -33,7 +33,7 @@ public class ShowSessionsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { + public void execute(Client c, String[] params) { SessionCoordinator.getInstance().printSessionTrace(c); } } diff --git a/src/main/java/client/command/commands/gm6/ClearQuestCacheCommand.java b/src/main/java/client/command/commands/gm6/ClearQuestCacheCommand.java index 19a49bc430..5f094f5600 100644 --- a/src/main/java/client/command/commands/gm6/ClearQuestCacheCommand.java +++ b/src/main/java/client/command/commands/gm6/ClearQuestCacheCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.quest.MapleQuest; +import server.quest.Quest; public class ClearQuestCacheCommand extends Command { { @@ -34,9 +34,9 @@ public class ClearQuestCacheCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); - MapleQuest.clearCache(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); + Quest.clearCache(); player.dropMessage(5, "Quest Cache Cleared."); } } diff --git a/src/main/java/client/command/commands/gm6/ClearQuestCommand.java b/src/main/java/client/command/commands/gm6/ClearQuestCommand.java index dfe63ac229..79707eff05 100644 --- a/src/main/java/client/command/commands/gm6/ClearQuestCommand.java +++ b/src/main/java/client/command/commands/gm6/ClearQuestCommand.java @@ -23,10 +23,10 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; -import server.quest.MapleQuest; +import server.quest.Quest; public class ClearQuestCommand extends Command { { @@ -34,13 +34,13 @@ public class ClearQuestCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Please include a quest ID."); return; } - MapleQuest.clearCache(Integer.parseInt(params[0])); + Quest.clearCache(Integer.parseInt(params[0])); player.dropMessage(5, "Quest Cache for quest " + params[0] + " cleared."); } diff --git a/src/main/java/client/command/commands/gm6/DCAllCommand.java b/src/main/java/client/command/commands/gm6/DCAllCommand.java index 139301174c..f8298a4534 100644 --- a/src/main/java/client/command/commands/gm6/DCAllCommand.java +++ b/src/main/java/client/command/commands/gm6/DCAllCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.world.World; @@ -35,10 +35,10 @@ public class DCAllCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + for (Character chr : world.getPlayerStorage().getAllCharacters()) { if (!chr.isGM()) { chr.getClient().disconnect(false, false); } diff --git a/src/main/java/client/command/commands/gm6/EraseAllPNpcsCommand.java b/src/main/java/client/command/commands/gm6/EraseAllPNpcsCommand.java index 517c085826..6f6394454c 100644 --- a/src/main/java/client/command/commands/gm6/EraseAllPNpcsCommand.java +++ b/src/main/java/client/command/commands/gm6/EraseAllPNpcsCommand.java @@ -23,9 +23,9 @@ */ package client.command.commands.gm6; -import client.MapleClient; +import client.Client; import client.command.Command; -import server.life.MaplePlayerNPC; +import server.life.PlayerNPC; public class EraseAllPNpcsCommand extends Command { { @@ -33,7 +33,7 @@ public class EraseAllPNpcsCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MaplePlayerNPC.removeAllPlayerNPC(); + public void execute(Client c, String[] params) { + PlayerNPC.removeAllPlayerNPC(); } } diff --git a/src/main/java/client/command/commands/gm6/GetAccCommand.java b/src/main/java/client/command/commands/gm6/GetAccCommand.java index d0c550a8c3..00b81c69ac 100644 --- a/src/main/java/client/command/commands/gm6/GetAccCommand.java +++ b/src/main/java/client/command/commands/gm6/GetAccCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class GetAccCommand extends Command { @@ -33,13 +33,13 @@ public class GetAccCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1) { player.yellowMessage("Syntax: !getacc "); return; } - MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { player.message(victim.getName() + "'s account name is " + victim.getClient().getAccountName() + "."); } else { diff --git a/src/main/java/client/command/commands/gm6/MapPlayersCommand.java b/src/main/java/client/command/commands/gm6/MapPlayersCommand.java index a5f42142d6..2404bd9bc0 100644 --- a/src/main/java/client/command/commands/gm6/MapPlayersCommand.java +++ b/src/main/java/client/command/commands/gm6/MapPlayersCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.world.World; @@ -35,12 +35,12 @@ public class MapPlayersCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); String names = ""; int map = player.getMapId(); for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + for (Character chr : world.getPlayerStorage().getAllCharacters()) { int curMap = chr.getMapId(); String hp = Integer.toString(chr.getHp()); String maxhp = Integer.toString(chr.getCurrentMaxHp()); diff --git a/src/main/java/client/command/commands/gm6/SaveAllCommand.java b/src/main/java/client/command/commands/gm6/SaveAllCommand.java index d6a117a24f..28df7b456f 100644 --- a/src/main/java/client/command/commands/gm6/SaveAllCommand.java +++ b/src/main/java/client/command/commands/gm6/SaveAllCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.world.World; @@ -36,10 +36,10 @@ public class SaveAllCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + for (Character chr : world.getPlayerStorage().getAllCharacters()) { chr.saveCharToDB(); } } diff --git a/src/main/java/client/command/commands/gm6/ServerAddChannelCommand.java b/src/main/java/client/command/commands/gm6/ServerAddChannelCommand.java index 4e5cbcca39..0f58fedea1 100644 --- a/src/main/java/client/command/commands/gm6/ServerAddChannelCommand.java +++ b/src/main/java/client/command/commands/gm6/ServerAddChannelCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.ThreadManager; @@ -35,8 +35,8 @@ public class ServerAddChannelCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - final MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + final Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Syntax: @addchannel "); diff --git a/src/main/java/client/command/commands/gm6/ServerAddWorldCommand.java b/src/main/java/client/command/commands/gm6/ServerAddWorldCommand.java index 2fa045c58c..a177cedb48 100644 --- a/src/main/java/client/command/commands/gm6/ServerAddWorldCommand.java +++ b/src/main/java/client/command/commands/gm6/ServerAddWorldCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.ThreadManager; @@ -35,8 +35,8 @@ public class ServerAddWorldCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - final MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + final Character player = c.getPlayer(); ThreadManager.getInstance().newTask(() -> { int wid = Server.getInstance().addWorld(); diff --git a/src/main/java/client/command/commands/gm6/ServerRemoveChannelCommand.java b/src/main/java/client/command/commands/gm6/ServerRemoveChannelCommand.java index fa2b379d07..16958a5e29 100644 --- a/src/main/java/client/command/commands/gm6/ServerRemoveChannelCommand.java +++ b/src/main/java/client/command/commands/gm6/ServerRemoveChannelCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.ThreadManager; @@ -35,8 +35,8 @@ public class ServerRemoveChannelCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - final MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + final Character player = c.getPlayer(); if (params.length < 1) { player.dropMessage(5, "Syntax: @removechannel "); diff --git a/src/main/java/client/command/commands/gm6/ServerRemoveWorldCommand.java b/src/main/java/client/command/commands/gm6/ServerRemoveWorldCommand.java index 0692b3ed51..f9df512306 100644 --- a/src/main/java/client/command/commands/gm6/ServerRemoveWorldCommand.java +++ b/src/main/java/client/command/commands/gm6/ServerRemoveWorldCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import server.ThreadManager; @@ -35,8 +35,8 @@ public class ServerRemoveWorldCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - final MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + final Character player = c.getPlayer(); final int rwid = Server.getInstance().getWorldsSize() - 1; if(rwid <= 0) { diff --git a/src/main/java/client/command/commands/gm6/SetGmLevelCommand.java b/src/main/java/client/command/commands/gm6/SetGmLevelCommand.java index 00ca92a224..9387ac0cb8 100644 --- a/src/main/java/client/command/commands/gm6/SetGmLevelCommand.java +++ b/src/main/java/client/command/commands/gm6/SetGmLevelCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; public class SetGmLevelCommand extends Command { @@ -33,15 +33,15 @@ public class SetGmLevelCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 2) { player.yellowMessage("Syntax: !setgmlevel "); return; } int newLevel = Integer.parseInt(params[1]); - MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + Character target = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (target != null) { target.setGMLevel(newLevel); target.getClient().setGMLevel(newLevel); diff --git a/src/main/java/client/command/commands/gm6/ShutdownCommand.java b/src/main/java/client/command/commands/gm6/ShutdownCommand.java index 2f4797b606..948ebe0994 100644 --- a/src/main/java/client/command/commands/gm6/ShutdownCommand.java +++ b/src/main/java/client/command/commands/gm6/ShutdownCommand.java @@ -23,8 +23,8 @@ */ package client.command.commands.gm6; -import client.MapleCharacter; -import client.MapleClient; +import client.Character; +import client.Client; import client.command.Command; import net.server.Server; import net.server.world.World; @@ -36,8 +36,8 @@ public class ShutdownCommand extends Command { } @Override - public void execute(MapleClient c, String[] params) { - MapleCharacter player = c.getPlayer(); + public void execute(Client c, String[] params) { + Character player = c.getPlayer(); if (params.length < 1){ player.yellowMessage("Syntax: !shutdown [