From 5480035005a8056dd027e0f711c668cc13d4c8fa Mon Sep 17 00:00:00 2001 From: ronancpl Date: Sun, 23 Sep 2018 22:37:00 -0300 Subject: [PATCH] Level/exp on all equips + Player stats overhaul + Chair handler patch Implemented a massive overhaul on Character.wz, adding in equipment level-related nodes in order to make equipments level/EXP info available for anyone to check. Implemented a major overhaul on the player stat management throughout the source, properly encapsulating and concurrency protecting it's mechanics. Reviewed several MoveLifeHandler aspects, some of them trying to prevent mobs from falling from footholds in certain circumstances. Fixed MP Recovery instant killing players when they run out of HP to use. Fixed some chairs arbitrarily disconnecting players upon HP/MP recovery. Fixed Puppets sticking to maps in certain scenarios. Cached data and added concurrency protection for EXP gain on equipments. Reworked Chair Mastery skill, now with recovering amounts based on a player's base HP/MP pool. Fixed several deadlock issues revolving rate coupons and character inventory. Improved overall autopot handler performance. Reworked door bosses (such as Crocell), now spawning each 3 hours instead of upon player's demand. Fixed alliances not saving rank names on DB at creation time. Fixed alliances retaining disbanded guild info on DB. Added Mystic Door support for the Mushroom Castle area. --- .gitignore | 4 + README.md | 2 +- docs/feature_list.md | 10 +- docs/mychanges_ptbr.txt | 34 +- scripts/event/AreaBossDoor1.js | 57 + scripts/event/AreaBossDoor2.js | 57 + scripts/event/AreaBossDoor3.js | 57 + scripts/event/AreaBossDoor4.js | 57 + scripts/event/AreaBossDoor5.js | 57 + scripts/event/AreaBossDoor6.js | 57 + scripts/event/Cygnus_Magic_Library.js | 5 +- scripts/event/GuardianNex.js | 5 +- scripts/event/GuildQuest.js | 9 +- scripts/event/MK_PrimeMinister.js | 5 +- scripts/event/MK_PrimeMinister2.js | 5 +- scripts/event/Puppeteer.js | 5 +- scripts/event/RockSpirit.js | 9 +- scripts/event/RockSpiritVIP.js | 11 +- scripts/npc/9977777.js | 7 +- scripts/quest/1021.js | 5 +- scripts/quest/21010.js | 9 +- sql/db_database.sql | 10 +- src/client/AbstractCharacterListener.java | 30 + src/client/AbstractMapleCharacterObject.java | 712 ++ src/client/MapleCharacter.java | 1760 ++-- src/client/MapleClient.java | 11 +- src/client/autoban/AutobanManager.java | 5 +- src/client/command/CommandsExecutor.java | 16 +- .../commands/{v0 => gm0}/BuyBackCommand.java | 2 +- .../commands/{v0 => gm0}/DisposeCommand.java | 2 +- .../{v0 => gm0}/DropLimitCommand.java | 2 +- .../commands/{v0 => gm0}/EquipLvCommand.java | 2 +- .../commands/{v0 => gm0}/GachaCommand.java | 2 +- .../commands/{v0 => gm0}/GmCommand.java | 2 +- .../commands/{v0 => gm0}/HelpCommand.java | 2 +- .../{v0 => gm0}/JoinEventCommand.java | 2 +- .../{v0 => gm0}/LeaveEventCommand.java | 2 +- .../commands/{v0 => gm0}/OnlineCommand.java | 2 +- .../commands/{v0 => gm0}/RanksCommand.java | 2 +- .../commands/{v0 => gm0}/RatesCommand.java | 2 +- .../{v0 => gm0}/ReportBugCommand.java | 2 +- .../{v0 => gm0}/ShowRatesCommand.java | 2 +- .../commands/{v0 => gm0}/StaffCommand.java | 2 +- .../commands/{v0 => gm0}/StatDexCommand.java | 21 +- .../commands/{v0 => gm0}/StatIntCommand.java | 21 +- .../commands/{v0 => gm0}/StatLukCommand.java | 21 +- .../commands/{v0 => gm0}/StatStrCommand.java | 23 +- .../commands/{v0 => gm0}/TimeCommand.java | 2 +- .../commands/{v0 => gm0}/UptimeCommand.java | 2 +- .../commands/{v1 => gm1}/BossHpCommand.java | 2 +- .../commands/{v1 => gm1}/BuffMeCommand.java | 8 +- .../commands/{v1 => gm1}/GotoCommand.java | 2 +- .../commands/{v1 => gm1}/MobHpCommand.java | 2 +- .../{v1 => gm1}/WhatDropsFromCommand.java | 2 +- .../commands/{v1 => gm1}/WhoDropsCommand.java | 2 +- .../commands/{v2 => gm2}/ApCommand.java | 9 +- .../commands/{v2 => gm2}/BombCommand.java | 2 +- .../commands/{v2 => gm2}/BuffCommand.java | 2 +- .../commands/{v2 => gm2}/BuffMapCommand.java | 2 +- .../{v2 => gm2}/ClearDropsCommand.java | 2 +- .../{v2 => gm2}/ClearSlotCommand.java | 2 +- .../commands/{v2 => gm2}/DcCommand.java | 2 +- .../{v2 => gm2}/EmpowerMeCommand.java | 2 +- .../commands/{v2 => gm2}/GmShopCommand.java | 2 +- .../commands/{v2 => gm2}/HealCommand.java | 4 +- .../commands/{v2 => gm2}/HideCommand.java | 2 +- .../commands/{v2 => gm2}/ItemCommand.java | 2 +- .../commands/{v2 => gm2}/ItemDropCommand.java | 2 +- .../commands/{v2 => gm2}/JailCommand.java | 2 +- .../commands/{v2 => gm2}/JobCommand.java | 2 +- .../commands/{v2 => gm2}/LevelCommand.java | 2 +- .../commands/{v2 => gm2}/LevelProCommand.java | 2 +- .../commands/{v2 => gm2}/MaxSkillCommand.java | 2 +- .../commands/{v2 => gm2}/MaxStatCommand.java | 17 +- .../commands/{v2 => gm2}/MesosCommand.java | 2 +- .../commands/{v2 => gm2}/ReachCommand.java | 2 +- .../commands/{v2 => gm2}/RechargeCommand.java | 2 +- .../{v2 => gm2}/ResetSkillCommand.java | 2 +- .../commands/{v2 => gm2}/SearchCommand.java | 2 +- .../commands/{v2 => gm2}/SetStatCommand.java | 18 +- .../commands/{v2 => gm2}/SpCommand.java | 9 +- .../commands/{v2 => gm2}/SummonCommand.java | 2 +- .../commands/{v2 => gm2}/UnBugCommand.java | 2 +- .../commands/{v2 => gm2}/UnHideCommand.java | 2 +- .../commands/{v2 => gm2}/UnJailCommand.java | 2 +- .../commands/{v2 => gm2}/WarpCommand.java | 2 +- .../commands/{v2 => gm2}/WarpToCommand.java | 2 +- .../commands/{v2 => gm2}/WhereaMiCommand.java | 2 +- .../commands/{v3 => gm3}/BanCommand.java | 2 +- .../commands/{v3 => gm3}/ChatCommand.java | 2 +- .../commands/{v3 => gm3}/CheckDmgCommand.java | 2 +- .../{v3 => gm3}/ClosePortalCommand.java | 2 +- .../commands/{v3 => gm3}/DebuffCommand.java | 2 +- .../commands/{v3 => gm3}/EndEventCommand.java | 2 +- .../commands/{v3 => gm3}/ExpedsCommand.java | 2 +- .../commands/{v3 => gm3}/FaceCommand.java | 2 +- .../commands/{v3 => gm3}/FameCommand.java | 2 +- .../commands/{v3 => gm3}/FlyCommand.java | 2 +- .../{v3 => gm3}/GiveMesosCommand.java | 2 +- .../commands/{v3 => gm3}/GiveNxCommand.java | 2 +- .../commands/{v3 => gm3}/GiveVpCommand.java | 2 +- .../commands/{v3 => gm3}/HairCommand.java | 2 +- .../commands/{v3 => gm3}/HealMapCommand.java | 7 +- .../{v3 => gm3}/HealPersonCommand.java | 7 +- .../commands/{v3 => gm3}/HpMpCommand.java | 10 +- .../commands/{v3 => gm3}/HurtCommand.java | 6 +- .../commands/{v3 => gm3}/IdCommand.java | 2 +- .../commands/{v3 => gm3}/IgnoreCommand.java | 2 +- .../commands/{v3 => gm3}/IgnoredCommand.java | 2 +- .../commands/{v3 => gm3}/InMapCommand.java | 2 +- .../commands/{v3 => gm3}/KillAllCommand.java | 2 +- .../commands/{v3 => gm3}/KillCommand.java | 4 +- .../commands/{v3 => gm3}/KillMapCommand.java | 6 +- .../{v3 => gm3}/MaxEnergyCommand.java | 2 +- .../commands/{v3 => gm3}/MaxHpMpCommand.java | 39 +- .../commands/{v3 => gm3}/MonitorCommand.java | 2 +- .../commands/{v3 => gm3}/MonitorsCommand.java | 2 +- .../commands/{v3 => gm3}/MusicCommand.java | 2 +- .../commands/{v3 => gm3}/MuteMapCommand.java | 2 +- .../commands/{v3 => gm3}/NightCommand.java | 2 +- .../commands/{v3 => gm3}/NoticeCommand.java | 2 +- .../commands/{v3 => gm3}/NpcCommand.java | 2 +- .../{v3 => gm3}/OnlineTwoCommand.java | 2 +- .../{v3 => gm3}/OpenPortalCommand.java | 2 +- .../commands/{v3 => gm3}/PeCommand.java | 2 +- .../commands/{v3 => gm3}/PosCommand.java | 2 +- .../{v3 => gm3}/QuestCompleteCommand.java | 2 +- .../{v3 => gm3}/QuestResetCommand.java | 2 +- .../{v3 => gm3}/QuestStartCommand.java | 2 +- .../{v3 => gm3}/ReloadDropsCommand.java | 2 +- .../{v3 => gm3}/ReloadEventsCommand.java | 2 +- .../{v3 => gm3}/ReloadMapCommand.java | 2 +- .../{v3 => gm3}/ReloadPortalsCommand.java | 2 +- .../{v3 => gm3}/ReloadShopsCommand.java | 2 +- .../commands/{v3 => gm3}/RipCommand.java | 2 +- .../commands/{v3 => gm3}/SeedCommand.java | 2 +- .../commands/{v3 => gm3}/SpawnCommand.java | 4 +- .../{v3 => gm3}/StartEventCommand.java | 2 +- .../{v3 => gm3}/ToggleCouponCommand.java | 2 +- .../commands/{v3 => gm3}/UnBanCommand.java | 2 +- .../{v3 => gm3}/WarpSnowBallCommand.java | 2 +- .../commands/{v4 => gm4}/CakeCommand.java | 2 +- .../commands/{v4 => gm4}/DropRateCommand.java | 2 +- .../commands/{v4 => gm4}/ExpRateCommand.java | 2 +- .../commands/{v4 => gm4}/ForceVacCommand.java | 2 +- .../commands/{v4 => gm4}/HorntailCommand.java | 2 +- .../commands/{v4 => gm4}/ItemVacCommand.java | 2 +- .../commands/{v4 => gm4}/MesoRateCommand.java | 2 +- .../commands/{v4 => gm4}/PapCommand.java | 2 +- .../commands/{v4 => gm4}/PianusCommand.java | 2 +- .../commands/{v4 => gm4}/PinkbeanCommand.java | 2 +- .../{v4 => gm4}/PlayerNpcCommand.java | 2 +- .../{v4 => gm4}/PlayerNpcRemoveCommand.java | 2 +- .../commands/{v4 => gm4}/ProItemCommand.java | 2 +- .../{v4 => gm4}/QuestRateCommand.java | 2 +- .../{v4 => gm4}/ServerMessageCommand.java | 2 +- .../{v4 => gm4}/SetEqStatCommand.java | 40 +- .../{v4 => gm4}/TravelRateCommand.java | 2 +- .../commands/{v4 => gm4}/ZakumCommand.java | 2 +- .../commands/{v5 => gm5}/DebugCommand.java | 2 +- .../commands/{v5 => gm5}/SetCommand.java | 2 +- .../{v5 => gm5}/ShowPacketsCommand.java | 2 +- .../{v6 => gm6}/ClearQuestCacheCommand.java | 2 +- .../{v6 => gm6}/ClearQuestCommand.java | 2 +- .../commands/{v6 => gm6}/DCAllCommand.java | 2 +- .../{v6 => gm6}/EraseAllPNpcsCommand.java | 2 +- .../commands/{v6 => gm6}/FredCommand.java | 2 +- .../commands/{v6 => gm6}/GetAccCommand.java | 2 +- .../{v6 => gm6}/MapPlayersCommand.java | 6 +- .../commands/{v6 => gm6}/SaveAllCommand.java | 2 +- .../{v6 => gm6}/ServerAddChannelCommand.java | 2 +- .../{v6 => gm6}/ServerAddWorldCommand.java | 2 +- .../ServerRemoveChannelCommand.java | 2 +- .../{v6 => gm6}/ServerRemoveWorldCommand.java | 2 +- .../{v6 => gm6}/SetGmLevelCommand.java | 2 +- .../commands/{v6 => gm6}/ShutdownCommand.java | 9 +- .../{v6 => gm6}/SpawnAllPNpcsCommand.java | 2 +- .../{v6 => gm6}/WarpWorldCommand.java | 2 +- src/client/inventory/Equip.java | 23 +- src/client/inventory/MapleInventory.java | 26 +- src/client/inventory/MapleInventoryProof.java | 2 +- src/client/processor/AssignAPProcessor.java | 251 +- src/client/processor/AssignSPProcessor.java | 10 +- src/client/processor/BuybackProcessor.java | 13 +- src/client/processor/MakerProcessor.java | 2 +- src/constants/ExpTable.java | 4 +- src/constants/GameConstants.java | 2 + src/constants/ServerConstants.java | 5 +- src/net/MapleServerHandler.java | 41 +- src/net/server/Server.java | 2 +- .../server/audit/locks/MonitoredLockType.java | 3 +- .../server/audit/locks/MonitoredReadLock.java | 2 +- .../audit/locks/MonitoredReentrantLock.java | 2 +- .../audit/locks/MonitoredWriteLock.java | 2 +- .../audit/locks/empty/EmptyReadLock.java | 4 +- .../audit/locks/empty/EmptyReentrantLock.java | 4 +- .../audit/locks/empty/EmptyWriteLock.java | 4 +- .../factory/MonitoredReadLockFactory.java | 2 +- .../MonitoredReentrantLockFactory.java | 2 +- .../factory/MonitoredWriteLockFactory.java | 2 +- src/net/server/channel/Channel.java | 4 +- .../handlers/AbstractDealDamageHandler.java | 5 +- .../handlers/AllianceOperationHandler.java | 2 +- .../channel/handlers/ChangeMapHandler.java | 13 +- .../handlers/CloseRangeDamageHandler.java | 10 +- .../channel/handlers/DamageSummonHandler.java | 1 + .../channel/handlers/HealOvertimeHandler.java | 12 +- .../channel/handlers/MoveLifeHandler.java | 119 +- .../channel/handlers/PetAutoPotHandler.java | 103 +- .../handlers/PlayerLoggedinHandler.java | 13 +- .../channel/handlers/SpecialMoveHandler.java | 10 +- .../channel/handlers/TakeDamageHandler.java | 5 +- .../channel/handlers/UseItemHandler.java | 2 - .../channel/handlers/UseMountFoodHandler.java | 26 +- .../server/channel/worker/BaseScheduler.java | 2 +- .../server/channel/worker/EventScheduler.java | 2 +- .../worker/FaceExpressionScheduler.java | 2 +- .../channel/worker/MobAnimationScheduler.java | 2 +- .../worker/MobClearSkillScheduler.java | 2 +- .../channel/worker/MobMistScheduler.java | 2 +- .../channel/worker/MobStatusScheduler.java | 2 +- .../channel/worker/OverallScheduler.java | 2 +- .../channel/worker/SchedulerListener.java | 2 +- src/net/server/guild/MapleAlliance.java | 57 +- src/net/server/guild/MapleGuild.java | 7 +- src/net/server/world/World.java | 10 +- src/scripting/event/EventInstanceManager.java | 59 +- src/scripting/event/EventManager.java | 18 +- src/scripting/event/EventScheduledFuture.java | 2 +- src/scripting/event/EventScriptManager.java | 16 +- .../event/worker/EventScriptScheduler.java | 2 +- .../reactor/ReactorActionManager.java | 2 + .../reactor/ReactorScriptManager.java | 7 +- src/server/MakerItemFactory.java | 4 +- src/server/MapleItemInformationProvider.java | 28 +- src/server/MapleStatEffect.java | 60 +- src/server/life/MapleLifeFactory.java | 14 +- src/server/life/MapleMonster.java | 139 +- .../life/MapleMonsterInformationProvider.java | 21 +- src/server/life/MobSkill.java | 2 - src/server/maps/MapleMap.java | 24 +- src/server/quest/actions/ExpAction.java | 4 +- src/server/quest/actions/MesoAction.java | 4 +- src/tools/MaplePacketCreator.java | 88 +- tools/MapleEquipmentOmnileveler/build.xml | 73 + tools/MapleEquipmentOmnileveler/manifest.mf | 3 + .../MapleEquipmentOmnileveler.java | 495 ++ wz/Map.wz/Map/Map1/106020000.img.xml | 4138 ++++----- wz/Map.wz/Map/Map6/677000011.img.xml | 7809 ++++++++--------- wz/Mob.wz/9400590.img.xml | 2 +- wz/Mob.wz/9400593.img.xml | 8 +- wz/Mob.wz/9400597.img.xml | 6 +- wz/Mob.wz/9400633.img.xml | 8 +- wz/Quest.wz/QuestInfo.img.xml | 3 +- wz/String.wz/Skill.img.xml | 4 +- 255 files changed, 9576 insertions(+), 7850 deletions(-) create mode 100644 scripts/event/AreaBossDoor1.js create mode 100644 scripts/event/AreaBossDoor2.js create mode 100644 scripts/event/AreaBossDoor3.js create mode 100644 scripts/event/AreaBossDoor4.js create mode 100644 scripts/event/AreaBossDoor5.js create mode 100644 scripts/event/AreaBossDoor6.js create mode 100644 src/client/AbstractCharacterListener.java create mode 100644 src/client/AbstractMapleCharacterObject.java rename src/client/command/commands/{v0 => gm0}/BuyBackCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/DisposeCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/DropLimitCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/EquipLvCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/GachaCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/GmCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/HelpCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/JoinEventCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/LeaveEventCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/OnlineCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/RanksCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/RatesCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/ReportBugCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/ShowRatesCommand.java (98%) rename src/client/command/commands/{v0 => gm0}/StaffCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/StatDexCommand.java (65%) rename src/client/command/commands/{v0 => gm0}/StatIntCommand.java (65%) rename src/client/command/commands/{v0 => gm0}/StatLukCommand.java (65%) rename src/client/command/commands/{v0 => gm0}/StatStrCommand.java (64%) rename src/client/command/commands/{v0 => gm0}/TimeCommand.java (97%) rename src/client/command/commands/{v0 => gm0}/UptimeCommand.java (97%) rename src/client/command/commands/{v1 => gm1}/BossHpCommand.java (98%) rename src/client/command/commands/{v1 => gm1}/BuffMeCommand.java (87%) rename src/client/command/commands/{v1 => gm1}/GotoCommand.java (98%) rename src/client/command/commands/{v1 => gm1}/MobHpCommand.java (97%) rename src/client/command/commands/{v1 => gm1}/WhatDropsFromCommand.java (98%) rename src/client/command/commands/{v1 => gm1}/WhoDropsCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/ApCommand.java (86%) rename src/client/command/commands/{v2 => gm2}/BombCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/BuffCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/BuffMapCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/ClearDropsCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/ClearSlotCommand.java (99%) rename src/client/command/commands/{v2 => gm2}/DcCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/EmpowerMeCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/GmShopCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/HealCommand.java (95%) rename src/client/command/commands/{v2 => gm2}/HideCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/ItemCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/ItemDropCommand.java (99%) rename src/client/command/commands/{v2 => gm2}/JailCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/JobCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/LevelCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/LevelProCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/MaxSkillCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/MaxStatCommand.java (72%) rename src/client/command/commands/{v2 => gm2}/MesosCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/ReachCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/RechargeCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/ResetSkillCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/SearchCommand.java (99%) rename src/client/command/commands/{v2 => gm2}/SetStatCommand.java (75%) rename src/client/command/commands/{v2 => gm2}/SpCommand.java (87%) rename src/client/command/commands/{v2 => gm2}/SummonCommand.java (99%) rename src/client/command/commands/{v2 => gm2}/UnBugCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/UnHideCommand.java (97%) rename src/client/command/commands/{v2 => gm2}/UnJailCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/WarpCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/WarpToCommand.java (98%) rename src/client/command/commands/{v2 => gm2}/WhereaMiCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/BanCommand.java (99%) rename src/client/command/commands/{v3 => gm3}/ChatCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/CheckDmgCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/ClosePortalCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/DebuffCommand.java (99%) rename src/client/command/commands/{v3 => gm3}/EndEventCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ExpedsCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/FaceCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/FameCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/FlyCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/GiveMesosCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/GiveNxCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/GiveVpCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/HairCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/HealMapCommand.java (84%) rename src/client/command/commands/{v3 => gm3}/HealPersonCommand.java (85%) rename src/client/command/commands/{v3 => gm3}/HpMpCommand.java (85%) rename src/client/command/commands/{v3 => gm3}/HurtCommand.java (91%) rename src/client/command/commands/{v3 => gm3}/IdCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/IgnoreCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/IgnoredCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/InMapCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/KillAllCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/KillCommand.java (96%) rename src/client/command/commands/{v3 => gm3}/KillMapCommand.java (90%) rename src/client/command/commands/{v3 => gm3}/MaxEnergyCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/MaxHpMpCommand.java (62%) rename src/client/command/commands/{v3 => gm3}/MonitorCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/MonitorsCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/MusicCommand.java (99%) rename src/client/command/commands/{v3 => gm3}/MuteMapCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/NightCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/NoticeCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/NpcCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/OnlineTwoCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/OpenPortalCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/PeCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/PosCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/QuestCompleteCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/QuestResetCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/QuestStartCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/ReloadDropsCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ReloadEventsCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ReloadMapCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ReloadPortalsCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ReloadShopsCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/RipCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/SeedCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/SpawnCommand.java (94%) rename src/client/command/commands/{v3 => gm3}/StartEventCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/ToggleCouponCommand.java (97%) rename src/client/command/commands/{v3 => gm3}/UnBanCommand.java (98%) rename src/client/command/commands/{v3 => gm3}/WarpSnowBallCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/CakeCommand.java (98%) rename src/client/command/commands/{v4 => gm4}/DropRateCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ExpRateCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ForceVacCommand.java (98%) rename src/client/command/commands/{v4 => gm4}/HorntailCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ItemVacCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/MesoRateCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/PapCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/PianusCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/PinkbeanCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/PlayerNpcCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/PlayerNpcRemoveCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ProItemCommand.java (98%) rename src/client/command/commands/{v4 => gm4}/QuestRateCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ServerMessageCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/SetEqStatCommand.java (72%) rename src/client/command/commands/{v4 => gm4}/TravelRateCommand.java (97%) rename src/client/command/commands/{v4 => gm4}/ZakumCommand.java (97%) rename src/client/command/commands/{v5 => gm5}/DebugCommand.java (99%) rename src/client/command/commands/{v5 => gm5}/SetCommand.java (97%) rename src/client/command/commands/{v5 => gm5}/ShowPacketsCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/ClearQuestCacheCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/ClearQuestCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/DCAllCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/EraseAllPNpcsCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/FredCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/GetAccCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/MapPlayersCommand.java (91%) rename src/client/command/commands/{v6 => gm6}/SaveAllCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/ServerAddChannelCommand.java (98%) rename src/client/command/commands/{v6 => gm6}/ServerAddWorldCommand.java (98%) rename src/client/command/commands/{v6 => gm6}/ServerRemoveChannelCommand.java (98%) rename src/client/command/commands/{v6 => gm6}/ServerRemoveWorldCommand.java (98%) rename src/client/command/commands/{v6 => gm6}/SetGmLevelCommand.java (98%) rename src/client/command/commands/{v6 => gm6}/ShutdownCommand.java (92%) rename src/client/command/commands/{v6 => gm6}/SpawnAllPNpcsCommand.java (97%) rename src/client/command/commands/{v6 => gm6}/WarpWorldCommand.java (98%) create mode 100644 tools/MapleEquipmentOmnileveler/build.xml create mode 100644 tools/MapleEquipmentOmnileveler/manifest.mf create mode 100644 tools/MapleEquipmentOmnileveler/src/mapleequipmentomnileveler/MapleEquipmentOmnileveler.java diff --git a/.gitignore b/.gitignore index 480e5c0c55..029f36015f 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,10 @@ /tools/MapleCouponInstaller/dist/ /tools/MapleCouponInstaller/nbproject/ +/tools/MapleEquipmentOmnileveler/build/ +/tools/MapleEquipmentOmnileveler/dist/ +/tools/MapleEquipmentOmnileveler/nbproject/ + /tools/MapleIdRetriever/build/ /tools/MapleIdRetriever/dist/ /tools/MapleIdRetriever/nbproject/ diff --git a/README.md b/README.md index cfa63a92c8..6290ff8250 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Head developer: Ronan C. P. Lana -Besides myself for maintaining this repository, credits are to be given to Nexon(Duh!), the original MapleSolaxia staff and other colaborators, as just some changes/patches on the game were applied by myself, in which some of them diverged from the original v83 patch contents (alright, not just "some patches" by now since a whole lot of major server core changes have been applied on this development). +Besides myself for maintaining this repository, credits are to be given to Wizet/Nexon (owners of MapleStory & it's IP contents), the original MapleSolaxia staff and other colaborators, as just some changes/patches on the game were applied by myself, in which some of them diverged from the original v83 patch contents (alright, not just "some patches" by now since a whole lot of major server core changes have been applied on this development). Regarding distributability and usage of the code presented here: like it was before, this MapleStory server is open-source. By that, it is meant that anyone is **free to install, use, modify and redistribute the contents**, as long as there is **no kind of commercial trading involved** and the **credits to the original creators are maintained** within the codes. diff --git a/docs/feature_list.md b/docs/feature_list.md index eede63433b..00e72ec4aa 100644 --- a/docs/feature_list.md +++ b/docs/feature_list.md @@ -25,7 +25,7 @@ PQs: * HPQ/KPQ/LPQ/LMPQ/OPQ/EllinPQ/PiratePQ/MagatiaPQ/HorntailPQ/AmoriaPQ/TreasurePQ/ElnathPQ/HolidayPQ. * CWKPQ as Expedition-based event. * Expeditions: Scarga/Horntail/Showa/Balrog/Zakum/Pinkbean. -* GuildPQ + Guild queue with multi-lobby systems available. +* GuildPQ + Guild queue with multi-lobby system available. * Brand-new PQs: BossRushPQ, CafePQ. * Mu Lung Dojo. * Capt. Latanica remade as an event (parties can now fight the boss). @@ -67,6 +67,7 @@ Player Social Network: * Further improved the server's ranking system, now displaying properly daily player ranking movement. * Automated support for Player NPCs and Hall of Fame. * Protected concurrently and improved the face expression system, guarding from trivial packet spam and exploits. +* All upgradeable non-cash equipments in inventory with level & EXP information available for read by anyone, given proper visibility. Cash & Items: @@ -98,6 +99,7 @@ Monsters, Maps & Reactors: * Mobs now can drop more than one of the same equipment (number of possible drops defined at droptime, uses the minimum/maximum quantity fields on DB). * Mobs only drops items that are visible/collectable by the player's party. * Redesigned HT mechanics for spawn and linked damage to the sponge. +* Reviewed aspects of MoveLifeHandler: implemented banish move, patched MP cost not contabilized on non-skill mob moves and slightly fixed mobs dropping from footholds in certain cases. * Limited item count on maps, smartly expiring oldest registered items, preventing potential item flooding. * Implemented Zombify disease status. * Added Boss HP Bar for dozens of bosses (needs provided custom wz). @@ -113,6 +115,7 @@ Monsters, Maps & Reactors: * Reactors pick items up smartly, checking for an option to pick up on many-items-nearby scenario. * Updated many scripted portals not implementing SFX properly. * Updated Crimsonwood, World Tour, Nihal Desert and Neo City, enabling quest completion and game progression in these areas. +* Added world maps for Mushroom Castle, World Tour (Singapore, Malaysia and Zipangu) & Ellin Forest areas. * Giant Cake (anniversary-themed boss) drops Maple equipments, Maple scrolls, summoning bags and many more interesting items. PQ potentials: @@ -122,13 +125,14 @@ PQ potentials: * Expedition system - Multiples parties can attempt on a same instance (lobbies and expeds are mutually-exclusive). * Guild queue system - Guilds can register themselves on a queue for the GPQ. * EIM Pool system - After the first instance setup, next event instances are loaded beforehand and set on a pooling queue, optimizing future loadouts. +* Recall system - Players can rejoin the last event instance they were in before disconnection. Player potentials: * Adventurer Mount quests functional. * All Equipment levels up. * Player level rates. -* Gain fame by quests. +* Gain fame by quests and event instances. * Pet evolutions functional (not GMS-like). * Reviewed keybinding system. * Account's Character slots: either each world has it's own count or there's a shared value between all worlds. @@ -145,6 +149,7 @@ Server potentials: * Enhanced AP auto-assigner: exactly matches AP with the needed for the player's current level, surplus assigned to the primary attribute. * Enhanced inventory check: free slots on inventory smartly fetched on demand. * Enhanced auto-loot handler: optimized the brute-force checks for some cash items on the player equipped inventory at every requisition. +* Added players-appointed bestsellers item ranking system for Owl of Minerva and Cash Shop. * Tweaked pet/mount hunger: calculations for fullness/tiredness takes active time of the subject into account. * Consistent experience and meso gain system. * NPC crafters (equips, plates/jewels, etc) now won't take items freely if the requirement conditions are not properly met. @@ -191,6 +196,7 @@ External tools: * MapleBossHpBarFetcher - Searches the quest WZ files and reports in all relevant data regarding mobs that has a boss HP bar whilst not having a proper "boss" label. * MapleCashDropFetcher - Searches the DB for any CASH drop data entry and lists them on a report file. * MapleCouponInstaller - Retrieves coupon info from the WZ and makes a SQL table with it. The server will use that table to gather info regarding rates and intervals. +* MapleEquipmentOmnileveler - Updates the equipment WZ nodes with item level information, allowing thus access for item level and EXP info for common equipments. * MapleIdRetriever - Two behaviors: generates a SQL table with relation (id, name) of the handbook given as input. Given a file with names, outputs a file with ids. * MapleInvalidItemIdFetcher - Generates a file listing all inexistent itemid's currently laying on the DB. * MapleInvalidItemWithNoNameFetcher - Generates two files: one listing all itemid's with inexistent name and "cash" property. And other with a prepared XML to solve the name issue. diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index 023d4d3822..8895877978 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -1292,4 +1292,36 @@ Corrigido valores incorretos sendo retirado de jogadores para expansão de guild Adicionado world map em Ellin Forest. Protegido concorrentemente sistema de fames. Adicionado ganho de quest points para jogadores que participam de PQs. Reformulado sistema de quest points para viabilizar a nova feature. -Otimizado método de ganho de experiência em equipamentos, agora devidamente cacheado e sem busca em strings no processo. \ No newline at end of file +Otimizado método de ganho de experiência em equipamentos, agora devidamente cacheado e sem busca em strings no processo. + +08 Agosto 2018, +MapleServerHandler agora é devidamente deregistrado ao finalizar uma instância de channel, eliminando possível foco de memory leak. +Funções playerDead e playerRevive são agora opcionais em EIM scripts. +Nova ferramenta: MapleEquipmentOmnileveler. Permite adicionar e atualizar nodos referentes a níveis para todos os equipamentos. Em jogo, essa adição permite jogadores a ver nível de qualquer equipamento do jogo. + +09 - 10 Agosto 2018, +Adicionado cálculo de MP ao realizar ataques de mobs. +Aplicado vários pequenos ajustes no handler que lida com movimentação de mobs, procurando assim reduzir ruidos no fluxo do jogo (e.g. mob caindo de foothold). +Corrigido schedules de event instances sendo chamados após finalização da mesma, levando locks já liberados a serem chamados inesperadamente. +Corrigido casos onde jogadores poderiam requisitar instanciação de uma nova PQ, cujo EM que já tenha sido liberado. +Aplicado reformatação geral no Character.wz, adicionando nodos de level para todos os equipamentos do jogo. Tal mudança permite que todos os equipamentos exponham nível e experiência em todos os equipamentos no inventário. +Implementado cálculo de experiência no lado do servidor que permite mostrar adequadamente EXP dos equipamentos no lado do cliente. + +11 - 19 Agosto 2018, +Corrigido MP Recovery skill não atuando segundo descrição, além de matando jogador com pouco HP disponível. +Refatorado completamente acessos de stats no código do server. +Refatorado check de Berserk sendo chamado em múltiplas seções do código. +Corrigido algumas cadeiras levando jogadores a desconectarem aleatoriamente. +Corrigido puppets ficando no mapa indeterminadamente em certos cenários. +Acrescentado proteção contra acesso concorrente em ganhos de EXP em equipamentos. +Door bosses (Marbas, Crocell, etc) agora spawnam de tempos em tempos, ao invés de serem chamados ao entrar no mapa. +Retrabalhado Chair Mastery, agora com cura atuando em porcentagem de HP/MP base. +Corrigido problema de deadlock com inventário de jogadores e EXP/DROP coupons. +Corrigido problema de deadlock com pickup de mesos e detecção de jogadores em party. +Corrigido problema de deadlock com o handler de pet autopot. +Melhorado desempenho do autopot handler. +Corrigido diversos aspectos do novo modelo de acesso de stats, agora propriamente protegido contra acesso concorrente. +Revitalizers de mounts são devidamente consumidos mesmo em casos mount tiredness seja zero. +Corrigido alliances retendo informações de guilds que foram desfeitas na DB. +Corrigido alliances não salvando nomes de ranks na DB ao serem criadas. +Adicionado suporte para doors na região de Mushroom Castle. \ No newline at end of file diff --git a/scripts/event/AreaBossDoor1.js b/scripts/event/AreaBossDoor1.js new file mode 100644 index 0000000000..a47477b60b --- /dev/null +++ b/scripts/event/AreaBossDoor1.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400610; + var bossMapid = 677000003; + var bossMsg = "Amdusias has appeared!"; + var bossPos = new Packages.java.awt.Point(467, 0); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/AreaBossDoor2.js b/scripts/event/AreaBossDoor2.js new file mode 100644 index 0000000000..a618988373 --- /dev/null +++ b/scripts/event/AreaBossDoor2.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400609; + var bossMapid = 677000005; + var bossMsg = "Andras has appeared!"; + var bossPos = new Packages.java.awt.Point(201, 80); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/AreaBossDoor3.js b/scripts/event/AreaBossDoor3.js new file mode 100644 index 0000000000..2014c572c7 --- /dev/null +++ b/scripts/event/AreaBossDoor3.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400613; + var bossMapid = 677000009; + var bossMsg = "Valefor has appeared!"; + var bossPos = new Packages.java.awt.Point(251, -841); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/AreaBossDoor4.js b/scripts/event/AreaBossDoor4.js new file mode 100644 index 0000000000..81be937ea9 --- /dev/null +++ b/scripts/event/AreaBossDoor4.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400633; + var bossMapid = 677000012; + var bossMsg = "Astaroth has appeared!"; + var bossPos = new Packages.java.awt.Point(842, 0); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/AreaBossDoor5.js b/scripts/event/AreaBossDoor5.js new file mode 100644 index 0000000000..4363b431e1 --- /dev/null +++ b/scripts/event/AreaBossDoor5.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400612; + var bossMapid = 677000001; + var bossMsg = "Marbas has appeared!"; + var bossPos = new Packages.java.awt.Point(461, 61); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/AreaBossDoor6.js b/scripts/event/AreaBossDoor6.js new file mode 100644 index 0000000000..0b30926c07 --- /dev/null +++ b/scripts/event/AreaBossDoor6.js @@ -0,0 +1,57 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Door boss Spawner (based on xQuasar's King Clang spawner) +**/ + +function init() { + scheduleNew(); +} + +function scheduleNew() { + setupTask = em.schedule("start", 0); //spawns upon server start. Each 3 hours an server event checks if boss exists, if not spawns it instantly. +} + +function cancelSchedule() { + if (setupTask != null) + setupTask.cancel(true); +} + +function start() { + var bossMobid = 9400611; + var bossMapid = 677000007; + var bossMsg = "Crocell has appeared!"; + var bossPos = new Packages.java.awt.Point(171, 50); + + var map = em.getChannelServer().getMapFactory().getMap(bossMapid); + if (map.getMonsterById(bossMobid) != null) { + em.schedule("start", 3 * 60 * 60 * 1000); + return; + } + + var boss = Packages.server.life.MapleLifeFactory.getMonster(bossMobid); + map.spawnMonsterOnGroundBelow(boss, bossPos); + map.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, bossMsg)); + + em.schedule("start", 3 * 60 * 60 * 1000); +} \ No newline at end of file diff --git a/scripts/event/Cygnus_Magic_Library.js b/scripts/event/Cygnus_Magic_Library.js index a5b237fe7a..5222bf2d3d 100644 --- a/scripts/event/Cygnus_Magic_Library.js +++ b/scripts/event/Cygnus_Magic_Library.js @@ -40,10 +40,7 @@ function scheduledTimeout(eim){ } function playerRevive(eim, player){ - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(entryMap); + player.respawn(eim, entryMap); return false; } diff --git a/scripts/event/GuardianNex.js b/scripts/event/GuardianNex.js index e298d71bcf..eb804b05af 100644 --- a/scripts/event/GuardianNex.js +++ b/scripts/event/GuardianNex.js @@ -36,10 +36,7 @@ function scheduledTimeout(eim){ } function playerRevive(eim, player){ - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(exitMap); + player.respawn(eim, exitMap); return false; } diff --git a/scripts/event/GuildQuest.js b/scripts/event/GuildQuest.js index d683de323e..de751d6f18 100644 --- a/scripts/event/GuildQuest.js +++ b/scripts/event/GuildQuest.js @@ -254,16 +254,11 @@ function playerDead(eim, player) { function playerRevive(eim, player) { // player presses ok on the death pop up. if(eim.getIntProperty("canRevive") == 0) { if (eim.isEventTeamLackingNow(true, minPlayers, player) && eim.getIntProperty("canJoin") == 0) { - eim.unregisterPlayer(player); - player.setHp(50); - player.changeMap(exitMap); - + player.respawn(eim, exitMap); end(eim); } else { - eim.unregisterPlayer(player); - player.setHp(50); - player.changeMap(exitMap); + player.respawn(eim, exitMap); } return false; diff --git a/scripts/event/MK_PrimeMinister.js b/scripts/event/MK_PrimeMinister.js index 33d44734aa..934b7bac3f 100644 --- a/scripts/event/MK_PrimeMinister.js +++ b/scripts/event/MK_PrimeMinister.js @@ -39,10 +39,7 @@ function scheduledTimeout(eim){ } function playerRevive(eim, player){ - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(entryMap); + player.respawn(eim, entryMap); return false; } diff --git a/scripts/event/MK_PrimeMinister2.js b/scripts/event/MK_PrimeMinister2.js index 746ee1f39d..ea9e3c1009 100644 --- a/scripts/event/MK_PrimeMinister2.js +++ b/scripts/event/MK_PrimeMinister2.js @@ -50,10 +50,7 @@ function scheduledTimeout(eim){ } function playerRevive(eim, player){ - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(entryMap); + player.respawn(eim, entryMap); return false; } diff --git a/scripts/event/Puppeteer.js b/scripts/event/Puppeteer.js index b0410e9f24..d7d4b07f5c 100644 --- a/scripts/event/Puppeteer.js +++ b/scripts/event/Puppeteer.js @@ -34,10 +34,7 @@ function scheduledTimeout(eim){ } function playerRevive(eim, player){ - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(exitMap); + player.respawn(eim, exitMap); return false; } diff --git a/scripts/event/RockSpirit.js b/scripts/event/RockSpirit.js index 61966a2031..b1cbdd4662 100644 --- a/scripts/event/RockSpirit.js +++ b/scripts/event/RockSpirit.js @@ -61,10 +61,7 @@ function playerEntry(eim, player) { } function playerRevive(eim, player) { - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(exitMap); + player.respawn(eim, exitMap); return false; } @@ -136,9 +133,9 @@ function timeOut(eim) { if (eim.getPlayerCount() > 0) { var pIter = eim.getPlayers().iterator(); while (pIter.hasNext()){ - var player = pIter.next(); + var player = pIter.next(); playerExit(eim, player); - } + } } eim.dispose(); } diff --git a/scripts/event/RockSpiritVIP.js b/scripts/event/RockSpiritVIP.js index e6636ee87c..4895d5dc2b 100644 --- a/scripts/event/RockSpiritVIP.js +++ b/scripts/event/RockSpiritVIP.js @@ -57,14 +57,11 @@ function respawn(eim) { function playerEntry(eim, player) { var amplifierMap = eim.getMapInstance(startMap.getId()); player.changeMap(amplifierMap); - eim.schedule("timeOut", timer); + eim.schedule("timeOut", timer); } function playerRevive(eim, player) { - player.setHp(50); - player.setStance(0); - eim.unregisterPlayer(player); - player.changeMap(exitMap); + player.respawn(eim, exitMap); return false; } @@ -136,9 +133,9 @@ function timeOut(eim) { if (eim.getPlayerCount() > 0) { var pIter = eim.getPlayers().iterator(); while (pIter.hasNext()){ - var player = pIter.next(); + var player = pIter.next(); playerExit(eim, player); - } + } } eim.dispose(); } diff --git a/scripts/npc/9977777.js b/scripts/npc/9977777.js index 9725a8388e..eecf0196a7 100644 --- a/scripts/npc/9977777.js +++ b/scripts/npc/9977777.js @@ -81,6 +81,7 @@ function writeFeatureTab_PlayerSocialNetwork() { addFeature("Protected and improved face expression system."); addFeature("Automated support for Player NPCs and Hall of Fame."); addFeature("Engagement & Wedding system."); + addFeature("Equipments displays to everyone it's level & EXP info."); } function writeFeatureTab_CashItems() { @@ -112,6 +113,9 @@ function writeFeatureTab_MonstersMapsReactors() { addFeature("Every skill/mastery book is now obtainable."); addFeature("Mobs now can drop more than one of the same equip."); addFeature("Mobs only drop items collectable by the player/party."); + addFeature("Mobs shouldn't fall from foothold too often now."); + addFeature("Properly applying MP cost on non-skill mob moves."); + addFeature("Implemented banish mob skill move."); addFeature("Redesigned HT mechanics: assemble & dmg taken."); addFeature("Implemented Zombify disease status."); addFeature("Added Boss HP Bar for dozens of bosses."); @@ -126,7 +130,7 @@ function writeFeatureTab_MonstersMapsReactors() { addFeature("Uncovered missing portal SFX on scripted portals."); addFeature("PQ boxes sprays items when opened, GMS-like."); addFeature("Reactors pick items up smartly from the field."); - addFeature("Updated scripted portals now with proper portal SFX."); + addFeature("Updated scripted portals, now with proper portal SFX."); addFeature("Reviewed Masteria, W. Tour, N. Desert and Neo City."); addFeature("Added world maps for M. Castle, W. Tour & Ellin areas."); addFeature("Giant Cake boss drops s. bags and Maple items."); @@ -232,6 +236,7 @@ function writeFeatureTab_Project() { addFeature("Developed many survey tools for content profiling."); addFeature("ThreadTracker: runtime tool for deadlock detection."); addFeature("Channel, World and Server-wide timer management."); + addFeature("Thoroughly reviewed encapsulation for player stats."); addFeature("Heavily reviewed future task management, spawning much less threads and relieving task overload on the TimerManager."); } diff --git a/scripts/quest/1021.js b/scripts/quest/1021.js index e7a4a89242..143f404c80 100644 --- a/scripts/quest/1021.js +++ b/scripts/quest/1021.js @@ -49,9 +49,8 @@ function start(mode, type, selection) { else if (status == 2) qm.sendAcceptDecline("So..... Let me just do this for fun! Abaracadabra~!"); else if (status == 3) { - if (qm.c.getPlayer().getHp() >= 50) { - qm.c.getPlayer().setHp(25); - qm.c.getPlayer().updateSingleStat(MapleStat.HP, 25); + if (qm.getPlayer().getHp() >= 50) { + qm.getPlayer().updateHp(25); } if (!qm.haveItem(2010007)) { diff --git a/scripts/quest/21010.js b/scripts/quest/21010.js index 831757491b..2f30a5eef5 100644 --- a/scripts/quest/21010.js +++ b/scripts/quest/21010.js @@ -46,9 +46,8 @@ function start(mode, type, selection) { } else if (status == 3) { qm.sendAcceptDecline("Oh, but it seems our hero has become very weak since the Black Mage's curse. It's only makes sense, considering that the hero has been asleep for hundreds of years. #bHere, I'll give you a HP Recovery Potion.#k");//nexon probably forgot to remove the '.' before '#k', lol } else if (status == 4) { - if (qm.c.getPlayer().getHp() >= 50) { - qm.c.getPlayer().setHp(25); - qm.c.getPlayer().updateSingleStat(MapleStat.HP, 25); + if (qm.getPlayer().getHp() >= 50) { + qm.getPlayer().updateHp(25); } if (!qm.isQuestStarted(21010) && !qm.isQuestCompleted(21010)) { qm.gainItem(2000022, 1); @@ -59,8 +58,8 @@ function start(mode, type, selection) { qm.sendNextPrev("#b(How do I drink the potion? I don't remember..)", 3); } else if (status == 6) { qm.guideHint(14); - qm.dispose(); - } + qm.dispose(); + } } function end(mode, type, selection) { diff --git a/sql/db_database.sql b/sql/db_database.sql index 57a1499d17..589c9cf177 100644 --- a/sql/db_database.sql +++ b/sql/db_database.sql @@ -55,11 +55,11 @@ CREATE TABLE IF NOT EXISTS `alliance` ( `capacity` int(10) unsigned NOT NULL DEFAULT '2', `notice` varchar(20) NOT NULL DEFAULT '', - `rank1` varchar(11) NOT NULL DEFAULT '', - `rank2` varchar(11) NOT NULL DEFAULT '', - `rank3` varchar(11) NOT NULL DEFAULT '', - `rank4` varchar(11) NOT NULL DEFAULT '', - `rank5` varchar(11) NOT NULL DEFAULT '', + `rank1` varchar(11) NOT NULL DEFAULT 'Master', + `rank2` varchar(11) NOT NULL DEFAULT 'Jr. Master', + `rank3` varchar(11) NOT NULL DEFAULT 'Member', + `rank4` varchar(11) NOT NULL DEFAULT 'Member', + `rank5` varchar(11) NOT NULL DEFAULT 'Member', PRIMARY KEY (`id`), INDEX (name) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; diff --git a/src/client/AbstractCharacterListener.java b/src/client/AbstractCharacterListener.java new file mode 100644 index 0000000000..439d52a07d --- /dev/null +++ b/src/client/AbstractCharacterListener.java @@ -0,0 +1,30 @@ +/* + This file is part of the HeavenMS MapleStory Server + Copyleft (L) 2016 - 2018 RonanLana + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +package client; + +/** + * + * @author Ronan + */ +public interface AbstractCharacterListener { + public void onHpChanged(int oldHp); + public void onHpmpPoolUpdate(); + public void onAnnounceStatPoolUpdate(); +} diff --git a/src/client/AbstractMapleCharacterObject.java b/src/client/AbstractMapleCharacterObject.java new file mode 100644 index 0000000000..a7a422391a --- /dev/null +++ b/src/client/AbstractMapleCharacterObject.java @@ -0,0 +1,712 @@ +/* + This file is part of the HeavenMS MapleStory Server + Copyleft (L) 2016 - 2018 RonanLana + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +package client; + +import constants.GameConstants; +import constants.ServerConstants; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; +import net.server.audit.locks.MonitoredLockType; +import net.server.audit.locks.MonitoredReentrantReadWriteLock; +import net.server.audit.locks.factory.MonitoredReentrantLockFactory; +import server.maps.AbstractAnimatedMapleMapObject; + +/** + * + * @author RonanLana + */ +public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMapleMapObject { + 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; + + private AbstractCharacterListener listener = null; + protected Map statUpdates = new HashMap<>(); + + protected Lock effLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EFF, true); + protected ReadLock statRlock; + protected WriteLock statWlock; + + protected AbstractMapleCharacterObject() { + ReentrantReadWriteLock locks = new MonitoredReentrantReadWriteLock(MonitoredLockType.CHARACTER_STA, true); + statRlock = locks.readLock(); + statWlock = locks.writeLock(); + + for (int i = 0; i < remainingSp.length; i++) { + remainingSp[i] = 0; + } + } + + protected void setListener(AbstractCharacterListener listener) { + this.listener = listener; + } + + public int getStr() { + statRlock.lock(); + try { + return str; + } finally { + statRlock.unlock(); + } + } + + public int getDex() { + statRlock.lock(); + try { + return dex; + } finally { + statRlock.unlock(); + } + } + + public int getInt() { + statRlock.lock(); + try { + return int_; + } finally { + statRlock.unlock(); + } + } + + public int getLuk() { + statRlock.lock(); + try { + return luk; + } finally { + statRlock.unlock(); + } + } + + public int getRemainingAp() { + statRlock.lock(); + try { + return remainingAp; + } finally { + statRlock.unlock(); + } + } + + protected int getRemainingSp(int jobid) { + statRlock.lock(); + try { + return remainingSp[GameConstants.getSkillBook(jobid)]; + } finally { + statRlock.unlock(); + } + } + + public int[] getRemainingSps() { + statRlock.lock(); + try { + return Arrays.copyOf(remainingSp, remainingSp.length); + } finally { + statRlock.unlock(); + } + } + + public int getHpMpApUsed() { + statRlock.lock(); + try { + return hpMpApUsed; + } finally { + statRlock.unlock(); + } + } + + public boolean isAlive() { + statRlock.lock(); + try { + return hp > 0; + } finally { + statRlock.unlock(); + } + } + + public int getHp() { + statRlock.lock(); + try { + return hp; + } finally { + statRlock.unlock(); + } + } + + public int getMp() { + statRlock.lock(); + try { + return mp; + } finally { + statRlock.unlock(); + } + } + + public int getMaxHp() { + statRlock.lock(); + try { + return maxhp; + } finally { + statRlock.unlock(); + } + } + + public int getMaxMp() { + statRlock.lock(); + try { + return maxmp; + } finally { + statRlock.unlock(); + } + } + + public int getClientMaxHp() { + return clientmaxhp; + } + + public int getClientMaxMp() { + return clientmaxmp; + } + + public int getCurrentMaxHp() { + return localmaxhp; + } + + public int getCurrentMaxMp() { + return localmaxmp; + } + + private void setHpMpApUsed(int mpApUsed) { + this.hpMpApUsed = mpApUsed; + } + + private void dispatchHpChanged(int oldHp) { + listener.onHpChanged(oldHp); + } + + private void dispatchHpmpPoolUpdated() { + listener.onHpmpPoolUpdate(); + } + + 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; + } + this.hp = thp; + + dispatchHpChanged(oldHp); + } + + protected void setMp(int newMp) { + int tmp = newMp; + if (tmp < 0) { + tmp = 0; + } else if (tmp > localmaxmp) { + tmp = localmaxmp; + } + 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_) { + this.maxhp = hp_; + this.clientmaxhp = Math.min(30000, hp_); + } + + protected void setMaxMp(int mp_) { + this.maxmp = mp_; + this.clientmaxmp = Math.min(30000, mp_); + } + + private static long calcStatPoolNode(long v, int displacement) { + if (v > Short.MAX_VALUE) { + v = Short.MAX_VALUE; + } else if (v < Short.MIN_VALUE) { + v = Short.MIN_VALUE; + } + + return ((v & 0x0FFFF) << displacement); + } + + private static long calcStatPoolLong(int v1, int v2, int v3, int 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(); + try { + statUpdates.clear(); + boolean poolUpdate = false; + + if (hpMpPool != null) { + short newHp = (short) (hpMpPool >> 48); + short newMp = (short) (hpMpPool >> 32); + short newMaxHp = (short) (hpMpPool >> 16); + short newMaxMp = (short) (hpMpPool.shortValue()); + + if (newMaxHp != Short.MIN_VALUE) { + if (newMaxHp < 50) { + newMaxHp = 50; + } + + poolUpdate = true; + setMaxHp(newMaxHp); + statUpdates.put(MapleStat.MAXHP, clientmaxhp); + statUpdates.put(MapleStat.HP, hp); + } + + if (newHp != Short.MIN_VALUE) { + setHp(newHp); + statUpdates.put(MapleStat.HP, hp); + } + + if (newMaxMp != Short.MIN_VALUE) { + if (newMaxMp < 5) { + newMaxMp = 5; + } + + poolUpdate = true; + setMaxMp(newMaxMp); + statUpdates.put(MapleStat.MAXMP, clientmaxmp); + statUpdates.put(MapleStat.MP, mp); + } + + if (newMp != Short.MIN_VALUE) { + setMp(newMp); + statUpdates.put(MapleStat.MP, mp); + } + } + + if (strDexIntLuk != null) { + short newStr = (short) (strDexIntLuk >> 48); + short newDex = (short) (strDexIntLuk >> 32); + short newInt = (short) (strDexIntLuk >> 16); + short newLuk = (short) (strDexIntLuk.shortValue()); + + if (newStr >= 4) { + setStr(newStr); + statUpdates.put(MapleStat.STR, str); + } + + if (newDex >= 4) { + setDex(newDex); + statUpdates.put(MapleStat.DEX, dex); + } + + if (newInt >= 4) { + setInt(newInt); + statUpdates.put(MapleStat.INT, int_); + } + + if (newLuk >= 4) { + setLuk(newLuk); + statUpdates.put(MapleStat.LUK, luk); + } + + if (newAp >= 0) { + setRemainingAp(newAp); + statUpdates.put(MapleStat.AVAILABLEAP, remainingAp); + } + + poolUpdate = true; // recalc stats + } + + if (newSp != null) { + short sp = (short) (newSp >> 16); + short skillbook = (short) (newSp.shortValue()); + + setRemainingSp(sp, skillbook); + statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]); + } + + if (!statUpdates.isEmpty()) { + if (poolUpdate) { + dispatchHpmpPoolUpdated(); + } + + if (!silent) { + dispatchStatPoolUpdateAnnounced(); + } + } + } finally { + statWlock.unlock(); + 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, Short.MIN_VALUE, Short.MIN_VALUE, silent); + } + + private void changeHpMpPool(int hp, int mp, int maxhp, int maxmp, boolean silent) { + long hpMpPool = calcStatPoolLong(hp, mp, maxhp, maxmp); + changeStatPool(hpMpPool, null, null, -1, silent); + } + + public void updateHp(int hp) { + updateHpMaxHp(hp, Short.MIN_VALUE); + } + + public void updateMaxHp(int maxhp) { + updateHpMaxHp(Short.MIN_VALUE, maxhp); + } + + public void updateHpMaxHp(int hp, int maxhp) { + changeHpMpPool(hp, Short.MIN_VALUE, maxhp, Short.MIN_VALUE, false); + } + + public void updateMp(int mp) { + updateMpMaxMp(mp, Short.MIN_VALUE); + } + + public void updateMaxMp(int maxmp) { + updateMpMaxMp(Short.MIN_VALUE, maxmp); + } + + public void updateMpMaxMp(int mp, int maxmp) { + changeHpMpPool(Short.MIN_VALUE, mp, Short.MIN_VALUE, maxmp, false); + } + + public void updateMaxHpMaxMp(int maxhp, int maxmp) { + changeHpMpPool(Short.MIN_VALUE, Short.MIN_VALUE, maxhp, maxmp, false); + } + + protected void enforceMaxHpMp() { + effLock.lock(); + statWlock.lock(); + try { + if (mp > localmaxmp || hp > localmaxhp) { + changeHpMp(hp, mp, false); + } + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public int safeAddHP(int delta) { + effLock.lock(); + statWlock.lock(); + try { + if (hp + delta <= 0) { + delta = -hp + 1; + } + + addHP(delta); + return delta; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void addHP(int delta) { + effLock.lock(); + statWlock.lock(); + try { + updateHp(hp + delta); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void addMP(int delta) { + effLock.lock(); + statWlock.lock(); + try { + updateMp(mp + delta); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void addMPHP(int hpDelta, int mpDelta) { + effLock.lock(); + statWlock.lock(); + try { + updateHpMp(hp + hpDelta, mp + mpDelta); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + protected void addMaxMPMaxHP(int hpdelta, int mpdelta, boolean silent) { + effLock.lock(); + statWlock.lock(); + try { + changeHpMpPool(Short.MIN_VALUE, Short.MIN_VALUE, maxhp + hpdelta, maxmp + mpdelta, silent); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void addMaxHP(int delta) { + effLock.lock(); + statWlock.lock(); + try { + updateMaxHp(maxhp + delta); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void addMaxMP(int delta) { + effLock.lock(); + statWlock.lock(); + try { + updateMaxMp(maxmp + delta); + } finally { + statWlock.unlock(); + 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, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE); + } + + public boolean assignDex(int x) { + return assignStrDexIntLuk(Short.MIN_VALUE, x, Short.MIN_VALUE, Short.MIN_VALUE); + } + + public boolean assignInt(int x) { + return assignStrDexIntLuk(Short.MIN_VALUE, Short.MIN_VALUE, x, Short.MIN_VALUE); + } + + public boolean assignLuk(int x) { + return assignStrDexIntLuk(Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, x); + } + + public boolean assignHP(int deltaHP, int deltaAp) { + effLock.lock(); + statWlock.lock(); + try { + if (remainingAp - deltaAp < 0 || hpMpApUsed + deltaAp < 0 || maxhp >= 30000) { + return false; + } + + long hpMpPool = calcStatPoolLong(Short.MIN_VALUE, Short.MIN_VALUE, maxhp + deltaHP, maxmp); + long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); + + changeStatPool(hpMpPool, strDexIntLuk, null, remainingAp - deltaAp, false); + setHpMpApUsed(hpMpApUsed + deltaAp); + return true; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public boolean assignMP(int deltaMP, int deltaAp) { + effLock.lock(); + statWlock.lock(); + try { + if (remainingAp - deltaAp < 0 || hpMpApUsed + deltaAp < 0 || maxmp >= 30000) { + return false; + } + + long hpMpPool = calcStatPoolLong(Short.MIN_VALUE, Short.MIN_VALUE, maxhp, maxmp + deltaMP); + long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); + + changeStatPool(hpMpPool, strDexIntLuk, null, remainingAp - deltaAp, false); + setHpMpApUsed(hpMpApUsed + deltaAp); + return true; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + private static int apAssigned(int x) { + return x != Short.MIN_VALUE ? x : 0; + } + + public boolean assignStrDexIntLuk(int deltaStr, int deltaDex, int deltaInt, int deltaLuk) { + effLock.lock(); + statWlock.lock(); + try { + int apUsed = apAssigned(deltaStr) + apAssigned(deltaDex) + apAssigned(deltaInt) + apAssigned(deltaLuk); + if (apUsed > remainingAp) { + return false; + } + + int newStr = str + deltaStr, newDex = dex + deltaDex, newInt = int_ + deltaInt, newLuk = luk + deltaLuk; + if (newStr < 4 && deltaStr != Short.MIN_VALUE || newStr > ServerConstants.MAX_AP) { + return false; + } + + if (newDex < 4 && deltaDex != Short.MIN_VALUE || newDex > ServerConstants.MAX_AP) { + return false; + } + + if (newInt < 4 && deltaInt != Short.MIN_VALUE || newInt > ServerConstants.MAX_AP) { + return false; + } + + if (newLuk < 4 && deltaLuk != Short.MIN_VALUE || newLuk > ServerConstants.MAX_AP) { + return false; + } + + int newAp = remainingAp - apUsed; + updateStrDexIntLuk(newStr, newDex, newInt, newLuk, newAp); + return true; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void updateStrDexIntLuk(int x) { + updateStrDexIntLuk(x, x, x, x, -1); + } + + public void changeRemainingAp(int x, boolean silent) { + effLock.lock(); + statWlock.lock(); + try { + changeStrDexIntLuk(str, dex, int_, luk, x, silent); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + public void gainAp(int deltaAp, boolean silent) { + effLock.lock(); + statWlock.lock(); + try { + changeRemainingAp(Math.max(0, remainingAp + deltaAp), silent); + } finally { + statWlock.unlock(); + 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(int str, int dex, int int_, int luk, int remainingAp, boolean silent) { + long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk); + changeStatPool(null, strDexIntLuk, null, remainingAp, silent); + } + + private void changeStrDexIntLukSp(int str, int dex, int int_, int 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(); + try { + System.arraycopy(sps, 0, remainingSp, 0, sps.length); + } finally { + statWlock.unlock(); + 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(); + try { + changeRemainingSp(Math.max(0, remainingSp[skillbook] + deltaSp), skillbook, silent); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } +} diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index b0038282e8..ef7ad023e4 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -16,6 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -78,7 +79,6 @@ import server.events.gm.MapleOla; import server.life.MapleMonster; import server.life.MobSkill; import server.loot.MapleLootManager; -import server.maps.AbstractAnimatedMapleMapObject; import server.maps.MapleHiredMerchant; import server.maps.MapleDoor; import server.maps.MapleDragon; @@ -136,7 +136,6 @@ import constants.skills.DarkKnight; import constants.skills.DawnWarrior; import constants.skills.Evan; import constants.skills.FPArchMage; -import constants.skills.GM; import constants.skills.Hermit; import constants.skills.Hero; import constants.skills.ILArchMage; @@ -151,8 +150,6 @@ import constants.skills.Priest; import constants.skills.Ranger; import constants.skills.Shadower; import constants.skills.Sniper; -import constants.skills.Spearman; -import constants.skills.SuperGM; import constants.skills.Swordsman; import constants.skills.ThunderBreaker; import net.server.channel.handlers.PartyOperationHandler; @@ -162,27 +159,20 @@ import server.maps.MapleMapItem; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; -public class MapleCharacter extends AbstractAnimatedMapleMapObject { - private static MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); +public class MapleCharacter extends AbstractMapleCharacterObject { + private static final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); private static final String LEVEL_200 = "[Congrats] %s has reached Level 200! Congratulate %s on such an amazing achievement!"; private static final String[] BLOCKED_NAMES = {"admin", "owner", "moderator", "intern", "donor", "administrator", "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"}; private int world; - private int accountid, id; + private int accountid, id, level; private int rank, rankMove, jobRank, jobRankMove; - private int level, str, dex, luk, int_, hp, maxhp, eqphp, mp, maxmp, eqpmp; - private int hpMpApUsed; - private int hair; - private int face; - private int remainingAp; - private int[] remainingSp = new int[10]; - private int quest_fame; - private int fame; + private int gender, hair, face; + private int fame, quest_fame; private int initialSpawnPoint; private int mapid; - private int gender; private int currentPage, currentType = 0, currentTab = 1; private int itemEffect; private int guildid, guildRank, allianceRank; @@ -204,8 +194,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private int omokwins, omokties, omoklosses, matchcardwins, matchcardties, matchcardlosses; private int owlSearch; private long lastfametime, lastUsedCashItem, lastExpression = 0, lastHealed, lastBuyback = 0, lastDeathtime, lastMesoDrop = -1, jailExpiration = -1; - private transient int localmaxhp, localmaxmp, localstr, localdex, localluk, localint_, magic, watk; - private boolean hidden, canDoor = true, berserk, hasMerchant, hasSandboxItem = false, whiteChat = false; + private transient int localstr, localdex, localluk, localint_, localmagic, localwatk; + private transient int equipmaxhp, equipmaxmp, equipstr, equipdex, equipluk, equipint_, equipmagic, equipwatk, localchairhp, localchairmp; + private int localchairrate; + private boolean hidden, equipchanged = true, canDoor = true, berserk, hasMerchant, hasSandboxItem = false, whiteChat = false; private boolean equippedMesoMagnet = false, equippedItemPouch = false, equippedPetItemIgnore = false; private int linkedLevel = 0; private String linkedName = null; @@ -279,7 +271,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private ScheduledFuture chairRecoveryTask = null; private ScheduledFuture pendantOfSpirit = null; //1122017 private Lock chrLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CHR, true); - private Lock effLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EFF, true); private Lock evtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EVT, true); private Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true); // for meso & quest tasks as well private Lock prtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PRT); @@ -323,14 +314,46 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private long banishTime = 0; private MapleCharacter() { + super.setListener(new AbstractCharacterListener() { + @Override + public void onHpChanged(int oldHp) { + hpChangeAction(oldHp); + } + + @Override + public void onHpmpPoolUpdate() { + List> hpmpupdate = recalcLocalStats(); + for (Pair p : hpmpupdate) { + statUpdates.put(p.getLeft(), p.getRight()); + } + + if (hp > localmaxhp) { + setHp(localmaxhp); + statUpdates.put(MapleStat.HP, hp); + } + + if (mp > localmaxmp) { + setMp(localmaxmp); + statUpdates.put(MapleStat.MP, mp); + } + } + + @Override + public void onAnnounceStatPoolUpdate() { + List> statup = new ArrayList<>(8); + for (Map.Entry s : statUpdates.entrySet()) { + statup.add(new Pair<>(s.getKey(), s.getValue())); + } + + announce(MaplePacketCreator.updatePlayerStats(statup, true, MapleCharacter.this)); + } + }); + useCS = false; setStance(0); inventory = new MapleInventory[MapleInventoryType.values().length]; savedLocations = new SavedLocation[SavedLocationType.values().length]; - for (int i = 0; i < remainingSp.length; i++) { - remainingSp[i] = 0; - } for (MapleInventoryType type : MapleInventoryType.values()) { byte b = 24; @@ -391,9 +414,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.client = c; ret.gmLevel = 0; ret.hp = 50; - ret.maxhp = 50; + ret.setMaxHp(50); ret.mp = 5; - ret.maxmp = 5; + ret.setMaxMp(5); ret.str = 12; ret.dex = 5; ret.int_ = 4; @@ -557,7 +580,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public int getRelationshipId() { - return client.getWorldServer().getRelationshipId(id); + return getWorldServer().getRelationshipId(id); } public boolean isMarried() { @@ -602,28 +625,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void addMarriageRing(MapleRing r) { marriageRing = r; } - - public void addHP(int delta) { - setHp(hp + delta); - updateSingleStat(MapleStat.HP, hp); - } - + public void addMesosTraded(int gain) { this.mesosTraded += gain; } - - public void addMP(int delta) { - setMp(mp + delta); - updateSingleStat(MapleStat.MP, mp); - } - - public void addMPHP(int hpDiff, int mpDiff) { - setHp(hp + hpDiff); - setMp(mp + mpDiff); - updateSingleStat(MapleStat.HP, getHp()); - updateSingleStat(MapleStat.MP, getMp()); - } - + public void addPet(MaplePet pet) { petLock.lock(); try { @@ -637,80 +643,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { petLock.unlock(); } } - - public void addStat(int type, int up) { - if (type == 1) { - this.str += up; - updateSingleStat(MapleStat.STR, str); - } else if (type == 2) { - this.dex += up; - updateSingleStat(MapleStat.DEX, dex); - } else if (type == 3) { - this.int_ += up; - updateSingleStat(MapleStat.INT, int_); - } else if (type == 4) { - this.luk += up; - updateSingleStat(MapleStat.LUK, luk); - } - recalcLocalStats(); - } - - public static int addHP(MapleClient c) { - MapleCharacter player = c.getPlayer(); - MapleJob jobtype = player.getJob(); - int MaxHP = player.getMaxHp(); - if (player.getHpMpApUsed() > 9999 || MaxHP >= 30000) { - return MaxHP; - } - if (jobtype.isA(MapleJob.BEGINNER)) { - MaxHP += 8; - } else if (jobtype.isA(MapleJob.WARRIOR) || jobtype.isA(MapleJob.DAWNWARRIOR1)) { - if (player.getSkillLevel(player.isCygnus() ? SkillFactory.getSkill(10000000) : SkillFactory.getSkill(1000001)) > 0) { - MaxHP += 20; - } else { - MaxHP += 8; - } - } else if (jobtype.isA(MapleJob.MAGICIAN) || jobtype.isA(MapleJob.BLAZEWIZARD1)) { - MaxHP += 6; - } else if (jobtype.isA(MapleJob.BOWMAN) || jobtype.isA(MapleJob.WINDARCHER1)) { - MaxHP += 8; - } else if (jobtype.isA(MapleJob.THIEF) || jobtype.isA(MapleJob.NIGHTWALKER1)) { - MaxHP += 8; - } else if (jobtype.isA(MapleJob.PIRATE) || jobtype.isA(MapleJob.THUNDERBREAKER1)) { - if (player.getSkillLevel(player.isCygnus() ? SkillFactory.getSkill(15100000) : SkillFactory.getSkill(5100000)) > 0) { - MaxHP += 18; - } else { - MaxHP += 8; - } - } - return MaxHP; - } - - public static int addMP(MapleClient c) { - MapleCharacter player = c.getPlayer(); - int MaxMP = player.getMaxMp(); - if (player.getHpMpApUsed() > 9999 || player.getMaxMp() >= 30000) { - return MaxMP; - } - if (player.getJob().isA(MapleJob.BEGINNER) || player.getJob().isA(MapleJob.NOBLESSE) || player.getJob().isA(MapleJob.LEGEND)) { - MaxMP += 6; - } else if (player.getJob().isA(MapleJob.WARRIOR) || player.getJob().isA(MapleJob.DAWNWARRIOR1) || player.getJob().isA(MapleJob.ARAN1)) { - MaxMP += 2; - } else if (player.getJob().isA(MapleJob.MAGICIAN) || player.getJob().isA(MapleJob.BLAZEWIZARD1)) { - if (player.getSkillLevel(player.isCygnus() ? SkillFactory.getSkill(12000000) : SkillFactory.getSkill(2000001)) > 0) { - MaxMP += 18; - } else { - MaxMP += 14; - } - - } else if (player.getJob().isA(MapleJob.BOWMAN) || player.getJob().isA(MapleJob.THIEF)) { - MaxMP += 10; - } else if (player.getJob().isA(MapleJob.PIRATE)) { - MaxMP += 14; - } - - return MaxMP; - } public void addSummon(int id, MapleSummon summon) { summons.put(id, summon); @@ -905,8 +837,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { for(MapleSummon ms: this.getSummonsValues()) { getMap().broadcastNONGMMessage(this, MaplePacketCreator.spawnSummon(ms, false), false); } - - updatePartyMemberHP(); } else { this.hidden = true; announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1)); @@ -947,8 +877,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void cancelPlayerBuffs(List buffstats) { if (client.getChannelServer().getPlayerStorage().getCharacterById(getId()) != null) { - recalcLocalStats(); - enforceMaxHpMp(); + updateLocalStats(); client.announce(MaplePacketCreator.cancelBuff(buffstats)); if (buffstats.size() > 0) { getMap().broadcastMessage(this, MaplePacketCreator.cancelForeignBuff(getId(), buffstats), false); @@ -1090,59 +1019,25 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - public void changeJob(MapleJob newJob) { + public synchronized void changeJob(MapleJob newJob) { if (newJob == null) { return;//the fuck you doing idiot! } this.job = newJob; - remainingSp[GameConstants.getSkillBook(newJob.getId())] += 1; + + int spGain = 1; if (GameConstants.hasSPTable(newJob)) { - remainingSp[GameConstants.getSkillBook(newJob.getId())] += 2; + spGain += 2; } else { if (newJob.getId() % 10 == 2) { - remainingSp[GameConstants.getSkillBook(newJob.getId())] += 2; + spGain += 2; } } + gainSp(spGain, GameConstants.getSkillBook(newJob.getId()), true); + if (newJob.getId() % 10 > 1) { - this.remainingAp += 5; - } - int job_ = job.getId() % 1000; // lame temp "fix" - if (job_ == 100) { // 1st warrior - maxhp += Randomizer.rand(200, 250); - } else if (job_ == 200) { // 1st mage - maxmp += Randomizer.rand(100, 150); - } else if (job_ % 100 == 0) { // 1st others - maxhp += Randomizer.rand(100, 150); - maxhp += Randomizer.rand(25, 50); - } else if (job_ > 0 && job_ < 200) { // 2nd~4th warrior - maxhp += Randomizer.rand(300, 350); - } else if (job_ < 300) { // 2nd~4th mage - maxmp += Randomizer.rand(450, 500); - } else if (job_ > 0) { // 2nd~4th others - maxhp += Randomizer.rand(300, 350); - maxmp += Randomizer.rand(150, 200); - } - - /* - //aran perks? - int newJobId = newJob.getId(); - if(newJobId == 2100) { // become aran1 - maxhp += 275; - maxmp += 15; - } else if(newJobId == 2110) { // become aran2 - maxmp += 275; - } else if(newJobId == 2111) { // become aran3 - maxhp += 275; - maxmp += 275; - } - */ - - if (maxhp >= 30000) { - maxhp = 30000; - } - if (maxmp >= 30000) { - maxmp = 30000; + gainAp(5, true); } if (!isGM()) { @@ -1151,20 +1046,65 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - List> statup = new ArrayList<>(5); - statup.add(new Pair<>(MapleStat.MAXHP, Integer.valueOf(maxhp))); - statup.add(new Pair<>(MapleStat.MAXMP, Integer.valueOf(maxmp))); - statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); - statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); - statup.add(new Pair<>(MapleStat.JOB, Integer.valueOf(job.getId()))); - client.announce(MaplePacketCreator.updatePlayerStats(statup, this)); + int addhp = 0, addmp = 0; + int job_ = job.getId() % 1000; // lame temp "fix" + if (job_ == 100) { // 1st warrior + addhp += Randomizer.rand(200, 250); + } else if (job_ == 200) { // 1st mage + addmp += Randomizer.rand(100, 150); + } else if (job_ % 100 == 0) { // 1st others + addhp += Randomizer.rand(100, 150); + addhp += Randomizer.rand(25, 50); + } else if (job_ > 0 && job_ < 200) { // 2nd~4th warrior + addhp += Randomizer.rand(300, 350); + } else if (job_ < 300) { // 2nd~4th mage + addmp += Randomizer.rand(450, 500); + } else if (job_ > 0) { // 2nd~4th others + addhp += Randomizer.rand(300, 350); + addmp += Randomizer.rand(150, 200); + } + + /* + //aran perks? + int newJobId = newJob.getId(); + if(newJobId == 2100) { // become aran1 + addhp += 275; + addmp += 15; + } else if(newJobId == 2110) { // become aran2 + addmp += 275; + } else if(newJobId == 2111) { // become aran3 + addhp += 275; + 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())); + client.announce(MaplePacketCreator.updatePlayerStats(statup, true, this)); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + + silentPartyUpdate(); if (dragon != null) { getMap().broadcastMessage(MaplePacketCreator.removeDragon(dragon.getObjectId())); dragon = null; } - recalcLocalStats(); - silentPartyUpdate(); + if (this.guildid > 0) { getGuild().broadcast(MaplePacketCreator.jobMessage(0, job.getId(), name), this.getId()); } @@ -1192,7 +1132,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void broadcastAcquaintances(byte[] packet) { - buddylist.broadcast(packet, client.getWorldServer().getPlayerStorage()); + buddylist.broadcast(packet, getWorldServer().getPlayerStorage()); if(family != null) { //family.broadcast(packet, id); not yet implemented @@ -1602,7 +1542,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void notifyMapTransferToPartner(int mapid) { if(partnerId > 0) { - final MapleCharacter partner = client.getWorldServer().getPlayerStorage().getCharacterById(partnerId); + final MapleCharacter partner = getWorldServer().getPlayerStorage().getCharacterById(partnerId); if(partner != null && !partner.isAwayFromWorld()) { partner.announce(Wedding.OnNotifyWeddingPartnerTransfer(id, mapid)); } @@ -1719,7 +1659,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { Skill BerserkX = SkillFactory.getSkill(DarkKnight.BERSERK); final int skilllevel = getSkillLevel(BerserkX); if (skilllevel > 0) { - berserk = chr.getHp() * 100 / chr.getMaxHp() < BerserkX.getEffect(skilllevel).getX(); + berserk = chr.getHp() * 100 / chr.getCurrentMaxHp() < BerserkX.getEffect(skilllevel).getX(); berserkSchedule = TimerManager.getInstance().register(new Runnable() { @Override public void run() { @@ -1736,7 +1676,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void checkMessenger() { if (messenger != null && messengerposition < 4 && messengerposition > -1) { - World worldz = Server.getInstance().getWorld(world); + World worldz = getWorldServer(); worldz.silentJoinMessenger(messenger.getId(), new MapleMessengerCharacter(this, messengerposition), messengerposition); worldz.updateMessenger(getMessenger().getId(), name, client.getChannel()); } @@ -1758,21 +1698,21 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { client.announce(MaplePacketCreator.controlMonster(monster, false, aggro)); } - private static boolean useItem(final MapleClient c, final int id) { + private boolean useItem(final int id) { if (id / 1000000 == 2) { if (ii.isConsumeOnPickup(id)) { if (ItemConstants.isPartyItem(id)) { - List pchr = c.getPlayer().getPartyMembersOnSameMap(); + List pchr = this.getPartyMembersOnSameMap(); if(!ItemConstants.isPartyAllcure(id)) { + MapleStatEffect mse = ii.getItemEffect(id); + if(!pchr.isEmpty()) { for (MapleCharacter mc : pchr) { - ii.getItemEffect(id).applyTo(mc); - mc.checkBerserk(mc.isHidden()); + mse.applyTo(mc); } } else { - ii.getItemEffect(id).applyTo(c.getPlayer()); - c.getPlayer().checkBerserk(c.getPlayer().isHidden()); + mse.applyTo(this); } } else { if(!pchr.isEmpty()) { @@ -1780,12 +1720,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { mc.dispelDebuffs(); } } else { - c.getPlayer().dispelDebuffs(); + this.dispelDebuffs(); } } } else { - ii.getItemEffect(id).applyTo(c.getPlayer()); - c.getPlayer().checkBerserk(c.getPlayer().isHidden()); + ii.getItemEffect(id).applyTo(this); } return true; } @@ -1804,14 +1743,19 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (ob instanceof MapleMapItem) { MapleMapItem mapitem = (MapleMapItem) ob; - if(System.currentTimeMillis() - mapitem.getDropTime() < 900 || !mapitem.canBePickedBy(this)) { + if(Server.getInstance().getCurrentTime() - mapitem.getDropTime() < 900 || !mapitem.canBePickedBy(this)) { client.announce(MaplePacketCreator.enableActions()); return; } + List mpcs = new LinkedList<>(); + if (mapitem.getMeso() > 0 && !mapitem.isPickedUp()) { + mpcs = getPartyMembersOnSameMap(); + } + mapitem.lockItem(); try { - if(mapitem.isPickedUp()) { + if (mapitem.isPickedUp()) { client.announce(MaplePacketCreator.showItemUnavailable()); client.announce(MaplePacketCreator.enableActions()); return; @@ -1820,14 +1764,25 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { boolean isPet = petIndex > -1; final byte[] pickupPacket = MaplePacketCreator.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(), mapitem.getItem().getQuantity(), mapitem.getItem().getOwner()))) { + if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = MapleInventoryManipulator.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) { - this.gainMeso(mapitem.getMeso(), true, true, false); + if (!mpcs.isEmpty()) { + int mesosamm = mapitem.getMeso() / mpcs.size(); + for (MapleCharacter partymem : mpcs) { + if (partymem.isLoggedinWorld()) { + partymem.gainMeso(mesosamm, true, true, false); + } + } + } else { + this.gainMeso(mapitem.getMeso(), true, true, false); + } + this.getMap().pickItemDrop(pickupPacket, mapitem); } else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { // Add NX to account, show effect and make item disappear @@ -1837,7 +1792,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { 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, mapitem.getItem(), true)) { + } else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) { this.getMap().pickItemDrop(pickupPacket, mapitem); } else { client.announce(MaplePacketCreator.enableActions()); @@ -1859,38 +1814,18 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } if (mapitem.getMeso() > 0) { - prtLock.lock(); - try { - if (this.party != null) { - int mesosamm = mapitem.getMeso(); - if (mesosamm > 50000 * this.getMesoRate()) { - return; + if (!mpcs.isEmpty()) { + int mesosamm = mapitem.getMeso() / mpcs.size(); + for (MapleCharacter partymem : mpcs) { + if (partymem.isLoggedinWorld()) { + partymem.gainMeso(mesosamm, true, true, false); } - - MapleMap thisMap = this.getMap(); - int partynum = 0; - Collection mpcs = this.party.getMembers(); - for (MaplePartyCharacter partymem : mpcs) { - if (partymem.getPlayer().isLoggedinWorld() && partymem.getMapId() == thisMap.getId() && partymem.getChannel() == client.getChannel()) { - partynum++; - } - } - for (MaplePartyCharacter partymem : mpcs) { - if (partymem.getPlayer().isLoggedinWorld() && partymem.getMapId() == thisMap.getId()) { - MapleCharacter somecharacter = client.getChannelServer().getPlayerStorage().getCharacterById(partymem.getId()); - if (somecharacter != null) { - somecharacter.gainMeso(mesosamm / partynum, true, true, false); - } - } - } - } else { - this.gainMeso(mapitem.getMeso(), true, true, false); } - } finally { - prtLock.unlock(); + } else { + this.gainMeso(mapitem.getMeso(), true, true, false); } - } else if (mapitem.getItem().getItemId() / 10000 == 243) { - MapleItemInformationProvider.scriptedItem info = ii.getScriptedItemInfo(mapitem.getItem().getItemId()); + } else if (mItem.getItemId() / 10000 == 243) { + MapleItemInformationProvider.scriptedItem info = ii.getScriptedItemInfo(mItem.getItemId()); if (info.runOnPickup()) { ItemScriptManager ism = ItemScriptManager.getInstance(); String scriptName = info.getScript(); @@ -1899,7 +1834,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } else { - if (!MapleInventoryManipulator.addFromDrop(client, mapitem.getItem(), true)) { + if (!MapleInventoryManipulator.addFromDrop(client, mItem, true)) { client.announce(MaplePacketCreator.enableActions()); return; } @@ -1910,12 +1845,12 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { this.getCashShop().gainCash(1, nxGain); showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300); - } else if (useItem(client, mapitem.getItem().getItemId())) { - if (mapitem.getItem().getItemId() / 10000 == 238) { - this.getMonsterBook().addCard(client, mapitem.getItem().getItemId()); + } else if (useItem(mItem.getItemId())) { + if (mItem.getItemId() / 10000 == 238) { + this.getMonsterBook().addCard(client, mItem.getItemId()); } - } else if (MapleInventoryManipulator.addFromDrop(client, mapitem.getItem(), true)) { - } else if (mapitem.getItem().getItemId() == 4031868) { + } else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) { + } else if (mItem.getItemId() == 4031868) { this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false)); } else { client.announce(MaplePacketCreator.enableActions()); @@ -2019,7 +1954,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { BuddyList bl = getBuddylist(); if (bl.containsVisible(otherCid)) { - notifyRemoteChannel(client, client.getWorldServer().find(otherCid), otherCid, BuddyList.BuddyOperation.DELETED); + notifyRemoteChannel(client, getWorldServer().find(otherCid), otherCid, BuddyList.BuddyOperation.DELETED); } bl.remove(otherCid); client.announce(MaplePacketCreator.updateBuddylist(getBuddylist().getBuddies())); @@ -2243,25 +2178,100 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - private void startChairTask() { - if(chair.get() == 0) return; + private static Pair> getChairTaskIntervalRate(int maxhp, int maxmp) { + float toHeal = Math.max(maxhp, maxmp); + float maxDuration = ServerConstants.CHAIR_EXTRA_HEAL_MAX_DELAY * 1000; - final int healInterval = 5000; - final byte healHP = (byte) Math.max(ServerConstants.CHAIR_EXTRA_HEAL_HP, 1); - final byte healMP = (byte) Math.max(ServerConstants.CHAIR_EXTRA_HEAL_MP, 0); + int rate = 0; + int minRegen = 1, maxRegen = (256 * ServerConstants.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) { + maxRegen = (int) (0.8 * midRegen); + } else { + break; + } + } + + float procs = maxDuration / rate; + int hpRegen, mpRegen; + if (maxhp > maxmp) { + hpRegen = midRegen; + mpRegen = (int) Math.ceil(maxmp / procs); + } else { + hpRegen = (int) Math.ceil(maxhp / procs); + mpRegen = midRegen; + } + + return new Pair<>(rate, new Pair<>(hpRegen, mpRegen)); + } + + private void updateChairHealStats() { + statRlock.lock(); + try { + if (localchairrate != -1) { + return; + } + } finally { + statRlock.unlock(); + } + + effLock.lock(); + statWlock.lock(); + try { + Pair> p = getChairTaskIntervalRate(localmaxhp, localmaxmp); + + localchairrate = p.getLeft(); + localchairhp = p.getRight().getLeft(); + localchairmp = p.getRight().getRight(); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + private void startChairTask() { + if (chair.get() == 0) return; + + int healInterval; + effLock.lock(); + try { + updateChairHealStats(); + healInterval = localchairrate; + } finally { + effLock.unlock(); + } chrLock.lock(); try { + if (chairRecoveryTask != null) { + stopChairTask(); + } + chairRecoveryTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - if(hp < localmaxhp) { - client.announce(MaplePacketCreator.showOwnRecovery(healHP)); - getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showRecovery(id, healHP), false); + updateChairHealStats(); + final int healHP = localchairhp; + final int healMP = localchairmp; + + if(MapleCharacter.this.getHp() < localmaxhp) { + byte recHP = (byte) (healHP / ServerConstants.CHAIR_EXTRA_HEAL_MULTIPLIER); + + client.announce(MaplePacketCreator.showOwnRecovery(recHP)); + getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showRecovery(id, recHP), false); + } else if (MapleCharacter.this.getMp() >= localmaxmp) { + stopChairTask(); // optimizing schedule management when player is already with full pool. } - addHP(healHP); - addMP(healMP); + addMPHP(healHP, healMP); } }, healInterval, healInterval); } finally { @@ -2301,15 +2311,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return; } - if(hp < localmaxhp) { + if(MapleCharacter.this.getHp() < localmaxhp) { if(healHP > 0) { client.announce(MaplePacketCreator.showOwnRecovery(healHP)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showRecovery(id, healHP), false); } } - addHP(healHP); - addMP(healMP); + addMPHP(healHP, healMP); } }, healInterval, healInterval); } @@ -2343,7 +2352,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { List mbsvhList = getAllStatups(); for (MapleBuffStatValueHolder mbsvh : mbsvhList) { if (mbsvh.effect.isSkill()) { - cancelEffect(mbsvh.effect, false, mbsvh.startTime); + if (mbsvh.effect.getBuffSourceId() != Aran.COMBO_ABILITY) { // check discovered thanks to Croosade dev team + cancelEffect(mbsvh.effect, false, mbsvh.startTime); + } } } } @@ -2370,7 +2381,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public Map> getAllDiseases() { chrLock.lock(); try { - long curtime = System.currentTimeMillis(); + long curtime = Server.getInstance().getCurrentTime(); Map> ret = new LinkedHashMap<>(); for(Entry de : diseaseExpires.entrySet()) { @@ -2389,7 +2400,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void silentApplyDiseases(Map> diseaseMap) { chrLock.lock(); try { - long curTime = System.currentTimeMillis(); + long curTime = Server.getInstance().getCurrentTime(); for(Entry> di : diseaseMap.entrySet()) { long expTime = curTime + di.getValue().getLeft(); @@ -2435,7 +2446,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { chrLock.lock(); try { - long curTime = System.currentTimeMillis(); + long curTime = Server.getInstance().getCurrentTime(); diseaseExpires.put(disease, curTime + skill.getDuration()); diseases.put(disease, new Pair<>(new MapleDiseaseValueHolder(curTime, skill.getDuration()), skill)); } finally { @@ -2529,7 +2540,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void doHurtHp() { if (!(this.getInventory(MapleInventoryType.EQUIPPED).findById(getMap().getHPDecProtect()) != null || buffMapProtection())) { addHP(-getMap().getHPDec()); - lastHpDec = System.currentTimeMillis(); + lastHpDec = Server.getInstance().getCurrentTime(); } } @@ -2547,7 +2558,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { hpDecreaseTask.cancel(false); } - long lastHpTask = System.currentTimeMillis() - lastHpDec; + long lastHpTask = Server.getInstance().getCurrentTime() - lastHpDec; startHpDecreaseTask((lastHpTask > 10000) ? 10000 : lastHpTask); } @@ -2558,22 +2569,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void dropMessage(int type, String message) { client.announce(MaplePacketCreator.serverNotice(type, message)); } - - private void enforceMaxHpMp() { - List> stats = new ArrayList<>(2); - if (getMp() > getCurrentMaxMp()) { - setMp(getMp()); - stats.add(new Pair<>(MapleStat.MP, Integer.valueOf(getMp()))); - } - if (getHp() > getCurrentMaxHp()) { - setHp(getHp()); - stats.add(new Pair<>(MapleStat.HP, Integer.valueOf(getHp()))); - } - if (stats.size() > 0) { - client.announce(MaplePacketCreator.updatePlayerStats(stats, this)); - } - } - + public void enteredScript(String script, int mapid) { if (!entered.containsKey(mapid)) { entered.put(mapid, script); @@ -2582,10 +2578,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void equipChanged() { getMap().broadcastMessage(this, MaplePacketCreator.updateCharLook(this), false); - recalcLocalStats(); - enforceMaxHpMp(); + equipchanged = true; + updateLocalStats(); if (getMessenger() != null) { - Server.getInstance().getWorld(world).updateMessenger(getMessenger(), getName(), getWorld(), client.getChannel()); + getWorldServer().updateMessenger(getMessenger(), getName(), getWorld(), client.getChannel()); } } @@ -2605,7 +2601,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { chrLock.lock(); try { - long curTime = System.currentTimeMillis(); + long curTime = Server.getInstance().getCurrentTime(); for(Entry de : diseaseExpires.entrySet()) { if(de.getValue() < curTime) { @@ -2644,7 +2640,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { try { es = new LinkedHashSet<>(buffExpires.entrySet()); - long curTime = System.currentTimeMillis(); + long curTime = Server.getInstance().getCurrentTime(); for(Entry bel : es) { if(curTime >= bel.getValue()) { toCancel.add(buffEffects.get(bel.getKey()).entrySet().iterator().next().getValue()); //rofl @@ -2735,19 +2731,19 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { item.setExpiration(-1); forceUpdateItem(item); //TEST :3 } else if (expiration != -1 && expiration < currenttime) { - if(!ItemConstants.isPet(item.getItemId())) { + if (!ItemConstants.isPet(item.getItemId())) { client.announce(MaplePacketCreator.itemExpired(item.getItemId())); toberemove.add(item); - if(ItemConstants.isRateCoupon(item.getItemId())) { + if (ItemConstants.isRateCoupon(item.getItemId())) { deletedCoupon = true; } } else { - if(item.getPetId() > -1) { + if (item.getPetId() > -1) { int petIdx = getPetIndex(item.getPetId()); if(petIdx > -1) unequipPet(getPet(petIdx), true); } - if(ItemConstants.isExpirablePet(item.getItemId())) { + if (ItemConstants.isExpirablePet(item.getItemId())) { client.announce(MaplePacketCreator.itemExpired(item.getItemId())); toberemove.add(item); } else { @@ -3123,7 +3119,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.lock(); chrLock.lock(); try { - long curtime = System.currentTimeMillis(); + long curtime = Server.getInstance().getCurrentTime(); Map ret = new LinkedHashMap<>(); for(Map bel : buffEffects.values()) { @@ -3313,6 +3309,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.lock(); chrLock.lock(); try { + cancelEffectFromBuffStat(MapleBuffStat.SUMMON); + cancelEffectFromBuffStat(MapleBuffStat.PUPPET); + cancelEffectFromBuffStat(MapleBuffStat.COMBO); + effects.clear(); for(Integer srcid : new ArrayList<>(buffEffects.keySet())) { @@ -3362,8 +3362,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { chrLock.unlock(); } - recalcLocalStats(); - /* if (nestedCancel) { this.cancelEffect(cancelEffectCancelTasks.getRight().effect, false, -1, false); @@ -3503,6 +3501,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private boolean cancelEffect(MapleStatEffect effect, boolean overwrite, long startTime, boolean firstCancel) { Set removedStats = new LinkedHashSet<>(); dropBuffStats(cancelEffectInternal(effect, overwrite, startTime, removedStats)); + updateLocalStats(); updateEffects(removedStats); return !removedStats.isEmpty(); @@ -3553,14 +3552,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } List> toCancel = deregisterBuffStats(buffstats); - if (effect.getSourceId() == Spearman.HYPER_BODY || effect.getSourceId() == GM.HYPER_BODY || effect.getSourceId() == SuperGM.HYPER_BODY) { - List> statup = new ArrayList<>(4); - statup.add(new Pair<>(MapleStat.HP, Math.min(hp, maxhp))); - statup.add(new Pair<>(MapleStat.MP, Math.min(mp, maxmp))); - statup.add(new Pair<>(MapleStat.MAXHP, maxhp)); - statup.add(new Pair<>(MapleStat.MAXMP, maxmp)); - client.announce(MaplePacketCreator.updatePlayerStats(statup, this)); - } if (effect.isMonsterRiding()) { if (effect.getSourceId() != Corsair.BATTLE_SHIP) { this.getClient().getWorldServer().unregisterMountHunger(this); @@ -4014,7 +4005,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.unlock(); } - recalcLocalStats(); + updateLocalStats(); } private static int getJobMapChair(MapleJob job) { @@ -4097,14 +4088,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return currentPage; } - public int getCurrentMaxHp() { - return localmaxhp; - } - - public int getCurrentMaxMp() { - return localmaxmp; - } - public int getCurrentTab() { return currentTab; } @@ -4113,10 +4096,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return currentType; } - public int getDex() { - return dex; - } - public int getDojoEnergy() { return dojoEnergy; } @@ -4314,7 +4293,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public int getRawExpRate() { - return expRate / (expCoupon * client.getWorldServer().getExpRate()); + return expRate / (expCoupon * getWorldServer().getExpRate()); } public int getDropRate() { @@ -4326,7 +4305,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public int getRawDropRate() { - return dropRate / (dropCoupon * client.getWorldServer().getDropRate()); + return dropRate / (dropCoupon * getWorldServer().getDropRate()); } public int getMesoRate() { @@ -4338,7 +4317,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public int getRawMesoRate() { - return mesoRate / (mesoCoupon * client.getWorldServer().getMesoRate()); + return mesoRate / (mesoCoupon * getWorldServer().getMesoRate()); } public int getFace() { @@ -4419,14 +4398,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return hiredMerchant; } - public int getHp() { - return hp; - } - - public int getHpMpApUsed() { - return hpMpApUsed; - } - public int getId() { return id; } @@ -4508,10 +4479,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return initialSpawnPoint; } - public int getInt() { - return int_; - } - public MapleInventory getInventory(MapleInventoryType type) { return inventory[type.ordinal()]; } @@ -4576,11 +4543,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public int getLevel() { return level; } - - public int getLuk() { - return luk; - } - + public int getFh() { Point pos = this.getPosition(); pos.y -= 6; @@ -4617,23 +4580,31 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } return skills.get(skill).masterlevel; } - - public int getMaxHp() { - return maxhp; - } - public int getMaxMp() { - return maxmp; - } - - public int getMaxHpEquipped() { - return Math.min(maxhp + eqphp, 30000); - } - - public int getMaxMpEquipped() { - return Math.min(maxmp + eqpmp, 30000); + public int getTotalStr() { + return localstr; } + public int getTotalDex() { + return localdex; + } + + public int getTotalInt() { + return localint_; + } + + public int getTotalLuk() { + return localluk; + } + + public int getTotalMagic() { + return localmagic; + } + + public int getTotalWatk() { + return localwatk; + } + public int getMaxClassLevel() { return isCygnus() ? 120 : 200; } @@ -4703,7 +4674,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void resetPlayerAggro() { - if(client.getWorldServer().unregisterDisabledServerMessage(id)) { + if(getWorldServer().unregisterDisabledServerMessage(id)) { client.announceServerMessage(); } @@ -4749,10 +4720,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return maplemount; } - public int getMp() { - return mp; - } - public MapleMessenger getMessenger() { return messenger; } @@ -4839,7 +4806,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { for(MaplePartyCharacter partyMembers: party.getMembers()) { MapleCharacter chr = partyMembers.getPlayer(); MapleMap chrMap = chr.getMap(); - if(chrMap != null && chrMap.hashCode() == thisMapHash && chr.isLoggedinWorld()) list.add(chr); + if(chrMap != null && chrMap.hashCode() == thisMapHash && chr.isLoggedinWorld()) { + list.add(chr); + } } } } finally { @@ -4909,7 +4878,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (mps.isOwner(this)) { mps.setOpen(false); - client.getWorldServer().unregisterPlayerShop(mps); + getWorldServer().unregisterPlayerShop(mps); for (MaplePlayerShopItem mpsi : mps.getItems()) { if (mpsi.getBundles() >= 2) { @@ -4966,7 +4935,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { MapleMessenger m = this.getMessenger(); if(m == null) return; - World w = client.getWorldServer(); + World w = getWorldServer(); MapleMessengerCharacter messengerplayer = new MapleMessengerCharacter(this, this.getMessengerPosition()); w.leaveMessenger(m.getId(), messengerplayer); @@ -5114,22 +5083,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return rankMove; } - public int getRemainingAp() { - return remainingAp; - } - - public int getRemainingSp() { - return remainingSp[GameConstants.getSkillBook(job.getId())]; //default - } - - public int getRemainingSpBySkill(final int skillbook) { - return remainingSp[skillbook]; - } - - public int[] getRemainingSps() { - return remainingSp; - } - private void clearSavedLocation(SavedLocationType type) { savedLocations[type.ordinal()] = null; } @@ -5245,10 +5198,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return storage; } - public int getStr() { - return str; - } - public Collection getSummonsValues() { return summons.values(); } @@ -5269,30 +5218,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return summons.containsValue(summon); } - public int getTotalStr() { - return localstr; - } - - public int getTotalDex() { - return localdex; - } - - public int getTotalInt() { - return localint_; - } - - public int getTotalLuk() { - return localluk; - } - - public int getTotalMagic() { - return magic; - } - - public int getTotalWatk() { - return watk; - } - public MapleTrade getTrade() { return trade; } @@ -5312,6 +5237,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public int getWorld() { return world; } + + public World getWorldServer() { + return Server.getInstance().getWorld(world); + } public void giveCoolDowns(final int skillid, long starttime, long length) { if (skillid == 5221999) { @@ -5478,17 +5407,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } return false; } - - public boolean isAlive() { - return hp > 0; - } private boolean canBuyback(int fee, boolean usingMesos) { return (usingMesos ? this.getMeso() : cashshop.getCash(1)) >= fee; } private void applyBuybackFee(int fee, boolean usingMesos) { - if(usingMesos) { + if (usingMesos) { this.gainMeso(-fee); } else { cashshop.gainCash(1, -fee); @@ -5514,13 +5439,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public boolean couldBuyback() { // Ronan's buyback system long timeNow = Server.getInstance().getCurrentTime(); - if(timeNow - lastDeathtime > ServerConstants.BUYBACK_RETURN_MINUTES * 60 * 1000) { - this.dropMessage(5, "The time available to decide has expired, therefore you are unable to buyback now."); + if (timeNow - lastDeathtime > ServerConstants.BUYBACK_RETURN_MINUTES * 60 * 1000) { + this.dropMessage(5, "The time available to decide has expired, therefore you are unable to buyback."); return false; } long nextBuybacktime = getNextBuybackTime(); - if(timeNow < nextBuybacktime) { + if (timeNow < nextBuybacktime) { long timeLeft = nextBuybacktime - timeNow; int seconds = (int) Math.floor(timeLeft / 1000) % 60; int minutes = (int) Math.floor(timeLeft / (1000*60)) % 60; @@ -5531,9 +5456,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { boolean usingMesos = ServerConstants.USE_BUYBACK_WITH_MESOS; int fee = getBuybackFee(); - if(usingMesos) fee *= ServerConstants.BUYBACK_MESO_MULTIPLIER; + if (usingMesos) fee *= ServerConstants.BUYBACK_MESO_MULTIPLIER; - if(!canBuyback(fee, usingMesos)) { + if (!canBuyback(fee, usingMesos)) { this.dropMessage(5, "You don't have " + fee + " " + (usingMesos ? "mesos" : "NX") + " to buyback."); return false; } @@ -5609,142 +5534,164 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - public void levelUp(boolean takeexp) { - petLock.lock(); - try { - Skill improvingMaxHP = null; - Skill improvingMaxMP = null; - int improvingMaxHPLevel = 0; - int improvingMaxMPLevel = 0; + public synchronized void levelUp(boolean takeexp) { + Skill improvingMaxHP = null; + Skill improvingMaxMP = null; + int improvingMaxHPLevel = 0; + int improvingMaxMPLevel = 0; - boolean isBeginner = isBeginnerJob(); - if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP && isBeginner && level < 11) { - remainingAp = 0; + boolean isBeginner = isBeginnerJob(); + if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP && isBeginner && level < 11) { + effLock.lock(); + statWlock.lock(); + try { + gainAp(5, true); + + int str = 0, dex = 0; if (level < 6) { str += 5; } else { str += 4; dex += 1; } + + assignStrDexIntLuk(str, dex, 0, 0); + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } else { + int remainingAp = 5; + if (isCygnus() && level > 10 && level < 70) { + remainingAp++; + } + + gainAp(remainingAp, true); + } + + int addhp = 0, addmp = 0; + if (isBeginner) { + addhp += Randomizer.rand(12, 16); + addmp += Randomizer.rand(10, 12); + } else if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1)) { + improvingMaxHP = isCygnus() ? SkillFactory.getSkill(DawnWarrior.MAX_HP_INCREASE) : SkillFactory.getSkill(Swordsman.IMPROVED_MAX_HP_INCREASE); + if (job.isA(MapleJob.CRUSADER)) { + improvingMaxMP = SkillFactory.getSkill(1210000); + } else if (job.isA(MapleJob.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)) { + 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)) { + addhp += Randomizer.rand(20, 24); + addmp += Randomizer.rand(14, 16); + } else if (job.isA(MapleJob.GM)) { + addhp += 30000; + addmp += 30000; + } else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) { + improvingMaxHP = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.IMPROVE_MAX_HP) : SkillFactory.getSkill(5100000); + improvingMaxHPLevel = getSkillLevel(improvingMaxHP); + addhp += Randomizer.rand(22, 28); + addmp += Randomizer.rand(18, 23); + } else if (job.isA(MapleJob.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))) { + addhp += improvingMaxHP.getEffect(improvingMaxHPLevel).getX(); + } + if (improvingMaxMPLevel > 0 && (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.CRUSADER) || job.isA(MapleJob.BLAZEWIZARD1))) { + addmp += improvingMaxMP.getEffect(improvingMaxMPLevel).getX(); + } + + if (ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if (getJobStyle() == MapleJob.MAGICIAN) { + addmp += localint_ / 20; } else { - remainingAp += 5; - if (isCygnus() && level > 10 && level < 70) { - remainingAp++; - } + addmp += localint_ / 10; } + } - if (isBeginner) { - maxhp += Randomizer.rand(12, 16); - maxmp += Randomizer.rand(10, 12); - } else if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1)) { - improvingMaxHP = isCygnus() ? SkillFactory.getSkill(DawnWarrior.MAX_HP_INCREASE) : SkillFactory.getSkill(Swordsman.IMPROVED_MAX_HP_INCREASE); - if (job.isA(MapleJob.CRUSADER)) { - improvingMaxMP = SkillFactory.getSkill(1210000); - } else if (job.isA(MapleJob.DAWNWARRIOR2)) { - improvingMaxMP = SkillFactory.getSkill(11110000); - } - improvingMaxHPLevel = getSkillLevel(improvingMaxHP); - maxhp += Randomizer.rand(24, 28); - maxmp += Randomizer.rand(4, 6); - } else if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) { - improvingMaxMP = isCygnus() ? SkillFactory.getSkill(BlazeWizard.INCREASING_MAX_MP) : SkillFactory.getSkill(Magician.IMPROVED_MAX_MP_INCREASE); - improvingMaxMPLevel = getSkillLevel(improvingMaxMP); - maxhp += Randomizer.rand(10, 14); - maxmp += Randomizer.rand(22, 24); - } else if (job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.THIEF) || (job.getId() > 1299 && job.getId() < 1500)) { - maxhp += Randomizer.rand(20, 24); - maxmp += Randomizer.rand(14, 16); - } else if (job.isA(MapleJob.GM)) { - maxhp = 30000; - maxmp = 30000; - } else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) { - improvingMaxHP = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.IMPROVE_MAX_HP) : SkillFactory.getSkill(5100000); - improvingMaxHPLevel = getSkillLevel(improvingMaxHP); - maxhp += Randomizer.rand(22, 28); - maxmp += Randomizer.rand(18, 23); - } else if (job.isA(MapleJob.ARAN1)) { - maxhp += Randomizer.rand(44, 48); - int aids = Randomizer.rand(4, 8); - maxmp += aids + Math.floor(aids * 0.1); - } - if (improvingMaxHPLevel > 0 && (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.PIRATE) || job.isA(MapleJob.DAWNWARRIOR1))) { - maxhp += improvingMaxHP.getEffect(improvingMaxHPLevel).getX(); - } - if (improvingMaxMPLevel > 0 && (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.CRUSADER) || job.isA(MapleJob.BLAZEWIZARD1))) { - maxmp += improvingMaxMP.getEffect(improvingMaxMPLevel).getX(); - } + addMaxMPMaxHP(addhp, addmp, true); - if (ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { - if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) { - maxmp += localint_ / 20; - } else { - maxmp += localint_ / 10; - } - } - - if (takeexp) { - exp.addAndGet(-ExpTable.getExpNeededForLevel(level)); - if (exp.get() < 0) { - exp.set(0); - } - } - level++; - if (level >= getMaxClassLevel()) { + if (takeexp) { + exp.addAndGet(-ExpTable.getExpNeededForLevel(level)); + if (exp.get() < 0) { exp.set(0); - level = getMaxClassLevel(); //To prevent levels past the maximum + } + } + + level++; + if (level >= getMaxClassLevel()) { + exp.set(0); + + int maxClassLevel = getMaxClassLevel(); + if (level == maxClassLevel) { + if (!this.isGM()) { + if (ServerConstants.PLAYERNPC_AUTODEPLOY) { + Thread t = new Thread(new Runnable() { + @Override + public void run() { + MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), MapleCharacter.this); + } + }); + + t.start(); + } + + final String names = (getMedalText() + name); + getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, String.format(LEVEL_200, names, names))); + } } - maxhp = Math.min(30000, maxhp); - maxmp = Math.min(30000, maxmp); - if (level == 200) { - exp.set(0); - if(ServerConstants.PLAYERNPC_AUTODEPLOY && !this.isGM()) MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), this); - } + level = maxClassLevel; //To prevent levels past the maximum + } + + if (job.getId() % 1000 > 0) { + gainSp(3, GameConstants.getSkillBook(job.getId()), true); + } + + effLock.lock(); + statWlock.lock(); + try { recalcLocalStats(); - hp = localmaxhp; - mp = localmaxmp; + changeHpMp(localmaxhp, localmaxmp, true); + List> statup = new ArrayList<>(10); statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); - statup.add(new Pair<>(MapleStat.HP, localmaxhp)); - statup.add(new Pair<>(MapleStat.MP, localmaxmp)); + 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, maxhp)); - statup.add(new Pair<>(MapleStat.MAXMP, maxmp)); - statup.add(new Pair<>(MapleStat.STR, Math.min(str, Short.MAX_VALUE))); - statup.add(new Pair<>(MapleStat.DEX, Math.min(dex, Short.MAX_VALUE))); - if (job.getId() % 1000 > 0) { - remainingSp[GameConstants.getSkillBook(job.getId())] += 3; - statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); - } - client.announce(MaplePacketCreator.updatePlayerStats(statup, this)); - getMap().broadcastMessage(this, MaplePacketCreator.showForeignEffect(getId(), 0), false); - recalcLocalStats(); - setMPC(new MaplePartyCharacter(this)); - silentPartyUpdate(); + 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)); + + client.announce(MaplePacketCreator.updatePlayerStats(statup, true, this)); + } finally { + statWlock.unlock(); + effLock.unlock(); + } - if(level == 10 && party != null) { - if(this.isPartyLeader()) party.assignNewLeader(client); - PartyOperationHandler.leaveParty(party, mpc, client); + getMap().broadcastMessage(this, MaplePacketCreator.showForeignEffect(getId(), 0), false); + setMPC(new MaplePartyCharacter(this)); + silentPartyUpdate(); - showHint("You have reached #blevel 10#k, therefore you must leave your #rstarter party#k."); - } + if (this.guildid > 0) { + getGuild().broadcast(MaplePacketCreator.levelUpMessage(2, level, name), this.getId()); + } - if (this.guildid > 0) { - getGuild().broadcast(MaplePacketCreator.levelUpMessage(2, level, name), this.getId()); - } - if (ServerConstants.USE_PERFECT_PITCH && level >= 30) { - //milestones? - if (MapleInventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { - MapleInventoryManipulator.addById(client, 4310000, (short) 1); - } - } - if (level == 200 && !isGM()) { - final String names = (getMedalText() + name); - client.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, String.format(LEVEL_200, names, names))); - } - - if(level % 20 == 0 && ServerConstants.USE_ADD_SLOTS_BY_LEVEL == true) { + if (level % 20 == 0) { + if (ServerConstants.USE_ADD_SLOTS_BY_LEVEL == true) { if (!isGM()) { for (byte i = 1; i < 5; i++) { gainSlots(i, 4, true); @@ -5753,31 +5700,42 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { this.yellowMessage("You reached level " + level + ". Congratulations! As a token of your success, your inventory has been expanded a little bit."); } } - if (level % 20 == 0 && ServerConstants.USE_ADD_RATES_BY_LEVEL == true) { //For the rate upgrade + if (ServerConstants.USE_ADD_RATES_BY_LEVEL == true) { //For the rate upgrade revertLastPlayerRates(); setPlayerRates(); this.yellowMessage("You managed to get level " + level + "! Getting experience and items seems a little easier now, huh?"); } - - levelUpMessages(); - guildUpdate(); - } finally { - petLock.unlock(); } - } - public void gainAp(int amount) { - List> statup = new ArrayList<>(1); - remainingAp += amount; - statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); - client.announce(MaplePacketCreator.updatePlayerStats(statup, this)); - } + if (ServerConstants.USE_PERFECT_PITCH && level >= 30) { + //milestones? + if (MapleInventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { + MapleInventoryManipulator.addById(client, 4310000, (short) 1); + } + } else if (level == 10) { + Runnable r = new Runnable() { + @Override + public void run() { + prtLock.lock(); + try { + if (party != null) { + if(isPartyLeader()) party.assignNewLeader(client); + PartyOperationHandler.leaveParty(party, mpc, client); - public void gainSp(int amount) { - List> statup = new ArrayList<>(1); - remainingSp[GameConstants.getSkillBook(job.getId())] += amount; - statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())])); - client.announce(MaplePacketCreator.updatePlayerStats(statup, this)); + showHint("You have reached #blevel 10#k, therefore you must leave your #rstarter party#k."); + } + } finally { + prtLock.unlock(); + } + } + }; + + Thread t = new Thread(r); + t.start(); + } + + levelUpMessages(); + guildUpdate(); } private void levelUpMessages() { @@ -5886,14 +5844,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void setWorldRates() { - World worldz = Server.getInstance().getWorld(world); + World worldz = getWorldServer(); this.expRate *= worldz.getExpRate(); this.mesoRate *= worldz.getMesoRate(); this.dropRate *= worldz.getDropRate(); } public void revertWorldRates() { - World worldz = Server.getInstance().getWorld(world); + World worldz = getWorldServer(); this.expRate /= worldz.getExpRate(); this.mesoRate /= worldz.getMesoRate(); this.dropRate /= worldz.getDropRate(); @@ -5902,9 +5860,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void setCouponRates() { List couponEffects; + Collection cashItems = this.getInventory(MapleInventoryType.CASH).list(); chrLock.lock(); try { - setActiveCoupons(); + setActiveCoupons(cashItems); couponEffects = activateCouponsEffects(); } finally { chrLock.unlock(); @@ -6008,15 +5967,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return toCommitEffect; } - private void setActiveCoupons() { + private void setActiveCoupons(Collection cashItems) { activeCoupons.clear(); activeCouponRates.clear(); Map coupons = Server.getInstance().getCouponRates(); List active = Server.getInstance().getActiveCoupons(); - for(Item it: this.getInventory(MapleInventoryType.CASH).list()) { - if(ItemConstants.isRateCoupon(it.getItemId()) && active.contains(it.getItemId())) { + for (Item it: cashItems) { + if (ItemConstants.isRateCoupon(it.getItemId()) && active.contains(it.getItemId())) { Integer count = activeCoupons.get(it.getItemId()); if(count != null) activeCoupons.put(it.getItemId(), count + 1); @@ -6029,7 +5988,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } private void commitBuffCoupon(int couponid) { - if(!isLoggedin() || getCashShop().isOpened()) return; + if (!isLoggedin() || getCashShop().isOpened()) return; MapleStatEffect mse = ii.getItemEffect(couponid); mse.applyTo(this); @@ -6086,16 +6045,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.int_ = rs.getInt("int"); ret.luk = rs.getInt("luk"); ret.hp = rs.getInt("hp"); - ret.maxhp = rs.getInt("maxhp"); + ret.setMaxHp(rs.getInt("maxhp")); ret.mp = rs.getInt("mp"); - ret.maxmp = rs.getInt("maxmp"); - + ret.setMaxMp(rs.getInt("maxmp")); ret.remainingAp = rs.getInt("ap"); - String[] skillPoints = rs.getString("sp").split(","); - for (int i = 0; i < ret.remainingSp.length; i++) { - ret.remainingSp[i] = Integer.parseInt(skillPoints[i]); - } - + ret.loadCharSkillPoints(rs.getString("sp").split(",")); ret.exp.set(rs.getInt("exp")); ret.fame = rs.getInt("fame"); ret.gachaexp.set(rs.getInt("gachaexp")); @@ -6142,11 +6096,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.int_ = this.getInt(); ret.luk = this.getLuk(); ret.hp = this.getHp(); - ret.maxhp = this.getMaxHp(); + ret.setMaxHp(this.getMaxHp()); ret.mp = this.getMp(); - ret.maxmp = this.getMaxMp(); + ret.setMaxMp(this.getMaxMp()); ret.remainingAp = this.getRemainingAp(); - ret.remainingSp = this.getRemainingSps(); + ret.setRemainingSp(this.getRemainingSps()); ret.exp.set(this.getExp()); ret.fame = this.getFame(); ret.gachaexp.set(this.getGachaExp()); @@ -6165,6 +6119,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return ret; } + private void loadCharSkillPoints(String[] skillPoints) { + 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(int charid, MapleClient client, boolean channelserver) throws SQLException { try { MapleCharacter ret = new MapleCharacter(); @@ -6191,16 +6162,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.exp.set(rs.getInt("exp")); ret.gachaexp.set(rs.getInt("gachaexp")); ret.hp = rs.getInt("hp"); - ret.maxhp = rs.getInt("maxhp"); + ret.setMaxHp(rs.getInt("maxhp")); ret.mp = rs.getInt("mp"); - ret.maxmp = rs.getInt("maxmp"); + ret.setMaxMp(rs.getInt("maxmp")); ret.hpMpApUsed = rs.getInt("hpMpUsed"); ret.hasMerchant = rs.getInt("HasMerchant") == 1; - String[] skillPoints = rs.getString("sp").split(","); - for (int i = 0; i < ret.remainingSp.length; i++) { - ret.remainingSp[i] = Integer.parseInt(skillPoints[i]); - } ret.remainingAp = rs.getInt("ap"); + ret.loadCharSkillPoints(rs.getString("sp").split(",")); ret.meso.set(rs.getInt("meso")); ret.merchantmeso = rs.getInt("MerchantMesos"); ret.gmLevel = rs.getInt("gm"); @@ -6564,9 +6532,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.close(); ret.buddylist.loadFromDb(charid); ret.storage = MapleStorage.loadOrCreateFromDB(ret.accountid, ret.world); + + int startHp = ret.hp, startMp = ret.mp; ret.recalcLocalStats(); + ret.changeHpMp(startHp, startMp, true); //ret.resetBattleshipHp(); - ret.silentEnforceMaxHpMp(); } int mountid = ret.getJobType() * 10000000 + 1004; if (ret.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18) != null) { @@ -6739,6 +6709,20 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } client.announce(MaplePacketCreator.enableActions()); } + + 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) { + cancelAllBuffs(false); + + updateHp(50); + setStance(0); + + if (eim != null) eim.unregisterPlayer(this); // some event scripts uses this... + changeMap(returnMap); + } private void prepareDragonBlood(final MapleStatEffect bloodEffect) { if (dragonBloodSchedule != null) { @@ -6750,134 +6734,204 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if(awayFromWorld.get()) return; addHP(-bloodEffect.getX()); - client.announce(MaplePacketCreator.showOwnBuffEffect(bloodEffect.getSourceId(), 5)); + announce(MaplePacketCreator.showOwnBuffEffect(bloodEffect.getSourceId(), 5)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBuffeffect(getId(), bloodEffect.getSourceId(), 5), false); - checkBerserk(isHidden()); } }, 4000, 4000); } - private void recalcLocalStats() { - int oldmaxhp = localmaxhp; - localmaxhp = getMaxHp(); - localmaxmp = getMaxMp(); - localdex = getDex(); - localint_ = getInt(); - localstr = getStr(); - localluk = getLuk(); - int speed = 100, jump = 100; - magic = localint_; - watk = 0; - - for (Item item : getInventory(MapleInventoryType.EQUIPPED)) { - Equip equip = (Equip) item; - localmaxhp += equip.getHp(); - localmaxmp += equip.getMp(); - localdex += equip.getDex(); - localint_ += equip.getInt(); - localstr += equip.getStr(); - localluk += equip.getLuk(); - magic += equip.getMatk() + equip.getInt(); - watk += equip.getWatk(); - speed += equip.getSpeed(); - jump += equip.getJump(); - } - magic = Math.min(magic, 2000); - Integer hbhp = getBuffedValue(MapleBuffStat.HYPERBODYHP); - if (hbhp != null) { - localmaxhp += (hbhp.doubleValue() / 100) * localmaxhp; - } - Integer hbmp = getBuffedValue(MapleBuffStat.HYPERBODYMP); - if (hbmp != null) { - localmaxmp += (hbmp.doubleValue() / 100) * localmaxmp; - } - localmaxhp = Math.min(30000, localmaxhp); - localmaxmp = Math.min(30000, localmaxmp); - Integer watkbuff = getBuffedValue(MapleBuffStat.WATK); - if (watkbuff != null) { - watk += watkbuff.intValue(); - } - MapleStatEffect combo = getBuffEffect(MapleBuffStat.ARAN_COMBO); - if (combo != null) { - watk += combo.getX(); - } - - if (energybar == 15000) { - Skill energycharge = isCygnus() ? SkillFactory.getSkill(ThunderBreaker.ENERGY_CHARGE) : SkillFactory.getSkill(Marauder.ENERGY_CHARGE); - MapleStatEffect ceffect = energycharge.getEffect(getSkillLevel(energycharge)); - watk += ceffect.getWatk(); - } - - Integer mwarr = getBuffedValue(MapleBuffStat.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)) { - Skill expert = null; - if (job.isA(MapleJob.MARKSMAN)) { - expert = SkillFactory.getSkill(3220004); - } else if (job.isA(MapleJob.BOWMASTER)) { - expert = SkillFactory.getSkill(3120005); + private void recalcEquipStats() { + if (equipchanged) { + equipmaxhp = 0; + equipmaxmp = 0; + equipdex = 0; + equipint_ = 0; + equipstr = 0; + equipluk = 0; + equipmagic = 0; + equipwatk = 0; + //equipspeed = 0; + //equipjump = 0; + + for (Item item : getInventory(MapleInventoryType.EQUIPPED)) { + Equip equip = (Equip) item; + equipmaxhp += equip.getHp(); + equipmaxmp += equip.getMp(); + equipdex += equip.getDex(); + equipint_ += equip.getInt(); + equipstr += equip.getStr(); + equipluk += equip.getLuk(); + equipmagic += equip.getMatk() + equip.getInt(); + equipwatk += equip.getWatk(); + //equipspeed += equip.getSpeed(); + //equipjump += equip.getJump(); } - if (expert != null) { - int boostLevel = getSkillLevel(expert); - if (boostLevel > 0) { - watk += expert.getEffect(boostLevel).getX(); + + equipchanged = false; + } + + localmaxhp += equipmaxhp; + localmaxmp += equipmaxmp; + localdex += equipdex; + localint_ += equipint_; + localstr += equipstr; + localluk += equipluk; + localmagic += equipmagic; + localwatk += equipwatk; + } + + private List> recalcLocalStats() { + effLock.lock(); + statWlock.lock(); + try { + List> hpmpupdate = new ArrayList<>(2); + + int oldlocalmaxhp = localmaxhp; + int oldlocalmaxmp = localmaxmp; + + localmaxhp = getMaxHp(); + localmaxmp = getMaxMp(); + localdex = getDex(); + localint_ = getInt(); + localstr = getStr(); + localluk = getLuk(); + localmagic = localint_; + localwatk = 0; + localchairrate = -1; + + recalcEquipStats(); + + localmagic = Math.min(localmagic, 2000); + + Integer hbhp = getBuffedValue(MapleBuffStat.HYPERBODYHP); + if (hbhp != null) { + localmaxhp += (hbhp.doubleValue() / 100) * localmaxhp; + } + Integer hbmp = getBuffedValue(MapleBuffStat.HYPERBODYMP); + if (hbmp != null) { + localmaxmp += (hbmp.doubleValue() / 100) * localmaxmp; + } + + localmaxhp = Math.min(30000, localmaxhp); + localmaxmp = Math.min(30000, localmaxmp); + + if (ServerConstants.USE_FIXED_RATIO_HPMP_UPDATE) { + if (localmaxhp != oldlocalmaxhp) hpmpupdate.add(calcHpRatioUpdate(localmaxhp, oldlocalmaxhp)); + if (localmaxmp != oldlocalmaxmp) hpmpupdate.add(calcMpRatioUpdate(localmaxmp, oldlocalmaxmp)); + } + + MapleStatEffect combo = getBuffEffect(MapleBuffStat.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)); + localwatk += ceffect.getWatk(); + } + + Integer mwarr = getBuffedValue(MapleBuffStat.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)) { + Skill expert = null; + if (job.isA(MapleJob.MARKSMAN)) { + expert = SkillFactory.getSkill(3220004); + } else if (job.isA(MapleJob.BOWMASTER)) { + expert = SkillFactory.getSkill(3120005); + } + if (expert != null) { + int boostLevel = getSkillLevel(expert); + if (boostLevel > 0) { + localwatk += expert.getEffect(boostLevel).getX(); + } } } - } - Integer matkbuff = getBuffedValue(MapleBuffStat.MATK); - if (matkbuff != null) { - magic += matkbuff.intValue(); - } - Integer speedbuff = getBuffedValue(MapleBuffStat.SPEED); - if (speedbuff != null) { - speed += speedbuff.intValue(); - } - Integer jumpbuff = getBuffedValue(MapleBuffStat.JUMP); - if (jumpbuff != null) { - jump += jumpbuff.intValue(); - } - Integer blessing = getSkillLevel(10000000 * getJobType() + 12); - if (blessing > 0) { - watk += blessing; - magic += blessing * 2; - } + Integer watkbuff = getBuffedValue(MapleBuffStat.WATK); + if (watkbuff != null) { + localwatk += watkbuff.intValue(); + } + Integer matkbuff = getBuffedValue(MapleBuffStat.MATK); + if (matkbuff != null) { + localmagic += matkbuff.intValue(); + } - 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 (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; - if (bow || crossbow || claw || gun) { - // Also calc stars into this. - MapleInventory inv = getInventory(MapleInventoryType.USE); - for (short i = 1; i <= inv.getSlotLimit(); i++) { - Item item = inv.getItem(i); - if (item != null) { - if ((claw && ItemConstants.isThrowingStar(item.getItemId())) || (gun && ItemConstants.isBullet(item.getItemId())) || (bow && ItemConstants.isArrowForBow(item.getItemId())) || (crossbow && ItemConstants.isArrowForCrossBow(item.getItemId()))) { - if (item.getQuantity() > 0) { - // Finally there! - watk += ii.getWatkForProjectile(item.getItemId()); - break; + /* + Integer speedbuff = getBuffedValue(MapleBuffStat.SPEED); + if (speedbuff != null) { + localspeed += speedbuff.intValue(); + } + Integer jumpbuff = getBuffedValue(MapleBuffStat.JUMP); + if (jumpbuff != null) { + localjump += jumpbuff.intValue(); + } + */ + + Integer blessing = getSkillLevel(10000000 * getJobType() + 12); + if (blessing > 0) { + localwatk += blessing; + 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 (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; + if (bow || crossbow || claw || gun) { + // Also calc stars into this. + MapleInventory inv = getInventory(MapleInventoryType.USE); + for (short i = 1; i <= inv.getSlotLimit(); i++) { + Item item = inv.getItem(i); + if (item != null) { + if ((claw && ItemConstants.isThrowingStar(item.getItemId())) || (gun && ItemConstants.isBullet(item.getItemId())) || (bow && ItemConstants.isArrowForBow(item.getItemId())) || (crossbow && ItemConstants.isArrowForCrossBow(item.getItemId()))) { + if (item.getQuantity() > 0) { + // Finally there! + localwatk += ii.getWatkForProjectile(item.getItemId()); + break; + } } } } } } + // Add throwing stars to dmg. } - // Add throwing stars to dmg. - } - if (oldmaxhp != 0 && oldmaxhp != localmaxhp) { - updatePartyMemberHP(); + return hpmpupdate; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + + private void updateLocalStats() { + effLock.lock(); + statWlock.lock(); + try { + int oldmaxhp = localmaxhp; + List> hpmpupdate = recalcLocalStats(); + enforceMaxHpMp(); + + if (!hpmpupdate.isEmpty()) { + client.announce(MaplePacketCreator.updatePlayerStats(hpmpupdate, true, this)); + } + + if (oldmaxhp != localmaxhp) { + updatePartyMemberHP(); + } + } finally { + statWlock.unlock(); + effLock.unlock(); } } @@ -6885,17 +6939,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { prtLock.lock(); try { if (party != null) { - int channel = client.getChannel(); - int mapId = getMapId(); - World wserv = Server.getInstance().getWorld(world); - - for (MaplePartyCharacter partychar : party.getMembers()) { - if (partychar.getMapId() == mapId && partychar.getChannel() == channel) { - MapleCharacter other = wserv.getChannel(channel).getPlayerStorage().getCharacterById(partychar.getId()); - if (other != null) { - client.announce(MaplePacketCreator.updatePartyMemberHP(other.getId(), other.getHp(), other.getMaxHpEquipped())); - } - } + for (MapleCharacter partychar : this.getPartyMembersOnSameMap()) { + announce(MaplePacketCreator.updatePartyMemberHP(partychar.getId(), partychar.getHp(), partychar.getCurrentMaxHp())); } } } finally { @@ -6978,57 +7023,51 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return; } - List> statup = new ArrayList<>(5); - int tap = remainingAp + str + dex + int_ + luk, tsp = 1; - int tstr = 4, tdex = 4, tint = 4, tluk = 4; - - switch (job.getId()) { - case 100: - case 1100: - case 2100: - tstr = 35; - tsp += ((getLevel() - 10) * 3); - break; - case 200: - case 1200: - tint = 20; - tsp += ((getLevel() - 8) * 3); - break; - case 300: - case 1300: - case 400: - case 1400: - tdex = 25; - tsp += ((getLevel() - 10) * 3); - break; - case 500: - case 1500: - tdex = 20; - tsp += ((getLevel() - 10) * 3); - break; - } - - tap -= tstr; - tap -= tdex; - tap -= tint; - tap -= tluk; - - if (tap >= 0) { - this.remainingAp = tap; - this.remainingSp[GameConstants.getSkillBook(job.getId())] = tsp; - this.str = tstr; - this.dex = tdex; - this.int_ = tint; - this.luk = tluk; - statup.add(new Pair<>(MapleStat.AVAILABLEAP, tap)); - statup.add(new Pair<>(MapleStat.AVAILABLESP, tsp)); - statup.add(new Pair<>(MapleStat.STR, tstr)); - statup.add(new Pair<>(MapleStat.DEX, tdex)); - statup.add(new Pair<>(MapleStat.INT, tint)); - statup.add(new Pair<>(MapleStat.LUK, tluk)); - announce(MaplePacketCreator.updatePlayerStats(statup, this)); - } else { - FilePrinter.print(FilePrinter.EXCEPTION_CAUGHT, name + " tried to get their stats reseted, without having enough AP available."); + effLock.lock(); + statWlock.lock(); + try { + int tap = remainingAp + str + dex + int_ + luk, tsp = 1; + int tstr = 4, tdex = 4, tint = 4, tluk = 4; + + switch (job.getId()) { + case 100: + case 1100: + case 2100: + tstr = 35; + tsp += ((getLevel() - 10) * 3); + break; + case 200: + case 1200: + tint = 20; + tsp += ((getLevel() - 8) * 3); + break; + case 300: + case 1300: + case 400: + case 1400: + tdex = 25; + tsp += ((getLevel() - 10) * 3); + break; + case 500: + case 1500: + tdex = 20; + tsp += ((getLevel() - 10) * 3); + break; + } + + tap -= tstr; + tap -= tdex; + tap -= tint; + tap -= tluk; + + if (tap >= 0) { + updateStrDexIntLukSp(tstr, tdex, tint, tluk, tap, tsp, GameConstants.getSkillBook(job.getId())); + } else { + FilePrinter.print(FilePrinter.EXCEPTION_CAUGHT, name + " tried to get their stats reseted, without having enough AP available."); + } + } finally { + statWlock.unlock(); + effLock.unlock(); } } @@ -7135,8 +7174,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { dex = recipe.getDex(); int_ = recipe.getInt(); luk = recipe.getLuk(); - maxhp = recipe.getMaxHp(); - maxmp = recipe.getMaxMp(); + setMaxHp(recipe.getMaxHp()); + setMaxMp(recipe.getMaxMp()); hp = maxhp; mp = maxmp; level = recipe.getLevel(); @@ -7327,24 +7366,33 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.setInt(1, level); } ps.setInt(2, fame); - ps.setInt(3, str); - ps.setInt(4, dex); - ps.setInt(5, luk); - ps.setInt(6, int_); - ps.setInt(7, Math.abs(exp.get())); - ps.setInt(8, Math.abs(gachaexp.get())); - ps.setInt(9, hp); - ps.setInt(10, mp); - ps.setInt(11, maxhp); - ps.setInt(12, maxmp); - StringBuilder sps = new StringBuilder(); - for (int i = 0; i < remainingSp.length; i++) { - sps.append(remainingSp[i]); - sps.append(","); + + effLock.lock(); + statWlock.lock(); + try { + ps.setInt(3, str); + ps.setInt(4, dex); + ps.setInt(5, luk); + ps.setInt(6, int_); + ps.setInt(7, Math.abs(exp.get())); + ps.setInt(8, Math.abs(gachaexp.get())); + ps.setInt(9, hp); + ps.setInt(10, mp); + ps.setInt(11, maxhp); + ps.setInt(12, maxmp); + StringBuilder sps = new StringBuilder(); + for (int i = 0; i < remainingSp.length; i++) { + sps.append(remainingSp[i]); + sps.append(","); + } + String sp = sps.toString(); + ps.setString(13, sp.substring(0, sp.length() - 1)); + ps.setInt(14, remainingAp); + } finally { + statWlock.unlock(); + effLock.unlock(); } - String sp = sps.toString(); - ps.setString(13, sp.substring(0, sp.length() - 1)); - ps.setInt(14, remainingAp); + ps.setInt(15, gmLevel); ps.setInt(16, skinColor.getId()); ps.setInt(17, gender); @@ -7748,12 +7796,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setChalkboard(String text) { this.chalktext = text; } - - public void setDex(int dex) { - this.dex = dex; - recalcLocalStats(); - } - + public void setDojoEnergy(int x) { this.dojoEnergy = Math.min(x, 10000); } @@ -7901,49 +7944,79 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setHiredMerchant(MapleHiredMerchant merchant) { this.hiredMerchant = merchant; } - - public void setHp(int newhp) { - setHp(newhp, false); - } - - public void setHp(int newhp, boolean silent) { - int oldHp = hp; - int thp = newhp; - if (thp < 0) { - thp = 0; - } - if (thp > localmaxhp) { - thp = localmaxhp; - } - this.hp = thp; - if (!silent) { - updatePartyMemberHP(); - } - if (oldHp > hp && !isAlive()) { - if(!isBuybackInvincible()) { - playerDead(); - } else { - this.hp = 1; + + private void hpChangeAction(int oldHp) { + boolean playerDied = false; + if (hp <= 0) { + if (oldHp > hp) { + if(!isBuybackInvincible()) { + playerDied = true; + } else { + hp = 1; + } } } - } - public void setHpMpApUsed(int mpApUsed) { - this.hpMpApUsed = mpApUsed; - } + updatePartyMemberHP(); - public void setHpMp(int x) { - setHp(x); - setMp(x); - updateSingleStat(MapleStat.HP, hp); - updateSingleStat(MapleStat.MP, mp); + if (playerDied) { + playerDead(); + } else { + checkBerserk(isHidden()); + } } - - public void setInt(int int_) { - this.int_ = int_; - recalcLocalStats(); + + private Pair calcHpRatioUpdate(int newHp, int oldHp) { + int delta = newHp - oldHp; + this.hp = calcHpMpRatioUpdate(hp, oldHp, delta); + + hpChangeAction(Short.MIN_VALUE); + return new Pair<>(MapleStat.HP, hp); } + + private Pair calcMpRatioUpdate(int newMp, int oldMp) { + int delta = newMp - oldMp; + this.mp = calcHpMpRatioUpdate(mp, oldMp, delta); + return new Pair<>(MapleStat.MP, mp); + } + + private static int calcHpMpRatioUpdate(int curpoint, int maxpoint, int diffpoint) { + int curMax = maxpoint; + int nextMax = Math.min(30000, maxpoint + diffpoint); + + float temp = curpoint * nextMax; + int ret = (int) Math.round(temp / curMax); + + //System.out.println("cur: " + curpoint + " next: " + ret + " max: " + curMax + " nextmax:" + nextMax + " diff: " + diffpoint); + return !(ret <= 0 && curpoint > 0) ? ret : 1; + } + + public boolean applyHpMpChange(int hpCon, int hpchange, int mpchange) { + boolean zombify = hasDisease(MapleDisease.ZOMBIFY); + + effLock.lock(); + statWlock.lock(); + try { + int nextHp = hp + hpchange, nextMp = mp + mpchange; + boolean cannotApplyHp = hpchange != 0 && nextHp <= 0 && (!zombify || hpCon > 0); + boolean cannotApplyMp = mpchange != 0 && nextMp < 0; + if (cannotApplyHp || cannotApplyMp) { + if (!isGM()) { + return false; + } + + if (cannotApplyHp) nextHp = 1; + } + + updateHpMp(nextHp, nextMp); + return true; + } finally { + statWlock.unlock(); + effLock.unlock(); + } + } + public void setInventory(MapleInventoryType type, MapleInventory inv) { inventory[type.ordinal()] = inv; } @@ -7967,12 +8040,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setLevel(int level) { this.level = level; } - - public void setLuk(int luk) { - this.luk = luk; - recalcLocalStats(); - } - + public void setMap(int PmapId) { this.mapid = PmapId; } @@ -7984,35 +8052,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setMarkedMonster(int markedMonster) { this.markedMonster = markedMonster; } - - public void setMaxHp(int hp) { - this.maxhp = hp; - recalcLocalStats(); - } - - public void setMaxHp(int hp, boolean ap) { - hp = Math.min(30000, hp); - if (ap) { - setHpMpApUsed(getHpMpApUsed() + 1); - } - this.maxhp = hp; - recalcLocalStats(); - } - - public void setMaxMp(int mp) { - this.maxmp = mp; - recalcLocalStats(); - } - - public void setMaxMp(int mp, boolean ap) { - mp = Math.min(30000, mp); - if (ap) { - setHpMpApUsed(getHpMpApUsed() + 1); - } - this.maxmp = mp; - recalcLocalStats(); - } - + public void setMessenger(MapleMessenger messenger) { this.messenger = messenger; } @@ -8055,17 +8095,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { this.bookCover = bookCover; } - public void setMp(int newmp) { - int tmp = newmp; - if (tmp < 0) { - tmp = 0; - } - if (tmp > localmaxmp) { - tmp = localmaxmp; - } - this.mp = tmp; - } - public void setName(String name) { this.name = name; } @@ -8120,19 +8149,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setPlayerShop(MaplePlayerShop playerShop) { this.playerShop = playerShop; } - - public void setRemainingAp(int remainingAp) { - this.remainingAp = remainingAp; - } - - public void setRemainingSp(int remainingSp) { - this.remainingSp[GameConstants.getSkillBook(job.getId())] = remainingSp; //default - } - - public void setRemainingSp(int remainingSp, int skillbook) { - this.remainingSp[skillbook] = remainingSp; - } - + public void setSearch(String find) { search = find; } @@ -8232,12 +8249,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setSlot(int slotid) { slots = slotid; } - - public void setStr(int str) { - this.str = str; - recalcLocalStats(); - } - + public void setTrade(MapleTrade trade) { this.trade = trade; } @@ -8268,7 +8280,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } private long getDojoTimeLeft() { - return client.getChannelServer().getDojoFinishTime(map.getId()) - System.currentTimeMillis(); + return client.getChannelServer().getDojoFinishTime(map.getId()) - Server.getInstance().getCurrentTime(); } public void showDojoClock() { @@ -8286,7 +8298,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void showUnderleveledInfo(MapleMonster mob) { chrLock.lock(); try { - long curTime = System.currentTimeMillis(); + long curTime = Server.getInstance().getCurrentTime(); if(nextUnderlevelTime < curTime) { nextUnderlevelTime = curTime + (60 * 1000); // show underlevel info again after 1 minute @@ -8324,11 +8336,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - private void silentEnforceMaxHpMp() { - setMp(getMp()); - setHp(getHp(), true); - } - public void silentGiveBuffs(List> buffs) { for (Pair mbsv : buffs) { PlayerBuffValueHolder mbsvh = mbsv.getRight(); @@ -8347,7 +8354,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void silentPartyUpdateInternal() { if (party != null) { - Server.getInstance().getWorld(world).updateParty(party.getId(), PartyOperation.SILENT_UPDATE, getMPC()); + getWorldServer().updateParty(party.getId(), PartyOperation.SILENT_UPDATE, getMPC()); } } @@ -8479,17 +8486,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void updatePartyMemberHPInternal() { if (party != null) { - int channel = client.getChannel(); - int mapId = getMapId(); - - int curmaxhp = getMaxHpEquipped(); - for (MaplePartyCharacter partychar : party.getMembers()) { - if (partychar.getMapId() == mapId && partychar.getChannel() == channel) { - MapleCharacter other = Server.getInstance().getWorld(world).getChannel(channel).getPlayerStorage().getCharacterByName(partychar.getName()); - if (other != null) { - other.client.announce(MaplePacketCreator.updatePartyMemberHP(getId(), this.hp, curmaxhp)); - } - } + int curmaxhp = getCurrentMaxHp(); + int curhp = getHp(); + for (MapleCharacter partychar : this.getPartyMembersOnSameMap()) { + partychar.announce(MaplePacketCreator.updatePartyMemberHP(getId(), curhp, curmaxhp)); } } } @@ -9018,16 +9018,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public AutobanManager getAutobanManager() { return autoban; } - - public void resetEquippedHpMp() { - eqphp = 0; - eqpmp = 0; - } public void equippedItem(Equip equip) { int itemid = equip.getItemId(); - eqphp += equip.getHp(); - eqpmp += equip.getMp(); if (itemid == 1122017) { this.equipPendantOfSpirit(); @@ -9042,8 +9035,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void unequippedItem(Equip equip) { int itemid = equip.getItemId(); - eqphp -= equip.getHp(); - eqpmp -= equip.getMp(); if (itemid == 1122017) { this.unequipPendantOfSpirit(); @@ -9101,10 +9092,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (itemName == null) { continue; } - - if ((nEquip.getItemLevel() < ServerConstants.USE_EQUIPMNT_LVLUP) || (nEquip.getItemLevel() < ii.getEquipLevel(nEquip.getItemId(), true))) { - nEquip.gainItemExp(client, expGain); - } + + nEquip.gainItemExp(client, expGain); } } @@ -9214,11 +9203,12 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { party = null; family = null; - Server.getInstance().getWorld(world).registerTimedMapObject(new Runnable() { + getWorldServer().registerTimedMapObject(new Runnable() { @Override public void run() { client = null; // clients still triggers handlers a few times after disconnecting map = null; + setListener(null); } }, 5 * 60 * 1000); } @@ -9284,16 +9274,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setDragon(MapleDragon dragon) { this.dragon = dragon; } - - public int getRemainingSpSize() { - int sp = 0; - for (int i = 0; i < remainingSp.length; i++) { - if (remainingSp[i] > 0) { - sp++; - } - } - return sp; - } public long getJailExpirationTimeLeft() { return jailExpiration - System.currentTimeMillis(); diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index 7e762135d9..451e9a3414 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -886,7 +886,7 @@ public class MapleClient { final MapleGuild guild = player.getGuild(); player.cancelMagicDoor(); - + final World wserv = getWorldServer(); // obviously wserv is NOT null if this player was online on it try { removePlayer(wserv); @@ -1028,7 +1028,7 @@ public class MapleClient { } public void pongReceived() { - lastPong = System.currentTimeMillis(); + lastPong = Server.getInstance().getCurrentTime(); } public void testPing(long timeThen) { @@ -1381,12 +1381,7 @@ public class MapleClient { player.cancelQuestExpirationTask(); //Cancelling magicdoor? Nope //Cancelling mounts? Noty - if (player.getBuffedValue(MapleBuffStat.PUPPET) != null) { - player.cancelEffectFromBuffStat(MapleBuffStat.PUPPET); - } - if (player.getBuffedValue(MapleBuffStat.COMBO) != null) { - player.cancelEffectFromBuffStat(MapleBuffStat.COMBO); - } + player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test player.getMap().removePlayer(player); player.clearBanishPlayerData(); diff --git a/src/client/autoban/AutobanManager.java b/src/client/autoban/AutobanManager.java index 83990b106f..83fc5dbd8e 100644 --- a/src/client/autoban/AutobanManager.java +++ b/src/client/autoban/AutobanManager.java @@ -91,7 +91,6 @@ public class AutobanManager { * Timestamp checker * * type:
- * 0: HealOverTime
* 1: Pet Food
* 2: InventoryMerge
* 3: InventorySort
@@ -99,6 +98,8 @@ public class AutobanManager { * 5: UseCatchItem
* 6: Item Drop
* 7: Chat
+ * 8: HealOverTimeHP
+ * 9: HealOverTimeMP
* * @param type type * @return Timestamp checker @@ -108,7 +109,7 @@ public class AutobanManager { this.timestampcounter[type]++; if (this.timestampcounter[type] >= times) { chr.getClient().disconnect(false, false); - //System.out.println("Same timestamp for type: " + type + "; Character: " + chr); + FilePrinter.print(FilePrinter.EXPLOITS, "Player " + chr + " was caught spamming TYPE " + type + " and has been disconnected."); } return; } diff --git a/src/client/command/CommandsExecutor.java b/src/client/command/CommandsExecutor.java index 3db0b3c38c..a40e14d7e1 100644 --- a/src/client/command/CommandsExecutor.java +++ b/src/client/command/CommandsExecutor.java @@ -23,14 +23,16 @@ */ package client.command; +import client.command.commands.gm0.*; +import client.command.commands.gm1.*; +import client.command.commands.gm2.*; +import client.command.commands.gm3.*; +import client.command.commands.gm4.*; +import client.command.commands.gm5.*; +import client.command.commands.gm6.*; + import client.MapleClient; -import client.command.commands.v0.*; -import client.command.commands.v1.*; -import client.command.commands.v2.*; -import client.command.commands.v3.*; -import client.command.commands.v4.*; -import client.command.commands.v5.*; -import client.command.commands.v6.*; + import tools.FilePrinter; import tools.Pair; diff --git a/src/client/command/commands/v0/BuyBackCommand.java b/src/client/command/commands/gm0/BuyBackCommand.java similarity index 97% rename from src/client/command/commands/v0/BuyBackCommand.java rename to src/client/command/commands/gm0/BuyBackCommand.java index d895a763d6..85ec0e9e04 100644 --- a/src/client/command/commands/v0/BuyBackCommand.java +++ b/src/client/command/commands/gm0/BuyBackCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleClient; import client.command.Command; diff --git a/src/client/command/commands/v0/DisposeCommand.java b/src/client/command/commands/gm0/DisposeCommand.java similarity index 97% rename from src/client/command/commands/v0/DisposeCommand.java rename to src/client/command/commands/gm0/DisposeCommand.java index 1500a39cb4..a11d97d87f 100644 --- a/src/client/command/commands/v0/DisposeCommand.java +++ b/src/client/command/commands/gm0/DisposeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v0/DropLimitCommand.java b/src/client/command/commands/gm0/DropLimitCommand.java similarity index 97% rename from src/client/command/commands/v0/DropLimitCommand.java rename to src/client/command/commands/gm0/DropLimitCommand.java index 17017a1c99..7f10a7dd2c 100644 --- a/src/client/command/commands/v0/DropLimitCommand.java +++ b/src/client/command/commands/gm0/DropLimitCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleClient; import client.command.Command; diff --git a/src/client/command/commands/v0/EquipLvCommand.java b/src/client/command/commands/gm0/EquipLvCommand.java similarity index 97% rename from src/client/command/commands/v0/EquipLvCommand.java rename to src/client/command/commands/gm0/EquipLvCommand.java index 8c87869b4b..38d230ad49 100644 --- a/src/client/command/commands/v0/EquipLvCommand.java +++ b/src/client/command/commands/gm0/EquipLvCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v0/GachaCommand.java b/src/client/command/commands/gm0/GachaCommand.java similarity index 98% rename from src/client/command/commands/v0/GachaCommand.java rename to src/client/command/commands/gm0/GachaCommand.java index bd24795dfa..5c4ecd46af 100644 --- a/src/client/command/commands/v0/GachaCommand.java +++ b/src/client/command/commands/gm0/GachaCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v0/GmCommand.java b/src/client/command/commands/gm0/GmCommand.java similarity index 98% rename from src/client/command/commands/v0/GmCommand.java rename to src/client/command/commands/gm0/GmCommand.java index 4d451cc639..893b98fa15 100644 --- a/src/client/command/commands/v0/GmCommand.java +++ b/src/client/command/commands/gm0/GmCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/HelpCommand.java b/src/client/command/commands/gm0/HelpCommand.java similarity index 97% rename from src/client/command/commands/v0/HelpCommand.java rename to src/client/command/commands/gm0/HelpCommand.java index ac409b400e..42c195e95c 100644 --- a/src/client/command/commands/v0/HelpCommand.java +++ b/src/client/command/commands/gm0/HelpCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleClient; import client.command.Command; diff --git a/src/client/command/commands/v0/JoinEventCommand.java b/src/client/command/commands/gm0/JoinEventCommand.java similarity index 98% rename from src/client/command/commands/v0/JoinEventCommand.java rename to src/client/command/commands/gm0/JoinEventCommand.java index a652918082..60ea01e506 100644 --- a/src/client/command/commands/v0/JoinEventCommand.java +++ b/src/client/command/commands/gm0/JoinEventCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/LeaveEventCommand.java b/src/client/command/commands/gm0/LeaveEventCommand.java similarity index 98% rename from src/client/command/commands/v0/LeaveEventCommand.java rename to src/client/command/commands/gm0/LeaveEventCommand.java index b588bc692c..41dfc9db44 100644 --- a/src/client/command/commands/v0/LeaveEventCommand.java +++ b/src/client/command/commands/gm0/LeaveEventCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/OnlineCommand.java b/src/client/command/commands/gm0/OnlineCommand.java similarity index 97% rename from src/client/command/commands/v0/OnlineCommand.java rename to src/client/command/commands/gm0/OnlineCommand.java index 847d10ba11..4944b085a8 100644 --- a/src/client/command/commands/v0/OnlineCommand.java +++ b/src/client/command/commands/gm0/OnlineCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/RanksCommand.java b/src/client/command/commands/gm0/RanksCommand.java similarity index 97% rename from src/client/command/commands/v0/RanksCommand.java rename to src/client/command/commands/gm0/RanksCommand.java index b2445731af..fbe368f44d 100644 --- a/src/client/command/commands/v0/RanksCommand.java +++ b/src/client/command/commands/gm0/RanksCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/RatesCommand.java b/src/client/command/commands/gm0/RatesCommand.java similarity index 98% rename from src/client/command/commands/v0/RatesCommand.java rename to src/client/command/commands/gm0/RatesCommand.java index 4840c3d15c..1ffdfcafbb 100644 --- a/src/client/command/commands/v0/RatesCommand.java +++ b/src/client/command/commands/gm0/RatesCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/ReportBugCommand.java b/src/client/command/commands/gm0/ReportBugCommand.java similarity index 98% rename from src/client/command/commands/v0/ReportBugCommand.java rename to src/client/command/commands/gm0/ReportBugCommand.java index 1ab77f8653..0654da4f0f 100644 --- a/src/client/command/commands/v0/ReportBugCommand.java +++ b/src/client/command/commands/gm0/ReportBugCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/ShowRatesCommand.java b/src/client/command/commands/gm0/ShowRatesCommand.java similarity index 98% rename from src/client/command/commands/v0/ShowRatesCommand.java rename to src/client/command/commands/gm0/ShowRatesCommand.java index 7bddad2b14..99117ef866 100644 --- a/src/client/command/commands/v0/ShowRatesCommand.java +++ b/src/client/command/commands/gm0/ShowRatesCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v0/StaffCommand.java b/src/client/command/commands/gm0/StaffCommand.java similarity index 97% rename from src/client/command/commands/v0/StaffCommand.java rename to src/client/command/commands/gm0/StaffCommand.java index 1db3a7acf8..525bbac64b 100644 --- a/src/client/command/commands/v0/StaffCommand.java +++ b/src/client/command/commands/gm0/StaffCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleClient; import client.command.Command; diff --git a/src/client/command/commands/v0/StatDexCommand.java b/src/client/command/commands/gm0/StatDexCommand.java similarity index 65% rename from src/client/command/commands/v0/StatDexCommand.java rename to src/client/command/commands/gm0/StatDexCommand.java index 3154f80296..3b14dc0b33 100644 --- a/src/client/command/commands/v0/StatDexCommand.java +++ b/src/client/command/commands/gm0/StatDexCommand.java @@ -21,12 +21,12 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.MapleClient; -import client.MapleStat; import client.command.Command; +import constants.ServerConstants; public class StatDexCommand extends Command { { @@ -38,20 +38,9 @@ public class StatDexCommand extends Command { MapleCharacter player = c.getPlayer(); int remainingAp = player.getRemainingAp(); - int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp; - if (amount > 0 && amount <= remainingAp && amount <= 32763) { - int playerStat = player.getDex(); - - if (amount + playerStat <= 32767 && amount + playerStat >= 4) { - player.setDex(playerStat + amount); - player.updateSingleStat(MapleStat.DEX, playerStat); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else { - player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4."); - } - } else { - player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute."); + int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getDex()); + if (!player.assignDex(amount)) { + player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/v0/StatIntCommand.java b/src/client/command/commands/gm0/StatIntCommand.java similarity index 65% rename from src/client/command/commands/v0/StatIntCommand.java rename to src/client/command/commands/gm0/StatIntCommand.java index be1d310d70..21a347d8f2 100644 --- a/src/client/command/commands/v0/StatIntCommand.java +++ b/src/client/command/commands/gm0/StatIntCommand.java @@ -21,12 +21,12 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import constants.ServerConstants; public class StatIntCommand extends Command { { @@ -38,20 +38,9 @@ public class StatIntCommand extends Command { MapleCharacter player = c.getPlayer(); int remainingAp = player.getRemainingAp(); - int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp; - if (amount > 0 && amount <= remainingAp && amount <= 32763) { - int playerStat = player.getInt(); - - if (amount + playerStat <= 32767 && amount + playerStat >= 4) { - player.setInt(playerStat + amount); - player.updateSingleStat(MapleStat.INT, playerStat); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else { - player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4."); - } - } else { - player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute."); + int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getInt()); + if (!player.assignInt(amount)) { + player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/v0/StatLukCommand.java b/src/client/command/commands/gm0/StatLukCommand.java similarity index 65% rename from src/client/command/commands/v0/StatLukCommand.java rename to src/client/command/commands/gm0/StatLukCommand.java index 5754fbd78f..03a41e0341 100644 --- a/src/client/command/commands/v0/StatLukCommand.java +++ b/src/client/command/commands/gm0/StatLukCommand.java @@ -21,12 +21,12 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleCharacter; import client.MapleClient; -import client.MapleStat; import client.command.Command; +import constants.ServerConstants; public class StatLukCommand extends Command { { @@ -38,20 +38,9 @@ public class StatLukCommand extends Command { MapleCharacter player = c.getPlayer(); int remainingAp = player.getRemainingAp(); - int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp; - if (amount > 0 && amount <= remainingAp && amount <= 32763) { - int playerStat = player.getLuk(); - - if (amount + playerStat <= 32767 && amount + playerStat >= 4) { - player.setLuk(playerStat + amount); - player.updateSingleStat(MapleStat.LUK, playerStat); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else { - player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4."); - } - } else { - player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute."); + int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getLuk()); + if (!player.assignLuk(amount)) { + player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/v0/StatStrCommand.java b/src/client/command/commands/gm0/StatStrCommand.java similarity index 64% rename from src/client/command/commands/v0/StatStrCommand.java rename to src/client/command/commands/gm0/StatStrCommand.java index da81e7e7b6..ce288f27f3 100644 --- a/src/client/command/commands/v0/StatStrCommand.java +++ b/src/client/command/commands/gm0/StatStrCommand.java @@ -21,12 +21,12 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import constants.ServerConstants; public class StatStrCommand extends Command { { @@ -37,21 +37,10 @@ public class StatStrCommand extends Command { public void execute(MapleClient c, String[] params) { MapleCharacter player = c.getPlayer(); int remainingAp = player.getRemainingAp(); - - int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp; - if (amount > 0 && amount <= remainingAp && amount <= 32763) { - int playerStat = player.getStr(); - - if (amount + playerStat <= 32767 && amount + playerStat >= 4) { - player.setStr(playerStat + amount); - player.updateSingleStat(MapleStat.STR, playerStat); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else { - player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4."); - } - } else { - player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute."); + int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getStr()); + + if (!player.assignStr(amount)) { + player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/v0/TimeCommand.java b/src/client/command/commands/gm0/TimeCommand.java similarity index 97% rename from src/client/command/commands/v0/TimeCommand.java rename to src/client/command/commands/gm0/TimeCommand.java index a7e2fd87cb..08f862b90c 100644 --- a/src/client/command/commands/v0/TimeCommand.java +++ b/src/client/command/commands/gm0/TimeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.MapleClient; import client.command.Command; diff --git a/src/client/command/commands/v0/UptimeCommand.java b/src/client/command/commands/gm0/UptimeCommand.java similarity index 97% rename from src/client/command/commands/v0/UptimeCommand.java rename to src/client/command/commands/gm0/UptimeCommand.java index 966135b0bf..6329cae360 100644 --- a/src/client/command/commands/v0/UptimeCommand.java +++ b/src/client/command/commands/gm0/UptimeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v0; +package client.command.commands.gm0; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v1/BossHpCommand.java b/src/client/command/commands/gm1/BossHpCommand.java similarity index 98% rename from src/client/command/commands/v1/BossHpCommand.java rename to src/client/command/commands/gm1/BossHpCommand.java index 5bd3ff083b..6040abd57e 100644 --- a/src/client/command/commands/v1/BossHpCommand.java +++ b/src/client/command/commands/gm1/BossHpCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v1/BuffMeCommand.java b/src/client/command/commands/gm1/BuffMeCommand.java similarity index 87% rename from src/client/command/commands/v1/BuffMeCommand.java rename to src/client/command/commands/gm1/BuffMeCommand.java index a1760124b1..9103972c0d 100644 --- a/src/client/command/commands/v1/BuffMeCommand.java +++ b/src/client/command/commands/gm1/BuffMeCommand.java @@ -21,10 +21,9 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; -import client.MapleStat; import client.SkillFactory; import client.command.Command; import client.MapleClient; @@ -42,9 +41,6 @@ public class BuffMeCommand extends Command { SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(player); SkillFactory.getSkill(2301004).getEffect(SkillFactory.getSkill(2301004).getMaxLevel()).applyTo(player); SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(player); - player.setHp(player.getMaxHp()); - player.updateSingleStat(MapleStat.HP, player.getMaxHp()); - player.setMp(player.getMaxMp()); - player.updateSingleStat(MapleStat.MP, player.getMaxMp()); + player.healHpMp(); } } diff --git a/src/client/command/commands/v1/GotoCommand.java b/src/client/command/commands/gm1/GotoCommand.java similarity index 98% rename from src/client/command/commands/v1/GotoCommand.java rename to src/client/command/commands/gm1/GotoCommand.java index 8deb4c3ba8..1c93a3207d 100644 --- a/src/client/command/commands/v1/GotoCommand.java +++ b/src/client/command/commands/gm1/GotoCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v1/MobHpCommand.java b/src/client/command/commands/gm1/MobHpCommand.java similarity index 97% rename from src/client/command/commands/v1/MobHpCommand.java rename to src/client/command/commands/gm1/MobHpCommand.java index 64d0a9d29c..b8c9dcaef1 100644 --- a/src/client/command/commands/v1/MobHpCommand.java +++ b/src/client/command/commands/gm1/MobHpCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v1/WhatDropsFromCommand.java b/src/client/command/commands/gm1/WhatDropsFromCommand.java similarity index 98% rename from src/client/command/commands/v1/WhatDropsFromCommand.java rename to src/client/command/commands/gm1/WhatDropsFromCommand.java index 662c67ef46..91ab0cb262 100644 --- a/src/client/command/commands/v1/WhatDropsFromCommand.java +++ b/src/client/command/commands/gm1/WhatDropsFromCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v1/WhoDropsCommand.java b/src/client/command/commands/gm1/WhoDropsCommand.java similarity index 98% rename from src/client/command/commands/v1/WhoDropsCommand.java rename to src/client/command/commands/gm1/WhoDropsCommand.java index 4022ef98a9..ff130495dc 100644 --- a/src/client/command/commands/v1/WhoDropsCommand.java +++ b/src/client/command/commands/gm1/WhoDropsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v1; +package client.command.commands.gm1; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v2/ApCommand.java b/src/client/command/commands/gm2/ApCommand.java similarity index 86% rename from src/client/command/commands/v2/ApCommand.java rename to src/client/command/commands/gm2/ApCommand.java index d305c0dc5a..b6163e3a29 100644 --- a/src/client/command/commands/v2/ApCommand.java +++ b/src/client/command/commands/gm2/ApCommand.java @@ -21,9 +21,8 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; @@ -47,8 +46,7 @@ public class ApCommand extends Command { if (newAp < 0) newAp = 0; else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; - player.setRemainingAp(newAp); - player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); + player.changeRemainingAp(newAp, false); } else { MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { @@ -56,8 +54,7 @@ public class ApCommand extends Command { if (newAp < 0) newAp = 0; else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; - victim.setRemainingAp(newAp); - victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp()); + victim.changeRemainingAp(newAp, false); } else { player.message("Player '" + params[0] + "' could not be found on this channel."); } diff --git a/src/client/command/commands/v2/BombCommand.java b/src/client/command/commands/gm2/BombCommand.java similarity index 98% rename from src/client/command/commands/v2/BombCommand.java rename to src/client/command/commands/gm2/BombCommand.java index d1b1b39ea5..18795b6767 100644 --- a/src/client/command/commands/v2/BombCommand.java +++ b/src/client/command/commands/gm2/BombCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/BuffCommand.java b/src/client/command/commands/gm2/BuffCommand.java similarity index 97% rename from src/client/command/commands/v2/BuffCommand.java rename to src/client/command/commands/gm2/BuffCommand.java index 0c7278aa99..2e2210ce19 100644 --- a/src/client/command/commands/v2/BuffCommand.java +++ b/src/client/command/commands/gm2/BuffCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.Skill; import client.SkillFactory; diff --git a/src/client/command/commands/v2/BuffMapCommand.java b/src/client/command/commands/gm2/BuffMapCommand.java similarity index 98% rename from src/client/command/commands/v2/BuffMapCommand.java rename to src/client/command/commands/gm2/BuffMapCommand.java index c850ca6207..c9f35f3fb8 100644 --- a/src/client/command/commands/v2/BuffMapCommand.java +++ b/src/client/command/commands/gm2/BuffMapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.SkillFactory; import client.command.Command; diff --git a/src/client/command/commands/v2/ClearDropsCommand.java b/src/client/command/commands/gm2/ClearDropsCommand.java similarity index 97% rename from src/client/command/commands/v2/ClearDropsCommand.java rename to src/client/command/commands/gm2/ClearDropsCommand.java index 20111d1173..27cdfc0e60 100644 --- a/src/client/command/commands/v2/ClearDropsCommand.java +++ b/src/client/command/commands/gm2/ClearDropsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/ClearSlotCommand.java b/src/client/command/commands/gm2/ClearSlotCommand.java similarity index 99% rename from src/client/command/commands/v2/ClearSlotCommand.java rename to src/client/command/commands/gm2/ClearSlotCommand.java index 0a35d0aa71..df84a9678a 100644 --- a/src/client/command/commands/v2/ClearSlotCommand.java +++ b/src/client/command/commands/gm2/ClearSlotCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/DcCommand.java b/src/client/command/commands/gm2/DcCommand.java similarity index 98% rename from src/client/command/commands/v2/DcCommand.java rename to src/client/command/commands/gm2/DcCommand.java index 589faa0c3a..48c41a3ce2 100644 --- a/src/client/command/commands/v2/DcCommand.java +++ b/src/client/command/commands/gm2/DcCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/EmpowerMeCommand.java b/src/client/command/commands/gm2/EmpowerMeCommand.java similarity index 97% rename from src/client/command/commands/v2/EmpowerMeCommand.java rename to src/client/command/commands/gm2/EmpowerMeCommand.java index c4fce8bdc1..a901ad1b19 100644 --- a/src/client/command/commands/v2/EmpowerMeCommand.java +++ b/src/client/command/commands/gm2/EmpowerMeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.SkillFactory; import client.command.Command; diff --git a/src/client/command/commands/v2/GmShopCommand.java b/src/client/command/commands/gm2/GmShopCommand.java similarity index 97% rename from src/client/command/commands/v2/GmShopCommand.java rename to src/client/command/commands/gm2/GmShopCommand.java index c77454061e..4eb870054c 100644 --- a/src/client/command/commands/v2/GmShopCommand.java +++ b/src/client/command/commands/gm2/GmShopCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/HealCommand.java b/src/client/command/commands/gm2/HealCommand.java similarity index 95% rename from src/client/command/commands/v2/HealCommand.java rename to src/client/command/commands/gm2/HealCommand.java index a1eeba29e6..1c9884a3e5 100644 --- a/src/client/command/commands/v2/HealCommand.java +++ b/src/client/command/commands/gm2/HealCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; @@ -35,7 +35,7 @@ public class HealCommand extends Command { @Override public void execute(MapleClient c, String[] params) { MapleCharacter player = c.getPlayer(); - player.setHpMp(30000); + player.healHpMp(); } } diff --git a/src/client/command/commands/v2/HideCommand.java b/src/client/command/commands/gm2/HideCommand.java similarity index 97% rename from src/client/command/commands/v2/HideCommand.java rename to src/client/command/commands/gm2/HideCommand.java index 38b7c09118..654136c9b6 100644 --- a/src/client/command/commands/v2/HideCommand.java +++ b/src/client/command/commands/gm2/HideCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.SkillFactory; import client.command.Command; diff --git a/src/client/command/commands/v2/ItemCommand.java b/src/client/command/commands/gm2/ItemCommand.java similarity index 98% rename from src/client/command/commands/v2/ItemCommand.java rename to src/client/command/commands/gm2/ItemCommand.java index 677748974f..3d05313ec2 100644 --- a/src/client/command/commands/v2/ItemCommand.java +++ b/src/client/command/commands/gm2/ItemCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/ItemDropCommand.java b/src/client/command/commands/gm2/ItemDropCommand.java similarity index 99% rename from src/client/command/commands/v2/ItemDropCommand.java rename to src/client/command/commands/gm2/ItemDropCommand.java index 7edbe3900e..ac75522174 100644 --- a/src/client/command/commands/v2/ItemDropCommand.java +++ b/src/client/command/commands/gm2/ItemDropCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/JailCommand.java b/src/client/command/commands/gm2/JailCommand.java similarity index 98% rename from src/client/command/commands/v2/JailCommand.java rename to src/client/command/commands/gm2/JailCommand.java index 97d6ec3944..78720b2314 100644 --- a/src/client/command/commands/v2/JailCommand.java +++ b/src/client/command/commands/gm2/JailCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/JobCommand.java b/src/client/command/commands/gm2/JobCommand.java similarity index 98% rename from src/client/command/commands/v2/JobCommand.java rename to src/client/command/commands/gm2/JobCommand.java index a40ce8f06d..cf679b2c2e 100644 --- a/src/client/command/commands/v2/JobCommand.java +++ b/src/client/command/commands/gm2/JobCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.MapleJob; import client.command.Command; diff --git a/src/client/command/commands/v2/LevelCommand.java b/src/client/command/commands/gm2/LevelCommand.java similarity index 97% rename from src/client/command/commands/v2/LevelCommand.java rename to src/client/command/commands/gm2/LevelCommand.java index cc03a5b0db..e0b0b7392e 100644 --- a/src/client/command/commands/v2/LevelCommand.java +++ b/src/client/command/commands/gm2/LevelCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/LevelProCommand.java b/src/client/command/commands/gm2/LevelProCommand.java similarity index 97% rename from src/client/command/commands/v2/LevelProCommand.java rename to src/client/command/commands/gm2/LevelProCommand.java index 4ce2ebf9ca..bb6e674009 100644 --- a/src/client/command/commands/v2/LevelProCommand.java +++ b/src/client/command/commands/gm2/LevelProCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/MaxSkillCommand.java b/src/client/command/commands/gm2/MaxSkillCommand.java similarity index 98% rename from src/client/command/commands/v2/MaxSkillCommand.java rename to src/client/command/commands/gm2/MaxSkillCommand.java index 4fdde06ed8..a534718dc2 100644 --- a/src/client/command/commands/v2/MaxSkillCommand.java +++ b/src/client/command/commands/gm2/MaxSkillCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.*; import client.command.Command; diff --git a/src/client/command/commands/v2/MaxStatCommand.java b/src/client/command/commands/gm2/MaxStatCommand.java similarity index 72% rename from src/client/command/commands/v2/MaxStatCommand.java rename to src/client/command/commands/gm2/MaxStatCommand.java index 995764ea25..af770b4fe2 100644 --- a/src/client/command/commands/v2/MaxStatCommand.java +++ b/src/client/command/commands/gm2/MaxStatCommand.java @@ -21,13 +21,12 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; -import client.command.CommandsExecutor; import constants.ServerConstants; public class MaxStatCommand extends Command { @@ -43,21 +42,11 @@ public class MaxStatCommand extends Command { player.resetPlayerRates(); if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); player.setWorldRates(); - player.setStr(Short.MAX_VALUE); - player.setDex(Short.MAX_VALUE); - player.setInt(Short.MAX_VALUE); - player.setLuk(Short.MAX_VALUE); - player.updateSingleStat(MapleStat.STR, Short.MAX_VALUE); - player.updateSingleStat(MapleStat.DEX, Short.MAX_VALUE); - player.updateSingleStat(MapleStat.INT, Short.MAX_VALUE); - player.updateSingleStat(MapleStat.LUK, Short.MAX_VALUE); + player.updateStrDexIntLuk(Short.MAX_VALUE); player.setFame(13337); - player.setMaxHp(30000); - player.setMaxMp(30000); + player.updateMaxHpMaxMp(30000, 30000); player.updateSingleStat(MapleStat.LEVEL, 255); player.updateSingleStat(MapleStat.FAME, 13337); - player.updateSingleStat(MapleStat.MAXHP, 30000); - player.updateSingleStat(MapleStat.MAXMP, 30000); player.yellowMessage("Stats maxed out."); } } diff --git a/src/client/command/commands/v2/MesosCommand.java b/src/client/command/commands/gm2/MesosCommand.java similarity index 97% rename from src/client/command/commands/v2/MesosCommand.java rename to src/client/command/commands/gm2/MesosCommand.java index 5d1c6de96b..65c2e87ba9 100644 --- a/src/client/command/commands/v2/MesosCommand.java +++ b/src/client/command/commands/gm2/MesosCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/ReachCommand.java b/src/client/command/commands/gm2/ReachCommand.java similarity index 98% rename from src/client/command/commands/v2/ReachCommand.java rename to src/client/command/commands/gm2/ReachCommand.java index e4e2fa46a6..6f4702b995 100644 --- a/src/client/command/commands/v2/ReachCommand.java +++ b/src/client/command/commands/gm2/ReachCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/RechargeCommand.java b/src/client/command/commands/gm2/RechargeCommand.java similarity index 98% rename from src/client/command/commands/v2/RechargeCommand.java rename to src/client/command/commands/gm2/RechargeCommand.java index 631fcae7af..17e2245a94 100644 --- a/src/client/command/commands/v2/RechargeCommand.java +++ b/src/client/command/commands/gm2/RechargeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v2/ResetSkillCommand.java b/src/client/command/commands/gm2/ResetSkillCommand.java similarity index 98% rename from src/client/command/commands/v2/ResetSkillCommand.java rename to src/client/command/commands/gm2/ResetSkillCommand.java index 93287e2882..8a429e4260 100644 --- a/src/client/command/commands/v2/ResetSkillCommand.java +++ b/src/client/command/commands/gm2/ResetSkillCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.*; import client.command.Command; diff --git a/src/client/command/commands/v2/SearchCommand.java b/src/client/command/commands/gm2/SearchCommand.java similarity index 99% rename from src/client/command/commands/v2/SearchCommand.java rename to src/client/command/commands/gm2/SearchCommand.java index 2306f23649..4fa3d31e35 100644 --- a/src/client/command/commands/v2/SearchCommand.java +++ b/src/client/command/commands/gm2/SearchCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/SetStatCommand.java b/src/client/command/commands/gm2/SetStatCommand.java similarity index 75% rename from src/client/command/commands/v2/SetStatCommand.java rename to src/client/command/commands/gm2/SetStatCommand.java index b1fabca6b7..42234661f3 100644 --- a/src/client/command/commands/v2/SetStatCommand.java +++ b/src/client/command/commands/gm2/SetStatCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.MapleStat; import client.command.Command; @@ -41,23 +41,13 @@ public class SetStatCommand extends Command { return; } - int x; try { - x = Integer.parseInt(params[0]); + int x = Integer.parseInt(params[0]); if (x > Short.MAX_VALUE) x = Short.MAX_VALUE; else if (x < 0) x = 0; - player.setStr(x); - player.setDex(x); - player.setInt(x); - player.setLuk(x); - player.updateSingleStat(MapleStat.STR, x); - player.updateSingleStat(MapleStat.DEX, x); - player.updateSingleStat(MapleStat.INT, x); - player.updateSingleStat(MapleStat.LUK, x); - - } catch (NumberFormatException nfe) { - } + player.updateStrDexIntLuk(x); + } catch (NumberFormatException nfe) {} } } diff --git a/src/client/command/commands/v2/SpCommand.java b/src/client/command/commands/gm2/SpCommand.java similarity index 87% rename from src/client/command/commands/v2/SpCommand.java rename to src/client/command/commands/gm2/SpCommand.java index 5a610a4d14..3804f636b9 100644 --- a/src/client/command/commands/v2/SpCommand.java +++ b/src/client/command/commands/gm2/SpCommand.java @@ -21,9 +21,8 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; @@ -47,8 +46,7 @@ public class SpCommand extends Command { if (newSp < 0) newSp = 0; else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; - player.setRemainingSp(newSp); - player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + player.updateRemainingSp(newSp); } else { MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { @@ -56,8 +54,7 @@ public class SpCommand extends Command { if (newSp < 0) newSp = 0; else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; - victim.setRemainingSp(newSp); - victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + victim.updateRemainingSp(newSp); player.dropMessage(5, "SP given."); } else { diff --git a/src/client/command/commands/v2/SummonCommand.java b/src/client/command/commands/gm2/SummonCommand.java similarity index 99% rename from src/client/command/commands/v2/SummonCommand.java rename to src/client/command/commands/gm2/SummonCommand.java index 785d5dfa14..c3bd50dec4 100644 --- a/src/client/command/commands/v2/SummonCommand.java +++ b/src/client/command/commands/gm2/SummonCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/UnBugCommand.java b/src/client/command/commands/gm2/UnBugCommand.java similarity index 97% rename from src/client/command/commands/v2/UnBugCommand.java rename to src/client/command/commands/gm2/UnBugCommand.java index de7fefd97e..06bd0cdf5f 100644 --- a/src/client/command/commands/v2/UnBugCommand.java +++ b/src/client/command/commands/gm2/UnBugCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/UnHideCommand.java b/src/client/command/commands/gm2/UnHideCommand.java similarity index 97% rename from src/client/command/commands/v2/UnHideCommand.java rename to src/client/command/commands/gm2/UnHideCommand.java index 37a8de8539..9826d8b887 100644 --- a/src/client/command/commands/v2/UnHideCommand.java +++ b/src/client/command/commands/gm2/UnHideCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.SkillFactory; import client.command.Command; diff --git a/src/client/command/commands/v2/UnJailCommand.java b/src/client/command/commands/gm2/UnJailCommand.java similarity index 98% rename from src/client/command/commands/v2/UnJailCommand.java rename to src/client/command/commands/gm2/UnJailCommand.java index 52b2e86ff7..f5fb8b4da8 100644 --- a/src/client/command/commands/v2/UnJailCommand.java +++ b/src/client/command/commands/gm2/UnJailCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/WarpCommand.java b/src/client/command/commands/gm2/WarpCommand.java similarity index 98% rename from src/client/command/commands/v2/WarpCommand.java rename to src/client/command/commands/gm2/WarpCommand.java index 95f3af1558..e3eaef060e 100644 --- a/src/client/command/commands/v2/WarpCommand.java +++ b/src/client/command/commands/gm2/WarpCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/WarpToCommand.java b/src/client/command/commands/gm2/WarpToCommand.java similarity index 98% rename from src/client/command/commands/v2/WarpToCommand.java rename to src/client/command/commands/gm2/WarpToCommand.java index 67f5207fdf..a510070464 100644 --- a/src/client/command/commands/v2/WarpToCommand.java +++ b/src/client/command/commands/gm2/WarpToCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v2/WhereaMiCommand.java b/src/client/command/commands/gm2/WhereaMiCommand.java similarity index 98% rename from src/client/command/commands/v2/WhereaMiCommand.java rename to src/client/command/commands/gm2/WhereaMiCommand.java index 54ff6299e6..2d1eb27564 100644 --- a/src/client/command/commands/v2/WhereaMiCommand.java +++ b/src/client/command/commands/gm2/WhereaMiCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v2; +package client.command.commands.gm2; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/BanCommand.java b/src/client/command/commands/gm3/BanCommand.java similarity index 99% rename from src/client/command/commands/v3/BanCommand.java rename to src/client/command/commands/gm3/BanCommand.java index 3d6f6bbdeb..414a3d66e8 100644 --- a/src/client/command/commands/v3/BanCommand.java +++ b/src/client/command/commands/gm3/BanCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ChatCommand.java b/src/client/command/commands/gm3/ChatCommand.java similarity index 97% rename from src/client/command/commands/v3/ChatCommand.java rename to src/client/command/commands/gm3/ChatCommand.java index 298b4c9d32..0e8967ed27 100644 --- a/src/client/command/commands/v3/ChatCommand.java +++ b/src/client/command/commands/gm3/ChatCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/CheckDmgCommand.java b/src/client/command/commands/gm3/CheckDmgCommand.java similarity index 98% rename from src/client/command/commands/v3/CheckDmgCommand.java rename to src/client/command/commands/gm3/CheckDmgCommand.java index 9809288bc8..08f5ae6545 100644 --- a/src/client/command/commands/v3/CheckDmgCommand.java +++ b/src/client/command/commands/gm3/CheckDmgCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleBuffStat; import client.command.Command; diff --git a/src/client/command/commands/v3/ClosePortalCommand.java b/src/client/command/commands/gm3/ClosePortalCommand.java similarity index 97% rename from src/client/command/commands/v3/ClosePortalCommand.java rename to src/client/command/commands/gm3/ClosePortalCommand.java index 893d790732..7836d195ec 100644 --- a/src/client/command/commands/v3/ClosePortalCommand.java +++ b/src/client/command/commands/gm3/ClosePortalCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/DebuffCommand.java b/src/client/command/commands/gm3/DebuffCommand.java similarity index 99% rename from src/client/command/commands/v3/DebuffCommand.java rename to src/client/command/commands/gm3/DebuffCommand.java index 40b6feff6d..eaba92ecfc 100644 --- a/src/client/command/commands/v3/DebuffCommand.java +++ b/src/client/command/commands/gm3/DebuffCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleDisease; import client.command.Command; diff --git a/src/client/command/commands/v3/EndEventCommand.java b/src/client/command/commands/gm3/EndEventCommand.java similarity index 97% rename from src/client/command/commands/v3/EndEventCommand.java rename to src/client/command/commands/gm3/EndEventCommand.java index 1eb60675d3..9fc6de5c40 100644 --- a/src/client/command/commands/v3/EndEventCommand.java +++ b/src/client/command/commands/gm3/EndEventCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ExpedsCommand.java b/src/client/command/commands/gm3/ExpedsCommand.java similarity index 98% rename from src/client/command/commands/v3/ExpedsCommand.java rename to src/client/command/commands/gm3/ExpedsCommand.java index 6b90241f5e..c9acc0c431 100644 --- a/src/client/command/commands/v3/ExpedsCommand.java +++ b/src/client/command/commands/gm3/ExpedsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/FaceCommand.java b/src/client/command/commands/gm3/FaceCommand.java similarity index 98% rename from src/client/command/commands/v3/FaceCommand.java rename to src/client/command/commands/gm3/FaceCommand.java index 0611d7a823..48bc450f35 100644 --- a/src/client/command/commands/v3/FaceCommand.java +++ b/src/client/command/commands/gm3/FaceCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleStat; import client.command.Command; diff --git a/src/client/command/commands/v3/FameCommand.java b/src/client/command/commands/gm3/FameCommand.java similarity index 98% rename from src/client/command/commands/v3/FameCommand.java rename to src/client/command/commands/gm3/FameCommand.java index b51d70336c..9e1b8e6165 100644 --- a/src/client/command/commands/v3/FameCommand.java +++ b/src/client/command/commands/gm3/FameCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleStat; import client.command.Command; diff --git a/src/client/command/commands/v3/FlyCommand.java b/src/client/command/commands/gm3/FlyCommand.java similarity index 98% rename from src/client/command/commands/v3/FlyCommand.java rename to src/client/command/commands/gm3/FlyCommand.java index 4929dcaa97..5f7c115729 100644 --- a/src/client/command/commands/v3/FlyCommand.java +++ b/src/client/command/commands/gm3/FlyCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/GiveMesosCommand.java b/src/client/command/commands/gm3/GiveMesosCommand.java similarity index 98% rename from src/client/command/commands/v3/GiveMesosCommand.java rename to src/client/command/commands/gm3/GiveMesosCommand.java index 946e828da3..e66dc3b0e8 100644 --- a/src/client/command/commands/v3/GiveMesosCommand.java +++ b/src/client/command/commands/gm3/GiveMesosCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/GiveNxCommand.java b/src/client/command/commands/gm3/GiveNxCommand.java similarity index 98% rename from src/client/command/commands/v3/GiveNxCommand.java rename to src/client/command/commands/gm3/GiveNxCommand.java index 6294b98892..04289bec41 100644 --- a/src/client/command/commands/v3/GiveNxCommand.java +++ b/src/client/command/commands/gm3/GiveNxCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/GiveVpCommand.java b/src/client/command/commands/gm3/GiveVpCommand.java similarity index 97% rename from src/client/command/commands/v3/GiveVpCommand.java rename to src/client/command/commands/gm3/GiveVpCommand.java index ce6b642f97..798ac91ad9 100644 --- a/src/client/command/commands/v3/GiveVpCommand.java +++ b/src/client/command/commands/gm3/GiveVpCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/HairCommand.java b/src/client/command/commands/gm3/HairCommand.java similarity index 98% rename from src/client/command/commands/v3/HairCommand.java rename to src/client/command/commands/gm3/HairCommand.java index b9f3a31058..489e136cc3 100644 --- a/src/client/command/commands/v3/HairCommand.java +++ b/src/client/command/commands/gm3/HairCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleStat; import client.command.Command; diff --git a/src/client/command/commands/v3/HealMapCommand.java b/src/client/command/commands/gm3/HealMapCommand.java similarity index 84% rename from src/client/command/commands/v3/HealMapCommand.java rename to src/client/command/commands/gm3/HealMapCommand.java index aedfc4cac8..a3b06d5073 100644 --- a/src/client/command/commands/v3/HealMapCommand.java +++ b/src/client/command/commands/gm3/HealMapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleStat; import client.command.Command; @@ -38,10 +38,7 @@ public class HealMapCommand extends Command { MapleCharacter player = c.getPlayer(); for (MapleCharacter mch : player.getMap().getCharacters()) { if (mch != null) { - mch.setHp(mch.getMaxHp()); - mch.updateSingleStat(MapleStat.HP, mch.getMaxHp()); - mch.setMp(mch.getMaxMp()); - mch.updateSingleStat(MapleStat.MP, mch.getMaxMp()); + mch.healHpMp(); } } } diff --git a/src/client/command/commands/v3/HealPersonCommand.java b/src/client/command/commands/gm3/HealPersonCommand.java similarity index 85% rename from src/client/command/commands/v3/HealPersonCommand.java rename to src/client/command/commands/gm3/HealPersonCommand.java index 6c6c0f9aad..7621cb2815 100644 --- a/src/client/command/commands/v3/HealPersonCommand.java +++ b/src/client/command/commands/gm3/HealPersonCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.MapleStat; import client.command.Command; @@ -38,10 +38,7 @@ public class HealPersonCommand extends Command { MapleCharacter player = c.getPlayer(); MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { - victim.setHp(victim.getMaxHp()); - victim.updateSingleStat(MapleStat.HP, victim.getMaxHp()); - victim.setMp(victim.getMaxMp()); - victim.updateSingleStat(MapleStat.MP, victim.getMaxMp()); + victim.healHpMp(); } else { player.message("Player '" + params[0] + "' could not be found on this channel."); } diff --git a/src/client/command/commands/v3/HpMpCommand.java b/src/client/command/commands/gm3/HpMpCommand.java similarity index 85% rename from src/client/command/commands/v3/HpMpCommand.java rename to src/client/command/commands/gm3/HpMpCommand.java index 30b680825d..f1a808d8da 100644 --- a/src/client/command/commands/v3/HpMpCommand.java +++ b/src/client/command/commands/gm3/HpMpCommand.java @@ -21,9 +21,8 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; @@ -49,12 +48,7 @@ public class HpMpCommand extends Command { } if (victim != null) { - victim.setHp(statUpdate); - victim.setMp(statUpdate); - victim.updateSingleStat(MapleStat.HP, statUpdate); - victim.updateSingleStat(MapleStat.MP, statUpdate); - - victim.checkBerserk(victim.isHidden()); + victim.updateHpMp(statUpdate); } else { player.message("Player '" + params[0] + "' could not be found on this world."); } diff --git a/src/client/command/commands/v3/HurtCommand.java b/src/client/command/commands/gm3/HurtCommand.java similarity index 91% rename from src/client/command/commands/v3/HurtCommand.java rename to src/client/command/commands/gm3/HurtCommand.java index 069454b6f9..82cf06ac92 100644 --- a/src/client/command/commands/v3/HurtCommand.java +++ b/src/client/command/commands/gm3/HurtCommand.java @@ -21,9 +21,8 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; @@ -38,8 +37,7 @@ public class HurtCommand extends Command { MapleCharacter player = c.getPlayer(); MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { - victim.setHp(1); - victim.updateSingleStat(MapleStat.HP, 1); + victim.updateHp(1); } else { player.message("Player '" + params[0] + "' could not be found on this channel."); } diff --git a/src/client/command/commands/v3/IdCommand.java b/src/client/command/commands/gm3/IdCommand.java similarity index 98% rename from src/client/command/commands/v3/IdCommand.java rename to src/client/command/commands/gm3/IdCommand.java index 7248268598..c19bee6714 100644 --- a/src/client/command/commands/v3/IdCommand.java +++ b/src/client/command/commands/gm3/IdCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/IgnoreCommand.java b/src/client/command/commands/gm3/IgnoreCommand.java similarity index 98% rename from src/client/command/commands/v3/IgnoreCommand.java rename to src/client/command/commands/gm3/IgnoreCommand.java index 9d58f4e1e3..fb13a76a4d 100644 --- a/src/client/command/commands/v3/IgnoreCommand.java +++ b/src/client/command/commands/gm3/IgnoreCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/IgnoredCommand.java b/src/client/command/commands/gm3/IgnoredCommand.java similarity index 97% rename from src/client/command/commands/v3/IgnoredCommand.java rename to src/client/command/commands/gm3/IgnoredCommand.java index c4b287477a..e66880caac 100644 --- a/src/client/command/commands/v3/IgnoredCommand.java +++ b/src/client/command/commands/gm3/IgnoredCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/InMapCommand.java b/src/client/command/commands/gm3/InMapCommand.java similarity index 97% rename from src/client/command/commands/v3/InMapCommand.java rename to src/client/command/commands/gm3/InMapCommand.java index a33d27b7d7..e2406f486d 100644 --- a/src/client/command/commands/v3/InMapCommand.java +++ b/src/client/command/commands/gm3/InMapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/KillAllCommand.java b/src/client/command/commands/gm3/KillAllCommand.java similarity index 98% rename from src/client/command/commands/v3/KillAllCommand.java rename to src/client/command/commands/gm3/KillAllCommand.java index c942641436..533a471573 100644 --- a/src/client/command/commands/v3/KillAllCommand.java +++ b/src/client/command/commands/gm3/KillAllCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/KillCommand.java b/src/client/command/commands/gm3/KillCommand.java similarity index 96% rename from src/client/command/commands/v3/KillCommand.java rename to src/client/command/commands/gm3/KillCommand.java index 2801828c2e..910fd9f53a 100644 --- a/src/client/command/commands/v3/KillCommand.java +++ b/src/client/command/commands/gm3/KillCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; @@ -44,7 +44,7 @@ public class KillCommand extends Command { MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); if (victim != null) { - victim.setHpMp(0); + victim.updateHpMp(0); Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, player.getName() + " used !kill on " + victim.getName())); } else { player.message("Player '" + params[0] + "' could not be found on this channel."); diff --git a/src/client/command/commands/v3/KillMapCommand.java b/src/client/command/commands/gm3/KillMapCommand.java similarity index 90% rename from src/client/command/commands/v3/KillMapCommand.java rename to src/client/command/commands/gm3/KillMapCommand.java index 12e8421a97..cc922f739c 100644 --- a/src/client/command/commands/v3/KillMapCommand.java +++ b/src/client/command/commands/gm3/KillMapCommand.java @@ -21,9 +21,8 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; @@ -37,8 +36,7 @@ public class KillMapCommand extends Command { public void execute(MapleClient c, String[] params) { MapleCharacter player = c.getPlayer(); for (MapleCharacter mch : player.getMap().getCharacters()) { - mch.setHp(0); - mch.updateSingleStat(MapleStat.HP, 0); + mch.updateHp(0); } } } diff --git a/src/client/command/commands/v3/MaxEnergyCommand.java b/src/client/command/commands/gm3/MaxEnergyCommand.java similarity index 97% rename from src/client/command/commands/v3/MaxEnergyCommand.java rename to src/client/command/commands/gm3/MaxEnergyCommand.java index 57c8ef545d..595e7d2fb8 100644 --- a/src/client/command/commands/v3/MaxEnergyCommand.java +++ b/src/client/command/commands/gm3/MaxEnergyCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/MaxHpMpCommand.java b/src/client/command/commands/gm3/MaxHpMpCommand.java similarity index 62% rename from src/client/command/commands/v3/MaxHpMpCommand.java rename to src/client/command/commands/gm3/MaxHpMpCommand.java index 55de83e58c..8971665454 100644 --- a/src/client/command/commands/v3/MaxHpMpCommand.java +++ b/src/client/command/commands/gm3/MaxHpMpCommand.java @@ -21,16 +21,11 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; -import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; -import java.util.ArrayList; -import java.util.List; -import tools.MaplePacketCreator; -import tools.Pair; public class MaxHpMpCommand extends Command { { @@ -41,37 +36,25 @@ public class MaxHpMpCommand extends Command { public void execute(MapleClient c, String[] params) { MapleCharacter player = c.getPlayer(); MapleCharacter victim = player; + int statUpdate = 1; - if (params.length >= 2) { victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); - statUpdate = Math.max(1, Integer.valueOf(params[1])); + statUpdate = Integer.valueOf(params[1]); } else if (params.length == 1) { - statUpdate = Math.max(1, Integer.valueOf(params[0])); + statUpdate = Integer.valueOf(params[0]); } else { player.yellowMessage("Syntax: !maxhpmp [] "); } - + if (victim != null) { - List> statup = new ArrayList<>(4); - - if (victim.getHp() > statUpdate) { - victim.setHp(statUpdate); - statup.add(new Pair<>(MapleStat.HP, statUpdate)); - } - statup.add(new Pair<>(MapleStat.MAXHP, statUpdate)); + int extraHp = victim.getCurrentMaxHp() - victim.getClientMaxHp(); + int extraMp = victim.getCurrentMaxMp() - victim.getClientMaxMp(); + statUpdate = Math.max(1 + Math.max(extraHp, extraMp), statUpdate); - if (victim.getMp() > statUpdate) { - victim.setMp(statUpdate); - statup.add(new Pair<>(MapleStat.MP, statUpdate)); - } - statup.add(new Pair<>(MapleStat.MAXMP, statUpdate)); - c.announce(MaplePacketCreator.updatePlayerStats(statup, victim)); - - victim.setMaxHp(statUpdate); - victim.setMaxMp(statUpdate); - - victim.checkBerserk(victim.isHidden()); + int maxhpUpdate = statUpdate - extraHp; + int maxmpUpdate = statUpdate - extraMp; + victim.updateMaxHpMaxMp(maxhpUpdate, maxmpUpdate); } else { player.message("Player '" + params[0] + "' could not be found on this world."); } diff --git a/src/client/command/commands/v3/MonitorCommand.java b/src/client/command/commands/gm3/MonitorCommand.java similarity index 98% rename from src/client/command/commands/v3/MonitorCommand.java rename to src/client/command/commands/gm3/MonitorCommand.java index ce20568df6..b6127d2055 100644 --- a/src/client/command/commands/v3/MonitorCommand.java +++ b/src/client/command/commands/gm3/MonitorCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/MonitorsCommand.java b/src/client/command/commands/gm3/MonitorsCommand.java similarity index 97% rename from src/client/command/commands/v3/MonitorsCommand.java rename to src/client/command/commands/gm3/MonitorsCommand.java index 5adbeca2ad..23ab6c0870 100644 --- a/src/client/command/commands/v3/MonitorsCommand.java +++ b/src/client/command/commands/gm3/MonitorsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/MusicCommand.java b/src/client/command/commands/gm3/MusicCommand.java similarity index 99% rename from src/client/command/commands/v3/MusicCommand.java rename to src/client/command/commands/gm3/MusicCommand.java index eb664d228e..3ca6b4953e 100644 --- a/src/client/command/commands/v3/MusicCommand.java +++ b/src/client/command/commands/gm3/MusicCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/MuteMapCommand.java b/src/client/command/commands/gm3/MuteMapCommand.java similarity index 97% rename from src/client/command/commands/v3/MuteMapCommand.java rename to src/client/command/commands/gm3/MuteMapCommand.java index 45bb445ba7..8e879cb5c3 100644 --- a/src/client/command/commands/v3/MuteMapCommand.java +++ b/src/client/command/commands/gm3/MuteMapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/NightCommand.java b/src/client/command/commands/gm3/NightCommand.java similarity index 97% rename from src/client/command/commands/v3/NightCommand.java rename to src/client/command/commands/gm3/NightCommand.java index ec1eb7b9ed..72f907edaf 100644 --- a/src/client/command/commands/v3/NightCommand.java +++ b/src/client/command/commands/gm3/NightCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/NoticeCommand.java b/src/client/command/commands/gm3/NoticeCommand.java similarity index 97% rename from src/client/command/commands/v3/NoticeCommand.java rename to src/client/command/commands/gm3/NoticeCommand.java index 8c22496d9f..9ee0011f2f 100644 --- a/src/client/command/commands/v3/NoticeCommand.java +++ b/src/client/command/commands/gm3/NoticeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/NpcCommand.java b/src/client/command/commands/gm3/NpcCommand.java similarity index 98% rename from src/client/command/commands/v3/NpcCommand.java rename to src/client/command/commands/gm3/NpcCommand.java index d5d68d0cf9..86a4a155bf 100644 --- a/src/client/command/commands/v3/NpcCommand.java +++ b/src/client/command/commands/gm3/NpcCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/OnlineTwoCommand.java b/src/client/command/commands/gm3/OnlineTwoCommand.java similarity index 98% rename from src/client/command/commands/v3/OnlineTwoCommand.java rename to src/client/command/commands/gm3/OnlineTwoCommand.java index 2f160bb73a..3919cb707a 100644 --- a/src/client/command/commands/v3/OnlineTwoCommand.java +++ b/src/client/command/commands/gm3/OnlineTwoCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/OpenPortalCommand.java b/src/client/command/commands/gm3/OpenPortalCommand.java similarity index 97% rename from src/client/command/commands/v3/OpenPortalCommand.java rename to src/client/command/commands/gm3/OpenPortalCommand.java index 14f5ee6598..92dead8050 100644 --- a/src/client/command/commands/v3/OpenPortalCommand.java +++ b/src/client/command/commands/gm3/OpenPortalCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/PeCommand.java b/src/client/command/commands/gm3/PeCommand.java similarity index 98% rename from src/client/command/commands/v3/PeCommand.java rename to src/client/command/commands/gm3/PeCommand.java index 1d1353a505..62e1d13055 100644 --- a/src/client/command/commands/v3/PeCommand.java +++ b/src/client/command/commands/gm3/PeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/PosCommand.java b/src/client/command/commands/gm3/PosCommand.java similarity index 97% rename from src/client/command/commands/v3/PosCommand.java rename to src/client/command/commands/gm3/PosCommand.java index 8427f65e2f..37c198501b 100644 --- a/src/client/command/commands/v3/PosCommand.java +++ b/src/client/command/commands/gm3/PosCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/QuestCompleteCommand.java b/src/client/command/commands/gm3/QuestCompleteCommand.java similarity index 98% rename from src/client/command/commands/v3/QuestCompleteCommand.java rename to src/client/command/commands/gm3/QuestCompleteCommand.java index 591d30efa5..63a17198b3 100644 --- a/src/client/command/commands/v3/QuestCompleteCommand.java +++ b/src/client/command/commands/gm3/QuestCompleteCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/QuestResetCommand.java b/src/client/command/commands/gm3/QuestResetCommand.java similarity index 98% rename from src/client/command/commands/v3/QuestResetCommand.java rename to src/client/command/commands/gm3/QuestResetCommand.java index 4f32d2ac4e..e1c9863c1e 100644 --- a/src/client/command/commands/v3/QuestResetCommand.java +++ b/src/client/command/commands/gm3/QuestResetCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/QuestStartCommand.java b/src/client/command/commands/gm3/QuestStartCommand.java similarity index 98% rename from src/client/command/commands/v3/QuestStartCommand.java rename to src/client/command/commands/gm3/QuestStartCommand.java index e25e173378..747732d05f 100644 --- a/src/client/command/commands/v3/QuestStartCommand.java +++ b/src/client/command/commands/gm3/QuestStartCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ReloadDropsCommand.java b/src/client/command/commands/gm3/ReloadDropsCommand.java similarity index 97% rename from src/client/command/commands/v3/ReloadDropsCommand.java rename to src/client/command/commands/gm3/ReloadDropsCommand.java index 330d40a515..260823dedf 100644 --- a/src/client/command/commands/v3/ReloadDropsCommand.java +++ b/src/client/command/commands/gm3/ReloadDropsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ReloadEventsCommand.java b/src/client/command/commands/gm3/ReloadEventsCommand.java similarity index 97% rename from src/client/command/commands/v3/ReloadEventsCommand.java rename to src/client/command/commands/gm3/ReloadEventsCommand.java index 0fec0a7f02..727231bc95 100644 --- a/src/client/command/commands/v3/ReloadEventsCommand.java +++ b/src/client/command/commands/gm3/ReloadEventsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ReloadMapCommand.java b/src/client/command/commands/gm3/ReloadMapCommand.java similarity index 97% rename from src/client/command/commands/v3/ReloadMapCommand.java rename to src/client/command/commands/gm3/ReloadMapCommand.java index 1e0ea36300..4485def5e8 100644 --- a/src/client/command/commands/v3/ReloadMapCommand.java +++ b/src/client/command/commands/gm3/ReloadMapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ReloadPortalsCommand.java b/src/client/command/commands/gm3/ReloadPortalsCommand.java similarity index 97% rename from src/client/command/commands/v3/ReloadPortalsCommand.java rename to src/client/command/commands/gm3/ReloadPortalsCommand.java index 9fdd32f8fd..773f607c9c 100644 --- a/src/client/command/commands/v3/ReloadPortalsCommand.java +++ b/src/client/command/commands/gm3/ReloadPortalsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ReloadShopsCommand.java b/src/client/command/commands/gm3/ReloadShopsCommand.java similarity index 97% rename from src/client/command/commands/v3/ReloadShopsCommand.java rename to src/client/command/commands/gm3/ReloadShopsCommand.java index 3b10854c83..e764a17174 100644 --- a/src/client/command/commands/v3/ReloadShopsCommand.java +++ b/src/client/command/commands/gm3/ReloadShopsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/RipCommand.java b/src/client/command/commands/gm3/RipCommand.java similarity index 97% rename from src/client/command/commands/v3/RipCommand.java rename to src/client/command/commands/gm3/RipCommand.java index f34bf0ccf8..14ec86a59c 100644 --- a/src/client/command/commands/v3/RipCommand.java +++ b/src/client/command/commands/gm3/RipCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/SeedCommand.java b/src/client/command/commands/gm3/SeedCommand.java similarity index 98% rename from src/client/command/commands/v3/SeedCommand.java rename to src/client/command/commands/gm3/SeedCommand.java index 8f7c93b4da..d67d3999b9 100644 --- a/src/client/command/commands/v3/SeedCommand.java +++ b/src/client/command/commands/gm3/SeedCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/SpawnCommand.java b/src/client/command/commands/gm3/SpawnCommand.java similarity index 94% rename from src/client/command/commands/v3/SpawnCommand.java rename to src/client/command/commands/gm3/SpawnCommand.java index 144f372072..b194a70cb3 100644 --- a/src/client/command/commands/v3/SpawnCommand.java +++ b/src/client/command/commands/gm3/SpawnCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; @@ -38,7 +38,7 @@ public class SpawnCommand extends Command { public void execute(MapleClient c, String[] params) { MapleCharacter player = c.getPlayer(); if (params.length < 1) { - player.yellowMessage("Syntax: !spawn "); + player.yellowMessage("Syntax: !spawn []"); return; } diff --git a/src/client/command/commands/v3/StartEventCommand.java b/src/client/command/commands/gm3/StartEventCommand.java similarity index 97% rename from src/client/command/commands/v3/StartEventCommand.java rename to src/client/command/commands/gm3/StartEventCommand.java index f5b406c05d..cbceb66ce1 100644 --- a/src/client/command/commands/v3/StartEventCommand.java +++ b/src/client/command/commands/gm3/StartEventCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/ToggleCouponCommand.java b/src/client/command/commands/gm3/ToggleCouponCommand.java similarity index 97% rename from src/client/command/commands/v3/ToggleCouponCommand.java rename to src/client/command/commands/gm3/ToggleCouponCommand.java index 87c08c5947..ce0b76c5d7 100644 --- a/src/client/command/commands/v3/ToggleCouponCommand.java +++ b/src/client/command/commands/gm3/ToggleCouponCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/UnBanCommand.java b/src/client/command/commands/gm3/UnBanCommand.java similarity index 98% rename from src/client/command/commands/v3/UnBanCommand.java rename to src/client/command/commands/gm3/UnBanCommand.java index 54f5782a35..4ad73522f7 100644 --- a/src/client/command/commands/v3/UnBanCommand.java +++ b/src/client/command/commands/gm3/UnBanCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v3/WarpSnowBallCommand.java b/src/client/command/commands/gm3/WarpSnowBallCommand.java similarity index 97% rename from src/client/command/commands/v3/WarpSnowBallCommand.java rename to src/client/command/commands/gm3/WarpSnowBallCommand.java index 2d62daf4b6..c66e4563fe 100644 --- a/src/client/command/commands/v3/WarpSnowBallCommand.java +++ b/src/client/command/commands/gm3/WarpSnowBallCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v3; +package client.command.commands.gm3; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/CakeCommand.java b/src/client/command/commands/gm4/CakeCommand.java similarity index 98% rename from src/client/command/commands/v4/CakeCommand.java rename to src/client/command/commands/gm4/CakeCommand.java index 91e6c86276..1a58b65c85 100644 --- a/src/client/command/commands/v4/CakeCommand.java +++ b/src/client/command/commands/gm4/CakeCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/DropRateCommand.java b/src/client/command/commands/gm4/DropRateCommand.java similarity index 97% rename from src/client/command/commands/v4/DropRateCommand.java rename to src/client/command/commands/gm4/DropRateCommand.java index 783f0d3f22..cfac27e79b 100644 --- a/src/client/command/commands/v4/DropRateCommand.java +++ b/src/client/command/commands/gm4/DropRateCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ExpRateCommand.java b/src/client/command/commands/gm4/ExpRateCommand.java similarity index 97% rename from src/client/command/commands/v4/ExpRateCommand.java rename to src/client/command/commands/gm4/ExpRateCommand.java index 50026dde88..b0070efddc 100644 --- a/src/client/command/commands/v4/ExpRateCommand.java +++ b/src/client/command/commands/gm4/ExpRateCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ForceVacCommand.java b/src/client/command/commands/gm4/ForceVacCommand.java similarity index 98% rename from src/client/command/commands/v4/ForceVacCommand.java rename to src/client/command/commands/gm4/ForceVacCommand.java index cdb5fd202b..7830a66ef0 100644 --- a/src/client/command/commands/v4/ForceVacCommand.java +++ b/src/client/command/commands/gm4/ForceVacCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/HorntailCommand.java b/src/client/command/commands/gm4/HorntailCommand.java similarity index 97% rename from src/client/command/commands/v4/HorntailCommand.java rename to src/client/command/commands/gm4/HorntailCommand.java index a853f81245..3fc094478d 100644 --- a/src/client/command/commands/v4/HorntailCommand.java +++ b/src/client/command/commands/gm4/HorntailCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ItemVacCommand.java b/src/client/command/commands/gm4/ItemVacCommand.java similarity index 97% rename from src/client/command/commands/v4/ItemVacCommand.java rename to src/client/command/commands/gm4/ItemVacCommand.java index e17861a824..137749f1d1 100644 --- a/src/client/command/commands/v4/ItemVacCommand.java +++ b/src/client/command/commands/gm4/ItemVacCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/MesoRateCommand.java b/src/client/command/commands/gm4/MesoRateCommand.java similarity index 97% rename from src/client/command/commands/v4/MesoRateCommand.java rename to src/client/command/commands/gm4/MesoRateCommand.java index 9b2dd45beb..602650cc1b 100644 --- a/src/client/command/commands/v4/MesoRateCommand.java +++ b/src/client/command/commands/gm4/MesoRateCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/PapCommand.java b/src/client/command/commands/gm4/PapCommand.java similarity index 97% rename from src/client/command/commands/v4/PapCommand.java rename to src/client/command/commands/gm4/PapCommand.java index 1f03cb47e4..1b9f2e5fd1 100644 --- a/src/client/command/commands/v4/PapCommand.java +++ b/src/client/command/commands/gm4/PapCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/PianusCommand.java b/src/client/command/commands/gm4/PianusCommand.java similarity index 97% rename from src/client/command/commands/v4/PianusCommand.java rename to src/client/command/commands/gm4/PianusCommand.java index 9681481f4f..5ab407353f 100644 --- a/src/client/command/commands/v4/PianusCommand.java +++ b/src/client/command/commands/gm4/PianusCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/PinkbeanCommand.java b/src/client/command/commands/gm4/PinkbeanCommand.java similarity index 97% rename from src/client/command/commands/v4/PinkbeanCommand.java rename to src/client/command/commands/gm4/PinkbeanCommand.java index 45db91dd95..9a541d23db 100644 --- a/src/client/command/commands/v4/PinkbeanCommand.java +++ b/src/client/command/commands/gm4/PinkbeanCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/PlayerNpcCommand.java b/src/client/command/commands/gm4/PlayerNpcCommand.java similarity index 97% rename from src/client/command/commands/v4/PlayerNpcCommand.java rename to src/client/command/commands/gm4/PlayerNpcCommand.java index 68aaec60bb..01921cd418 100644 --- a/src/client/command/commands/v4/PlayerNpcCommand.java +++ b/src/client/command/commands/gm4/PlayerNpcCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/PlayerNpcRemoveCommand.java b/src/client/command/commands/gm4/PlayerNpcRemoveCommand.java similarity index 97% rename from src/client/command/commands/v4/PlayerNpcRemoveCommand.java rename to src/client/command/commands/gm4/PlayerNpcRemoveCommand.java index 95c6f02c2f..3d5c3d243c 100644 --- a/src/client/command/commands/v4/PlayerNpcRemoveCommand.java +++ b/src/client/command/commands/gm4/PlayerNpcRemoveCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ProItemCommand.java b/src/client/command/commands/gm4/ProItemCommand.java similarity index 98% rename from src/client/command/commands/v4/ProItemCommand.java rename to src/client/command/commands/gm4/ProItemCommand.java index c65b9a253a..40cc7c43a0 100644 --- a/src/client/command/commands/v4/ProItemCommand.java +++ b/src/client/command/commands/gm4/ProItemCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/QuestRateCommand.java b/src/client/command/commands/gm4/QuestRateCommand.java similarity index 97% rename from src/client/command/commands/v4/QuestRateCommand.java rename to src/client/command/commands/gm4/QuestRateCommand.java index 43f329e852..ea93261dd1 100644 --- a/src/client/command/commands/v4/QuestRateCommand.java +++ b/src/client/command/commands/gm4/QuestRateCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ServerMessageCommand.java b/src/client/command/commands/gm4/ServerMessageCommand.java similarity index 97% rename from src/client/command/commands/v4/ServerMessageCommand.java rename to src/client/command/commands/gm4/ServerMessageCommand.java index 00b02992c3..428133eded 100644 --- a/src/client/command/commands/v4/ServerMessageCommand.java +++ b/src/client/command/commands/gm4/ServerMessageCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/SetEqStatCommand.java b/src/client/command/commands/gm4/SetEqStatCommand.java similarity index 72% rename from src/client/command/commands/v4/SetEqStatCommand.java rename to src/client/command/commands/gm4/SetEqStatCommand.java index f616f8601f..61546c6420 100644 --- a/src/client/command/commands/v4/SetEqStatCommand.java +++ b/src/client/command/commands/gm4/SetEqStatCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; @@ -50,29 +50,29 @@ public class SetEqStatCommand extends Command { for (byte i = 1; i <= equip.getSlotLimit(); i++) { try { - Equip eu = (Equip) equip.getItem(i); - if (eu == null) continue; + Equip eq = (Equip) equip.getItem(i); + if (eq == null) continue; - eu.setWdef(newStat); - eu.setAcc(newStat); - eu.setAvoid(newStat); - eu.setJump(newSpdJmp); - eu.setMatk(newStat); - eu.setMdef(newStat); - eu.setHp(newStat); - eu.setMp(newStat); - eu.setSpeed(newSpdJmp); - eu.setWatk(newStat); - eu.setDex(newStat); - eu.setInt(newStat); - eu.setStr(newStat); - eu.setLuk(newStat); + eq.setWdef(newStat); + eq.setAcc(newStat); + eq.setAvoid(newStat); + eq.setJump(newSpdJmp); + eq.setMatk(newStat); + eq.setMdef(newStat); + eq.setHp(newStat); + eq.setMp(newStat); + eq.setSpeed(newSpdJmp); + eq.setWatk(newStat); + eq.setDex(newStat); + eq.setInt(newStat); + eq.setStr(newStat); + eq.setLuk(newStat); - byte flag = eu.getFlag(); + byte flag = eq.getFlag(); flag |= ItemConstants.UNTRADEABLE; - eu.setFlag(flag); + eq.setFlag(flag); - player.forceUpdateItem(eu); + player.forceUpdateItem(eq); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/client/command/commands/v4/TravelRateCommand.java b/src/client/command/commands/gm4/TravelRateCommand.java similarity index 97% rename from src/client/command/commands/v4/TravelRateCommand.java rename to src/client/command/commands/gm4/TravelRateCommand.java index acd2092f9b..e62d466cc0 100644 --- a/src/client/command/commands/v4/TravelRateCommand.java +++ b/src/client/command/commands/gm4/TravelRateCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v4/ZakumCommand.java b/src/client/command/commands/gm4/ZakumCommand.java similarity index 97% rename from src/client/command/commands/v4/ZakumCommand.java rename to src/client/command/commands/gm4/ZakumCommand.java index fe2b22aacf..97a8f4e482 100644 --- a/src/client/command/commands/v4/ZakumCommand.java +++ b/src/client/command/commands/gm4/ZakumCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v4; +package client.command.commands.gm4; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v5/DebugCommand.java b/src/client/command/commands/gm5/DebugCommand.java similarity index 99% rename from src/client/command/commands/v5/DebugCommand.java rename to src/client/command/commands/gm5/DebugCommand.java index df8c3a3a34..1bc4e0f8bc 100644 --- a/src/client/command/commands/v5/DebugCommand.java +++ b/src/client/command/commands/gm5/DebugCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v5; +package client.command.commands.gm5; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v5/SetCommand.java b/src/client/command/commands/gm5/SetCommand.java similarity index 97% rename from src/client/command/commands/v5/SetCommand.java rename to src/client/command/commands/gm5/SetCommand.java index a01613e27f..7614189753 100644 --- a/src/client/command/commands/v5/SetCommand.java +++ b/src/client/command/commands/gm5/SetCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v5; +package client.command.commands.gm5; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v5/ShowPacketsCommand.java b/src/client/command/commands/gm5/ShowPacketsCommand.java similarity index 97% rename from src/client/command/commands/v5/ShowPacketsCommand.java rename to src/client/command/commands/gm5/ShowPacketsCommand.java index 284cab3b5b..ff1798cc85 100644 --- a/src/client/command/commands/v5/ShowPacketsCommand.java +++ b/src/client/command/commands/gm5/ShowPacketsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v5; +package client.command.commands.gm5; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/ClearQuestCacheCommand.java b/src/client/command/commands/gm6/ClearQuestCacheCommand.java similarity index 97% rename from src/client/command/commands/v6/ClearQuestCacheCommand.java rename to src/client/command/commands/gm6/ClearQuestCacheCommand.java index bec633bf5f..c50822e71c 100644 --- a/src/client/command/commands/v6/ClearQuestCacheCommand.java +++ b/src/client/command/commands/gm6/ClearQuestCacheCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/ClearQuestCommand.java b/src/client/command/commands/gm6/ClearQuestCommand.java similarity index 97% rename from src/client/command/commands/v6/ClearQuestCommand.java rename to src/client/command/commands/gm6/ClearQuestCommand.java index db8b5ebefa..e15b2f32e5 100644 --- a/src/client/command/commands/v6/ClearQuestCommand.java +++ b/src/client/command/commands/gm6/ClearQuestCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/DCAllCommand.java b/src/client/command/commands/gm6/DCAllCommand.java similarity index 97% rename from src/client/command/commands/v6/DCAllCommand.java rename to src/client/command/commands/gm6/DCAllCommand.java index 382935ea18..caa2483454 100644 --- a/src/client/command/commands/v6/DCAllCommand.java +++ b/src/client/command/commands/gm6/DCAllCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/EraseAllPNpcsCommand.java b/src/client/command/commands/gm6/EraseAllPNpcsCommand.java similarity index 97% rename from src/client/command/commands/v6/EraseAllPNpcsCommand.java rename to src/client/command/commands/gm6/EraseAllPNpcsCommand.java index 7d32d5f12f..1161acc4f1 100644 --- a/src/client/command/commands/v6/EraseAllPNpcsCommand.java +++ b/src/client/command/commands/gm6/EraseAllPNpcsCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/FredCommand.java b/src/client/command/commands/gm6/FredCommand.java similarity index 97% rename from src/client/command/commands/v6/FredCommand.java rename to src/client/command/commands/gm6/FredCommand.java index 85a2424ed3..8e6722fac6 100644 --- a/src/client/command/commands/v6/FredCommand.java +++ b/src/client/command/commands/gm6/FredCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/GetAccCommand.java b/src/client/command/commands/gm6/GetAccCommand.java similarity index 97% rename from src/client/command/commands/v6/GetAccCommand.java rename to src/client/command/commands/gm6/GetAccCommand.java index 74487fae74..f6cf6c9e94 100644 --- a/src/client/command/commands/v6/GetAccCommand.java +++ b/src/client/command/commands/gm6/GetAccCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/MapPlayersCommand.java b/src/client/command/commands/gm6/MapPlayersCommand.java similarity index 91% rename from src/client/command/commands/v6/MapPlayersCommand.java rename to src/client/command/commands/gm6/MapPlayersCommand.java index 93bd128a33..d52fa4921a 100644 --- a/src/client/command/commands/v6/MapPlayersCommand.java +++ b/src/client/command/commands/gm6/MapPlayersCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; @@ -43,13 +43,13 @@ public class MapPlayersCommand extends Command { for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { int curMap = chr.getMapId(); String hp = Integer.toString(chr.getHp()); - String maxhp = Integer.toString(chr.getMaxHp()); + String maxhp = Integer.toString(chr.getCurrentMaxHp()); String name = chr.getName() + ": " + hp + "/" + maxhp; if (map == curMap) { names = names.equals("") ? name : (names + ", " + name); } } } - player.message("These b lurkin: " + names); + player.message("Players on mapid " + map + ": " + names); } } diff --git a/src/client/command/commands/v6/SaveAllCommand.java b/src/client/command/commands/gm6/SaveAllCommand.java similarity index 97% rename from src/client/command/commands/v6/SaveAllCommand.java rename to src/client/command/commands/gm6/SaveAllCommand.java index dd0d2a87eb..648e4450a4 100644 --- a/src/client/command/commands/v6/SaveAllCommand.java +++ b/src/client/command/commands/gm6/SaveAllCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/ServerAddChannelCommand.java b/src/client/command/commands/gm6/ServerAddChannelCommand.java similarity index 98% rename from src/client/command/commands/v6/ServerAddChannelCommand.java rename to src/client/command/commands/gm6/ServerAddChannelCommand.java index e75e232f77..a9055f2ab8 100644 --- a/src/client/command/commands/v6/ServerAddChannelCommand.java +++ b/src/client/command/commands/gm6/ServerAddChannelCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v6/ServerAddWorldCommand.java b/src/client/command/commands/gm6/ServerAddWorldCommand.java similarity index 98% rename from src/client/command/commands/v6/ServerAddWorldCommand.java rename to src/client/command/commands/gm6/ServerAddWorldCommand.java index 9414a5391c..00aae016d5 100644 --- a/src/client/command/commands/v6/ServerAddWorldCommand.java +++ b/src/client/command/commands/gm6/ServerAddWorldCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v6/ServerRemoveChannelCommand.java b/src/client/command/commands/gm6/ServerRemoveChannelCommand.java similarity index 98% rename from src/client/command/commands/v6/ServerRemoveChannelCommand.java rename to src/client/command/commands/gm6/ServerRemoveChannelCommand.java index 95f00ae768..09385dbd49 100644 --- a/src/client/command/commands/v6/ServerRemoveChannelCommand.java +++ b/src/client/command/commands/gm6/ServerRemoveChannelCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v6/ServerRemoveWorldCommand.java b/src/client/command/commands/gm6/ServerRemoveWorldCommand.java similarity index 98% rename from src/client/command/commands/v6/ServerRemoveWorldCommand.java rename to src/client/command/commands/gm6/ServerRemoveWorldCommand.java index 217d74d018..b298965c7e 100644 --- a/src/client/command/commands/v6/ServerRemoveWorldCommand.java +++ b/src/client/command/commands/gm6/ServerRemoveWorldCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.MapleCharacter; import client.command.Command; diff --git a/src/client/command/commands/v6/SetGmLevelCommand.java b/src/client/command/commands/gm6/SetGmLevelCommand.java similarity index 98% rename from src/client/command/commands/v6/SetGmLevelCommand.java rename to src/client/command/commands/gm6/SetGmLevelCommand.java index f746b86e8b..19d8b01ab1 100644 --- a/src/client/command/commands/v6/SetGmLevelCommand.java +++ b/src/client/command/commands/gm6/SetGmLevelCommand.java @@ -21,7 +21,7 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; diff --git a/src/client/command/commands/v6/ShutdownCommand.java b/src/client/command/commands/gm6/ShutdownCommand.java similarity index 92% rename from src/client/command/commands/v6/ShutdownCommand.java rename to src/client/command/commands/gm6/ShutdownCommand.java index f678d5e6ab..97c5fbec0a 100644 --- a/src/client/command/commands/v6/ShutdownCommand.java +++ b/src/client/command/commands/gm6/ShutdownCommand.java @@ -21,13 +21,14 @@ /* @Author: Arthur L - Refactored command content into modules */ -package client.command.commands.v6; +package client.command.commands.gm6; import client.command.Command; import client.MapleClient; import client.MapleCharacter; import net.server.Server; import net.server.world.World; +import server.TimerManager; public class ShutdownCommand extends Command { { @@ -39,11 +40,13 @@ public class ShutdownCommand extends Command { MapleCharacter player = c.getPlayer(); if (params.length < 1){ player.yellowMessage("Syntax: !shutdown [