From 132f28639180aea52aba572ce8b528fbd839dec1 Mon Sep 17 00:00:00 2001 From: ronancpl Date: Tue, 28 Aug 2018 14:12:00 -0300 Subject: [PATCH] Commands overhaul + Selective loot + Antimulticlient Coordinator Completely overhauled commands layout, each command splitted in Java classes. Optimized "ranks" command, no more calling the DB to get ranking info. Implemented a mechanic where mobs only spawns loots that are visible/collectable by the player's party. Implemented a server flag which sets whether explorers, cygnus and legends are allowed to share the cash shop inventory or not. Implemented support for dynamic server rates at bootup. Rates can now be assigned at the configuration.ini file. Devised the anti-multiclient login coordinator feature. Besides multiclient attempts by the same machine, it also prevents unauthorized login attempts into an account. Fixed PQ instances being forcefully closed even when party leader reassignment upon logout is available. Fixed mob statis not concurrently protected. --- docs/feature_list.md | 12 +- docs/issues.txt | 1 + docs/mychanges_ptbr.txt | 21 +- scripts/npc/9977777.js | 12 +- scripts/npc/commands.js | 278 +- scripts/npc/credits.js | 3 +- sql/db_database.sql | 16 +- src/client/MapleCharacter.java | 60 +- src/client/MapleClient.java | 171 +- src/client/command/Command.java | 53 + src/client/command/Commands.java | 3159 ----------------- src/client/command/CommandsExecutor.java | 356 ++ src/client/command/RegisteredCommand.java | 43 + .../command/commands/v0/BuyBackCommand.java | 35 + .../command/commands/v0/DisposeCommand.java | 43 + .../command/commands/v0/DropLimitCommand.java | 45 + .../command/commands/v0/EquipLvCommand.java | 38 + .../command/commands/v0/GachaCommand.java | 66 + src/client/command/commands/v0/GmCommand.java | 60 + .../command/commands/v0/HelpCommand.java | 38 + .../command/commands/v0/JoinEventCommand.java | 66 + .../commands/v0/LeaveEventCommand.java | 58 + .../command/commands/v0/OnlineCommand.java | 49 + .../command/commands/v0/RanksCommand.java | 47 + .../command/commands/v0/RatesCommand.java | 49 + .../command/commands/v0/ReportBugCommand.java | 53 + .../command/commands/v0/ShowRatesCommand.java | 67 + .../command/commands/v0/StaffCommand.java | 38 + .../command/commands/v0/StatDexCommand.java | 57 + .../command/commands/v0/StatIntCommand.java | 57 + .../command/commands/v0/StatLukCommand.java | 57 + .../command/commands/v0/StatStrCommand.java | 57 + .../command/commands/v0/TimeCommand.java | 46 + .../command/commands/v0/UptimeCommand.java | 44 + .../command/commands/v1/BossHpCommand.java | 52 + .../command/commands/v1/BuffMeCommand.java | 50 + .../command/commands/v1/GotoCommand.java | 108 + .../command/commands/v1/MobHpCommand.java | 46 + .../commands/v1/WhatDropsFromCommand.java | 77 + .../command/commands/v1/WhoDropsCommand.java | 88 + src/client/command/commands/v2/ApCommand.java | 66 + .../command/commands/v2/BombCommand.java | 53 + .../command/commands/v2/BuffCommand.java | 49 + .../command/commands/v2/BuffMapCommand.java | 46 + .../commands/v2/ClearDropsCommand.java | 41 + .../command/commands/v2/ClearSlotCommand.java | 130 + src/client/command/commands/v2/DcCommand.java | 65 + .../command/commands/v2/EmpowerMeCommand.java | 44 + .../command/commands/v2/GmShopCommand.java | 40 + .../command/commands/v2/HealCommand.java | 41 + .../command/commands/v2/HideCommand.java | 42 + .../command/commands/v2/ItemCommand.java | 88 + .../command/commands/v2/ItemDropCommand.java | 117 + .../command/commands/v2/JailCommand.java | 73 + .../command/commands/v2/JobCommand.java | 67 + .../command/commands/v2/LevelCommand.java | 53 + .../command/commands/v2/LevelProCommand.java | 46 + .../command/commands/v2/MaxSkillCommand.java | 60 + .../command/commands/v2/MaxStatCommand.java | 63 + .../command/commands/v2/MesosCommand.java | 42 + .../command/commands/v2/ReachCommand.java | 56 + .../command/commands/v2/RechargeCommand.java | 60 + .../commands/v2/ResetSkillCommand.java | 62 + .../command/commands/v2/SearchCommand.java | 98 + .../command/commands/v2/SetStatCommand.java | 63 + src/client/command/commands/v2/SpCommand.java | 68 + .../command/commands/v2/SummonCommand.java | 83 + .../command/commands/v2/UnBugCommand.java | 40 + .../command/commands/v2/UnHideCommand.java | 42 + .../command/commands/v2/UnJailCommand.java | 56 + .../command/commands/v2/WarpCommand.java | 58 + .../command/commands/v2/WarpToCommand.java | 78 + .../command/commands/v2/WhereaMiCommand.java | 64 + .../command/commands/v3/BanCommand.java | 96 + .../command/commands/v3/ChatCommand.java | 41 + .../command/commands/v3/CheckDmgCommand.java | 56 + .../commands/v3/ClosePortalCommand.java | 44 + .../command/commands/v3/DebuffCommand.java | 118 + .../command/commands/v3/EndEventCommand.java | 41 + .../command/commands/v3/ExpedsCommand.java | 66 + .../command/commands/v3/FaceCommand.java | 75 + .../command/commands/v3/FameCommand.java | 53 + .../command/commands/v3/FlyCommand.java | 61 + .../command/commands/v3/GiveMesosCommand.java | 60 + .../command/commands/v3/GiveNxCommand.java | 61 + .../command/commands/v3/GiveVpCommand.java | 51 + .../command/commands/v3/HairCommand.java | 75 + .../command/commands/v3/HealMapCommand.java | 48 + .../commands/v3/HealPersonCommand.java | 49 + .../command/commands/v3/HpMpCommand.java | 62 + .../command/commands/v3/HurtCommand.java | 47 + src/client/command/commands/v3/IdCommand.java | 57 + .../command/commands/v3/IgnoreCommand.java | 61 + .../command/commands/v3/IgnoredCommand.java | 43 + .../command/commands/v3/InMapCommand.java | 45 + .../command/commands/v3/KillAllCommand.java | 57 + .../command/commands/v3/KillCommand.java | 53 + .../command/commands/v3/KillMapCommand.java | 44 + .../command/commands/v3/MaxEnergyCommand.java | 42 + .../command/commands/v3/MaxHpMpCommand.java | 79 + .../command/commands/v3/MonitorCommand.java | 61 + .../command/commands/v3/MonitorsCommand.java | 43 + .../command/commands/v3/MusicCommand.java | 213 ++ .../command/commands/v3/MuteMapCommand.java | 46 + .../command/commands/v3/NightCommand.java | 41 + .../command/commands/v3/NoticeCommand.java | 42 + .../command/commands/v3/NpcCommand.java | 56 + .../command/commands/v3/OnlineTwoCommand.java | 56 + .../commands/v3/OpenPortalCommand.java | 44 + src/client/command/commands/v3/PeCommand.java | 78 + .../command/commands/v3/PosCommand.java | 44 + .../commands/v3/QuestCompleteCommand.java | 60 + .../commands/v3/QuestResetCommand.java | 57 + .../commands/v3/QuestStartCommand.java | 60 + .../commands/v3/ReloadDropsCommand.java | 42 + .../commands/v3/ReloadEventsCommand.java | 45 + .../command/commands/v3/ReloadMapCommand.java | 50 + .../commands/v3/ReloadPortalsCommand.java | 42 + .../commands/v3/ReloadShopsCommand.java | 40 + .../command/commands/v3/RipCommand.java | 42 + .../command/commands/v3/SeedCommand.java | 57 + .../command/commands/v3/SpawnCommand.java | 57 + .../commands/v3/StartEventCommand.java | 45 + .../commands/v3/ToggleCouponCommand.java | 45 + .../command/commands/v3/UnBanCommand.java | 68 + .../commands/v3/WarpSnowBallCommand.java | 46 + .../command/commands/v4/CakeCommand.java | 51 + .../command/commands/v4/DropRateCommand.java | 49 + .../command/commands/v4/ExpRateCommand.java | 48 + .../command/commands/v4/ForceVacCommand.java | 76 + .../command/commands/v4/HorntailCommand.java | 46 + .../command/commands/v4/ItemVacCommand.java | 48 + .../command/commands/v4/MesoRateCommand.java | 49 + .../command/commands/v4/PapCommand.java | 41 + .../command/commands/v4/PianusCommand.java | 41 + .../command/commands/v4/PinkbeanCommand.java | 42 + .../command/commands/v4/PlayerNpcCommand.java | 48 + .../commands/v4/PlayerNpcRemoveCommand.java | 45 + .../command/commands/v4/ProItemCommand.java | 83 + .../command/commands/v4/QuestRateCommand.java | 49 + .../commands/v4/ServerMessageCommand.java | 40 + .../command/commands/v4/SetQStatCommand.java | 81 + .../commands/v4/TravelRateCommand.java | 48 + .../command/commands/v4/ZakumCommand.java | 44 + .../command/commands/v5/DebugCommand.java | 162 + .../command/commands/v5/SetCommand.java | 41 + .../commands/v5/ShowPacketsCommand.java | 39 + .../commands/v6/ClearQuestCacheCommand.java | 42 + .../commands/v6/ClearQuestCommand.java | 47 + .../command/commands/v6/DCAllCommand.java | 49 + .../commands/v6/EraseAllPNpcsCommand.java | 41 + .../command/commands/v6/FredCommand.java | 41 + .../command/commands/v6/GetAccCommand.java | 49 + .../commands/v6/MapPlayersCommand.java | 55 + .../command/commands/v6/SaveAllCommand.java | 50 + .../commands/v6/ServerAddChannelCommand.java | 69 + .../commands/v6/ServerAddWorldCommand.java | 59 + .../v6/ServerRemoveChannelCommand.java | 61 + .../commands/v6/ServerRemoveWorldCommand.java | 65 + .../commands/v6/SetGmLevelCommand.java | 55 + .../command/commands/v6/ShutdownCommand.java | 69 + .../commands/v6/SpawnAllPNpcsCommand.java | 41 + .../command/commands/v6/WarpWorldCommand.java | 68 + src/client/inventory/ItemFactory.java | 3 +- src/client/status/MonsterStatusEffect.java | 7 +- src/constants/ServerConstants.java | 23 +- src/net/MapleServerHandler.java | 43 +- src/net/mina/MaplePacketDecoder.java | 5 +- src/net/server/Server.java | 204 +- src/net/server/audit/LockCollector.java | 6 +- src/net/server/audit/ThreadTracker.java | 15 +- .../server/audit/locks/MonitoredLockType.java | 1 + src/net/server/channel/Channel.java | 2 +- .../channel/handlers/GeneralChatHandler.java | 31 +- .../channel/handlers/PetLootHandler.java | 67 +- src/net/server/coordinator/LoginStorage.java | 92 + .../coordinator/MapleSessionCoordinator.java | 339 ++ .../handlers/login/AfterLoginHandler.java | 2 + .../handlers/login/RegisterPinHandler.java | 4 + .../handlers/login/SetGenderHandler.java | 19 +- .../server/worker/LoginCoordinatorWorker.java | 34 + src/net/server/worker/LoginStorageWorker.java | 34 + .../server/worker/RankingCommandWorker.java | 34 + ...ingWorker.java => RankingLoginWorker.java} | 2 +- src/net/server/world/World.java | 20 +- src/provider/wz/XMLDomMapleData.java | 157 +- src/scripting/event/EventManager.java | 4 +- src/scripting/item/ItemScriptManager.java | 11 +- src/scripting/map/MapScriptManager.java | 9 +- src/scripting/npc/NPCScriptManager.java | 9 +- src/scripting/portal/PortalScriptManager.java | 9 +- src/scripting/quest/QuestScriptManager.java | 8 +- .../reactor/ReactorScriptManager.java | 5 +- src/server/CashShop.java | 17 +- src/server/MapleItemInformationProvider.java | 34 +- src/server/MapleShopFactory.java | 8 +- src/server/TimerManager.java | 9 +- src/server/gachapon/MapleGachapon.java | 8 +- src/server/life/MapleMonster.java | 23 +- .../life/MapleMonsterInformationProvider.java | 9 +- .../life/positioner/MaplePlayerNPCPodium.java | 6 +- .../positioner/MaplePlayerNPCPositioner.java | 6 +- src/server/loot/MapleLootInventory.java | 56 + src/server/loot/MapleLootManager.java | 81 + src/server/maps/MapleMap.java | 40 +- src/server/maps/MapleMapItem.java | 2 +- src/tools/MaplePacketCreator.java | 23 +- .../nbproject/private/private.xml | 3 +- world.ini | 4 + wz/String.wz/Consume.img.xml | 14 +- 210 files changed, 10518 insertions(+), 3851 deletions(-) create mode 100644 src/client/command/Command.java delete mode 100644 src/client/command/Commands.java create mode 100644 src/client/command/CommandsExecutor.java create mode 100644 src/client/command/RegisteredCommand.java create mode 100644 src/client/command/commands/v0/BuyBackCommand.java create mode 100644 src/client/command/commands/v0/DisposeCommand.java create mode 100644 src/client/command/commands/v0/DropLimitCommand.java create mode 100644 src/client/command/commands/v0/EquipLvCommand.java create mode 100644 src/client/command/commands/v0/GachaCommand.java create mode 100644 src/client/command/commands/v0/GmCommand.java create mode 100644 src/client/command/commands/v0/HelpCommand.java create mode 100644 src/client/command/commands/v0/JoinEventCommand.java create mode 100644 src/client/command/commands/v0/LeaveEventCommand.java create mode 100644 src/client/command/commands/v0/OnlineCommand.java create mode 100644 src/client/command/commands/v0/RanksCommand.java create mode 100644 src/client/command/commands/v0/RatesCommand.java create mode 100644 src/client/command/commands/v0/ReportBugCommand.java create mode 100644 src/client/command/commands/v0/ShowRatesCommand.java create mode 100644 src/client/command/commands/v0/StaffCommand.java create mode 100644 src/client/command/commands/v0/StatDexCommand.java create mode 100644 src/client/command/commands/v0/StatIntCommand.java create mode 100644 src/client/command/commands/v0/StatLukCommand.java create mode 100644 src/client/command/commands/v0/StatStrCommand.java create mode 100644 src/client/command/commands/v0/TimeCommand.java create mode 100644 src/client/command/commands/v0/UptimeCommand.java create mode 100644 src/client/command/commands/v1/BossHpCommand.java create mode 100644 src/client/command/commands/v1/BuffMeCommand.java create mode 100644 src/client/command/commands/v1/GotoCommand.java create mode 100644 src/client/command/commands/v1/MobHpCommand.java create mode 100644 src/client/command/commands/v1/WhatDropsFromCommand.java create mode 100644 src/client/command/commands/v1/WhoDropsCommand.java create mode 100644 src/client/command/commands/v2/ApCommand.java create mode 100644 src/client/command/commands/v2/BombCommand.java create mode 100644 src/client/command/commands/v2/BuffCommand.java create mode 100644 src/client/command/commands/v2/BuffMapCommand.java create mode 100644 src/client/command/commands/v2/ClearDropsCommand.java create mode 100644 src/client/command/commands/v2/ClearSlotCommand.java create mode 100644 src/client/command/commands/v2/DcCommand.java create mode 100644 src/client/command/commands/v2/EmpowerMeCommand.java create mode 100644 src/client/command/commands/v2/GmShopCommand.java create mode 100644 src/client/command/commands/v2/HealCommand.java create mode 100644 src/client/command/commands/v2/HideCommand.java create mode 100644 src/client/command/commands/v2/ItemCommand.java create mode 100644 src/client/command/commands/v2/ItemDropCommand.java create mode 100644 src/client/command/commands/v2/JailCommand.java create mode 100644 src/client/command/commands/v2/JobCommand.java create mode 100644 src/client/command/commands/v2/LevelCommand.java create mode 100644 src/client/command/commands/v2/LevelProCommand.java create mode 100644 src/client/command/commands/v2/MaxSkillCommand.java create mode 100644 src/client/command/commands/v2/MaxStatCommand.java create mode 100644 src/client/command/commands/v2/MesosCommand.java create mode 100644 src/client/command/commands/v2/ReachCommand.java create mode 100644 src/client/command/commands/v2/RechargeCommand.java create mode 100644 src/client/command/commands/v2/ResetSkillCommand.java create mode 100644 src/client/command/commands/v2/SearchCommand.java create mode 100644 src/client/command/commands/v2/SetStatCommand.java create mode 100644 src/client/command/commands/v2/SpCommand.java create mode 100644 src/client/command/commands/v2/SummonCommand.java create mode 100644 src/client/command/commands/v2/UnBugCommand.java create mode 100644 src/client/command/commands/v2/UnHideCommand.java create mode 100644 src/client/command/commands/v2/UnJailCommand.java create mode 100644 src/client/command/commands/v2/WarpCommand.java create mode 100644 src/client/command/commands/v2/WarpToCommand.java create mode 100644 src/client/command/commands/v2/WhereaMiCommand.java create mode 100644 src/client/command/commands/v3/BanCommand.java create mode 100644 src/client/command/commands/v3/ChatCommand.java create mode 100644 src/client/command/commands/v3/CheckDmgCommand.java create mode 100644 src/client/command/commands/v3/ClosePortalCommand.java create mode 100644 src/client/command/commands/v3/DebuffCommand.java create mode 100644 src/client/command/commands/v3/EndEventCommand.java create mode 100644 src/client/command/commands/v3/ExpedsCommand.java create mode 100644 src/client/command/commands/v3/FaceCommand.java create mode 100644 src/client/command/commands/v3/FameCommand.java create mode 100644 src/client/command/commands/v3/FlyCommand.java create mode 100644 src/client/command/commands/v3/GiveMesosCommand.java create mode 100644 src/client/command/commands/v3/GiveNxCommand.java create mode 100644 src/client/command/commands/v3/GiveVpCommand.java create mode 100644 src/client/command/commands/v3/HairCommand.java create mode 100644 src/client/command/commands/v3/HealMapCommand.java create mode 100644 src/client/command/commands/v3/HealPersonCommand.java create mode 100644 src/client/command/commands/v3/HpMpCommand.java create mode 100644 src/client/command/commands/v3/HurtCommand.java create mode 100644 src/client/command/commands/v3/IdCommand.java create mode 100644 src/client/command/commands/v3/IgnoreCommand.java create mode 100644 src/client/command/commands/v3/IgnoredCommand.java create mode 100644 src/client/command/commands/v3/InMapCommand.java create mode 100644 src/client/command/commands/v3/KillAllCommand.java create mode 100644 src/client/command/commands/v3/KillCommand.java create mode 100644 src/client/command/commands/v3/KillMapCommand.java create mode 100644 src/client/command/commands/v3/MaxEnergyCommand.java create mode 100644 src/client/command/commands/v3/MaxHpMpCommand.java create mode 100644 src/client/command/commands/v3/MonitorCommand.java create mode 100644 src/client/command/commands/v3/MonitorsCommand.java create mode 100644 src/client/command/commands/v3/MusicCommand.java create mode 100644 src/client/command/commands/v3/MuteMapCommand.java create mode 100644 src/client/command/commands/v3/NightCommand.java create mode 100644 src/client/command/commands/v3/NoticeCommand.java create mode 100644 src/client/command/commands/v3/NpcCommand.java create mode 100644 src/client/command/commands/v3/OnlineTwoCommand.java create mode 100644 src/client/command/commands/v3/OpenPortalCommand.java create mode 100644 src/client/command/commands/v3/PeCommand.java create mode 100644 src/client/command/commands/v3/PosCommand.java create mode 100644 src/client/command/commands/v3/QuestCompleteCommand.java create mode 100644 src/client/command/commands/v3/QuestResetCommand.java create mode 100644 src/client/command/commands/v3/QuestStartCommand.java create mode 100644 src/client/command/commands/v3/ReloadDropsCommand.java create mode 100644 src/client/command/commands/v3/ReloadEventsCommand.java create mode 100644 src/client/command/commands/v3/ReloadMapCommand.java create mode 100644 src/client/command/commands/v3/ReloadPortalsCommand.java create mode 100644 src/client/command/commands/v3/ReloadShopsCommand.java create mode 100644 src/client/command/commands/v3/RipCommand.java create mode 100644 src/client/command/commands/v3/SeedCommand.java create mode 100644 src/client/command/commands/v3/SpawnCommand.java create mode 100644 src/client/command/commands/v3/StartEventCommand.java create mode 100644 src/client/command/commands/v3/ToggleCouponCommand.java create mode 100644 src/client/command/commands/v3/UnBanCommand.java create mode 100644 src/client/command/commands/v3/WarpSnowBallCommand.java create mode 100644 src/client/command/commands/v4/CakeCommand.java create mode 100644 src/client/command/commands/v4/DropRateCommand.java create mode 100644 src/client/command/commands/v4/ExpRateCommand.java create mode 100644 src/client/command/commands/v4/ForceVacCommand.java create mode 100644 src/client/command/commands/v4/HorntailCommand.java create mode 100644 src/client/command/commands/v4/ItemVacCommand.java create mode 100644 src/client/command/commands/v4/MesoRateCommand.java create mode 100644 src/client/command/commands/v4/PapCommand.java create mode 100644 src/client/command/commands/v4/PianusCommand.java create mode 100644 src/client/command/commands/v4/PinkbeanCommand.java create mode 100644 src/client/command/commands/v4/PlayerNpcCommand.java create mode 100644 src/client/command/commands/v4/PlayerNpcRemoveCommand.java create mode 100644 src/client/command/commands/v4/ProItemCommand.java create mode 100644 src/client/command/commands/v4/QuestRateCommand.java create mode 100644 src/client/command/commands/v4/ServerMessageCommand.java create mode 100644 src/client/command/commands/v4/SetQStatCommand.java create mode 100644 src/client/command/commands/v4/TravelRateCommand.java create mode 100644 src/client/command/commands/v4/ZakumCommand.java create mode 100644 src/client/command/commands/v5/DebugCommand.java create mode 100644 src/client/command/commands/v5/SetCommand.java create mode 100644 src/client/command/commands/v5/ShowPacketsCommand.java create mode 100644 src/client/command/commands/v6/ClearQuestCacheCommand.java create mode 100644 src/client/command/commands/v6/ClearQuestCommand.java create mode 100644 src/client/command/commands/v6/DCAllCommand.java create mode 100644 src/client/command/commands/v6/EraseAllPNpcsCommand.java create mode 100644 src/client/command/commands/v6/FredCommand.java create mode 100644 src/client/command/commands/v6/GetAccCommand.java create mode 100644 src/client/command/commands/v6/MapPlayersCommand.java create mode 100644 src/client/command/commands/v6/SaveAllCommand.java create mode 100644 src/client/command/commands/v6/ServerAddChannelCommand.java create mode 100644 src/client/command/commands/v6/ServerAddWorldCommand.java create mode 100644 src/client/command/commands/v6/ServerRemoveChannelCommand.java create mode 100644 src/client/command/commands/v6/ServerRemoveWorldCommand.java create mode 100644 src/client/command/commands/v6/SetGmLevelCommand.java create mode 100644 src/client/command/commands/v6/ShutdownCommand.java create mode 100644 src/client/command/commands/v6/SpawnAllPNpcsCommand.java create mode 100644 src/client/command/commands/v6/WarpWorldCommand.java create mode 100644 src/net/server/coordinator/LoginStorage.java create mode 100644 src/net/server/coordinator/MapleSessionCoordinator.java create mode 100644 src/net/server/worker/LoginCoordinatorWorker.java create mode 100644 src/net/server/worker/LoginStorageWorker.java create mode 100644 src/net/server/worker/RankingCommandWorker.java rename src/net/server/worker/{RankingWorker.java => RankingLoginWorker.java} (98%) create mode 100644 src/server/loot/MapleLootInventory.java create mode 100644 src/server/loot/MapleLootManager.java diff --git a/docs/feature_list.md b/docs/feature_list.md index c23548b2b3..eede63433b 100644 --- a/docs/feature_list.md +++ b/docs/feature_list.md @@ -1,4 +1,4 @@ -#**HeavenMS** +# HeavenMS Credits: @@ -96,6 +96,7 @@ Monsters, Maps & Reactors: * Monsterbook displays drop data info conformant with the underlying DB (needs custom wz). See more on the MobBookUpdate feature. * Every skill/mastery book is now droppable by mobs. * 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. * Limited item count on maps, smartly expiring oldest registered items, preventing potential item flooding. * Implemented Zombify disease status. @@ -131,10 +132,12 @@ Player potentials: * 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. +* Optional cash shop inventory separated by player classes or fully account-ranged. Server potentials: * Multi-worlds. +* Dynamic world rates, each world can hold it's own rates from server bootup. * Dynamic World/Channel deployment. While not implemented here, new channel deployment sensitive to quantity of online players was originally resinate's idea. * Inventory auto-gather and auto-sorting feature. * Enhanced auto-pot system: pet uses as many potions as necessary to reach the desired threshold. @@ -143,7 +146,7 @@ Server potentials: * 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. * Tweaked pet/mount hunger: calculations for fullness/tiredness takes active time of the subject into account. -* Consistent experience gain system. +* 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. * Improved Duey mechanics: package received popup and reviewed many delivery mechanics. * Pet item pickup now gives preference to player attacks rather than forcing attack disables when automatically picking up. @@ -178,7 +181,9 @@ Admin/GM commands: * Server commands layered by GM levels. * Spawn Zakum/Horntail/Pinkbean. -* New commands. +* Several new commands. +* Rank command highlighting users either by world or server-wide. +* Revamped command files layout -- thanks Arthur L. External tools: @@ -213,6 +218,7 @@ Project: * Improved login phase, using cache over DB queries. * Usage of HikariCP to improve the DB connection management. * Developed many survey tools for content profiling. +* Developed a robust anti-exploit login coordinator system. * Protected many flaws with login management system. * Channel, World and Server-wide timer management. * Heavily reviewed future task management inside the project. Way less trivial schedules are spawned now, relieving task overload on the TimerManager. diff --git a/docs/issues.txt b/docs/issues.txt index 6e87a5eab8..f7b4917ab2 100644 --- a/docs/issues.txt +++ b/docs/issues.txt @@ -23,6 +23,7 @@ Missing features list: - Some pirate skills doesn't work for 3rd parties. - Cache frequently used SQL data. - Pet commands are not being propagated to 3rd parties, and the commandResponse packet function seems somewhat wonky. +- Pet speed. --------------------------- diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index 61a8b68f89..641813bf12 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -1246,4 +1246,23 @@ Retirado campo de GM da tabela "accounts". Corrigido estatuas do stage1 da GuildPQ nao funcionando corretamente. Alterado varias strings de NPCs e de mensagens utilizando a palavra "evento" querendo dizer instancias (julgamento subjetivo). Adicionado comandos para start, complete e reset quests. -Adicionado scripts para meteoritos de Omega Sector. \ No newline at end of file +Adicionado scripts para meteoritos de Omega Sector. + +18 - 19 Agosto 2018, +Refatorado comandos, desacoplando e distribuindo código para várias classes separadas por GM ranks. +Refatorado comando "ranks", não mais requisitando acesso à DB para recuperar informações de ranking. +Corrigido comando "ranks" não avaliando donators corretamente. + +20 - 23 Agosto 2018, +Implementado mecânica com loot de mobs onde somente itens coletáveis pelo jogador/party podem aparecer. +Implementado server flag que permite explorers, cygnus e legends compartilharem mesmo inventário de cash shop. +Corrigido método de ganho de mesos ignorando atualização de meso quando há overflow. +Implementado suporte para rates específicos pra cada world (exp, meso, drop, quest e travel rates). +Adicionado listagem de tipos para o comando de debug. +Implementado sistema anti-multicliente e detector de tentativas inautorizadas de acesso a contas durante a fase de login. +Corrigido setGender não modificando estado do cliente para não-logado ao cancelar a ação. + +24 Agosto 2018, +Melhorado mecânica de logout de líder de party, passando a liderança adiante antes de efetivamente deslogar, permitindo assim instâncias a continuarem após a saída do mesmo, dadas circunstâncias favoráveis. +Outra correção no XMLDomMapleData, que ainda continua dando NullPointerExceptions. +Corrigido stati de mobs não protegido concorrentemente em certos casos. \ No newline at end of file diff --git a/scripts/npc/9977777.js b/scripts/npc/9977777.js index fa84fbf511..9e47f10de7 100644 --- a/scripts/npc/9977777.js +++ b/scripts/npc/9977777.js @@ -111,6 +111,7 @@ function writeFeatureTab_MonstersMapsReactors() { addFeature("Monsterbook displays updated drop data info."); 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("Redesigned HT mechanics: assemble & dmg taken."); addFeature("Implemented Zombify disease status."); addFeature("Added Boss HP Bar for dozens of bosses."); @@ -146,10 +147,12 @@ function writeFeatureTab_Playerpotentials() { addFeature("Pet evolutions functional (not GMS-like)."); addFeature("Reviewed keybinding system."); addFeature("Character slots per world/server-wide."); + addFeature("Optional cash shop inventory separated by classes."); } function writeFeatureTab_Serverpotentials() { addFeature("Multi-worlds."); + addFeature("Each world can hold it's own rates from server bootup."); addFeature("Dynamic World/Channel deployment."); addFeature("Inventory auto-gather and auto-sorting feature."); addFeature("Enhanced auto-pot system: smart pet potion handle."); @@ -158,13 +161,13 @@ function writeFeatureTab_Serverpotentials() { addFeature("Enhanced inventory check: free slots smartly fetched."); addFeature("Enhanced petloot handler: no brute-force inv. checks."); addFeature("Tweaked pet/mount hunger to a balanced growth rate."); - addFeature("Consistent experience gain system."); + addFeature("Consistent experience and meso gain system."); addFeature("NPC crafters won't take items freely anymore."); addFeature("Duey: pkg rcvd popup and many delivery mechanics."); addFeature("Pet pickup gives preference to player attacks."); addFeature("Channel capacity bar and worlds with capacity check."); addFeature("Diseases visible for others, even after changing maps."); - addFeature("Persistent diseases. Players keep their status on login."); + addFeature("Persistent diseases. Players keeps status on login."); addFeature("Poison damage value visible for other players."); addFeature("M. book announcer displays info based on demand."); addFeature("Custom jail system."); @@ -182,9 +185,11 @@ function writeFeatureTab_Serverpotentials() { } function writeFeatureTab_AdminGMcommands() { - addFeature("Server commands layered by GM levels."); addFeature("Spawn Zakum/Horntail/Pinkbean."); addFeature("Several new commands."); + addFeature("Rank command highlighting users by world or overall."); + addFeature("Server commands layered by GM levels."); + addFeature("Revamped command files layout - thanks Arthur L!"); } function writeFeatureTab_CustomNPCs() { @@ -219,6 +224,7 @@ function writeFeatureTab_Project() { addFeature("Reviewed SQL data, eliminating duplicated entries."); addFeature("Improved login phase, using cache over DB queries."); addFeature("Protected many flaws with login management system."); + addFeature("Developed a robust anti-exploit login coordinator."); addFeature("Usage of HikariCP to improve DB connection calls."); addFeature("Developed many survey tools for content profiling."); addFeature("ThreadTracker: runtime tool for deadlock detection."); diff --git a/scripts/npc/commands.js b/scripts/npc/commands.js index 6a3c5f3c0a..a9c8257359 100644 --- a/scripts/npc/commands.js +++ b/scripts/npc/commands.js @@ -6,252 +6,18 @@ Script: commands.js */ +importPackage(Packages.client.command); + var status; var common_heading = "@"; var staff_heading = "!"; -var comm_lv6 = []; -var desc_lv6 = []; - -var comm_lv5 = []; -var desc_lv5 = []; - -var comm_lv4 = []; -var desc_lv4 = []; - -var comm_lv3 = []; -var desc_lv3 = []; - -var comm_lv2 = []; -var desc_lv2 = []; - -var comm_lv1 = []; -var desc_lv1 = []; - -var comm_lv0 = []; -var desc_lv0 = []; - var levels = ["Common", "Donator", "JrGM", "GM", "SuperGM", "Developer", "Admin"]; - -var comm_cursor, desc_cursor; - -function addCommand(comm, desc) { - comm_cursor.push(comm); - desc_cursor.push(desc); -} - -function writeHeavenMSCommandsLv6() { //Admin - comm_cursor = comm_lv6; - desc_cursor = desc_lv6; - - addCommand("setgmlevel", ""); - addCommand("warpworld", ""); - addCommand("saveall", ""); - addCommand("dcall", ""); - addCommand("mapplayers", ""); - addCommand("getacc", ""); - addCommand("addchannel", ""); - addCommand("addworld", ""); - //addCommand("removechannel", ""); - //addCommand("removeworld", ""); - addCommand("shutdown", ""); - addCommand("shutdownnow", ""); - addCommand("clearquestcache", ""); - addCommand("clearquest", ""); - addCommand("spawnallpnpcs", ""); - addCommand("eraseallpnpcs", ""); -} - -function writeHeavenMSCommandsLv5() { //Developer - comm_cursor = comm_lv5; - desc_cursor = desc_lv5; - - addCommand("debugmonster", ""); - addCommand("debugpacket", ""); - addCommand("debugportal", ""); - addCommand("debugspawnpoint", ""); - addCommand("debugpos", ""); - addCommand("debugmap", ""); - addCommand("debugmobsp", ""); - addCommand("debugevent", ""); - addCommand("debugareas", ""); - addCommand("debugreactors", ""); - addCommand("debugcoupons", ""); - addCommand("debugplayercoupons", ""); - addCommand("debugtimer", ""); - addCommand("debugmarriage", ""); - addCommand("showpackets", ""); - addCommand("set", ""); -} - -function writeHeavenMSCommandsLv4() { //SuperGM - comm_cursor = comm_lv4; - desc_cursor = desc_lv4; - - addCommand("servermessage", ""); - addCommand("proitem", ""); - addCommand("seteqstat", ""); - addCommand("exprate", ""); - addCommand("mesorate", ""); - addCommand("droprate", ""); - addCommand("questrate", ""); - addCommand("itemvac", ""); - addCommand("forcevac", ""); - addCommand("zakum", ""); - addCommand("horntail", ""); - addCommand("pinkbean", ""); - addCommand("pap", ""); - addCommand("pianus", ""); - addCommand("cake", ""); - addCommand("playernpcremove", ""); - addCommand("playernpc", ""); -} - -function writeHeavenMSCommandsLv3() { //GM - comm_cursor = comm_lv3; - desc_cursor = desc_lv3; - - addCommand("debuff", ""); - addCommand("fly", ""); - addCommand("spawn", ""); - addCommand("mutemap", ""); - addCommand("checkdmg", ""); - addCommand("inmap", ""); - addCommand("reloadevents", ""); - addCommand("reloaddrops", ""); - addCommand("reloadportals", ""); - addCommand("reloadmap", ""); - addCommand("reloadshops", ""); - addCommand("hpmp", ""); - addCommand("maxhpmp", ""); - addCommand("music", ""); - addCommand("monitor", ""); - addCommand("monitors", ""); - addCommand("ignore", ""); - addCommand("ignored", ""); - addCommand("pos", ""); - addCommand("togglecoupon", ""); - addCommand("chat", ""); - addCommand("fame", ""); - addCommand("givenx", ""); - addCommand("givevp", ""); - addCommand("givems", ""); - addCommand("id", ""); - addCommand("expeds", ""); - addCommand("kill", ""); - addCommand("seed", ""); - addCommand("maxenergy", ""); - addCommand("killall", ""); - addCommand("notice", ""); - addCommand("rip", ""); - addCommand("openportal", ""); - addCommand("closeportal", ""); - addCommand("pe", ""); - addCommand("startevent", ""); - addCommand("endevent", ""); - addCommand("online2", ""); - addCommand("warpsnowball", ""); - addCommand("ban", ""); - addCommand("unban", ""); - addCommand("healmap", ""); - addCommand("healperson", ""); - addCommand("hurt", ""); - addCommand("killmap", ""); - addCommand("night", ""); - addCommand("npc", ""); - addCommand("face", ""); - addCommand("hair", ""); - addCommand("startquest", ""); - addCommand("completequest", ""); - addCommand("resetquest", ""); -} - -function writeHeavenMSCommandsLv2() { //JrGM - comm_cursor = comm_lv2; - desc_cursor = desc_lv2; - - addCommand("recharge", ""); - addCommand("whereami", ""); - addCommand("hide", ""); - addCommand("unhide", ""); - addCommand("sp", ""); - addCommand("ap", ""); - addCommand("empowerme", ""); - addCommand("buffmap", ""); - addCommand("buff", ""); - addCommand("bomb", ""); - addCommand("dc", ""); - addCommand("cleardrops", ""); - addCommand("clearslot", ""); - addCommand("warp", ""); - addCommand("warpto", ""); - addCommand("warphere", ""); - addCommand("reach", ""); - addCommand("gmshop", ""); - addCommand("heal", ""); - addCommand("item", ""); - addCommand("level", ""); - addCommand("levelpro", ""); - addCommand("setstat", ""); - addCommand("maxstat", ""); - addCommand("maxskill", ""); - addCommand("resetskill", ""); - addCommand("mesos", ""); - addCommand("search", ""); - addCommand("jail", ""); - addCommand("unjail", ""); - addCommand("job", ""); - addCommand("unbug", ""); -} - -function writeHeavenMSCommandsLv1() { //Donator - comm_cursor = comm_lv1; - desc_cursor = desc_lv1; - - addCommand("bosshp", ""); - addCommand("mobhp", ""); - addCommand("whatdropsfrom", ""); - addCommand("whodrops", ""); - addCommand("buffme", ""); - addCommand("goto", ""); -} - -function writeHeavenMSCommandsLv0() { //Common - comm_cursor = comm_lv0; - desc_cursor = desc_lv0; - - addCommand("commands", ""); - addCommand("droplimit", ""); - addCommand("time", ""); - addCommand("credits", ""); - addCommand("uptime", ""); - addCommand("gacha", ""); - addCommand("dispose", ""); - addCommand("equiplv", ""); - addCommand("showrates", ""); - addCommand("rates", ""); - addCommand("online", ""); - addCommand("gm", ""); - addCommand("reportbug", ""); - //addCommand("points", ""); - addCommand("joinevent", ""); - addCommand("leaveevent", ""); - addCommand("ranks", ""); - addCommand("str", ""); - addCommand("dex", ""); - addCommand("int", ""); - addCommand("luk", ""); -} +var commands; function writeHeavenMSCommands() { - writeHeavenMSCommandsLv0(); //Common - writeHeavenMSCommandsLv1(); //Donator - writeHeavenMSCommandsLv2(); //JrGM - writeHeavenMSCommandsLv3(); //GM - writeHeavenMSCommandsLv4(); //Developer - writeHeavenMSCommandsLv5(); //SuperGM - writeHeavenMSCommandsLv6(); //Admin + commands = CommandsExecutor.getInstance().getGmCommands(); } function start() { @@ -282,33 +48,19 @@ function action(mode, type, selection) { cm.sendSimple(sendStr); } else if(status == 1) { var lvComm, lvDesc, lvHead = (cm.getPlayer().gmLevel() < 2) ? common_heading : staff_heading; - - if(selection == 0) { - lvComm = comm_lv0; - lvDesc = desc_lv0; - } else if(selection == 1) { - lvComm = comm_lv1; - lvDesc = desc_lv1; - } else if(selection == 2) { - lvComm = comm_lv2; - lvDesc = desc_lv2; - } else if(selection == 3) { - lvComm = comm_lv3; - lvDesc = desc_lv3; - } else if(selection == 4) { - lvComm = comm_lv4; - lvDesc = desc_lv4; - } else if(selection == 5) { - lvComm = comm_lv5; - lvDesc = desc_lv5; - } else { - lvComm = comm_lv6; - lvDesc = desc_lv6; + + if(selection > 6) { + selection = 6; + } else if(selection < 0) { + selection = 0; } - + + lvComm = commands.get(selection).getLeft(); + lvDesc = commands.get(selection).getRight(); + var sendStr = "The following commands are available for #b" + levels[selection] + "#k:\r\n\r\n"; - for(var i = 0; i < lvComm.length; i++) { - sendStr += " #L" + i + "# " + lvHead + lvComm[i] + " - " + lvDesc[i]; + for(var i = 0; i < lvComm.size(); i++) { + sendStr += " #L" + i + "# " + lvHead + lvComm.get(i) + " - " + lvDesc.get(i); sendStr += "#l\r\n"; } diff --git a/scripts/npc/credits.js b/scripts/npc/credits.js index ac94890497..11d59bf777 100644 --- a/scripts/npc/credits.js +++ b/scripts/npc/credits.js @@ -61,7 +61,7 @@ function writeServerStaff_MoopleDEV() { } function writeServerStaff_MetroMS() { - addPerson("Moongra", "Developer"); + addPerson("Moogra", "Developer"); setHistory(2009, 2010); } @@ -73,6 +73,7 @@ function writeServerStaff_BubblesDEV() { function writeServerStaff_ThePackII() { addPerson("Hofer", "Developer"); + addPerson("Moogra", "Developer"); setHistory(2008, 2009); } diff --git a/sql/db_database.sql b/sql/db_database.sql index f5192881d4..a1b780a0c8 100644 --- a/sql/db_database.sql +++ b/sql/db_database.sql @@ -1,4 +1,4 @@ -#EXECUTE THIS FIRST, THEN NEXT SQL: 'db_drops.sql' +#EXECUTE THIS FIRST, THEN NEXT SQL: 'db_drops.sql' SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `accounts` ( `hwid` varchar(12) NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), - KEY `ranking1` (`id`,`banned`,`gm`), + KEY `ranking1` (`id`,`banned`), INDEX (id, name), INDEX (id, nxCredit, maplePoint, nxPrepaid) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; @@ -13005,14 +13005,12 @@ CREATE TABLE IF NOT EXISTS `ipbans` ( PRIMARY KEY (`ipbanid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -CREATE TABLE IF NOT EXISTS `iplog` ( - `iplogid` int(10) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE IF NOT EXISTS `ipaccounts` ( `accountid` int(11) NOT NULL DEFAULT '0', - `ip` varchar(30) NOT NULL DEFAULT '', - `login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`iplogid`), - KEY `accountid` (`accountid`,`ip`), - KEY `ip` (`ip`) + `ip` varchar(40) NOT NULL DEFAULT '', + `relevance` tinyint(2) NOT NULL DEFAULT '0', + `expiresat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`accountid`,`ip`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `keymap` ( diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 7c2a820088..e29c3902ca 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -77,6 +77,7 @@ import server.events.gm.MapleFitness; 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; @@ -92,6 +93,7 @@ import server.maps.MaplePlayerShop; import server.maps.MaplePlayerShopItem; import server.maps.MapleSummon; import server.life.MaplePlayerNPC; +import server.life.MonsterDropEntry; import server.maps.SavedLocation; import server.maps.SavedLocationType; import server.partyquest.MonsterCarnival; @@ -279,7 +281,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { 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 quest tasks as well + private Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true); // for meso & quest tasks as well private Lock prtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PRT); private Map> excluded = new LinkedHashMap<>(); private Set excludedItems = new LinkedHashSet<>(); @@ -1852,7 +1854,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return; } - if (mapitem.getQuest() > 0 && !this.needQuestItem(mapitem.getQuest(), mapitem.getItemId())) { + if (!this.needQuestItem(mapitem.getQuest(), mapitem.getItemId())) { client.announce(MaplePacketCreator.showItemUnavailable()); client.announce(MaplePacketCreator.enableActions()); return; @@ -1984,13 +1986,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void deleteGuild(int guildId) { try { Connection con = DatabaseConnection.getConnection(); - try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET guildid = 0, guildrank = 5 WHERE guildid = ?")) { - ps.setInt(1, guildId); - ps.execute(); - } - try (PreparedStatement ps = con.prepareStatement("DELETE FROM guilds WHERE guildid = ?")) { - ps.setInt(1, id); - ps.execute(); + try { + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET guildid = 0, guildrank = 5 WHERE guildid = ?")) { + ps.setInt(1, guildId); + ps.execute(); + } + try (PreparedStatement ps = con.prepareStatement("DELETE FROM guilds WHERE guildid = ?")) { + ps.setInt(1, id); + ps.execute(); + } } finally { con.close(); } @@ -2897,13 +2901,27 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void gainMeso(int gain, boolean show, boolean enableActions, boolean inChat) { - if (meso.get() + gain < 0) { - client.announce(MaplePacketCreator.enableActions()); - return; + long nextMeso; + petLock.lock(); + try { + nextMeso = meso.get() + gain; + if (nextMeso > Integer.MAX_VALUE) { + gain -= (nextMeso - Integer.MAX_VALUE); + } else if (nextMeso < 0) { + gain = -meso.get(); + } + nextMeso = meso.addAndGet(gain); + } finally { + petLock.unlock(); } - updateSingleStat(MapleStat.MESO, meso.addAndGet(gain), enableActions); - if (show) { - client.announce(MaplePacketCreator.getShowMesoGain(gain, inChat)); + + if (gain != 0) { + updateSingleStat(MapleStat.MESO, (int) nextMeso, enableActions); + if (show) { + client.announce(MaplePacketCreator.getShowMesoGain(gain, inChat)); + } + } else { + client.announce(MaplePacketCreator.enableActions()); } } @@ -4817,6 +4835,18 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return false; } + + public List retrieveRelevantDrops(int monsterId) { + List pchars = new LinkedList<>(); + for (MapleCharacter chr : getPartyMembers()) { + if (chr.isLoggedinWorld()) { + pchars.add(chr); + } + } + + if(pchars.isEmpty()) pchars.add(this); + return MapleLootManager.retrieveRelevantDrops(monsterId, pchars); + } public MaplePlayerShop getPlayerShop() { return playerShop; diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index 874f633a0f..0de1520973 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -48,6 +48,8 @@ import tools.*; import javax.script.ScriptEngine; import net.server.Server; +import net.server.coordinator.MapleSessionCoordinator; +import net.server.coordinator.MapleSessionCoordinator.AntiMulticlientResult; import net.server.channel.Channel; import net.server.guild.MapleGuild; import net.server.guild.MapleGuildCharacter; @@ -88,7 +90,7 @@ public class MapleClient { private final IoSession session; private MapleCharacter player; private int channel = 1; - private int accId = 1; + private int accId = 0; private boolean loggedIn = false; private boolean serverTransition = false; private Calendar birthday = null; @@ -462,7 +464,7 @@ public class MapleClient { public boolean checkPin(String other) { pinattempt++; if (pinattempt > 5) { - session.close(false); + MapleSessionCoordinator.getInstance().closeSession(session, false); } if (pin.equals(other)) { pinattempt = 0; @@ -496,7 +498,7 @@ public class MapleClient { picattempt++; if (picattempt > 5) { - session.close(false); + MapleSessionCoordinator.getInstance().closeSession(session, false); } if (pic.equals(other)) { picattempt = 0; @@ -508,7 +510,7 @@ public class MapleClient { public int login(String login, String pwd) { loginattempt++; if (loginattempt > 4) { - session.close(false); + MapleSessionCoordinator.getInstance().closeSession(session, false); } int loginok = 5; Connection con = null; @@ -549,10 +551,6 @@ public class MapleClient { loggedIn = false; loginok = 4; } - ps = con.prepareStatement("INSERT INTO iplog (accountid, ip) VALUES (?, ?)"); - ps.setInt(1, accId); - ps.setString(2, session.getRemoteAddress().toString()); - ps.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); @@ -571,10 +569,36 @@ public class MapleClient { e.printStackTrace(); } } - if (loginok == 0) { - loginattempt = 0; - } - return loginok; + + if (loginok == 0 || loginok == 4) { + AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptSessionLogin(session, accId, loginok == 4); + + switch (res) { + case SUCCESS: + if (loginok == 0) { + loginattempt = 0; + } + + return loginok; + + case REMOTE_LOGGEDIN: + return 17; + + case REMOTE_REACHED_LIMIT: + return 13; + + case REMOTE_PROCESSING: + return 10; + + case MANY_ACCOUNT_ATTEMPTS: + return 16; + + default: + return 8; + } + } else { + return loginok; + } } public Calendar getTempBanCalendar() { @@ -717,13 +741,15 @@ public class MapleClient { public void updateLoginState(int newstate) { try { - Connection con = DatabaseConnection.getConnection(); - try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ?, lastlogin = CURRENT_TIMESTAMP() WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ?, lastlogin = ? WHERE id = ?")) { + // using sql currenttime here could potentially break the login, thanks Arnah for pointing this out + ps.setInt(1, newstate); - ps.setInt(2, getAccID()); + ps.setTimestamp(2, new java.sql.Timestamp(Server.getInstance().getCurrentTime())); + ps.setInt(3, getAccID()); ps.executeUpdate(); } - con.close(); } catch (SQLException e) { e.printStackTrace(); @@ -731,6 +757,7 @@ public class MapleClient { if (newstate == LOGIN_NOTLOGGEDIN) { loggedIn = false; serverTransition = false; + setAccID(0); } else { serverTransition = (newstate == LOGIN_SERVER_TRANSITION); loggedIn = !serverTransition; @@ -756,9 +783,9 @@ public class MapleClient { int state = rs.getInt("loggedin"); if (state == LOGIN_SERVER_TRANSITION) { - // Arnah's note: lastlogin is a date-type, in case of login and game servers being of different timezones this becomes broken - if (rs.getTimestamp("lastlogin").getTime() + 30000 < System.currentTimeMillis()) { + if (rs.getTimestamp("lastlogin").getTime() + 30000 < Server.getInstance().getCurrentTime()) { state = LOGIN_NOTLOGGEDIN; + MapleSessionCoordinator.getInstance().closeSession(session, null); updateLoginState(LOGIN_NOTLOGGEDIN); } } else if (state == LOGIN_LOGGEDIN && player == null) { @@ -791,7 +818,30 @@ public class MapleClient { return date.get(Calendar.YEAR) == birthday.get(Calendar.YEAR) && date.get(Calendar.MONTH) == birthday.get(Calendar.MONTH) && date.get(Calendar.DAY_OF_MONTH) == birthday.get(Calendar.DAY_OF_MONTH); } - private void removePlayer() { + private void removePartyPlayer(World wserv) { + MapleMap map = player.getMap(); + final MapleParty party = player.getParty(); + final int idz = player.getId(); + final MaplePartyCharacter chrp = new MaplePartyCharacter(player); + + if (party != null) { + chrp.setOnline(false); + wserv.updateParty(party.getId(), PartyOperation.LOG_ONOFF, chrp); + if (party.getLeader().getId() == idz && map != null) { + MaplePartyCharacter lchr = null; + for (MaplePartyCharacter pchr : party.getMembers()) { + if (pchr != null && pchr.getId() != idz && (lchr == null || lchr.getLevel() <= pchr.getLevel()) && map.getCharacterById(pchr.getId()) != null) { + lchr = pchr; + } + } + if (lchr != null) { + wserv.updateParty(party.getId(), PartyOperation.CHANGE_LEADER, lchr); + } + } + } + } + + private void removePlayer(World wserv) { try { player.setDisconnectedFromChannelWorld(); player.notifyMapTransferToPartner(-1); @@ -799,11 +849,14 @@ public class MapleClient { player.closePlayerInteractions(); QuestScriptManager.getInstance().dispose(this); - + + removePartyPlayer(wserv); + EventInstanceManager eim = player.getEventInstance(); if (eim != null) { eim.playerDisconnected(player); } + if (player.getMap() != null) { int mapId = player.getMapId(); player.getMap().removePlayer(player); @@ -823,37 +876,33 @@ public class MapleClient { } disconnecting = true; if (player != null && player.isLoggedin() && player.getClient() != null) { - MapleMap map = player.getMap(); - final MapleParty party = player.getParty(); - final int idz = player.getId(); final int messengerid = player.getMessenger() == null ? 0 : player.getMessenger().getId(); //final int fid = player.getFamilyId(); final BuddyList bl = player.getBuddylist(); - final MaplePartyCharacter chrp = new MaplePartyCharacter(player); final MapleMessengerCharacter chrm = new MapleMessengerCharacter(player, 0); final MapleGuildCharacter chrg = player.getMGC(); final MapleGuild guild = player.getGuild(); player.cancelMagicDoor(); - final World wserv = getWorldServer(); - if (channel == -1 || shutdown) { - if(chrg != null) chrg.setCharacter(null); - - if(wserv != null) wserv.removePlayer(player); - removePlayer(); - - player.saveCooldowns(); - player.cancelAllDebuffs(); - player.saveCharToDB(true); - - clear(); - return; - } - - removePlayer(); - + final World wserv = getWorldServer(); // obviously wserv is NOT null if this player was online on it try { + if (channel == -1 || shutdown) { + if(chrg != null) chrg.setCharacter(null); + + wserv.removePlayer(player); + removePlayer(wserv); + + player.saveCooldowns(); + player.cancelAllDebuffs(); + player.saveCharToDB(true); + + clear(); + return; + } + + removePlayer(wserv); + if (!cashshop) { if (!this.serverTransition) { // meaning not changing channels if (messengerid > 0) { @@ -878,42 +927,12 @@ public class MapleClient { server.setGuildMemberOnline(player, false, player.getClient().getChannel()); player.getClient().announce(MaplePacketCreator.showGuildInfo(player)); } - if (party != null) { - chrp.setOnline(false); - wserv.updateParty(party.getId(), PartyOperation.LOG_ONOFF, chrp); - if (map != null && party.getLeader().getId() == idz) { - MaplePartyCharacter lchr = null; - for (MaplePartyCharacter pchr : party.getMembers()) { - if (pchr != null && map.getCharacterById(pchr.getId()) != null && (lchr == null || lchr.getLevel() <= pchr.getLevel())) { - lchr = pchr; - } - } - if (lchr != null) { - wserv.updateParty(party.getId(), PartyOperation.CHANGE_LEADER, lchr); - } - } - } if (bl != null) { wserv.loggedOff(player.getName(), player.getId(), channel, player.getBuddylist().getBuddyIds()); } } } else { - if (!this.serverTransition) { // if dc inside of cash shop. - if (party != null) { - chrp.setOnline(false); - wserv.updateParty(party.getId(), PartyOperation.LOG_ONOFF, chrp); - if (map != null && party.getLeader().getId() == idz) { - MaplePartyCharacter lchr = null; - for (MaplePartyCharacter pchr : party.getMembers()) { - if (pchr != null && map.getCharacterById(pchr.getId()) != null && (lchr == null || lchr.getLevel() <= pchr.getLevel())) { - lchr = pchr; - } - } - if (lchr != null) { - wserv.updateParty(party.getId(), PartyOperation.CHANGE_LEADER, lchr); - } - } - } + if (!this.serverTransition) { // if dc inside of cash shop. if (bl != null) { wserv.loggedOff(player.getName(), player.getId(), channel, player.getBuddylist().getBuddyIds()); } @@ -943,10 +962,10 @@ public class MapleClient { } } if (!serverTransition && isLoggedIn()) { + MapleSessionCoordinator.getInstance().closeSession(session, false); updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); session.removeAttribute(MapleClient.CLIENT_KEY); // prevents double dcing during login - session.close(false); - + clear(); } else { engines.clear(); @@ -1026,7 +1045,9 @@ public class MapleClient { try { if (lastPong < timeThen) { if (session != null && session.isConnected()) { - session.close(false); + MapleSessionCoordinator.getInstance().closeSession(session, false); + updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN); + session.removeAttribute(MapleClient.CLIENT_KEY); } } } catch (NullPointerException e) { diff --git a/src/client/command/Command.java b/src/client/command/Command.java new file mode 100644 index 0000000000..874c9a36a6 --- /dev/null +++ b/src/client/command/Command.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command; + +import client.MapleClient; + +public abstract class Command { + + protected String description; + + public abstract void execute(MapleClient client, String[] params); + + public String getDescription() { + return description; + } + + protected void setDescription(String description) { + this.description = description; + } + + protected String joinStringFrom(String arr[], int start) { + StringBuilder builder = new StringBuilder(); + for (int i = start; i < arr.length; i++) { + builder.append(arr[i]); + if (i != arr.length - 1) { + builder.append(" "); + } + } + return builder.toString(); + } +} + diff --git a/src/client/command/Commands.java b/src/client/command/Commands.java deleted file mode 100644 index 566d1ea2d0..0000000000 --- a/src/client/command/Commands.java +++ /dev/null @@ -1,3159 +0,0 @@ -/* - 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 . - */ -package client.command; - -import java.awt.Point; -import java.awt.Rectangle; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.net.URL; -import java.net.UnknownHostException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.TimeZone; - -import client.inventory.manipulator.MapleInventoryManipulator; -import net.MaplePacketHandler; -import net.PacketProcessor; -import net.server.Server; -import net.server.channel.Channel; -import net.server.world.World; -import provider.MapleData; -import provider.MapleDataProvider; -import provider.MapleDataProviderFactory; -import provider.MapleDataTool; -import scripting.npc.NPCScriptManager; -import scripting.portal.PortalScriptManager; -import server.MapleItemInformationProvider; -import server.MaplePortal; -import server.MapleShopFactory; -import server.TimerManager; -import server.events.gm.MapleEvent; -import server.expeditions.MapleExpedition; -import server.gachapon.MapleGachapon.Gachapon; -import server.life.MapleLifeFactory; -import server.life.MapleMonster; -import server.life.MapleMonsterInformationProvider; -import server.life.MapleNPC; -import server.life.MaplePlayerNPC; -import server.life.MobSkill; -import server.life.MobSkillFactory; -import server.life.MonsterDropEntry; -import server.maps.MapleMap; -import server.maps.MapleMapItem; -import server.maps.MapleMapObject; -import server.maps.MapleMapObjectType; -import server.maps.MapleReactor; -import server.quest.MapleQuest; -import tools.DatabaseConnection; -import tools.FilePrinter; -import tools.HexTool; -import tools.MapleLogger; -import tools.MaplePacketCreator; -import tools.Pair; -import tools.Randomizer; -import tools.data.input.ByteArrayByteStream; -import tools.data.input.GenericSeekableLittleEndianAccessor; -import tools.data.input.SeekableLittleEndianAccessor; -import tools.data.output.MaplePacketLittleEndianWriter; -import client.MapleBuffStat; -import client.MapleCharacter; -import client.MapleClient; -import client.MapleDisease; -import client.MapleJob; -import client.MapleStat; -import client.Skill; -import client.SkillFactory; -import client.inventory.Item; -import client.inventory.Equip; -import client.inventory.MapleInventory; -import client.inventory.MapleInventoryType; -import client.inventory.MaplePet; -import client.processor.BuybackProcessor; -import constants.ItemConstants; -import constants.ServerConstants; -import java.util.ArrayList; -import server.life.SpawnPoint; -import server.maps.FieldLimit; - -public class Commands { - private static HashMap gotomaps = new HashMap(); - - private static String[] tips = { - "Please only use @gm in emergencies or to report somebody.", - "To report a bug or make a suggestion, use the forum.", - "Please do not use @gm to ask if a GM is online.", - "Do not ask if you can receive help, just state your issue.", - "Do not say 'I have a bug to report', just state it.", - }; - - private static String[] songs = { - "Jukebox/Congratulation", - "Bgm00/SleepyWood", - "Bgm00/FloralLife", - "Bgm00/GoPicnic", - "Bgm00/Nightmare", - "Bgm00/RestNPeace", - "Bgm01/AncientMove", - "Bgm01/MoonlightShadow", - "Bgm01/WhereTheBarlogFrom", - "Bgm01/CavaBien", - "Bgm01/HighlandStar", - "Bgm01/BadGuys", - "Bgm02/MissingYou", - "Bgm02/WhenTheMorningComes", - "Bgm02/EvilEyes", - "Bgm02/JungleBook", - "Bgm02/AboveTheTreetops", - "Bgm03/Subway", - "Bgm03/Elfwood", - "Bgm03/BlueSky", - "Bgm03/Beachway", - "Bgm03/SnowyVillage", - "Bgm04/PlayWithMe", - "Bgm04/WhiteChristmas", - "Bgm04/UponTheSky", - "Bgm04/ArabPirate", - "Bgm04/Shinin'Harbor", - "Bgm04/WarmRegard", - "Bgm05/WolfWood", - "Bgm05/DownToTheCave", - "Bgm05/AbandonedMine", - "Bgm05/MineQuest", - "Bgm05/HellGate", - "Bgm06/FinalFight", - "Bgm06/WelcomeToTheHell", - "Bgm06/ComeWithMe", - "Bgm06/FlyingInABlueDream", - "Bgm06/FantasticThinking", - "Bgm07/WaltzForWork", - "Bgm07/WhereverYouAre", - "Bgm07/FunnyTimeMaker", - "Bgm07/HighEnough", - "Bgm07/Fantasia", - "Bgm08/LetsMarch", - "Bgm08/ForTheGlory", - "Bgm08/FindingForest", - "Bgm08/LetsHuntAliens", - "Bgm08/PlotOfPixie", - "Bgm09/DarkShadow", - "Bgm09/TheyMenacingYou", - "Bgm09/FairyTale", - "Bgm09/FairyTalediffvers", - "Bgm09/TimeAttack", - "Bgm10/Timeless", - "Bgm10/TimelessB", - "Bgm10/BizarreTales", - "Bgm10/TheWayGrotesque", - "Bgm10/Eregos", - "Bgm11/BlueWorld", - "Bgm11/Aquarium", - "Bgm11/ShiningSea", - "Bgm11/DownTown", - "Bgm11/DarkMountain", - "Bgm12/AquaCave", - "Bgm12/DeepSee", - "Bgm12/WaterWay", - "Bgm12/AcientRemain", - "Bgm12/RuinCastle", - "Bgm12/Dispute", - "Bgm13/CokeTown", - "Bgm13/Leafre", - "Bgm13/Minar'sDream", - "Bgm13/AcientForest", - "Bgm13/TowerOfGoddess", - "Bgm14/DragonLoad", - "Bgm14/HonTale", - "Bgm14/CaveOfHontale", - "Bgm14/DragonNest", - "Bgm14/Ariant", - "Bgm14/HotDesert", - "Bgm15/MureungHill", - "Bgm15/MureungForest", - "Bgm15/WhiteHerb", - "Bgm15/Pirate", - "Bgm15/SunsetDesert", - "Bgm16/Duskofgod", - "Bgm16/FightingPinkBeen", - "Bgm16/Forgetfulness", - "Bgm16/Remembrance", - "Bgm16/Repentance", - "Bgm16/TimeTemple", - "Bgm17/MureungSchool1", - "Bgm17/MureungSchool2", - "Bgm17/MureungSchool3", - "Bgm17/MureungSchool4", - "Bgm18/BlackWing", - "Bgm18/DrillHall", - "Bgm18/QueensGarden", - "Bgm18/RaindropFlower", - "Bgm18/WolfAndSheep", - "Bgm19/BambooGym", - "Bgm19/CrystalCave", - "Bgm19/MushCatle", - "Bgm19/RienVillage", - "Bgm19/SnowDrop", - "Bgm20/GhostShip", - "Bgm20/NetsPiramid", - "Bgm20/UnderSubway", - "Bgm21/2021year", - "Bgm21/2099year", - "Bgm21/2215year", - "Bgm21/2230year", - "Bgm21/2503year", - "Bgm21/KerningSquare", - "Bgm21/KerningSquareField", - "Bgm21/KerningSquareSubway", - "Bgm21/TeraForest", - "BgmEvent/FunnyRabbit", - "BgmEvent/FunnyRabbitFaster", - "BgmEvent/wedding", - "BgmEvent/weddingDance", - "BgmEvent/wichTower", - "BgmGL/amoria", - "BgmGL/Amorianchallenge", - "BgmGL/chapel", - "BgmGL/cathedral", - "BgmGL/Courtyard", - "BgmGL/CrimsonwoodKeep", - "BgmGL/CrimsonwoodKeepInterior", - "BgmGL/GrandmastersGauntlet", - "BgmGL/HauntedHouse", - "BgmGL/NLChunt", - "BgmGL/NLCtown", - "BgmGL/NLCupbeat", - "BgmGL/PartyQuestGL", - "BgmGL/PhantomForest", - "BgmJp/Feeling", - "BgmJp/BizarreForest", - "BgmJp/Hana", - "BgmJp/Yume", - "BgmJp/Bathroom", - "BgmJp/BattleField", - "BgmJp/FirstStepMaster", - "BgmMY/Highland", - "BgmMY/KualaLumpur", - "BgmSG/BoatQuay_field", - "BgmSG/BoatQuay_town", - "BgmSG/CBD_field", - "BgmSG/CBD_town", - "BgmSG/Ghostship", - "BgmUI/ShopBgm", - "BgmUI/Title" - }; - - static { - gotomaps.put("gmmap", 180000000); - gotomaps.put("southperry", 60000); - gotomaps.put("amherst", 1000000); - gotomaps.put("henesys", 100000000); - gotomaps.put("ellinia", 101000000); - gotomaps.put("perion", 102000000); - gotomaps.put("kerning", 103000000); - gotomaps.put("lith", 104000000); - gotomaps.put("sleepywood", 105040300); - gotomaps.put("florina", 110000000); - gotomaps.put("nautilus", 120000000); - gotomaps.put("ereve", 130000000); - gotomaps.put("rien", 140000000); - gotomaps.put("orbis", 200000000); - gotomaps.put("happy", 209000000); - gotomaps.put("elnath", 211000000); - gotomaps.put("ludi", 220000000); - gotomaps.put("aqua", 230000000); - gotomaps.put("leafre", 240000000); - gotomaps.put("mulung", 250000000); - gotomaps.put("herb", 251000000); - gotomaps.put("omega", 221000000); - gotomaps.put("korean", 222000000); - gotomaps.put("ellin", 300000000); - gotomaps.put("nlc", 600000000); - gotomaps.put("excavation", 990000000); - gotomaps.put("pianus", 230040420); - gotomaps.put("horntail", 240060200); - gotomaps.put("mushmom", 100000005); - gotomaps.put("griffey", 240020101); - gotomaps.put("manon", 240020401); - gotomaps.put("horseman", 682000001); - gotomaps.put("balrog", 105090900); - gotomaps.put("zakum", 211042300); - gotomaps.put("papu", 220080001); - gotomaps.put("showa", 801000000); - gotomaps.put("guild", 200000301); - gotomaps.put("shrine", 800000000); - gotomaps.put("skelegon", 240040511); - gotomaps.put("hpq", 100000200); - gotomaps.put("ht", 240050400); - gotomaps.put("ariant", 260000000); - gotomaps.put("magatia", 261000000); - gotomaps.put("singapore", 540000000); - gotomaps.put("keep", 610020006); - gotomaps.put("amoria", 680000000); - gotomaps.put("temple", 270000100); - gotomaps.put("neo", 240070000); - gotomaps.put("fm", 910000000); - } - - private static void hardsetItemStats(Equip equip, short stat) { - equip.setStr(stat); - equip.setDex(stat); - equip.setInt(stat); - equip.setLuk(stat); - equip.setMatk(stat); - equip.setWatk(stat); - equip.setAcc(stat); - equip.setAvoid(stat); - equip.setJump(stat); - equip.setSpeed(stat); - equip.setWdef(stat); - equip.setMdef(stat); - equip.setHp(stat); - equip.setMp(stat); - - byte flag = equip.getFlag(); - flag |= ItemConstants.UNTRADEABLE; - equip.setFlag(flag); - } - - public static boolean executeHeavenMsCommandLv0(Channel cserv, Server srv, MapleClient c, String[] sub) { //Player - MapleCharacter player = c.getPlayer(); - - switch(sub[0]) { - case "help": - case "commands": - case "playercommands": - c.getAbstractPlayerInteraction().openNpc(9201143, "commands"); - break; - - case "droplimit": - int dropCount = c.getPlayer().getMap().getDroppedItemCount(); - if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) { - c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); - } else { - c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); - } - - break; - - case "buyback": - BuybackProcessor.processBuyback(c); - break; - - case "time": - DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); - dateFormat.setTimeZone(TimeZone.getTimeZone(ServerConstants.TIMEZONE)); - player.yellowMessage("HeavenMS Server Time: " + dateFormat.format(new Date())); - break; - - case "credits": - case "staff": - c.getAbstractPlayerInteraction().openNpc(2010007, "credits"); - break; - - case "lastrestart": - case "uptime": - long milliseconds = System.currentTimeMillis() - Server.uptime; - int seconds = (int) (milliseconds / 1000) % 60 ; - int minutes = (int) ((milliseconds / (1000*60)) % 60); - int hours = (int) ((milliseconds / (1000*60*60)) % 24); - int days = (int) ((milliseconds / (1000*60*60*24))); - player.yellowMessage("Server has been online for " + days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds."); - break; - - case "gacha": - Gachapon gacha = null; - String search = joinStringFrom(sub, 1); - String gachaName = ""; - String [] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"}; - int [] ids = {9100100, 9100101, 9100102, 9100103, 9100104, 9100105, 9100106, 9100107, 9100109, 9100117}; - for (int i = 0; i < names.length; i++){ - if (search.equalsIgnoreCase(names[i])){ - gachaName = names[i]; - gacha = Gachapon.getByNpcId(ids[i]); - } - } - if (gacha == null){ - player.yellowMessage("Please use @gacha where name corresponds to one of the below:"); - for (String name : names){ - player.yellowMessage(name); - } - break; - } - String talkStr = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n"; - for (int i = 0; i < 2; i++){ - for (int id : gacha.getItems(i)){ - talkStr += "-" + MapleItemInformationProvider.getInstance().getName(id) + "\r\n"; - } - } - talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here."; - c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, talkStr, "00 00", (byte) 0)); - break; - - case "dispose": - NPCScriptManager.getInstance().dispose(c); - c.announce(MaplePacketCreator.enableActions()); - c.removeClickedNPC(); - player.message("You've been disposed."); - break; - - case "equiplv": - player.showAllEquipFeatures(); - break; - - case "showrates": - String showMsg = "#eEXP RATE#n" + "\r\n"; - showMsg += "Server EXP Rate: #k" + c.getWorldServer().getExpRate() + "x#k" + "\r\n"; - showMsg += "Player EXP Rate: #k" + player.getRawExpRate() + "x#k" + "\r\n"; - if(player.getCouponExpRate() != 1) showMsg += "Coupon EXP Rate: #k" + player.getCouponExpRate() + "x#k" + "\r\n"; - showMsg += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n"; - - showMsg += "\r\n" + "#eMESO RATE#n" + "\r\n"; - showMsg += "Server MESO Rate: #k" + c.getWorldServer().getMesoRate() + "x#k" + "\r\n"; - showMsg += "Player MESO Rate: #k" + player.getRawMesoRate() + "x#k" + "\r\n"; - if(player.getCouponMesoRate() != 1) showMsg += "Coupon MESO Rate: #k" + player.getCouponMesoRate() + "x#k" + "\r\n"; - showMsg += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n"; - - showMsg += "\r\n" + "#eDROP RATE#n" + "\r\n"; - showMsg += "Server DROP Rate: #k" + c.getWorldServer().getDropRate() + "x#k" + "\r\n"; - showMsg += "Player DROP Rate: #k" + player.getRawDropRate() + "x#k" + "\r\n"; - if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n"; - showMsg += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n"; - - if(ServerConstants.USE_QUEST_RATE) { - showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n"; - showMsg += "Server QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; - } - - player.showHint(showMsg, 300); - break; - - case "rates": - String showMsg_ = "#eCHARACTER RATES#n" + "\r\n\r\n"; - showMsg_ += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n"; - showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n"; - showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n"; - if(ServerConstants.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; - - player.showHint(showMsg_, 300); - break; - - case "online": - for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) { - player.yellowMessage("Players in Channel " + ch.getId() + ":"); - for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { - if (!chr.isGM()) { - player.message(" >> " + MapleCharacter.makeMapleReadable(chr.getName()) + " is at " + chr.getMap().getMapName() + "."); - } - } - } - break; - - case "gm": - if (sub.length < 3) { // #goodbye 'hi' - player.dropMessage(5, "Your message was too short. Please provide as much detail as possible."); - break; - } - String message = joinStringFrom(sub, 1); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[GM MESSAGE]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message)); - FilePrinter.printError("gm.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n"); - player.dropMessage(5, "Your message '" + message + "' was sent to GMs."); - player.dropMessage(5, tips[Randomizer.nextInt(tips.length)]); - break; - - case "reportbug": - - if (sub.length < 2) { - player.dropMessage(5, "Message too short and not sent. Please do @bug "); - break; - } - message = joinStringFrom(sub, 1); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[BUG]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message)); - FilePrinter.printError("bug.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n"); - player.dropMessage(5, "Your bug '" + message + "' was submitted successfully to our developers. Thank you!"); - break; - /* - case "points": - player.dropMessage(5, "You have " + c.getVotePoints() + " vote point(s)."); - if (c.hasVotedAlready()) { - Date currentDate = new Date(); - int time = (int) ((int) 86400 - ((currentDate.getTime() / 1000) - c.getVoteTime())); //ugly as fuck - hours = time / 3600; - minutes = time % 3600 / 60; - seconds = time % 3600 % 60; - player.yellowMessage("You have already voted. You can vote again in " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds."); - } else { - player.yellowMessage("You are free to vote! Make sure to vote to gain a vote point!"); - } - break; - */ - case "joinevent": - if(!FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { - MapleEvent event = c.getChannelServer().getEvent(); - if(event != null) { - if(event.getMapId() != player.getMapId()) { - if(event.getLimit() > 0) { - player.saveLocation("EVENT"); - - if(event.getMapId() == 109080000 || event.getMapId() == 109060001) - player.setTeam(event.getLimit() % 2); - - event.minusLimit(); - - player.changeMap(event.getMapId()); - } else { - player.dropMessage(5, "The limit of players for the event has already been reached."); - } - } else { - player.dropMessage(5, "You are already in the event."); - } - } else { - player.dropMessage(5, "There is currently no event in progress."); - } - } else { - player.dropMessage(5, "You are currently in a map where you can't join an event."); - } - break; - - case "leaveevent": - int returnMap = player.getSavedLocation("EVENT"); - if(returnMap != -1) { - if(player.getOla() != null) { - player.getOla().resetTimes(); - player.setOla(null); - } - if(player.getFitness() != null) { - player.getFitness().resetTimes(); - player.setFitness(null); - } - - player.changeMap(returnMap); - if(c.getChannelServer().getEvent() != null) { - c.getChannelServer().getEvent().addLimit(); - } - } else { - player.dropMessage(5, "You are not currently in an event."); - } - break; - - case "ranks": - PreparedStatement ps = null; - ResultSet rs = null; - Connection con = null; - try { - con = DatabaseConnection.getConnection(); - ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` = '0' AND `accounts`.`banned` = '0' ORDER BY level DESC, exp DESC LIMIT 50"); - rs = ps.executeQuery(); - - player.announce(MaplePacketCreator.showPlayerRanks(9010000, rs)); - ps.close(); - rs.close(); - con.close(); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try { - if(ps != null && !ps.isClosed()) { - ps.close(); - } - if(rs != null && !rs.isClosed()) { - rs.close(); - } - if(con != null && !con.isClosed()) { - con.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - break; - - // stat autoassigning command credited to HeliosMS dev team - case "str": - case "dex": - case "int": - case "luk": - int remainingAp = player.getRemainingAp(); - - int amount = (sub.length > 1) ? Math.min(Integer.parseInt(sub[1]), remainingAp) : remainingAp; - boolean str = sub[0].equalsIgnoreCase("str"); - boolean Int = sub[0].equalsIgnoreCase("int"); - boolean luk = sub[0].equalsIgnoreCase("luk"); - boolean dex = sub[0].equalsIgnoreCase("dex"); - - if (amount > 0 && amount <= remainingAp && amount <= 32763) { - int playerStr = player.getStr(); - int playerDex = player.getDex(); - int playerInt = player.getInt(); - int playerLuk = player.getLuk(); - - if (str && amount + playerStr <= 32767 && amount + playerStr >= 4) { - player.setStr(playerStr + amount); - player.updateSingleStat(MapleStat.STR, playerStr); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else if (Int && amount + playerInt <= 32767 && amount + playerInt >= 4) { - player.setInt(playerInt + amount); - player.updateSingleStat(MapleStat.INT, playerInt); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else if (luk && amount + playerLuk <= 32767 && amount + playerLuk >= 4) { - player.setLuk(playerLuk + amount); - player.updateSingleStat(MapleStat.LUK, playerLuk); - player.setRemainingAp(remainingAp - amount); - player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp); - } else if (dex && amount + playerDex <= 32767 && amount + playerDex >= 4) { - player.setDex(playerDex + amount); - player.updateSingleStat(MapleStat.DEX, playerDex); - 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."); - } - - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommandLv1(Channel cserv, Server srv, MapleClient c, String[] sub) { //Donator - MapleCharacter player = c.getPlayer(); - - switch(sub[0]) { - case "bosshp": - for(MapleMonster monster : player.getMap().getMonsters()) { - if(monster != null && monster.isBoss() && monster.getHp() > 0) { - long percent = monster.getHp() * 100L / monster.getMaxHp(); - String bar = "["; - for (int i = 0; i < 100; i++){ - bar += i < percent ? "|" : "."; - } - bar += "]"; - player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + percent + "% HP left."); - player.yellowMessage("HP: " + bar); - } - } - break; - - case "mobhp": - for(MapleMonster monster : player.getMap().getMonsters()) { - if(monster != null && monster.getHp() > 0) { - player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP."); - - } - } - break; - - case "whatdropsfrom": - if (sub.length < 2) { - player.dropMessage(5, "Please do @whatdropsfrom "); - break; - } - String monsterName = joinStringFrom(sub, 1); - String output = ""; - int limit = 3; - Iterator> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator(); - for (int i = 0; i < limit; i++) { - if(listIterator.hasNext()) { - Pair data = listIterator.next(); - int mobId = data.getLeft(); - String mobName = data.getRight(); - output += mobName + " drops the following items:\r\n\r\n"; - for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){ - try { - String name = MapleItemInformationProvider.getInstance().getName(drop.itemId); - if (name.equals("null") || drop.chance == 0){ - continue; - } - float chance = 1000000 / drop.chance / player.getDropRate(); - output += "- " + name + " (1/" + (int) chance + ")\r\n"; - } catch (Exception ex){ - ex.printStackTrace(); - continue; - } - } - output += "\r\n"; - } - } - c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0)); - break; - - case "whodrops": - if (sub.length < 2) { - player.dropMessage(5, "Please do @whodrops "); - break; - } - String searchString = joinStringFrom(sub, 1); - output = ""; - listIterator = MapleItemInformationProvider.getInstance().getItemDataByName(searchString).iterator(); - if(listIterator.hasNext()) { - int count = 1; - while(listIterator.hasNext() && count <= 3) { - Pair data = listIterator.next(); - output += "#b" + data.getRight() + "#k is dropped by:\r\n"; - try { - Connection con = DatabaseConnection.getConnection(); - PreparedStatement ps = con.prepareStatement("SELECT dropperid FROM drop_data WHERE itemid = ? LIMIT 50"); - ps.setInt(1, data.getLeft()); - ResultSet rs = ps.executeQuery(); - while(rs.next()) { - String resultName = MapleMonsterInformationProvider.getMobNameFromID(rs.getInt("dropperid")); - if (resultName != null) { - output += resultName + ", "; - } - } - rs.close(); - ps.close(); - con.close(); - } catch (Exception e) { - player.dropMessage(6, "There was a problem retrieving the required data. Please try again."); - e.printStackTrace(); - break; - } - output += "\r\n\r\n"; - count++; - } - } else { - player.dropMessage(5, "The item you searched for doesn't exist."); - break; - } - c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0)); - break; - - case "buffme": - //GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero - SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(player); - SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(player); - SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(player); - 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()); - break; - - case "goto": - if (sub.length < 2){ - player.yellowMessage("Syntax: @goto "); - break; - } - - if (gotomaps.containsKey(sub[1])) { - MapleMap target = c.getChannelServer().getMapFactory().getMap(gotomaps.get(sub[1])); - MaplePortal targetPortal = target.getPortal(0); - if (player.getEventInstance() != null) { - player.getEventInstance().removePlayer(player); - } - player.changeMap(target, targetPortal); - } else { - player.dropMessage(5, "That map does not exist."); - } - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommandLv2(Channel cserv, Server srv, MapleClient c, String[] sub) { //JrGM - MapleCharacter player = c.getPlayer(); - MapleCharacter victim; - Skill skill; - - switch(sub[0]) { - case "recharge": - MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance(); - for (Item torecharge : c.getPlayer().getInventory(MapleInventoryType.USE).list()) { - if (ItemConstants.isThrowingStar(torecharge.getItemId())){ - torecharge.setQuantity(mii.getSlotMax(c, torecharge.getItemId())); - c.getPlayer().forceUpdateItem(torecharge); - } else if (ItemConstants.isArrow(torecharge.getItemId())){ - torecharge.setQuantity(mii.getSlotMax(c, torecharge.getItemId())); - c.getPlayer().forceUpdateItem(torecharge); - } else if (ItemConstants.isBullet(torecharge.getItemId())){ - torecharge.setQuantity(mii.getSlotMax(c, torecharge.getItemId())); - c.getPlayer().forceUpdateItem(torecharge); - } else if (ItemConstants.isConsumable(torecharge.getItemId())){ - torecharge.setQuantity(mii.getSlotMax(c, torecharge.getItemId())); - c.getPlayer().forceUpdateItem(torecharge); - } - } - player.dropMessage(5, "USE Recharged."); - break; - - case "whereami": - player.yellowMessage("Map ID: " + player.getMap().getId()); - player.yellowMessage("Players on this map:"); - for (MapleMapObject mmo : player.getMap().getPlayers()) { - MapleCharacter chr = (MapleCharacter) mmo; - player.dropMessage(5, ">> " + chr.getName() + " - " + chr.getId() + " - Oid: " + chr.getObjectId()); - } - player.yellowMessage("NPCs on this map:"); - for (MapleMapObject npcs : player.getMap().getMapObjects()) { - if (npcs instanceof MapleNPC) { - MapleNPC npc = (MapleNPC) npcs; - player.dropMessage(5, ">> " + npc.getName() + " - " + npc.getId() + " - Oid: " + npc.getObjectId()); - } - } - player.yellowMessage("Monsters on this map:"); - for (MapleMapObject mobs : player.getMap().getMapObjects()) { - if (mobs instanceof MapleMonster) { - MapleMonster mob = (MapleMonster) mobs; - if(mob.isAlive()){ - player.dropMessage(5, ">> " + mob.getName() + " - " + mob.getId() + " - Oid: " + mob.getObjectId()); - } - } - } - break; - - case "hide": - SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); - break; - - case "unhide": - SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); - break; - - case "sp": - if (sub.length < 2){ - player.yellowMessage("Syntax: !sp [] "); - break; - } - - if (sub.length == 2) { - int newSp = Integer.parseInt(sub[1]); - if(newSp < 0) newSp = 0; - else if(newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; - - player.setRemainingSp(newSp); - player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); - } else { - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - - if(victim != null) { - int newSp = Integer.parseInt(sub[2]); - if(newSp < 0) newSp = 0; - else if(newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; - - victim.setRemainingSp(newSp); - victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); - - player.dropMessage(5, "SP given."); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - } - break; - - case "ap": - if (sub.length < 2){ - player.yellowMessage("Syntax: !ap [] "); - break; - } - - if (sub.length < 3) { - int newAp = Integer.parseInt(sub[1]); - if(newAp < 0) newAp = 0; - else if(newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; - - player.setRemainingAp(newAp); - player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); - } else { - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - - if(victim != null) { - int newAp = Integer.parseInt(sub[2]); - if(newAp < 0) newAp = 0; - else if(newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; - - victim.setRemainingAp(newAp); - victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp()); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - } - break; - - case "empowerme": - final int[] array = {2311003, 2301004, 1301007, 4101004, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002}; - for (int i : array) { - SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(player); - } - break; - - case "buffmap": - SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(player, true); - SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(player, true); - SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(player, true); - SkillFactory.getSkill(9101008).getEffect(SkillFactory.getSkill(9101008).getMaxLevel()).applyTo(player, true); - SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(player, true); - break; - - case "buff": - if (sub.length < 2){ - player.yellowMessage("Syntax: !buff "); - break; - } - int skillid=Integer.parseInt(sub[1]); - - skill = SkillFactory.getSkill(skillid); - if(skill != null) skill.getEffect(skill.getMaxLevel()).applyTo(player); - break; - - case "bomb": - if (sub.length > 1){ - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - - if(victim != null) { - victim.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), victim.getPosition()); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, player.getName() + " used !bomb on " + victim.getName())); - } else { - player.message("Player '" + sub[1] + "' could not be found on this world."); - } - } else { - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), player.getPosition()); - } - break; - - case "dc": - if (sub.length < 2){ - player.yellowMessage("Syntax: !dc "); - break; - } - - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null) { - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null) { - victim = player.getMap().getCharacterByName(sub[1]); - if (victim != null) { - try {//sometimes bugged because the map = null - victim.getClient().disconnect(true, false); - player.getMap().removePlayer(victim); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - break; - } - } - } - if (player.gmLevel() < victim.gmLevel()) { - victim = player; - } - victim.getClient().disconnect(false, false); - break; - - case "cleardrops": - player.getMap().clearDrops(player); - player.dropMessage(5, "Cleared dropped items"); - break; - - case "clearslot": - if (sub.length < 2) { - player.yellowMessage("Syntax: !clearslot "); - break; - } - String type = sub[1]; - if (type.equals("all")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true); - } - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true); - } - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true); - } - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true); - } - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("All Slots Cleared."); - } - else if (type.equals("equip")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("Equipment Slot Cleared."); - } - else if (type.equals("use")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("Use Slot Cleared."); - } - else if (type.equals("setup")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("Set-Up Slot Cleared."); - } - else if (type.equals("etc")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("ETC Slot Cleared."); - } - else if (type.equals("cash")) { - for (int i = 0; i < 101; i++) { - Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); - if (tempItem == null) - continue; - MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true); - } - player.yellowMessage("Cash Slot Cleared."); - } - else player.yellowMessage("Slot" + type + " does not exist!"); - break; - - case "warp": - if (sub.length < 2){ - player.yellowMessage("Syntax: !warp "); - break; - } - - try { - MapleMap target = c.getChannelServer().getMapFactory().getMap(Integer.parseInt(sub[1])); - if (target == null) { - player.yellowMessage("Map ID " + sub[1] + " is invalid."); - break; - } - if (player.getEventInstance() != null) { - player.getEventInstance().leftParty(player); - } - player.changeMap(target, target.getRandomPlayerSpawnpoint()); - } catch (Exception ex) { - player.yellowMessage("Map ID " + sub[1] + " is invalid."); - break; - } - break; - - case "warpto": - if (sub.length < 3){ - player.yellowMessage("Syntax: !warpto "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null) {//If victim isn't on current channel or isnt a character try and find him by loop all channels on current world. - for (Channel ch : srv.getChannelsFromWorld(c.getWorld())) { - victim = ch.getPlayerStorage().getCharacterByName(sub[1]); - if (victim != null) { - break;//We found the person, no need to continue the loop. - } - } - } - if (victim != null) {//If target isn't null attempt to warp. - //Remove warper from current event instance. - if (player.getEventInstance() != null) { - player.getEventInstance().unregisterPlayer(player); - } - //Attempt to join the victims warp instance. - if (victim.getEventInstance() != null) { - if (victim.getClient().getChannel() == player.getClient().getChannel()) {//just in case.. you never know... - //victim.getEventInstance().registerPlayer(player); - player.changeMap(victim.getEventInstance().getMapInstance(victim.getMapId()), victim.getMap().findClosestPortal(victim.getPosition())); - } else { - player.dropMessage(6, "Please change to channel " + victim.getClient().getChannel()); - } - } else {//If victim isn't in an event instance, just warp them. - player.changeMap(victim.getMapId(), victim.getMap().findClosestPortal(victim.getPosition())); - } - if (player.getClient().getChannel() != victim.getClient().getChannel()) {//And then change channel if needed. - player.dropMessage("Changing channel, please wait a moment."); - player.getClient().changeChannel(victim.getClient().getChannel()); - } - } else { - player.dropMessage(6, "Unknown player."); - } - break; - - case "warphere": - case "summon": - if (sub.length < 2){ - player.yellowMessage("Syntax: !warphere "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null) {//If victim isn't on current channel, loop all channels on current world. - for (Channel ch : srv.getChannelsFromWorld(c.getWorld())) { - victim = ch.getPlayerStorage().getCharacterByName(sub[1]); - if (victim != null) { - break;//We found the person, no need to continue the loop. - } - } - } - if (victim != null) { - boolean changingEvent = true; - - if (victim.getEventInstance() != null) { - if(player.getEventInstance() != null && victim.getEventInstance().getLeaderId() == player.getEventInstance().getLeaderId()) { - changingEvent = false; - } - else { - victim.getEventInstance().unregisterPlayer(victim); - } - } - //Attempt to join the warpers instance. - if (player.getEventInstance() != null && changingEvent) { - if (player.getClient().getChannel() == victim.getClient().getChannel()) {//just in case.. you never know... - player.getEventInstance().registerPlayer(victim); - victim.changeMap(player.getEventInstance().getMapInstance(player.getMapId()), player.getMap().findClosestPortal(player.getPosition())); - } else { - player.dropMessage("Target isn't on your channel, not able to warp into event instance."); - } - } else {//If victim isn't in an event instance or is in the same event instance as the one the caller is, just warp them. - victim.changeMap(player.getMapId(), player.getMap().findClosestPortal(player.getPosition())); - } - if (player.getClient().getChannel() != victim.getClient().getChannel()) {//And then change channel if needed. - victim.dropMessage("Changing channel, please wait a moment."); - victim.getClient().changeChannel(player.getClient().getChannel()); - } - } else { - player.dropMessage(6, "Unknown player."); - } - break; - - case "reach": - if (sub.length < 2){ - player.yellowMessage("Syntax: !reach "); - break; - } - - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null && victim.isLoggedin()) { - if (player.getClient().getChannel() != victim.getClient().getChannel()) { - player.dropMessage(5, "Player '" + victim.getName() + "' is at channel " + victim.getClient().getChannel() + "."); - } else { - MapleMap map = victim.getMap(); - player.forceChangeMap(map, map.findClosestPortal(victim.getPosition())); - } - } else { - player.dropMessage(6, "Unknown player."); - } - break; - - case "gmshop": - MapleShopFactory.getInstance().getShop(1337).sendShop(c); - break; - - case "heal": - player.setHpMp(30000); - break; - - case "item": - case "drop": - if (sub.length < 2) { - player.yellowMessage("Syntax: !item "); - break; - } - - int itemId = Integer.parseInt(sub[1]); - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); - - if(ii.getName(itemId) == null) { - player.yellowMessage("Item id '" + sub[1] + "' does not exist."); - break; - } - - short quantity = 1; - if(sub.length >= 3) quantity = Short.parseShort(sub[2]); - - if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { - player.yellowMessage("You cannot create a cash item with this command."); - break; - } - - if (ItemConstants.isPet(itemId)) { - if (sub.length >= 3){ // thanks to istreety & TacoBell - quantity = 1; - long days = Math.max(1, Integer.parseInt(sub[2])); - long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000); - int petid = MaplePet.createPet(itemId); - - if(sub[0].equals("item")) { - MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration); - } else { - Item toDrop = new Item(itemId, (short) 0, quantity, petid); - toDrop.setExpiration(expiration); - - toDrop.setOwner(""); - if(player.gmLevel() < 3) { - byte b = toDrop.getFlag(); - b |= ItemConstants.ACCOUNT_SHARING; - b |= ItemConstants.UNTRADEABLE; - - toDrop.setFlag(b); - } - - c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true); - } - - break; - } else { - player.yellowMessage("Pet Syntax: !item "); - break; - } - } - - if (sub[0].equals("item")) { - byte flag = 0; - if(player.gmLevel() < 3) { - flag |= ItemConstants.ACCOUNT_SHARING; - flag |= ItemConstants.UNTRADEABLE; - } - - MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1); - } else { - Item toDrop; - if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) { - toDrop = ii.getEquipById(itemId); - } else { - toDrop = new Item(itemId, (short) 0, quantity); - } - - toDrop.setOwner(player.getName()); - if(player.gmLevel() < 3) { - byte b = toDrop.getFlag(); - b |= ItemConstants.ACCOUNT_SHARING; - b |= ItemConstants.UNTRADEABLE; - b |= ItemConstants.SANDBOX; - - toDrop.setFlag(b); - toDrop.setOwner("TRIAL-MODE"); - } - - c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true); - } - break; - - case "level": - if (sub.length < 2){ - player.yellowMessage("Syntax: !level "); - break; - } - - player.loseExp(player.getExp(), false, false); - player.setLevel(Math.min(Integer.parseInt(sub[1]), player.getMaxClassLevel()) - 1); - - player.resetPlayerRates(); - if(ServerConstants.USE_ADD_RATES_BY_LEVEL == true) player.setPlayerRates(); - player.setWorldRates(); - - player.levelUp(false); - break; - - case "levelpro": - if (sub.length < 2){ - player.yellowMessage("Syntax: !levelpro "); - break; - } - - while (player.getLevel() < Math.min(player.getMaxClassLevel(), Integer.parseInt(sub[1]))) { - player.levelUp(false); - } - break; - - case "setstat": - if (sub.length < 2){ - player.yellowMessage("Syntax: !setstat "); - break; - } - - int x; - try { - x = Integer.parseInt(sub[1]); - - 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) {} - break; - - case "maxstat": - final String[] s = {"setstat", String.valueOf(Short.MAX_VALUE)}; - executeHeavenMsCommandLv2(cserv, srv, c, s); - player.loseExp(player.getExp(), false, false); - player.setLevel(255); - - player.resetPlayerRates(); - if(ServerConstants.USE_ADD_RATES_BY_LEVEL == true) player.setPlayerRates(); - player.setWorldRates(); - - player.setFame(13337); - player.setMaxHp(30000); - player.setMaxMp(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."); - break; - - case "maxskill": - for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) { - try { - skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); - player.changeSkillLevel(skill, (byte) skill.getMaxLevel(), skill.getMaxLevel(), -1); - } catch (NumberFormatException nfe) { - nfe.printStackTrace(); - break; - } catch (NullPointerException npe) { - continue; - } - } - - if(player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { - skill = SkillFactory.getSkill(5001005); - player.changeSkillLevel(skill, (byte) -1, -1, -1); - } else { - skill = SkillFactory.getSkill(21001001); - player.changeSkillLevel(skill, (byte) -1, -1, -1); - } - - player.yellowMessage("Skills maxed out."); - break; - - case "resetskill": - for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) { - try { - skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); - player.changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1); - } catch (NumberFormatException nfe) { - nfe.printStackTrace(); - break; - } catch (NullPointerException npe) { - continue; - } - } - - if(player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { - skill = SkillFactory.getSkill(5001005); - player.changeSkillLevel(skill, (byte) -1, -1, -1); - } else { - skill = SkillFactory.getSkill(21001001); - player.changeSkillLevel(skill, (byte) -1, -1, -1); - } - - player.yellowMessage("Skills reseted."); - break; - - case "mesos": - if (sub.length >= 2) { - player.gainMeso(Integer.parseInt(sub[1]), true); - } - break; - - case "search": - if (sub.length < 3){ - player.yellowMessage("Syntax: !search "); - break; - } - - StringBuilder sb = new StringBuilder(); - - String search = joinStringFrom(sub, 2); - long start = System.currentTimeMillis();//for the lulz - MapleData data = null; - MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz")); - if (!sub[1].equalsIgnoreCase("ITEM")) { - if (sub[1].equalsIgnoreCase("NPC")) { - data = dataProvider.getData("Npc.img"); - } else if (sub[1].equalsIgnoreCase("MOB") || sub[1].equalsIgnoreCase("MONSTER")) { - data = dataProvider.getData("Mob.img"); - } else if (sub[1].equalsIgnoreCase("SKILL")) { - data = dataProvider.getData("Skill.img"); - /*} else if (sub[1].equalsIgnoreCase("MAP")) { - TODO - */ - } else { - sb.append("#bInvalid search.\r\nSyntax: '!search [type] [name]', where [type] is NPC, ITEM, MOB, or SKILL."); - } - if (data != null) { - String name; - for (MapleData searchData : data.getChildren()) { - name = MapleDataTool.getString(searchData.getChildByPath("name"), "NO-NAME"); - if (name.toLowerCase().contains(search.toLowerCase())) { - sb.append("#b").append(Integer.parseInt(searchData.getName())).append("#k - #r").append(name).append("\r\n"); - } - } - } - } else { - for (Pair itemPair : MapleItemInformationProvider.getInstance().getAllItems()) { - if (sb.length() < 32654) {//ohlol - if (itemPair.getRight().toLowerCase().contains(search.toLowerCase())) { - //#v").append(id).append("# #k- - sb.append("#b").append(itemPair.getLeft()).append("#k - #r").append(itemPair.getRight()).append("\r\n"); - } - } else { - sb.append("#bCouldn't load all items, there are too many results.\r\n"); - break; - } - } - } - if (sb.length() == 0) { - sb.append("#bNo ").append(sub[1].toLowerCase()).append("s found.\r\n"); - } - sb.append("\r\n#kLoaded within ").append((double) (System.currentTimeMillis() - start) / 1000).append(" seconds.");//because I can, and it's free - - c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, sb.toString(), "00 00", (byte) 0)); - break; - - case "jail": - if (sub.length < 2) { - player.yellowMessage("Syntax: !jail []"); - break; - } - - int minutesJailed = 5; - if(sub.length >= 3) { - minutesJailed = Integer.valueOf(sub[2]); - if(minutesJailed <= 0) { - player.yellowMessage("Syntax: !jail []"); - break; - } - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if (victim != null) { - victim.addJailExpirationTime(minutesJailed * 60 * 1000); - - int mapid = 300000012; - - if(victim.getMapId() != mapid) { // those gone to jail won't be changing map anyway - MapleMap target = cserv.getMapFactory().getMap(mapid); - MaplePortal targetPortal = target.getPortal(0); - victim.changeMap(target, targetPortal); - player.message(victim.getName() + " was jailed for " + minutesJailed + " minutes."); - } - else { - player.message(victim.getName() + "'s time in jail has been extended for " + minutesJailed + " minutes."); - } - - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "unjail": - if (sub.length < 2) { - player.yellowMessage("Syntax: !unjail "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if (victim != null) { - if(victim.getJailExpirationTimeLeft() <= 0) { - player.message("This player is already free."); - break; - } - victim.removeJailExpirationTime(); - victim.message("By lack of concrete proof you are now unjailed. Enjoy freedom!"); - player.message(victim.getName() + " was unjailed."); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "job": - if (sub.length == 2) { - int jobid = Integer.parseInt(sub[1]); - if(jobid < 0 || jobid >= 2200) { - player.message("Jobid " + jobid + " is not available."); - break; - } - - player.changeJob(MapleJob.getById(jobid)); - player.equipChanged(); - } else if (sub.length == 3) { - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - - if(victim != null) { - int jobid = Integer.parseInt(sub[2]); - if(jobid < 0 || jobid >= 2200) { - player.message("Jobid " + jobid + " is not available."); - break; - } - - victim.changeJob(MapleJob.getById(jobid)); - player.equipChanged(); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - } else { - player.message("Syntax: !job "); - } - break; - - case "unbug": - c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.enableActions()); - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommandLv3(Channel cserv, Server srv, MapleClient c, String[] sub) { //GM - MapleCharacter player = c.getPlayer(); - MapleCharacter victim; - - switch(sub[0]) { - case "debuff": - if (sub.length < 2) { - player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); - break; - } - - MapleDisease disease = null; - MobSkill skill = null; - - switch(sub[1].toUpperCase()) { - case "SLOW": - disease = MapleDisease.SLOW; - skill = MobSkillFactory.getMobSkill(126, 7); - break; - - case "SEDUCE": - disease = MapleDisease.SEDUCE; - skill = MobSkillFactory.getMobSkill(128, 7); - break; - - case "ZOMBIFY": - disease = MapleDisease.ZOMBIFY; - skill = MobSkillFactory.getMobSkill(133, 1); - break; - - case "CONFUSE": - disease = MapleDisease.CONFUSE; - skill = MobSkillFactory.getMobSkill(132, 2); - break; - - case "STUN": - disease = MapleDisease.STUN; - skill = MobSkillFactory.getMobSkill(123, 7); - break; - - case "POISON": - disease = MapleDisease.POISON; - skill = MobSkillFactory.getMobSkill(125, 5); - break; - - case "SEAL": - disease = MapleDisease.SEAL; - skill = MobSkillFactory.getMobSkill(120, 1); - break; - - case "DARKNESS": - disease = MapleDisease.DARKNESS; - skill = MobSkillFactory.getMobSkill(121, 1); - break; - - case "WEAKEN": - disease = MapleDisease.WEAKEN; - skill = MobSkillFactory.getMobSkill(122, 1); - break; - - case "CURSE": - disease = MapleDisease.CURSE; - skill = MobSkillFactory.getMobSkill(124, 1); - break; - } - - if(disease == null) { - player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); - break; - } - - for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) { - MapleCharacter chr = (MapleCharacter) mmo; - - if(chr.getId() != player.getId()) { - chr.giveDebuff(disease, skill); - } - } - break; - - case "fly": // fly option will become available for any character of that account - if (sub.length < 2) { - player.yellowMessage("Syntax: !fly "); - break; - } - - Integer accid = c.getAccID(); - - String sendStr = ""; - if(sub[1].equalsIgnoreCase("on")) { - sendStr += "Enabled Fly feature (F1). With fly active, you cannot attack."; - if(!srv.canFly(accid)) sendStr += " Re-login to take effect."; - - srv.changeFly(c.getAccID(), true); - } else { - sendStr += "Disabled Fly feature. You can now attack."; - if(srv.canFly(accid)) sendStr += " Re-login to take effect."; - - srv.changeFly(c.getAccID(), false); - } - - player.dropMessage(6, sendStr); - break; - - case "spawn": - if (sub.length < 2) { - player.yellowMessage("Syntax: !spawn "); - break; - } - - MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(sub[1])); - if (monster == null) { - break; - } - if (sub.length > 2) { - for (int i = 0; i < Integer.parseInt(sub[2]); i++) { - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition()); - } - } else { - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition()); - } - break; - - case "mutemap": - if(player.getMap().isMuted()) { - player.getMap().setMuted(false); - player.dropMessage(5, "The map you are in has been un-muted."); - } else { - player.getMap().setMuted(true); - player.dropMessage(5, "The map you are in has been muted."); - } - break; - - case "checkdmg": - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - int maxBase = victim.calculateMaxBaseDamage(victim.getTotalWatk()); - Integer watkBuff = victim.getBuffedValue(MapleBuffStat.WATK); - Integer matkBuff = victim.getBuffedValue(MapleBuffStat.MATK); - Integer blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12); - if(watkBuff == null) watkBuff = 0; - if(matkBuff == null) matkBuff = 0; - - player.dropMessage(5, "Cur Str: " + victim.getTotalStr() + " Cur Dex: " + victim.getTotalDex() + " Cur Int: " + victim.getTotalInt() + " Cur Luk: " + victim.getTotalLuk()); - player.dropMessage(5, "Cur WATK: " + victim.getTotalWatk() + " Cur MATK: " + victim.getTotalMagic()); - player.dropMessage(5, "Cur WATK Buff: " + watkBuff + " Cur MATK Buff: " + matkBuff + " Cur Blessing Level: " + blessing); - player.dropMessage(5, victim.getName() + "'s maximum base damage (before skills) is " + maxBase); - } else { - player.message("Player '" + sub[1] + "' could not be found on this world."); - } - break; - - case "inmap": - String st = ""; - for (MapleCharacter chr : player.getMap().getCharacters()) { - st += chr.getName() + " "; - } - player.message(st); - break; - - case "reloadevents": - for (Channel ch : Server.getInstance().getAllChannels()) { - ch.reloadEventScriptManager(); - } - player.dropMessage(5, "Reloaded Events"); - break; - - case "reloaddrops": - MapleMonsterInformationProvider.getInstance().clearDrops(); - player.dropMessage(5, "Reloaded Drops"); - break; - - case "reloadportals": - PortalScriptManager.getInstance().reloadPortalScripts(); - player.dropMessage(5, "Reloaded Portals"); - break; - - case "reloadmap": - MapleMap oldMap = c.getPlayer().getMap(); - MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId()); - int callerid = c.getPlayer().getId(); - - for (MapleCharacter chr : oldMap.getCharacters()) { - chr.changeMap(newMap); - if(chr.getId() != callerid) chr.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience."); - } - newMap.respawn(); - break; - - case "reloadshops": - MapleShopFactory.getInstance().reloadShops(); - break; - - case "hpmp": - victim = player; - int statUpdate = 1; - - if (sub.length >= 3) { - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - statUpdate = Integer.valueOf(sub[2]); - } else if(sub.length == 2) { - statUpdate = Integer.valueOf(sub[1]); - } else { - player.yellowMessage("Syntax: !hpmp [] "); - } - - if(victim != null) { - victim.setHp(statUpdate); - victim.setMp(statUpdate); - victim.updateSingleStat(MapleStat.HP, statUpdate); - victim.updateSingleStat(MapleStat.MP, statUpdate); - - victim.checkBerserk(victim.isHidden()); - } else { - player.message("Player '" + sub[1] + "' could not be found on this world."); - } - break; - - case "maxhpmp": - victim = player; - statUpdate = 1; - - if (sub.length >= 3) { - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - statUpdate = Math.max(1, Integer.valueOf(sub[2])); - } else if(sub.length == 2) { - statUpdate = Math.max(1, Integer.valueOf(sub[1])); - } 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)); - - 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()); - } else { - player.message("Player '" + sub[1] + "' could not be found on this world."); - } - break; - - case "music": - if (sub.length < 2) { - player.yellowMessage("Syntax: !music "); - for (String s : songs){ - player.yellowMessage(s); - } - break; - } - String song = joinStringFrom(sub, 1); - for (String s : songs){ - if (s.equals(song)){ - player.getMap().broadcastMessage(MaplePacketCreator.musicChange(s)); - player.yellowMessage("Now playing song " + song + "."); - break; - } - } - player.yellowMessage("Song not found, please enter a song below."); - for (String s : songs){ - player.yellowMessage(s); - } - break; - - case "monitor": - if (sub.length < 1){ - player.yellowMessage("Syntax: !monitor "); - break; - } - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null){ - player.message("Player '" + sub[1] + "' could not be found on this world."); - break; - } - boolean monitored = MapleLogger.monitored.contains(victim.getName()); - if (monitored){ - MapleLogger.monitored.remove(victim.getName()); - } else { - MapleLogger.monitored.add(victim.getName()); - } - player.yellowMessage(victim.getName() + " is " + (!monitored ? "now being monitored." : "no longer being monitored.")); - String message = player.getName() + (!monitored ? " has started monitoring " : " has stopped monitoring ") + victim.getName() + "."; - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message)); - break; - - case "monitors": - for (String ign : MapleLogger.monitored){ - player.yellowMessage(ign + " is being monitored."); - } - break; - - case "ignore": - if (sub.length < 1){ - player.yellowMessage("Syntax: !ignore "); - break; - } - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if (victim == null){ - player.message("Player '" + sub[1] + "' could not be found on this world."); - break; - } - boolean monitored_ = MapleLogger.ignored.contains(victim.getName()); - if (monitored_){ - MapleLogger.ignored.remove(victim.getName()); - } else { - MapleLogger.ignored.add(victim.getName()); - } - player.yellowMessage(victim.getName() + " is " + (!monitored_ ? "now being ignored." : "no longer being ignored.")); - String message_ = player.getName() + (!monitored_ ? " has started ignoring " : " has stopped ignoring ") + victim.getName() + "."; - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message_)); - break; - - case "ignored": - for (String ign : MapleLogger.ignored){ - player.yellowMessage(ign + " is being ignored."); - } - break; - - case "pos": - float xpos = player.getPosition().x; - float ypos = player.getPosition().y; - float fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId(); - player.dropMessage(6, "Position: (" + xpos + ", " + ypos + ")"); - player.dropMessage(6, "Foothold ID: " + fh); - break; - - case "togglecoupon": - if (sub.length < 2){ - player.yellowMessage("Syntax: !togglecoupon "); - break; - } - Server.getInstance().toggleCoupon(Integer.parseInt(sub[1])); - break; - - case "chat": - player.toggleWhiteChat(); - player.message("Your chat is now " + (player.getWhiteChat() ? " white" : "normal") + "."); - break; - - case "fame": - if (sub.length < 3){ - player.yellowMessage("Syntax: !fame "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.setFame(Integer.parseInt(sub[2])); - victim.updateSingleStat(MapleStat.FAME, victim.getFame()); - player.message("FAME given."); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "givenx": - if (sub.length < 2){ - player.yellowMessage("Syntax: !givenx [] "); - break; - } - - String recv; - int value; - if(sub.length > 2) { - recv = sub[1]; - value = Integer.parseInt(sub[2]); - } else { - recv = c.getPlayer().getName(); - value = Integer.parseInt(sub[1]); - } - - victim = cserv.getPlayerStorage().getCharacterByName(recv); - if(victim != null) { - victim.getCashShop().gainCash(1, value); - player.message("NX given."); - } else { - player.message("Player '" + recv + "' could not be found on this channel."); - } - break; - - case "givevp": - if (sub.length < 3){ - player.yellowMessage("Syntax: !givevp "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.getClient().addVotePoints(Integer.parseInt(sub[2])); - player.message("VP given."); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "givems": - if (sub.length < 2){ - player.yellowMessage("Syntax: !givems [] "); - break; - } - - String recv_; - int value_; - if(sub.length > 2) { - recv_ = sub[1]; - value_ = Integer.parseInt(sub[2]); - } else { - recv_ = c.getPlayer().getName(); - value_ = Integer.parseInt(sub[1]); - } - - victim = cserv.getPlayerStorage().getCharacterByName(recv_); - if(victim != null) { - victim.gainMeso(value_, true); - player.message("MESO given."); - } else { - player.message("Player '" + recv_ + "' could not be found on this channel."); - } - break; - - case "id": - if (sub.length < 2){ - player.yellowMessage("Syntax: !id "); - break; - } - try { - try (BufferedReader dis = new BufferedReader(new InputStreamReader(new URL("http://www.mapletip.com/search_java.php?search_value=" + sub[1] + "&check=true").openConnection().getInputStream()))) { - String s; - while ((s = dis.readLine()) != null) { - player.dropMessage(s); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - break; - - case "expeds": - for (Channel ch : Server.getInstance().getChannelsFromWorld(c.getWorld())) { - if (ch.getExpeditions().size() == 0) { - player.yellowMessage("No Expeditions in Channel " + ch.getId()); - continue; - } - player.yellowMessage("Expeditions in Channel " + ch.getId()); - int id = 0; - for (MapleExpedition exped : ch.getExpeditions()) { - id++; - player.yellowMessage("> Expedition " + id); - player.yellowMessage(">> Type: " + exped.getType().toString()); - player.yellowMessage(">> Status: " + (exped.isRegistering() ? "REGISTERING" : "UNDERWAY")); - player.yellowMessage(">> Size: " + exped.getMembers().size()); - player.yellowMessage(">> Leader: " + exped.getLeader().getName()); - int memId = 2; - for (MapleCharacter member : exped.getMembers()) { - if (exped.isLeader(member)) { - continue; - } - player.yellowMessage(">>> Member " + memId + ": " + member.getName()); - memId++; - } - } - } - break; - - case "kill": - if (sub.length < 2){ - player.yellowMessage("Syntax: !kill "); - break; - } - - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.setHpMp(0); - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, player.getName() + " used !kill on " + victim.getName())); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "seed": - if (player.getMapId() != 910010000) { - player.yellowMessage("This command can only be used in HPQ."); - break; - } - Point pos[] = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)}; - int seed[] = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098}; - for (int i = 0; i < pos.length; i++) { - Item item = new Item(seed[i], (byte) 0, (short) 1); - player.getMap().spawnItemDrop(player, player, item, pos[i], false, true); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - break; - - case "maxenergy": - c.getPlayer().setDojoEnergy(10000); - c.announce(MaplePacketCreator.getEnergy("energy", 10000)); - break; - - case "killall": - MapleMap map = player.getMap(); - List monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); - - int count = 0; - for (MapleMapObject monstermo : monsters) { - monster = (MapleMonster) monstermo; - if (!monster.getStats().isFriendly() && !(monster.getId() >= 8810010 && monster.getId() <= 8810018)) { - map.damageMonster(player, monster, Integer.MAX_VALUE); - count++; - } - } - player.dropMessage(5, "Killed " + count + " monsters."); - break; - - case "notice": - Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[Notice] " + joinStringFrom(sub, 1))); - break; - - case "rip": - Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + joinStringFrom(sub, 1))); - break; - - case "openportal": - if (sub.length < 2){ - player.yellowMessage("Syntax: !openportal "); - break; - } - player.getMap().getPortal(sub[1]).setPortalState(true); - break; - - case "closeportal": - if (sub.length < 2){ - player.yellowMessage("Syntax: !closeportal "); - break; - } - player.getMap().getPortal(sub[1]).setPortalState(false); - break; - - case "pe": - String packet = ""; - try { - InputStreamReader is = new FileReader("pe.txt"); - Properties packetProps = new Properties(); - packetProps.load(is); - is.close(); - packet = packetProps.getProperty("pe"); - } catch (IOException ex) { - ex.printStackTrace(); - player.yellowMessage("Failed to load pe.txt"); - break; - } - MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); - mplew.write(HexTool.getByteArrayFromHexString(packet)); - SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(mplew.getPacket())); - short packetId = slea.readShort(); - final MaplePacketHandler packetHandler = PacketProcessor.getProcessor(0, c.getChannel()).getHandler(packetId); - if (packetHandler != null && packetHandler.validateState(c)) { - try { - player.yellowMessage("Receiving: " + packet); - packetHandler.handlePacket(slea, c); - } catch (final Throwable t) { - FilePrinter.printError(FilePrinter.PACKET_HANDLER + packetHandler.getClass().getName() + ".txt", t, "Error for " + (c.getPlayer() == null ? "" : "player ; " + c.getPlayer() + " on map ; " + c.getPlayer().getMapId() + " - ") + "account ; " + c.getAccountName() + "\r\n" + slea.toString()); - break; - } - } - break; - - case "startevent": - int players = 50; - if(sub.length > 1) - players = Integer.parseInt(sub[1]); - - c.getChannelServer().setEvent(new MapleEvent(player.getMapId(), players)); - player.dropMessage(5, "The event has been set on " + player.getMap().getMapName() + " and will allow " + players + " players to join."); - break; - - case "endevent": - c.getChannelServer().setEvent(null); - player.dropMessage(5, "You have ended the event. No more players may join."); - break; - - case "online2": - int total = 0; - for (Channel ch : srv.getChannelsFromWorld(player.getWorld())) { - int size = ch.getPlayerStorage().getAllCharacters().size(); - total += size; - String s = "(Channel " + ch.getId() + " Online: " + size + ") : "; - if (ch.getPlayerStorage().getAllCharacters().size() < 50) { - for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { - s += MapleCharacter.makeMapleReadable(chr.getName()) + ", "; - } - player.dropMessage(6, s.substring(0, s.length() - 2)); - } - } - - //player.dropMessage(6, "There are a total of " + total + " players online."); - player.showHint("Players online: #e#r" + total + "#k#n.", 300); - break; - - case "warpsnowball": - List chars = new ArrayList<>(player.getMap().getCharacters()); - for (MapleCharacter chr : chars) { - chr.changeMap(109060000, chr.getTeam()); - } - break; - - case "ban": - if (sub.length < 3) { - player.yellowMessage("Syntax: !ban (Please be descriptive)"); - break; - } - String ign = sub[1]; - String reason = joinStringFrom(sub, 2); - MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(ign); - if (target != null) { - String readableTargetName = MapleCharacter.makeMapleReadable(target.getName()); - String ip = target.getClient().getSession().getRemoteAddress().toString().split(":")[0]; - //Ban ip - PreparedStatement ps = null; - try { - Connection con = DatabaseConnection.getConnection(); - if (ip.matches("/[0-9]{1,3}\\..*")) { - ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?, ?)"); - ps.setString(1, ip); - ps.setString(2, String.valueOf(target.getClient().getAccID())); - - ps.executeUpdate(); - ps.close(); - } - - con.close(); - } catch (SQLException ex) { - ex.printStackTrace(); - c.getPlayer().message("Error occured while banning IP address"); - c.getPlayer().message(target.getName() + "'s IP was not banned: " + ip); - } - target.getClient().banMacs(); - reason = c.getPlayer().getName() + " banned " + readableTargetName + " for " + reason + " (IP: " + ip + ") " + "(MAC: " + c.getMacs() + ")"; - target.ban(reason); - target.yellowMessage("You have been banned by #b" + c.getPlayer().getName() + " #k."); - target.yellowMessage("Reason: " + reason); - c.announce(MaplePacketCreator.getGMEffect(4, (byte) 0)); - final MapleCharacter rip = target; - TimerManager.getInstance().schedule(new Runnable() { - @Override - public void run() { - rip.getClient().disconnect(false, false); - } - }, 5000); //5 Seconds - Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); - } else if (MapleCharacter.ban(ign, reason, false)) { - c.announce(MaplePacketCreator.getGMEffect(4, (byte) 0)); - Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); - } else { - c.announce(MaplePacketCreator.getGMEffect(6, (byte) 1)); - } - break; - - case "unban": - if (sub.length < 2){ - player.yellowMessage("Syntax: !unban "); - break; - } - - try { - Connection con = DatabaseConnection.getConnection(); - int aid = MapleCharacter.getAccountIdByName(sub[1]); - - PreparedStatement p = con.prepareStatement("UPDATE accounts SET banned = -1 WHERE id = " + aid); - p.executeUpdate(); - - p = con.prepareStatement("DELETE FROM ipbans WHERE aid = " + aid); - p.executeUpdate(); - - p = con.prepareStatement("DELETE FROM macbans WHERE aid = " + aid); - p.executeUpdate(); - - con.close(); - } catch (Exception e) { - e.printStackTrace(); - player.message("Failed to unban " + sub[1]); - return true; - } - player.message("Unbanned " + sub[1]); - break; - - case "healmap": - 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()); - } - } - break; - - case "healperson": - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.setHp(victim.getMaxHp()); - victim.updateSingleStat(MapleStat.HP, victim.getMaxHp()); - victim.setMp(victim.getMaxMp()); - victim.updateSingleStat(MapleStat.MP, victim.getMaxMp()); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "hurt": - victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.setHp(1); - victim.updateSingleStat(MapleStat.HP, 1); - } else { - player.message("Player '" + sub[1] + "' could not be found on this channel."); - } - break; - - case "killmap": - for (MapleCharacter mch : player.getMap().getCharacters()) { - mch.setHp(0); - mch.updateSingleStat(MapleStat.HP, 0); - } - break; - - case "night": - player.getMap().broadcastNightEffect(); - player.yellowMessage("Done."); - break; - - case "npc": - if (sub.length < 2){ - player.yellowMessage("Syntax: !npc "); - break; - } - MapleNPC npc = MapleLifeFactory.getNPC(Integer.parseInt(sub[1])); - if (npc != null) { - npc.setPosition(player.getPosition()); - npc.setCy(player.getPosition().y); - npc.setRx0(player.getPosition().x + 50); - npc.setRx1(player.getPosition().x - 50); - npc.setFh(player.getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId()); - player.getMap().addMapObject(npc); - player.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc)); - } - break; - - case "face": - if (sub.length < 2){ - player.yellowMessage("Syntax: !face [] "); - break; - } - - try { - if (sub.length == 2) { - int itemId = Integer.parseInt(sub[1]); - if(!(itemId >= 20000 && itemId < 22000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { - player.yellowMessage("Face id '" + sub[1] + "' does not exist."); - break; - } - - player.setFace(itemId); - player.updateSingleStat(MapleStat.FACE, itemId); - player.equipChanged(); - } else { - int itemId = Integer.parseInt(sub[2]); - if(!(itemId >= 20000 && itemId < 22000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { - player.yellowMessage("Face id '" + sub[2] + "' does not exist."); - break; - } - - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - if(victim == null) { - victim.setFace(itemId); - victim.updateSingleStat(MapleStat.FACE, itemId); - victim.equipChanged(); - } else { - player.yellowMessage("Player '" + sub[1] + "' has not been found on this channel."); - } - } - } catch(Exception e) {} - - break; - - case "hair": - if (sub.length < 2){ - player.yellowMessage("Syntax: !hair [] "); - break; - } - - try { - if (sub.length == 2) { - int itemId = Integer.parseInt(sub[1]); - if(!(itemId >= 30000 && itemId < 35000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { - player.yellowMessage("Hair id '" + sub[1] + "' does not exist."); - break; - } - - player.setHair(itemId); - player.updateSingleStat(MapleStat.HAIR, itemId); - player.equipChanged(); - } else { - int itemId = Integer.parseInt(sub[2]); - if(!(itemId >= 30000 && itemId < 35000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { - player.yellowMessage("Hair id '" + sub[2] + "' does not exist."); - break; - } - - victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - victim.setHair(itemId); - victim.updateSingleStat(MapleStat.HAIR, itemId); - victim.equipChanged(); - } else { - player.yellowMessage("Player '" + sub[1] + "' has not been found on this channel."); - } - } - } catch(Exception e) {} - break; - - case "startquest": - if (sub.length < 2){ - player.yellowMessage("Syntax: !startquest "); - break; - } - - int questid = Integer.parseInt(sub[1]); - - if (player.getQuestStatus(questid) == 0) { - MapleQuest quest = MapleQuest.getInstance(questid); - if (quest != null) { - int npcid = quest.getNpcRequirement(false); - quest.forceStart(player, npcid); - player.dropMessage(5, "QUEST " + questid + " started."); - } else { - player.dropMessage(5, "QUESTID " + questid + " is invalid."); - } - } else { - player.dropMessage(5, "QUESTID " + questid + " already started/completed."); - } - - break; - - case "completequest": - if (sub.length < 2){ - player.yellowMessage("Syntax: !completequest "); - break; - } - - int questId = Integer.parseInt(sub[1]); - - if (player.getQuestStatus(questId) == 1) { - MapleQuest quest = MapleQuest.getInstance(questId); - if (quest != null) { - int npcid = quest.getNpcRequirement(true); - quest.forceComplete(player, npcid); - player.dropMessage(5, "QUEST " + questId + " completed."); - } else { // should not occur - player.dropMessage(5, "QUESTID " + questId + " is invalid."); - } - } else { - player.dropMessage(5, "QUESTID " + questId + " not started or already completed."); - } - - break; - - case "resetquest": - if (sub.length < 2){ - player.yellowMessage("Syntax: !resetquest "); - break; - } - - int questid_ = Integer.parseInt(sub[1]); - - if (player.getQuestStatus(questid_) != 0) { - MapleQuest quest = MapleQuest.getInstance(questid_); - if (quest != null) { - quest.reset(player); - player.dropMessage(5, "QUEST " + questid_ + " reseted."); - } else { // should not occur - player.dropMessage(5, "QUESTID " + questid_ + " is invalid."); - } - } - - break; - - default: - return false; - } - - return true; - } - - - public static boolean executeHeavenMsCommandLv4(Channel cserv, Server srv, MapleClient c, String[] sub) { //SuperGM - MapleCharacter player = c.getPlayer(); - - switch(sub[0]) { - case "servermessage": - c.getWorldServer().setServerMessage(joinStringFrom(sub, 1)); - break; - - case "proitem": - if (sub.length < 3) { - player.yellowMessage("Syntax: !proitem "); - break; - } - - int itemid = Integer.parseInt(sub[1]); - short multiply = Short.parseShort(sub[2]); - - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); - MapleInventoryType type = ItemConstants.getInventoryType(itemid); - if (type.equals(MapleInventoryType.EQUIP)) { - Item it = ii.getEquipById(itemid); - it.setOwner(player.getName()); - - hardsetItemStats((Equip) it, multiply); - MapleInventoryManipulator.addFromDrop(c, it); - } else { - player.dropMessage(6, "Make sure it's an equippable item."); - } - break; - - case "seteqstat": - if (sub.length < 2) { - player.yellowMessage("Syntax: !seteqstat "); - break; - } - - int newStat = Integer.parseInt(sub[1]); - MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP); - - for (byte i = 1; i <= equip.getSlotLimit(); i++) { - try { - Equip eu = (Equip) equip.getItem(i); - if(eu == null) continue; - - short incval = (short)newStat; - eu.setWdef(incval); - eu.setAcc(incval); - eu.setAvoid(incval); - eu.setJump(incval); - eu.setMatk(incval); - eu.setMdef(incval); - eu.setHp(incval); - eu.setMp(incval); - eu.setSpeed(incval); - eu.setWatk(incval); - eu.setDex(incval); - eu.setInt(incval); - eu.setStr(incval); - eu.setLuk(incval); - - byte flag = eu.getFlag(); - flag |= ItemConstants.UNTRADEABLE; - eu.setFlag(flag); - - player.forceUpdateItem(eu); - } catch(Exception e){ - e.printStackTrace(); - } - } - break; - - case "exprate": - if (sub.length < 2){ - player.yellowMessage("Syntax: !exprate "); - break; - } - - int exprate = Math.max(Integer.parseInt(sub[1]), 1); - c.getWorldServer().setExpRate(exprate); - c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Exp Rate has been changed to " + exprate + "x.")); - break; - - case "mesorate": - if (sub.length < 2){ - player.yellowMessage("Syntax: !mesorate "); - break; - } - - int mesorate = Math.max(Integer.parseInt(sub[1]), 1); - c.getWorldServer().setMesoRate(mesorate); - c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Meso Rate has been changed to " + mesorate + "x.")); - break; - - case "droprate": - if (sub.length < 2){ - player.yellowMessage("Syntax: !droprate "); - break; - } - - int droprate = Math.max(Integer.parseInt(sub[1]), 1); - c.getWorldServer().setDropRate(droprate); - c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Drop Rate has been changed to " + droprate + "x.")); - break; - - case "questrate": - if (sub.length < 2){ - player.yellowMessage("Syntax: !questrate "); - break; - } - - int questrate = Math.max(Integer.parseInt(sub[1]), 1); - c.getWorldServer().setQuestRate(questrate); - c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Quest Rate has been changed to " + questrate + "x.")); - break; - - case "itemvac": - List list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : list) { - player.pickupItem(item); - } - break; - - case "forcevac": - List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : items) { - MapleMapItem mapItem = (MapleMapItem) item; - - mapItem.lockItem(); - try { - if(mapItem.isPickedUp()) continue; - - if (mapItem.getMeso() > 0) { - player.gainMeso(mapItem.getMeso(), true); - } else if(mapItem.getItemId() == 4031865 || mapItem.getItemId() == 4031866) { - // Add NX to account, show effect and make item disappear - player.getCashShop().gainCash(1, mapItem.getItemId() == 4031865 ? 100 : 250); - } else if (mapItem.getItem().getItemId() >= 5000000 && mapItem.getItem().getItemId() <= 5000100) { - int petId = MaplePet.createPet(mapItem.getItem().getItemId()); - if (petId == -1) { - continue; - } - MapleInventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); - } else { - MapleInventoryManipulator.addFromDrop(c, mapItem.getItem(), true); - } - - player.getMap().pickItemDrop(MaplePacketCreator.removeItemFromMap(mapItem.getObjectId(), 2, player.getId()), mapItem); - } finally { - mapItem.unlockItem(); - } - } - break; - - case "zakum": - player.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8800000), player.getPosition()); - for (int x = 8800003; x < 8800011; x++) { - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(x), player.getPosition()); - } - break; - - case "horntail": - final Point targetPoint = player.getPosition(); - final MapleMap targetMap = player.getMap(); - - targetMap.spawnHorntailOnGroundBelow(targetPoint); - break; - - case "pinkbean": - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8820001), player.getPosition()); - break; - - case "pap": - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8500001), player.getPosition()); - break; - - case "pianus": - player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition()); - break; - - case "cake": - MapleMonster monster = MapleLifeFactory.getMonster(9400606); - if(sub.length > 1) { - double mobHp = Double.parseDouble(sub[1]); - int newHp = (mobHp <= 0) ? Integer.MAX_VALUE : ((mobHp > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) mobHp); - - monster.getStats().setHp(newHp); - monster.setStartingHp(newHp); - } - - player.getMap().spawnMonsterOnGroundBelow(monster, player.getPosition()); - break; - - case "playernpcremove": - if (sub.length < 2) { - player.yellowMessage("Syntax: !playernpcremove "); - break; - } - - MaplePlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1])); - break; - - case "playernpc": - if (sub.length < 2) { - player.yellowMessage("Syntax: !playernpc "); - break; - } - - if(!MaplePlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]))) { - player.dropMessage(5, "Could not deploy PlayerNPC. Either there's no room available here or depleted out scriptids to use."); - } - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommandLv5(Channel cserv, Server srv, MapleClient c, String[] sub) { //Developer - MapleCharacter player = c.getPlayer(); - MapleMonster monster; - - switch(sub[0]) { - case "debugmonster": - List monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); - for (MapleMapObject monstermo : monsters) { - monster = (MapleMonster) monstermo; - player.message("Monster ID: " + monster.getId() + " Aggro target: " + ((monster.getController() != null) ? monster.getController().getName() : "")); - } - break; - - case "debugpacket": - player.getMap().broadcastMessage(MaplePacketCreator.customPacket(joinStringFrom(sub, 1))); - break; - - case "debugportal": - MaplePortal portal = player.getMap().findClosestPortal(player.getPosition()); - if(portal != null) player.dropMessage(6, "Closest portal: " + portal.getId() + " '" + portal.getName() + "' Type: " + portal.getType() + " --> toMap: " + portal.getTargetMapId() + " scriptname: '" + portal.getScriptName() + "' state: " + portal.getPortalState() + "."); - else player.dropMessage(6, "There is no portal on this map."); - break; - - case "debugspawnpoint": - SpawnPoint sp = player.getMap().findClosestSpawnpoint(player.getPosition()); - if(sp != null) player.dropMessage(6, "Closest mob spawn point: " + " Position: x " + sp.getPosition().getX() + " y " + sp.getPosition().getY() + " Spawns mobid: '" + sp.getMonsterId() + "' --> canSpawn: " + !sp.getDenySpawn() + " canSpawnRightNow: " + sp.shouldSpawn() + "."); - else player.dropMessage(6, "There is no mob spawn point on this map."); - break; - - case "debugpos": - player.dropMessage(6, "Current map position: (" + player.getPosition().getX() + ", " + player.getPosition().getY() + ")."); - break; - - case "debugmap": - player.dropMessage(6, "Current map id " + player.getMap().getId() + ", event: '" + ((player.getMap().getEventInstance() != null) ? player.getMap().getEventInstance().getName() : "null") + "'; Players: " + player.getMap().getAllPlayers().size() + ", Mobs: " + player.getMap().countMonsters() + ", Reactors: " + player.getMap().countReactors() + ", Items: " + player.getMap().countItems() + ", Objects: " + player.getMap().getMapObjects().size() + "."); - break; - - case "debugmobsp": - player.getMap().reportMonsterSpawnPoints(player); - break; - - case "debugevent": - if(player.getEventInstance() == null) player.dropMessage(6, "Player currently not in an event."); - else player.dropMessage(6, "Current event name: " + player.getEventInstance().getName() + "."); - break; - - case "debugareas": - player.dropMessage(6, "Configured areas on map " + player.getMapId() + ":"); - - byte index = 0; - for(Rectangle rect: player.getMap().getAreas()) { - player.dropMessage(6, "Id: " + index + " -> posX: " + rect.getX() + " posY: '" + rect.getY() + "' dX: " + rect.getWidth() + " dY: " + rect.getHeight() + "."); - index++; - } - break; - - case "debugreactors": - player.dropMessage(6, "Current reactor states on map " + player.getMapId() + ":"); - - for(MapleMapObject mmo: player.getMap().getReactors()) { - MapleReactor mr = (MapleReactor) mmo; - player.dropMessage(6, "Id: " + mr.getId() + " Oid: " + mr.getObjectId() + " name: '" + mr.getName() + "' -> Type: " + mr.getReactorType() + " State: " + mr.getState() + " Event State: " + mr.getEventState() + " Position: x " + mr.getPosition().getX() + " y " + mr.getPosition().getY() + "."); - } - break; - - case "debugservercoupons": - case "debugcoupons": - String s = "Currently active SERVER coupons: "; - for(Integer i : Server.getInstance().getActiveCoupons()) { - s += (i + " "); - } - - player.dropMessage(6, s); - break; - - case "debugplayercoupons": - String st = "Currently active PLAYER coupons: "; - for(Integer i : player.getActiveCoupons()) { - st += (i + " "); - } - - player.dropMessage(6, st); - break; - - case "debugtimer": - TimerManager tMan = TimerManager.getInstance(); - player.dropMessage(6, "Total Task: " + tMan.getTaskCount() + " Current Task: " + tMan.getQueuedTasks() + " Active Task: " + tMan.getActiveCount() + " Completed Task: " + tMan.getCompletedTaskCount()); - break; - - case "debugmarriage": - c.getChannelServer().debugMarriageStatus(); - break; - - case "showpackets": - ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET = !ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET; - break; - - case "set": - for(int i = 0; i < sub.length - 1; i++) { - ServerConstants.DEBUG_VALUES[i] = Integer.parseInt(sub[i + 1]); - } - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommandLv6(Channel cserv, Server srv, MapleClient c, String[] sub) { //Admin - final MapleCharacter player = c.getPlayer(); - MapleCharacter victim; - - switch(sub[0]) { - case "setgmlevel": - if (sub.length < 3){ - player.yellowMessage("Syntax: !setgmlevel "); - break; - } - - int newLevel = Integer.parseInt(sub[2]); - MapleCharacter target = cserv.getPlayerStorage().getCharacterByName(sub[1]); - if(target != null) { - target.setGMLevel(newLevel); - target.getClient().setGMLevel(newLevel); - - target.dropMessage("You are now a level " + newLevel + " GM. See @commands for a list of available commands."); - player.dropMessage(target + " is now a level " + newLevel + " GM."); - } else { - player.dropMessage("Player '"+ sub[1] +"' was not found on this channel."); - } - break; - - case "warpworld": - if (sub.length < 2){ - player.yellowMessage("Syntax: !warpworld "); - break; - } - - Server server = Server.getInstance(); - byte worldb = Byte.parseByte(sub[1]); - if (worldb <= (server.getWorldsSize() - 1)) { - try { - String[] socket = server.getInetSocket(worldb, c.getChannel()); - if(socket != null) { - c.getWorldServer().removePlayer(player); - player.getMap().removePlayer(player);//LOL FORGOT THIS >< - c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION); - player.setWorld(worldb); - player.saveCharToDB();//To set the new world :O (true because else 2 player instances are created, one in both worlds) - c.announce(MaplePacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]))); - } else { - player.message("Error when trying to change worlds, are you sure the world you are trying to warp to has the same amount of channels?"); - } - } catch (UnknownHostException | NumberFormatException ex) { - ex.printStackTrace(); - player.message("Unexpected error when changing worlds, are you sure the world you are trying to warp to has the same amount of channels?"); - } - - } else { - player.message("Invalid world; highest number available: " + (server.getWorldsSize() - 1)); - } - break; - - case "saveall": - for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { - chr.saveCharToDB(); - } - } - String message = player.getName() + " used !saveall."; - Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message)); - player.message("All players saved successfully."); - break; - - case "dcall": - for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { - if (!chr.isGM()) { - chr.getClient().disconnect(false, false); - } - } - } - player.message("All players successfully disconnected."); - break; - - case "mapplayers": - String names = ""; - int map = player.getMapId(); - for (World world : Server.getInstance().getWorlds()) { - for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { - int curMap = chr.getMapId(); - String hp = Integer.toString(chr.getHp()); - String maxhp = Integer.toString(chr.getMaxHp()); - String name = chr.getName() + ": " + hp + "/" + maxhp; - if (map == curMap) { - names = names.equals("") ? name : (names + ", " + name); - } - } - } - player.message("These b lurkin: " + names); - break; - - case "getacc": - if (sub.length < 2){ - player.yellowMessage("Syntax: !getacc "); - break; - } - victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); - if(victim != null) { - player.message(victim.getName() + "'s account name is " + victim.getClient().getAccountName() + "."); - } else { - player.message("Player '" + sub[1] + "' could not be found on this world."); - } - break; - - case "addchannel": - if (sub.length < 2) { - player.dropMessage(5, "Syntax: @addchannel "); - break; - } - - final int worldid = Integer.parseInt(sub[1]); - - new Thread(new Runnable() { - @Override - public void run() { - int chid = Server.getInstance().addChannel(worldid); - if(player.isLoggedinWorld()) { - if(chid >= 0) { - player.dropMessage(5, "NEW Channel " + chid + " successfully deployed on world " + worldid + "."); - } else { - if(chid == -3) { - player.dropMessage(5, "Invalid worldid detected. Channel creation aborted."); - } else if(chid == -2) { - player.dropMessage(5, "Reached channel limit on worldid " + worldid + ". Channel creation aborted."); - } else if(chid == -1) { - player.dropMessage(5, "Error detected when loading the 'world.ini' file. Channel creation aborted."); - } else { - player.dropMessage(5, "NEW Channel failed to be deployed. Check if the needed port is already in use or other limitations are taking place."); - } - } - } - } - }).start(); - - break; - - case "addworld": - new Thread(new Runnable() { - @Override - public void run() { - int wid = Server.getInstance().addWorld(); - - if(player.isLoggedinWorld()) { - if(wid >= 0) { - player.dropMessage(5, "NEW World " + wid + " successfully deployed."); - } else { - if(wid == -2) { - player.dropMessage(5, "Error detected when loading the 'world.ini' file. World creation aborted."); - } else { - player.dropMessage(5, "NEW World failed to be deployed. Check if needed ports are already in use or maximum world count has been reached."); - } - } - } - } - }).start(); - - break; - - case "removechannel": - if (sub.length < 2) { - player.dropMessage(5, "Syntax: @removechannel "); - break; - } - - final int worldId = Integer.parseInt(sub[1]); - - new Thread(new Runnable() { - @Override - public void run() { - if(Server.getInstance().removeChannel(worldId)) { - if(player.isLoggedinWorld()) { - player.dropMessage(5, "Successfully removed a channel on World " + worldId + ". Current channel count: " + Server.getInstance().getWorld(worldId).getChannelsSize() + "."); - } - } else { - if(player.isLoggedinWorld()) { - player.dropMessage(5, "Failed to remove last Channel on world " + worldId + ". Check if either that world exists or there are people currently playing there."); - } - } - } - }).start(); - - break; - - case "removeworld": - final int rwid = Server.getInstance().getWorldsSize() - 1; - if(rwid <= 0) { - player.dropMessage(5, "Unable to remove world 0."); - break; - } - - new Thread(new Runnable() { - @Override - public void run() { - if(Server.getInstance().removeWorld()) { - if(player.isLoggedinWorld()) { - player.dropMessage(5, "Successfully removed a world. Current world count: " + Server.getInstance().getWorldsSize() + "."); - } - } else { - if(player.isLoggedinWorld()) { - if(rwid < 0) { - player.dropMessage(5, "No registered worlds to remove."); - } else { - player.dropMessage(5, "Failed to remove world " + rwid + ". Check if there are people currently playing there."); - } - } - } - } - }).start(); - - break; - - case "shutdown": - case "shutdownnow": - int time = 60000; - if (sub[0].equals("shutdownnow")) { - time = 1; - } else if (sub.length > 1) { - time *= Integer.parseInt(sub[1]); - } - - if(time > 1) { - int seconds = (int) (time / 1000) % 60 ; - int minutes = (int) ((time / (1000*60)) % 60); - int hours = (int) ((time / (1000*60*60)) % 24); - int days = (int) ((time / (1000*60*60*24))); - - String strTime = ""; - if(days > 0) strTime += days + " days, "; - if(hours > 0) strTime += hours + " hours, "; - strTime += minutes + " minutes, "; - strTime += seconds + " seconds"; - - for(World w : Server.getInstance().getWorlds()) { - for(MapleCharacter chr: w.getPlayerStorage().getAllCharacters()) { - chr.dropMessage("Server is undergoing maintenance process, and will be shutdown in " + strTime + ". Prepare yourself to quit safely in the mean time."); - } - } - } - - - TimerManager.getInstance().schedule(Server.getInstance().shutdown(false), time); - break; - - case "clearquestcache": - MapleQuest.clearCache(); - player.dropMessage(5, "Quest Cache Cleared."); - break; - - case "clearquest": - if(sub.length < 1) { - player.dropMessage(5, "Please include a quest ID."); - break; - } - MapleQuest.clearCache(Integer.parseInt(sub[1])); - player.dropMessage(5, "Quest Cache for quest " + sub[1] + " cleared."); - break; - - case "fred": - c.announce(MaplePacketCreator.fredrickMessage(Byte.valueOf(sub[1]))); - break; - - case "spawnallpnpcs": - MaplePlayerNPC.multicastSpawnPlayerNPC(player.getMapId(), player.getWorld()); - break; - - case "eraseallpnpcs": - MaplePlayerNPC.removeAllPlayerNPC(); - break; - - default: - return false; - } - - return true; - } - - public static boolean executeHeavenMsCommand(Channel cserv, Server srv, MapleClient c, String[] sub, int gmLevel) { - if(gmLevel == -1) { - c.getPlayer().yellowMessage("Command '" + sub[0] + "' is not available. See @commands for a list of available commands."); - return false; - } - - boolean executedCommand; - switch(gmLevel) { - case 0: //Player - executedCommand = executeHeavenMsCommandLv0(cserv, srv, c, sub); - break; - - case 1: //Donator - executedCommand = executeHeavenMsCommandLv1(cserv, srv, c, sub); - break; - - case 2: //JrGM - executedCommand = executeHeavenMsCommandLv2(cserv, srv, c, sub); - break; - - case 3: //GM - executedCommand = executeHeavenMsCommandLv3(cserv, srv, c, sub); - break; - - case 4: //SuperGM - executedCommand = executeHeavenMsCommandLv4(cserv, srv, c, sub); - break; - - case 5: //Developer - executedCommand = executeHeavenMsCommandLv5(cserv, srv, c, sub); - break; - - default: //Admin - executedCommand = executeHeavenMsCommandLv6(cserv, srv, c, sub); - } - - if(!executedCommand) return executeHeavenMsCommand(cserv, srv, c, sub, gmLevel - 1); - else return true; - } - - public static boolean executeHeavenMsPlayerCommand(MapleClient c, String[] sub, char heading) { - Channel cserv = c.getChannelServer(); - Server srv = Server.getInstance(); - - return executeHeavenMsCommand(cserv, srv, c, sub, c.getPlayer().gmLevel()); - } - - private static String joinStringFrom(String arr[], int start) { - StringBuilder builder = new StringBuilder(); - for (int i = start; i < arr.length; i++) { - builder.append(arr[i]); - if (i != arr.length - 1) { - builder.append(" "); - } - } - return builder.toString(); - } -} \ No newline at end of file diff --git a/src/client/command/CommandsExecutor.java b/src/client/command/CommandsExecutor.java new file mode 100644 index 0000000000..438a074aae --- /dev/null +++ b/src/client/command/CommandsExecutor.java @@ -0,0 +1,356 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command; + +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; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Arrays; +import java.util.Calendar; +import java.util.HashMap; + +public class CommandsExecutor { + + public static CommandsExecutor instance = new CommandsExecutor(); + + public static CommandsExecutor getInstance() { + return instance; + } + + private static final char USER_HEADING = '@'; + private static final char GM_HEADING = '!'; + + public static boolean isCommand(MapleClient client, String content){ + char heading = content.charAt(0); + if (client.getPlayer().isGM()){ + return heading == USER_HEADING || heading == GM_HEADING; + } + return heading == USER_HEADING; + } + + private HashMap registeredCommands = new HashMap<>(); + private Pair, List> levelCommandsCursor; + private List, List>> commandsNameDesc = new ArrayList<>(); + + private CommandsExecutor(){ + registerLv0Commands(); + registerLv1Commands(); + registerLv2Commands(); + registerLv3Commands(); + registerLv4Commands(); + registerLv5Commands(); + registerLv6Commands(); + } + + public List, List>> getGmCommands() { + return commandsNameDesc; + } + + public void handle(MapleClient client, String message){ + final String[] spitedMessage = message.toLowerCase().substring(1).split("[ ]"); + final String commandName = spitedMessage[0]; + final RegisteredCommand command = registeredCommands.get(commandName); + if (command == null){ + client.getPlayer().yellowMessage("Command '" + commandName + "' is not available. See @commands for a list of available commands."); + return; + } + if (client.getPlayer().gmLevel() < command.getRank()){ + client.getPlayer().yellowMessage("You not have permission to use this command."); + return; + } + String[] params; + if (spitedMessage.length > 1) { + params = Arrays.copyOfRange(spitedMessage, 1, spitedMessage.length); + } else { + params = new String[]{}; + } + try { + Command commandInstance = command.getCommandClass().newInstance(); + commandInstance.execute(client, params); + writeLog(client, message); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + } + + private void writeLog(MapleClient client, String command){ + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm"); + FilePrinter.print(FilePrinter.USED_COMMANDS, client.getPlayer().getName() + " used: " + command + " on " + + sdf.format(Calendar.getInstance().getTime()) + "\r\n"); + } + + private void addCommandInfo(String name, Class commandClass) { + try { + levelCommandsCursor.getRight().add(commandClass.newInstance().getDescription()); + levelCommandsCursor.getLeft().add(name); + } catch(Exception e) { + e.printStackTrace(); + } + } + + private void addCommand(String[] syntaxs, Class commandClass){ + for (String syntax : syntaxs){ + addCommand(syntax, 0, commandClass); + } + } + private void addCommand(String syntax, Class commandClass){ + //for (String syntax : syntaxs){ + addCommand(syntax, 0, commandClass); + //} + } + + private void addCommand(String[] surtaxes, int rank, Class commandClass){ + for (String syntax : surtaxes){ + addCommand(syntax, rank, commandClass); + } + } + + private void addCommand(String syntax, int rank, Class commandClass){ + if (registeredCommands.containsKey(syntax.toLowerCase())){ + System.out.println("Error on register command with name: " + syntax + ". Already exists."); + return; + } + + RegisteredCommand registeredCommand = new RegisteredCommand(commandClass, rank); + + String commandName = syntax.toLowerCase(); + addCommandInfo(commandName, commandClass); + registeredCommands.put(commandName, registeredCommand); + } + + private void registerLv0Commands(){ + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand(new String[]{"help", "commands"}, HelpCommand.class); + addCommand("droplimit", DropLimitCommand.class); + addCommand("time", TimeCommand.class); + addCommand("credits", StaffCommand.class); + addCommand("uptime", UptimeCommand.class); + addCommand("gacha", GachaCommand.class); + addCommand("dispose", DisposeCommand.class); + addCommand("equiplv", EquipLvCommand.class); + addCommand("showrates", ShowRatesCommand.class); + addCommand("rates", RatesCommand.class); + addCommand("online", OnlineCommand.class); + addCommand("gm", GmCommand.class); + addCommand("reportbug", ReportBugCommand.class); + //addCommand("points", ""); + addCommand("joinevent", JoinEventCommand.class); + addCommand("leaveevent", LeaveEventCommand.class); + addCommand("ranks", RanksCommand.class); + addCommand("str", StatStrCommand.class); + addCommand("dex", StatDexCommand.class); + addCommand("int", StatIntCommand.class); + addCommand("luk", StatLukCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + + private void registerLv1Commands() { + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("bosshp", 1, BossHpCommand.class); + addCommand("mobhp", 1, MobHpCommand.class); + addCommand("whatdropsfrom", 1, WhatDropsFromCommand.class); + addCommand("whodrops", 1, WhoDropsCommand.class); + addCommand("buffme", 1, BuffMeCommand.class); + addCommand("goto", 1, GotoCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + + private void registerLv2Commands(){ + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("recharge", 2, RechargeCommand.class); + addCommand("whereami", 2, WhereaMiCommand.class); + addCommand("hide", 2, HideCommand.class); + addCommand("unhide", 2, UnHideCommand.class); + addCommand("sp", 2, SpCommand.class); + addCommand("ap", 2, ApCommand.class); + addCommand("empowerme", 2, EmpowerMeCommand.class); + addCommand("buffmap", 2, BuffMapCommand.class); + addCommand("buff", 2, BuffCommand.class); + addCommand("bomb", 2, BombCommand.class); + addCommand("dc", 2, DcCommand.class); + addCommand("cleardrops", 2, ClearDropsCommand.class); + addCommand("clearslot", 2, ClearSlotCommand.class); + addCommand("warp", 2, WarpCommand.class); + addCommand("warpto", 2, WarpToCommand.class); + addCommand(new String[]{"warphere", "summon"}, 2, SummonCommand.class); + addCommand(new String[]{"reach", "follow"}, 2, ReachCommand.class); + addCommand("gmshop", 2, GmShopCommand.class); + addCommand("heal", 2, HealCommand.class); + addCommand("item", 2, ItemCommand.class); + addCommand("drop", 2, ItemDropCommand.class); + addCommand("level", 2, LevelCommand.class); + addCommand("levelpro", 2, LevelProCommand.class); + addCommand("setstat", 2, SetStatCommand.class); + addCommand("maxstat", 2, MaxStatCommand.class); + addCommand("maxskill", 2, MaxSkillCommand.class); + addCommand("resetskill", 2, ResetSkillCommand.class); + addCommand("mesos", 2, MesosCommand.class); + addCommand("search", 2, SearchCommand.class); + addCommand("jail", 2, JailCommand.class); + addCommand("unjail", 2, UnJailCommand.class); + addCommand("job", 2, JobCommand.class); + addCommand("unbug", 2, UnBugCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + private void registerLv3Commands() { + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("debuff", 3, DebuffCommand.class); + addCommand("fly", 3, FlyCommand.class); + addCommand("spawn", 3, SpawnCommand.class); + addCommand("mutemap", 3, MuteMapCommand.class); + addCommand("checkdmg", 3, CheckDmgCommand.class); + addCommand("inmap", 3, InMapCommand.class); + addCommand("reloadevents", 3, ReloadEventsCommand.class); + addCommand("reloaddrops", 3, ReloadDropsCommand.class); + addCommand("reloadportals", 3, ReloadPortalsCommand.class); + addCommand("reloadmap", 3, ReloadMapCommand.class); + addCommand("reloadshops", 3, ReloadShopsCommand.class); + addCommand("hpmp", 3, HpMpCommand.class); + addCommand("maxhpmp", 3, MaxHpMpCommand.class); + addCommand("music", 3, MusicCommand.class); + addCommand("monitor", 3, MonitorCommand.class); + addCommand("monitors", 3, MonitorsCommand.class); + addCommand("ignore", 3, IgnoreCommand.class); + addCommand("ignored", 3, IgnoredCommand.class); + addCommand("pos", 3, PosCommand.class); + addCommand("togglecoupon", 3, ToggleCouponCommand.class); + addCommand("chat", 3, ChatCommand.class); + addCommand("fame", 3, FameCommand.class); + addCommand("givenx", 3, GiveNxCommand.class); + addCommand("givevp", 3, GiveVpCommand.class); + addCommand("givems", 3, GiveMesosCommand.class); + addCommand("id", 3, IdCommand.class); + addCommand("expeds", 3, ExpedsCommand.class); + addCommand("kill", 3, KillCommand.class); + addCommand("seed", 3, SeedCommand.class); + addCommand("maxenergy", 3, MaxEnergyCommand.class); + addCommand("killall", 3, KillAllCommand.class); + addCommand("notice", 3, NoticeCommand.class); + addCommand("rip", 3, RipCommand.class); + addCommand("openportal", 3, OpenPortalCommand.class); + addCommand("closeportal", 3, ClosePortalCommand.class); + addCommand("pe", 3, PeCommand.class); + addCommand("startevent", 3, StartEventCommand.class); + addCommand("endevent", 3, EndEventCommand.class); + addCommand("online2", 3, OnlineTwoCommand.class); + addCommand("warpsnowball", 3, WarpSnowBallCommand.class); + addCommand("ban", 3, BanCommand.class); + addCommand("unban", 3, UnBanCommand.class); + addCommand("healmap", 3, HealMapCommand.class); + addCommand("healperson", 3, HealPersonCommand.class); + addCommand("hurt", 3, HurtCommand.class); + addCommand("killmap", 3, KillMapCommand.class); + addCommand("night", 3, NightCommand.class); + addCommand("npc", 3, NpcCommand.class); + addCommand("face", 3, FaceCommand.class); + addCommand("hair", 3, HairCommand.class); + addCommand("startquest", 3, QuestStartCommand.class); + addCommand("completequest", 3, QuestCompleteCommand.class); + addCommand("resetquest", 3, QuestResetCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + private void registerLv4Commands(){ + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("servermessage", 4, ServerMessageCommand.class); + addCommand("proitem", 4, ProItemCommand.class); + addCommand("seteqstat", 4, SetQStatCommand.class); + addCommand("exprate", 4, ExpRateCommand.class); + addCommand("mesorate", 4, MesoRateCommand.class); + addCommand("droprate", 4, DropRateCommand.class); + addCommand("questrate", 4, QuestRateCommand.class); + addCommand("travelrate", 4, TravelRateCommand.class); + addCommand("itemvac", 4, ItemVacCommand.class); + addCommand("forcevac", 4, ForceVacCommand.class); + addCommand("zakum", 4, ZakumCommand.class); + addCommand("horntail", 4, HorntailCommand.class); + addCommand("pinkbean", 4, PinkbeanCommand.class); + addCommand("pap", 4, PapCommand.class); + addCommand("pianus", 4, PianusCommand.class); + addCommand("cake", 4, CakeCommand.class); + addCommand("playernpcremove", 4, PlayerNpcRemoveCommand.class); + addCommand("playernpc", 4, PlayerNpcCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + private void registerLv5Commands(){ + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("debug", 5, DebugCommand.class); + addCommand("set", 5, SetCommand.class); + addCommand("showpackets", 5, ShowPacketsCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + + private void registerLv6Commands(){ + levelCommandsCursor = new Pair<>((List) new ArrayList(), (List) new ArrayList()); + + addCommand("setgmlevel", 6, SetGmLevelCommand.class); + addCommand("warpworld", 6, WarpWorldCommand.class); + addCommand("saveall", 6, SaveAllCommand.class); + addCommand("dcall", 6, DCAllCommand.class); + addCommand("mapplayers", 6, MapPlayersCommand.class); + addCommand("getacc", 6, GetAccCommand.class); + addCommand("shutdown", 6, ShutdownCommand.class); + addCommand("clearquestcache", 6, ClearQuestCacheCommand.class); + addCommand("clearquest", 6, ClearQuestCommand.class); + addCommand("spawnallpnpcs", 6, SpawnAllPNpcsCommand.class); + addCommand("eraseallpnpcs", 6, EraseAllPNpcsCommand.class); + addCommand("addchannel", 6, ServerAddChannelCommand.class); + addCommand("addworld", 6, ServerAddWorldCommand.class); + addCommand("removechannel", 6, ServerRemoveChannelCommand.class); + addCommand("removeworld", 6, ServerRemoveWorldCommand.class); + + commandsNameDesc.add(levelCommandsCursor); + } + +} diff --git a/src/client/command/RegisteredCommand.java b/src/client/command/RegisteredCommand.java new file mode 100644 index 0000000000..6bbe94e184 --- /dev/null +++ b/src/client/command/RegisteredCommand.java @@ -0,0 +1,43 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command; + +class RegisteredCommand { + + private final Class commandClass; + private final int rank; + + RegisteredCommand(Class commandClass, int rank){ + this.commandClass = commandClass; + this.rank = rank; + } + + public Class getCommandClass() { + return commandClass; + } + + public int getRank() { + return rank; + } +} diff --git a/src/client/command/commands/v0/BuyBackCommand.java b/src/client/command/commands/v0/BuyBackCommand.java new file mode 100644 index 0000000000..d895a763d6 --- /dev/null +++ b/src/client/command/commands/v0/BuyBackCommand.java @@ -0,0 +1,35 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleClient; +import client.command.Command; +import client.processor.BuybackProcessor; + +public class BuyBackCommand extends Command { + @Override + public void execute(MapleClient c, String[] params) { + BuybackProcessor.processBuyback(c); + } +} diff --git a/src/client/command/commands/v0/DisposeCommand.java b/src/client/command/commands/v0/DisposeCommand.java new file mode 100644 index 0000000000..1500a39cb4 --- /dev/null +++ b/src/client/command/commands/v0/DisposeCommand.java @@ -0,0 +1,43 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.command.Command; +import client.MapleClient; +import scripting.npc.NPCScriptManager; +import tools.MaplePacketCreator; + +public class DisposeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + NPCScriptManager.getInstance().dispose(c); + c.announce(MaplePacketCreator.enableActions()); + c.removeClickedNPC(); + c.getPlayer().message("You've been disposed."); + } +} diff --git a/src/client/command/commands/v0/DropLimitCommand.java b/src/client/command/commands/v0/DropLimitCommand.java new file mode 100644 index 0000000000..17017a1c99 --- /dev/null +++ b/src/client/command/commands/v0/DropLimitCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleClient; +import client.command.Command; +import constants.ServerConstants; + +public class DropLimitCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + int dropCount = c.getPlayer().getMap().getDroppedItemCount(); + if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) { + c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); + } else { + c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); + } + + } +} diff --git a/src/client/command/commands/v0/EquipLvCommand.java b/src/client/command/commands/v0/EquipLvCommand.java new file mode 100644 index 0000000000..8c87869b4b --- /dev/null +++ b/src/client/command/commands/v0/EquipLvCommand.java @@ -0,0 +1,38 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.command.Command; +import client.MapleClient; + +public class EquipLvCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + c.getPlayer().showAllEquipFeatures(); + } +} diff --git a/src/client/command/commands/v0/GachaCommand.java b/src/client/command/commands/v0/GachaCommand.java new file mode 100644 index 0000000000..bd24795dfa --- /dev/null +++ b/src/client/command/commands/v0/GachaCommand.java @@ -0,0 +1,66 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.command.Command; +import client.MapleClient; +import server.MapleItemInformationProvider; +import server.gachapon.MapleGachapon; +import tools.MaplePacketCreator; + +public class GachaCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleGachapon.Gachapon gacha = null; + String search = joinStringFrom(params,0); + String gachaName = ""; + String [] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"}; + int [] ids = {9100100, 9100101, 9100102, 9100103, 9100104, 9100105, 9100106, 9100107, 9100109, 9100117}; + for (int i = 0; i < names.length; i++){ + if (search.equalsIgnoreCase(names[i])){ + gachaName = names[i]; + gacha = MapleGachapon.Gachapon.getByNpcId(ids[i]); + } + } + if (gacha == null){ + c.getPlayer().yellowMessage("Please use @gacha where name corresponds to one of the below:"); + for (String name : names){ + c.getPlayer().yellowMessage(name); + } + return; + } + String talkStr = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n"; + for (int i = 0; i < 2; i++){ + for (int id : gacha.getItems(i)){ + talkStr += "-" + MapleItemInformationProvider.getInstance().getName(id) + "\r\n"; + } + } + talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here."; + c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, talkStr, "00 00", (byte) 0)); + } +} diff --git a/src/client/command/commands/v0/GmCommand.java b/src/client/command/commands/v0/GmCommand.java new file mode 100644 index 0000000000..4d451cc639 --- /dev/null +++ b/src/client/command/commands/v0/GmCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; +import tools.FilePrinter; +import tools.MaplePacketCreator; +import tools.Randomizer; + +public class GmCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + String[] tips = { + "Please only use @gm in emergencies or to report somebody.", + "To report a bug or make a suggestion, use the forum.", + "Please do not use @gm to ask if a GM is online.", + "Do not ask if you can receive help, just state your issue.", + "Do not say 'I have a bug to report', just state it.", + }; + MapleCharacter player = c.getPlayer(); + if (params[0].length() < 3) { // #goodbye 'hi' + player.dropMessage(5, "Your message was too short. Please provide as much detail as possible."); + return; + } + String message = joinStringFrom(params, 0); + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[GM MESSAGE]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message)); + FilePrinter.printError("gm.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n"); + player.dropMessage(5, "Your message '" + message + "' was sent to GMs."); + player.dropMessage(5, tips[Randomizer.nextInt(tips.length)]); + } +} diff --git a/src/client/command/commands/v0/HelpCommand.java b/src/client/command/commands/v0/HelpCommand.java new file mode 100644 index 0000000000..ac409b400e --- /dev/null +++ b/src/client/command/commands/v0/HelpCommand.java @@ -0,0 +1,38 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleClient; +import client.command.Command; + +public class HelpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient client, String[] params) { + client.getAbstractPlayerInteraction().openNpc(9201143, "commands"); + } +} diff --git a/src/client/command/commands/v0/JoinEventCommand.java b/src/client/command/commands/v0/JoinEventCommand.java new file mode 100644 index 0000000000..a652918082 --- /dev/null +++ b/src/client/command/commands/v0/JoinEventCommand.java @@ -0,0 +1,66 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.events.gm.MapleEvent; +import server.maps.FieldLimit; + +public class JoinEventCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if(!FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { + MapleEvent event = c.getChannelServer().getEvent(); + if(event != null) { + if(event.getMapId() != player.getMapId()) { + if(event.getLimit() > 0) { + player.saveLocation("EVENT"); + + if(event.getMapId() == 109080000 || event.getMapId() == 109060001) + player.setTeam(event.getLimit() % 2); + + event.minusLimit(); + + player.changeMap(event.getMapId()); + } else { + player.dropMessage(5, "The limit of players for the event has already been reached."); + } + } else { + player.dropMessage(5, "You are already in the event."); + } + } else { + player.dropMessage(5, "There is currently no event in progress."); + } + } else { + player.dropMessage(5, "You are currently in a map where you can't join an event."); + } + } +} diff --git a/src/client/command/commands/v0/LeaveEventCommand.java b/src/client/command/commands/v0/LeaveEventCommand.java new file mode 100644 index 0000000000..b588bc692c --- /dev/null +++ b/src/client/command/commands/v0/LeaveEventCommand.java @@ -0,0 +1,58 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; + +public class LeaveEventCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + int returnMap = player.getSavedLocation("EVENT"); + if(returnMap != -1) { + if(player.getOla() != null) { + player.getOla().resetTimes(); + player.setOla(null); + } + if(player.getFitness() != null) { + player.getFitness().resetTimes(); + player.setFitness(null); + } + + player.changeMap(returnMap); + if(c.getChannelServer().getEvent() != null) { + c.getChannelServer().getEvent().addLimit(); + } + } else { + player.dropMessage(5, "You are not currently in an event."); + } + + } +} diff --git a/src/client/command/commands/v0/OnlineCommand.java b/src/client/command/commands/v0/OnlineCommand.java new file mode 100644 index 0000000000..847d10ba11 --- /dev/null +++ b/src/client/command/commands/v0/OnlineCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; +import net.server.channel.Channel; + +public class OnlineCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) { + player.yellowMessage("Players in Channel " + ch.getId() + ":"); + for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { + if (!chr.isGM()) { + player.message(" >> " + MapleCharacter.makeMapleReadable(chr.getName()) + " is at " + chr.getMap().getMapName() + "."); + } + } + } + } +} diff --git a/src/client/command/commands/v0/RanksCommand.java b/src/client/command/commands/v0/RanksCommand.java new file mode 100644 index 0000000000..b2445731af --- /dev/null +++ b/src/client/command/commands/v0/RanksCommand.java @@ -0,0 +1,47 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; +import tools.MaplePacketCreator; + +import java.util.List; +import tools.Pair; + +public class RanksCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + List> worldRanking = Server.getInstance().getWorldPlayerRanking(player.getWorld()); + player.announce(MaplePacketCreator.showPlayerRanks(9010000, worldRanking)); + } +} diff --git a/src/client/command/commands/v0/RatesCommand.java b/src/client/command/commands/v0/RatesCommand.java new file mode 100644 index 0000000000..4840c3d15c --- /dev/null +++ b/src/client/command/commands/v0/RatesCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import constants.ServerConstants; + +public class RatesCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + // travel rates not applicable since it's intrinsically a server/environment rate rather than a character rate + String showMsg_ = "#eCHARACTER RATES#n" + "\r\n\r\n"; + showMsg_ += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n"; + showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n"; + showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n"; + if(ServerConstants.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; + + player.showHint(showMsg_, 300); + } +} diff --git a/src/client/command/commands/v0/ReportBugCommand.java b/src/client/command/commands/v0/ReportBugCommand.java new file mode 100644 index 0000000000..1ab77f8653 --- /dev/null +++ b/src/client/command/commands/v0/ReportBugCommand.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; +import tools.FilePrinter; +import tools.MaplePacketCreator; + +public class ReportBugCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.dropMessage(5, "Message too short and not sent. Please do @bug "); + return; + } + String message = joinStringFrom(params, 0); + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[BUG]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message)); + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message)); + FilePrinter.printError("bug.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n"); + player.dropMessage(5, "Your bug '" + message + "' was submitted successfully to our developers. Thank you!"); + + } +} diff --git a/src/client/command/commands/v0/ShowRatesCommand.java b/src/client/command/commands/v0/ShowRatesCommand.java new file mode 100644 index 0000000000..7bddad2b14 --- /dev/null +++ b/src/client/command/commands/v0/ShowRatesCommand.java @@ -0,0 +1,67 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import constants.ServerConstants; + +public class ShowRatesCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + String showMsg = "#eEXP RATE#n" + "\r\n"; + showMsg += "Server EXP Rate: #k" + c.getWorldServer().getExpRate() + "x#k" + "\r\n"; + showMsg += "Player EXP Rate: #k" + player.getRawExpRate() + "x#k" + "\r\n"; + if(player.getCouponExpRate() != 1) showMsg += "Coupon EXP Rate: #k" + player.getCouponExpRate() + "x#k" + "\r\n"; + showMsg += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n"; + + showMsg += "\r\n" + "#eMESO RATE#n" + "\r\n"; + showMsg += "Server MESO Rate: #k" + c.getWorldServer().getMesoRate() + "x#k" + "\r\n"; + showMsg += "Player MESO Rate: #k" + player.getRawMesoRate() + "x#k" + "\r\n"; + if(player.getCouponMesoRate() != 1) showMsg += "Coupon MESO Rate: #k" + player.getCouponMesoRate() + "x#k" + "\r\n"; + showMsg += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n"; + + showMsg += "\r\n" + "#eDROP RATE#n" + "\r\n"; + showMsg += "Server DROP Rate: #k" + c.getWorldServer().getDropRate() + "x#k" + "\r\n"; + showMsg += "Player DROP Rate: #k" + player.getRawDropRate() + "x#k" + "\r\n"; + if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n"; + showMsg += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n"; + + if(ServerConstants.USE_QUEST_RATE) { + showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n"; + showMsg += "Server QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; + } + + showMsg += "\r\n" + "#eTRAVEL RATE#n" + "\r\n"; + showMsg += "Server TRAVEL Rate: #e#b" + c.getWorldServer().getTravelRate() + "x#k#n" + "\r\n"; + + player.showHint(showMsg, 300); + } +} diff --git a/src/client/command/commands/v0/StaffCommand.java b/src/client/command/commands/v0/StaffCommand.java new file mode 100644 index 0000000000..1db3a7acf8 --- /dev/null +++ b/src/client/command/commands/v0/StaffCommand.java @@ -0,0 +1,38 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleClient; +import client.command.Command; + +public class StaffCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + c.getAbstractPlayerInteraction().openNpc(2010007, "credits"); + } +} diff --git a/src/client/command/commands/v0/StatDexCommand.java b/src/client/command/commands/v0/StatDexCommand.java new file mode 100644 index 0000000000..3154f80296 --- /dev/null +++ b/src/client/command/commands/v0/StatDexCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.MapleClient; +import client.MapleStat; +import client.command.Command; + +public class StatDexCommand extends Command { + { + setDescription(""); + } + + @Override + 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.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."); + } + } +} diff --git a/src/client/command/commands/v0/StatIntCommand.java b/src/client/command/commands/v0/StatIntCommand.java new file mode 100644 index 0000000000..be1d310d70 --- /dev/null +++ b/src/client/command/commands/v0/StatIntCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class StatIntCommand extends Command { + { + setDescription(""); + } + + @Override + 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.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."); + } + } +} diff --git a/src/client/command/commands/v0/StatLukCommand.java b/src/client/command/commands/v0/StatLukCommand.java new file mode 100644 index 0000000000..5754fbd78f --- /dev/null +++ b/src/client/command/commands/v0/StatLukCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleCharacter; +import client.MapleClient; +import client.MapleStat; +import client.command.Command; + +public class StatLukCommand extends Command { + { + setDescription(""); + } + + @Override + 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.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."); + } + } +} diff --git a/src/client/command/commands/v0/StatStrCommand.java b/src/client/command/commands/v0/StatStrCommand.java new file mode 100644 index 0000000000..da81e7e7b6 --- /dev/null +++ b/src/client/command/commands/v0/StatStrCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class StatStrCommand extends Command { + { + setDescription(""); + } + + @Override + 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."); + } + } +} diff --git a/src/client/command/commands/v0/TimeCommand.java b/src/client/command/commands/v0/TimeCommand.java new file mode 100644 index 0000000000..a7e2fd87cb --- /dev/null +++ b/src/client/command/commands/v0/TimeCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.MapleClient; +import client.command.Command; +import constants.ServerConstants; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class TimeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient client, String[] params) { + DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); + dateFormat.setTimeZone(TimeZone.getTimeZone(ServerConstants.TIMEZONE)); + client.getPlayer().yellowMessage("HeavenMS Server Time: " + dateFormat.format(new Date())); + } +} diff --git a/src/client/command/commands/v0/UptimeCommand.java b/src/client/command/commands/v0/UptimeCommand.java new file mode 100644 index 0000000000..966135b0bf --- /dev/null +++ b/src/client/command/commands/v0/UptimeCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v0; + +import client.command.Command; +import client.MapleClient; +import net.server.Server; + +public class UptimeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + long milliseconds = System.currentTimeMillis() - Server.uptime; + int seconds = (int) (milliseconds / 1000) % 60 ; + int minutes = (int) ((milliseconds / (1000*60)) % 60); + int hours = (int) ((milliseconds / (1000*60*60)) % 24); + int days = (int) ((milliseconds / (1000*60*60*24))); + c.getPlayer().yellowMessage("Server has been online for " + days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds."); + } +} diff --git a/src/client/command/commands/v1/BossHpCommand.java b/src/client/command/commands/v1/BossHpCommand.java new file mode 100644 index 0000000000..5bd3ff083b --- /dev/null +++ b/src/client/command/commands/v1/BossHpCommand.java @@ -0,0 +1,52 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.life.MapleMonster; + +public class BossHpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for(MapleMonster monster : player.getMap().getMonsters()) { + if(monster != null && monster.isBoss() && monster.getHp() > 0) { + long percent = monster.getHp() * 100L / monster.getMaxHp(); + String bar = "["; + for (int i = 0; i < 100; i++){ + bar += i < percent ? "|" : "."; + } + bar += "]"; + player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + percent + "% HP left."); + player.yellowMessage("HP: " + bar); + } + } + } +} diff --git a/src/client/command/commands/v1/BuffMeCommand.java b/src/client/command/commands/v1/BuffMeCommand.java new file mode 100644 index 0000000000..a1760124b1 --- /dev/null +++ b/src/client/command/commands/v1/BuffMeCommand.java @@ -0,0 +1,50 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.MapleStat; +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; + +public class BuffMeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(player); + SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(player); + SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(player); + 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()); + } +} diff --git a/src/client/command/commands/v1/GotoCommand.java b/src/client/command/commands/v1/GotoCommand.java new file mode 100644 index 0000000000..85c49a5bf0 --- /dev/null +++ b/src/client/command/commands/v1/GotoCommand.java @@ -0,0 +1,108 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.MaplePortal; +import server.maps.MapleMap; + +import java.util.HashMap; + +public class GotoCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final HashMap gotomaps = new HashMap(); + gotomaps.put("gmmap", 180000000); + gotomaps.put("southperry", 60000); + gotomaps.put("amherst", 1000000); + gotomaps.put("henesys", 100000000); + gotomaps.put("ellinia", 101000000); + gotomaps.put("perion", 102000000); + gotomaps.put("kerning", 103000000); + gotomaps.put("lith", 104000000); + gotomaps.put("sleepywood", 105040300); + gotomaps.put("florina", 110000000); + gotomaps.put("nautilus", 120000000); + gotomaps.put("ereve", 130000000); + gotomaps.put("rien", 140000000); + gotomaps.put("orbis", 200000000); + gotomaps.put("happy", 209000000); + gotomaps.put("elnath", 211000000); + gotomaps.put("ludi", 220000000); + gotomaps.put("aqua", 230000000); + gotomaps.put("leafre", 240000000); + gotomaps.put("mulung", 250000000); + gotomaps.put("herb", 251000000); + gotomaps.put("omega", 221000000); + gotomaps.put("korean", 222000000); + gotomaps.put("ellin", 300000000); + gotomaps.put("nlc", 600000000); + gotomaps.put("excavation", 990000000); + gotomaps.put("pianus", 230040420); + gotomaps.put("horntail", 240060200); + gotomaps.put("mushmom", 100000005); + gotomaps.put("griffey", 240020101); + gotomaps.put("manon", 240020401); + gotomaps.put("horseman", 682000001); + gotomaps.put("balrog", 105090900); + gotomaps.put("zakum", 211042300); + gotomaps.put("papu", 220080001); + gotomaps.put("showa", 801000000); + gotomaps.put("guild", 200000301); + gotomaps.put("shrine", 800000000); + gotomaps.put("skelegon", 240040511); + gotomaps.put("hpq", 100000200); + gotomaps.put("ht", 240050400); + gotomaps.put("ariant", 260000000); + gotomaps.put("magatia", 261000000); + gotomaps.put("singapore", 540000000); + gotomaps.put("keep", 610020006); + gotomaps.put("amoria", 680000000); + gotomaps.put("temple", 270000100); + gotomaps.put("neo", 240070000); + gotomaps.put("fm", 910000000); + + MapleCharacter player = c.getPlayer(); + if (params.length < 1){ + player.yellowMessage("Syntax: @goto "); + return; + } + if (gotomaps.containsKey(params[0])) { + MapleMap target = c.getChannelServer().getMapFactory().getMap(gotomaps.get(params[0])); + MaplePortal targetPortal = target.getPortal(0); + if (player.getEventInstance() != null) { + player.getEventInstance().removePlayer(player); + } + player.changeMap(target, targetPortal); + } else { + player.dropMessage(5, "That map does not exist."); + } + } +} diff --git a/src/client/command/commands/v1/MobHpCommand.java b/src/client/command/commands/v1/MobHpCommand.java new file mode 100644 index 0000000000..64d0a9d29c --- /dev/null +++ b/src/client/command/commands/v1/MobHpCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.life.MapleMonster; + +public class MobHpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for(MapleMonster monster : player.getMap().getMonsters()) { + if (monster != null && monster.getHp() > 0) { + player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP."); + + } + } + } +} diff --git a/src/client/command/commands/v1/WhatDropsFromCommand.java b/src/client/command/commands/v1/WhatDropsFromCommand.java new file mode 100644 index 0000000000..662c67ef46 --- /dev/null +++ b/src/client/command/commands/v1/WhatDropsFromCommand.java @@ -0,0 +1,77 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.MapleItemInformationProvider; +import server.life.MapleMonsterInformationProvider; +import server.life.MonsterDropEntry; +import tools.MaplePacketCreator; +import tools.Pair; + +import java.util.Iterator; + +public class WhatDropsFromCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.dropMessage(5, "Please do @whatdropsfrom "); + return; + } + String monsterName = joinStringFrom(params, 0); + String output = ""; + int limit = 3; + Iterator> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator(); + for (int i = 0; i < limit; i++) { + if(listIterator.hasNext()) { + Pair data = listIterator.next(); + int mobId = data.getLeft(); + String mobName = data.getRight(); + output += mobName + " drops the following items:\r\n\r\n"; + for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){ + try { + String name = MapleItemInformationProvider.getInstance().getName(drop.itemId); + if (name.equals("null") || drop.chance == 0){ + continue; + } + float chance = 1000000 / drop.chance / player.getDropRate(); + output += "- " + name + " (1/" + (int) chance + ")\r\n"; + } catch (Exception ex){ + ex.printStackTrace(); + continue; + } + } + output += "\r\n"; + } + } + c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0)); + } +} diff --git a/src/client/command/commands/v1/WhoDropsCommand.java b/src/client/command/commands/v1/WhoDropsCommand.java new file mode 100644 index 0000000000..4022ef98a9 --- /dev/null +++ b/src/client/command/commands/v1/WhoDropsCommand.java @@ -0,0 +1,88 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v1; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import server.MapleItemInformationProvider; +import server.life.MapleMonsterInformationProvider; +import tools.DatabaseConnection; +import tools.MaplePacketCreator; +import tools.Pair; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Iterator; + +public class WhoDropsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.dropMessage(5, "Please do @whodrops "); + return; + } + String searchString = joinStringFrom(params, 0); + String output = ""; + Iterator> listIterator = MapleItemInformationProvider.getInstance().getItemDataByName(searchString).iterator(); + if(listIterator.hasNext()) { + int count = 1; + while(listIterator.hasNext() && count <= 3) { + Pair data = listIterator.next(); + output += "#b" + data.getRight() + "#k is dropped by:\r\n"; + try { + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT dropperid FROM drop_data WHERE itemid = ? LIMIT 50"); + ps.setInt(1, data.getLeft()); + ResultSet rs = ps.executeQuery(); + while(rs.next()) { + String resultName = MapleMonsterInformationProvider.getMobNameFromID(rs.getInt("dropperid")); + if (resultName != null) { + output += resultName + ", "; + } + } + rs.close(); + ps.close(); + con.close(); + } catch (Exception e) { + player.dropMessage(6, "There was a problem retrieving the required data. Please try again."); + e.printStackTrace(); + return; + } + output += "\r\n\r\n"; + count++; + } + } else { + player.dropMessage(5, "The item you searched for doesn't exist."); + return; + } + c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0)); + } +} diff --git a/src/client/command/commands/v2/ApCommand.java b/src/client/command/commands/v2/ApCommand.java new file mode 100644 index 0000000000..d305c0dc5a --- /dev/null +++ b/src/client/command/commands/v2/ApCommand.java @@ -0,0 +1,66 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import constants.ServerConstants; + +public class ApCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !ap [] "); + return; + } + + if (params.length < 2) { + int newAp = Integer.parseInt(params[0]); + if (newAp < 0) newAp = 0; + else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; + + player.setRemainingAp(newAp); + player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); + } else { + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + int newAp = Integer.parseInt(params[1]); + if (newAp < 0) newAp = 0; + else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; + + victim.setRemainingAp(newAp); + victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp()); + } 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/v2/BombCommand.java new file mode 100644 index 0000000000..d1b1b39ea5 --- /dev/null +++ b/src/client/command/commands/v2/BombCommand.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import server.life.MapleLifeFactory; +import tools.MaplePacketCreator; + +public class BombCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length > 0) { + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), victim.getPosition()); + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, player.getName() + " used !bomb on " + victim.getName())); + } else { + player.message("Player '" + params[0] + "' could not be found on this world."); + } + } else { + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), player.getPosition()); + } + } +} diff --git a/src/client/command/commands/v2/BuffCommand.java b/src/client/command/commands/v2/BuffCommand.java new file mode 100644 index 0000000000..0c7278aa99 --- /dev/null +++ b/src/client/command/commands/v2/BuffCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.Skill; +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class BuffCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !buff "); + return; + } + int skillid = Integer.parseInt(params[0]); + + Skill skill = SkillFactory.getSkill(skillid); + if (skill != null) skill.getEffect(skill.getMaxLevel()).applyTo(player); + } +} diff --git a/src/client/command/commands/v2/BuffMapCommand.java b/src/client/command/commands/v2/BuffMapCommand.java new file mode 100644 index 0000000000..c850ca6207 --- /dev/null +++ b/src/client/command/commands/v2/BuffMapCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class BuffMapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(player, true); + SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(player, true); + SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(player, true); + SkillFactory.getSkill(9101008).getEffect(SkillFactory.getSkill(9101008).getMaxLevel()).applyTo(player, true); + SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(player, true); + + } +} diff --git a/src/client/command/commands/v2/ClearDropsCommand.java b/src/client/command/commands/v2/ClearDropsCommand.java new file mode 100644 index 0000000000..20111d1173 --- /dev/null +++ b/src/client/command/commands/v2/ClearDropsCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class ClearDropsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().clearDrops(player); + player.dropMessage(5, "Cleared dropped items"); + } +} diff --git a/src/client/command/commands/v2/ClearSlotCommand.java b/src/client/command/commands/v2/ClearSlotCommand.java new file mode 100644 index 0000000000..0a35d0aa71 --- /dev/null +++ b/src/client/command/commands/v2/ClearSlotCommand.java @@ -0,0 +1,130 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Item; +import client.inventory.MapleInventoryType; +import client.inventory.manipulator.MapleInventoryManipulator; + +public class ClearSlotCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !clearslot "); + return; + } + String type = params[0]; + switch (type) { + case "all": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true); + } + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true); + } + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true); + } + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true); + } + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("All Slots Cleared."); + break; + case "equip": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("Equipment Slot Cleared."); + break; + case "use": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("Use Slot Cleared."); + break; + case "setup": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("Set-Up Slot Cleared."); + break; + case "etc": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("ETC Slot Cleared."); + break; + case "cash": + for (int i = 0; i < 101; i++) { + Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i); + if (tempItem == null) + continue; + MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true); + } + player.yellowMessage("Cash Slot Cleared."); + break; + default: + player.yellowMessage("Slot" + type + " does not exist!"); + break; + } + } +} diff --git a/src/client/command/commands/v2/DcCommand.java b/src/client/command/commands/v2/DcCommand.java new file mode 100644 index 0000000000..589faa0c3a --- /dev/null +++ b/src/client/command/commands/v2/DcCommand.java @@ -0,0 +1,65 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class DcCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !dc "); + return; + } + + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) { + victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) { + victim = player.getMap().getCharacterByName(params[0]); + if (victim != null) { + try {//sometimes bugged because the map = null + victim.getClient().disconnect(true, false); + player.getMap().removePlayer(victim); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + return; + } + } + } + if (player.gmLevel() < victim.gmLevel()) { + victim = player; + } + victim.getClient().disconnect(false, false); + } +} diff --git a/src/client/command/commands/v2/EmpowerMeCommand.java b/src/client/command/commands/v2/EmpowerMeCommand.java new file mode 100644 index 0000000000..c4fce8bdc1 --- /dev/null +++ b/src/client/command/commands/v2/EmpowerMeCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class EmpowerMeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + final int[] array = {2311003, 2301004, 1301007, 4101004, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002}; + for (int i : array) { + SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(player); + } + } +} diff --git a/src/client/command/commands/v2/GmShopCommand.java b/src/client/command/commands/v2/GmShopCommand.java new file mode 100644 index 0000000000..c77454061e --- /dev/null +++ b/src/client/command/commands/v2/GmShopCommand.java @@ -0,0 +1,40 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.MapleShopFactory; + +public class GmShopCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleShopFactory.getInstance().getShop(1337).sendShop(c); + } +} diff --git a/src/client/command/commands/v2/HealCommand.java b/src/client/command/commands/v2/HealCommand.java new file mode 100644 index 0000000000..a1eeba29e6 --- /dev/null +++ b/src/client/command/commands/v2/HealCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HealCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.setHpMp(30000); + } + +} diff --git a/src/client/command/commands/v2/HideCommand.java b/src/client/command/commands/v2/HideCommand.java new file mode 100644 index 0000000000..38b7c09118 --- /dev/null +++ b/src/client/command/commands/v2/HideCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HideCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); + + } +} diff --git a/src/client/command/commands/v2/ItemCommand.java b/src/client/command/commands/v2/ItemCommand.java new file mode 100644 index 0000000000..677748974f --- /dev/null +++ b/src/client/command/commands/v2/ItemCommand.java @@ -0,0 +1,88 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.MaplePet; +import client.inventory.manipulator.MapleInventoryManipulator; +import constants.ItemConstants; +import constants.ServerConstants; +import server.MapleItemInformationProvider; + +public class ItemCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.yellowMessage("Syntax: !item "); + return; + } + + int itemId = Integer.parseInt(params[0]); + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + + if(ii.getName(itemId) == null) { + player.yellowMessage("Item id '" + params[0] + "' does not exist."); + return; + } + + short quantity = 1; + if(params.length >= 2) quantity = Short.parseShort(params[1]); + + if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { + player.yellowMessage("You cannot create a cash item with this command."); + return; + } + + if (ItemConstants.isPet(itemId)) { + if (params.length >= 2){ // thanks to istreety & TacoBell + quantity = 1; + long days = Math.max(1, Integer.parseInt(params[1])); + long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000); + int petid = MaplePet.createPet(itemId); + + MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration); + return; + } else { + player.yellowMessage("Pet Syntax: !item "); + return; + } + } + + byte flag = 0; + if(player.gmLevel() < 3) { + flag |= ItemConstants.ACCOUNT_SHARING; + flag |= ItemConstants.UNTRADEABLE; + } + + MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1); + } +} diff --git a/src/client/command/commands/v2/ItemDropCommand.java b/src/client/command/commands/v2/ItemDropCommand.java new file mode 100644 index 0000000000..7edbe3900e --- /dev/null +++ b/src/client/command/commands/v2/ItemDropCommand.java @@ -0,0 +1,117 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Item; +import client.inventory.MapleInventoryType; +import client.inventory.MaplePet; +import constants.ItemConstants; +import constants.ServerConstants; +import server.MapleItemInformationProvider; + +public class ItemDropCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.yellowMessage("Syntax: !item "); + return; + } + + int itemId = Integer.parseInt(params[0]); + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + + if(ii.getName(itemId) == null) { + player.yellowMessage("Item id '" + params[0] + "' does not exist."); + return; + } + + short quantity = 1; + if(params.length >= 2) quantity = Short.parseShort(params[1]); + + if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { + player.yellowMessage("You cannot create a cash item with this command."); + return; + } + + if (ItemConstants.isPet(itemId)) { + if (params.length >= 2){ // thanks to istreety & TacoBell + quantity = 1; + long days = Math.max(1, Integer.parseInt(params[1])); + long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000); + int petid = MaplePet.createPet(itemId); + + Item toDrop = new Item(itemId, (short) 0, quantity, petid); + toDrop.setExpiration(expiration); + + toDrop.setOwner(""); + if(player.gmLevel() < 3) { + byte b = toDrop.getFlag(); + b |= ItemConstants.ACCOUNT_SHARING; + b |= ItemConstants.UNTRADEABLE; + b |= ItemConstants.SANDBOX; + + toDrop.setFlag(b); + toDrop.setOwner("TRIAL-MODE"); + } + + c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true); + + return; + } else { + player.yellowMessage("Pet Syntax: !item "); + return; + } + } + + + Item toDrop; + if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) { + toDrop = ii.getEquipById(itemId); + } else { + toDrop = new Item(itemId, (short) 0, quantity); + } + + toDrop.setOwner(player.getName()); + if(player.gmLevel() < 3) { + byte b = toDrop.getFlag(); + b |= ItemConstants.ACCOUNT_SHARING; + b |= ItemConstants.UNTRADEABLE; + b |= ItemConstants.SANDBOX; + + toDrop.setFlag(b); + toDrop.setOwner("TRIAL-MODE"); + } + + c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true); + } +} diff --git a/src/client/command/commands/v2/JailCommand.java b/src/client/command/commands/v2/JailCommand.java new file mode 100644 index 0000000000..97d6ec3944 --- /dev/null +++ b/src/client/command/commands/v2/JailCommand.java @@ -0,0 +1,73 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.MaplePortal; +import server.maps.MapleMap; + +public class JailCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !jail []"); + return; + } + + int minutesJailed = 5; + if (params.length >= 2) { + minutesJailed = Integer.valueOf(params[1]); + if (minutesJailed <= 0) { + player.yellowMessage("Syntax: !jail []"); + return; + } + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.addJailExpirationTime(minutesJailed * 60 * 1000); + + int mapid = 300000012; + + if (victim.getMapId() != mapid) { // those gone to jail won't be changing map anyway + MapleMap target = c.getChannelServer().getMapFactory().getMap(mapid); + MaplePortal targetPortal = target.getPortal(0); + victim.changeMap(target, targetPortal); + player.message(victim.getName() + " was jailed for " + minutesJailed + " minutes."); + } else { + player.message(victim.getName() + "'s time in jail has been extended for " + minutesJailed + " minutes."); + } + + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v2/JobCommand.java b/src/client/command/commands/v2/JobCommand.java new file mode 100644 index 0000000000..a40ce8f06d --- /dev/null +++ b/src/client/command/commands/v2/JobCommand.java @@ -0,0 +1,67 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.MapleJob; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class JobCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length == 1) { + int jobid = Integer.parseInt(params[0]); + if (jobid < 0 || jobid >= 2200) { + player.message("Jobid " + jobid + " is not available."); + return; + } + + player.changeJob(MapleJob.getById(jobid)); + player.equipChanged(); + } else if (params.length == 2) { + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + + if (victim != null) { + int jobid = Integer.parseInt(params[1]); + if (jobid < 0 || jobid >= 2200) { + player.message("Jobid " + jobid + " is not available."); + return; + } + + victim.changeJob(MapleJob.getById(jobid)); + player.equipChanged(); + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } else { + player.message("Syntax: !job "); + } + } +} diff --git a/src/client/command/commands/v2/LevelCommand.java b/src/client/command/commands/v2/LevelCommand.java new file mode 100644 index 0000000000..cc03a5b0db --- /dev/null +++ b/src/client/command/commands/v2/LevelCommand.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import constants.ServerConstants; + +public class LevelCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !level "); + return; + } + + player.loseExp(player.getExp(), false, false); + player.setLevel(Math.min(Integer.parseInt(params[0]), player.getMaxClassLevel()) - 1); + + player.resetPlayerRates(); + if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); + player.setWorldRates(); + + player.levelUp(false); + } +} diff --git a/src/client/command/commands/v2/LevelProCommand.java b/src/client/command/commands/v2/LevelProCommand.java new file mode 100644 index 0000000000..4ce2ebf9ca --- /dev/null +++ b/src/client/command/commands/v2/LevelProCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class LevelProCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !levelpro "); + return; + } + while (player.getLevel() < Math.min(player.getMaxClassLevel(), Integer.parseInt(params[0]))) { + player.levelUp(false); + } + } +} diff --git a/src/client/command/commands/v2/MaxSkillCommand.java b/src/client/command/commands/v2/MaxSkillCommand.java new file mode 100644 index 0000000000..4fdde06ed8 --- /dev/null +++ b/src/client/command/commands/v2/MaxSkillCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.*; +import client.command.Command; +import provider.MapleData; +import provider.MapleDataProviderFactory; + +import java.io.File; + +public class MaxSkillCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) { + try { + Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); + player.changeSkillLevel(skill, (byte) skill.getMaxLevel(), skill.getMaxLevel(), -1); + } catch (NumberFormatException nfe) { + nfe.printStackTrace(); + break; + } catch (NullPointerException npe) { } + } + + if (player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { + Skill skill = SkillFactory.getSkill(5001005); + player.changeSkillLevel(skill, (byte) -1, -1, -1); + } else { + Skill skill = SkillFactory.getSkill(21001001); + player.changeSkillLevel(skill, (byte) -1, -1, -1); + } + + } +} diff --git a/src/client/command/commands/v2/MaxStatCommand.java b/src/client/command/commands/v2/MaxStatCommand.java new file mode 100644 index 0000000000..995764ea25 --- /dev/null +++ b/src/client/command/commands/v2/MaxStatCommand.java @@ -0,0 +1,63 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +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 { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.loseExp(player.getExp(), false, false); + player.setLevel(255); + 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.setFame(13337); + player.setMaxHp(30000); + player.setMaxMp(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/v2/MesosCommand.java new file mode 100644 index 0000000000..5d1c6de96b --- /dev/null +++ b/src/client/command/commands/v2/MesosCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class MesosCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length >= 1) { + player.gainMeso(Integer.parseInt(params[0]), true); + } + } +} diff --git a/src/client/command/commands/v2/ReachCommand.java b/src/client/command/commands/v2/ReachCommand.java new file mode 100644 index 0000000000..e4e2fa46a6 --- /dev/null +++ b/src/client/command/commands/v2/ReachCommand.java @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.maps.MapleMap; + +public class ReachCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !reach "); + return; + } + + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null && victim.isLoggedin()) { + if (player.getClient().getChannel() != victim.getClient().getChannel()) { + player.dropMessage(5, "Player '" + victim.getName() + "' is at channel " + victim.getClient().getChannel() + "."); + } else { + MapleMap map = victim.getMap(); + player.forceChangeMap(map, map.findClosestPortal(victim.getPosition())); + } + } else { + player.dropMessage(6, "Unknown player."); + } + } +} diff --git a/src/client/command/commands/v2/RechargeCommand.java b/src/client/command/commands/v2/RechargeCommand.java new file mode 100644 index 0000000000..631fcae7af --- /dev/null +++ b/src/client/command/commands/v2/RechargeCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import client.inventory.Item; +import client.inventory.MapleInventoryType; +import constants.ItemConstants; +import server.MapleItemInformationProvider; + +public class RechargeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + for (Item torecharge : c.getPlayer().getInventory(MapleInventoryType.USE).list()) { + if (ItemConstants.isThrowingStar(torecharge.getItemId())){ + torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId())); + c.getPlayer().forceUpdateItem(torecharge); + } else if (ItemConstants.isArrow(torecharge.getItemId())){ + torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId())); + c.getPlayer().forceUpdateItem(torecharge); + } else if (ItemConstants.isBullet(torecharge.getItemId())){ + torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId())); + c.getPlayer().forceUpdateItem(torecharge); + } else if (ItemConstants.isConsumable(torecharge.getItemId())){ + torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId())); + c.getPlayer().forceUpdateItem(torecharge); + } + } + player.dropMessage(5, "USE Recharged."); + } +} diff --git a/src/client/command/commands/v2/ResetSkillCommand.java b/src/client/command/commands/v2/ResetSkillCommand.java new file mode 100644 index 0000000000..93287e2882 --- /dev/null +++ b/src/client/command/commands/v2/ResetSkillCommand.java @@ -0,0 +1,62 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.*; +import client.command.Command; +import provider.MapleData; +import provider.MapleDataProviderFactory; + +import java.io.File; + +public class ResetSkillCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) { + try { + Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName())); + player.changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1); + } catch (NumberFormatException nfe) { + nfe.printStackTrace(); + break; + } catch (NullPointerException npe) { + } + } + + if (player.getJob().isA(MapleJob.ARAN1) || player.getJob().isA(MapleJob.LEGEND)) { + Skill skill = SkillFactory.getSkill(5001005); + player.changeSkillLevel(skill, (byte) -1, -1, -1); + } else { + Skill skill = SkillFactory.getSkill(21001001); + player.changeSkillLevel(skill, (byte) -1, -1, -1); + } + + player.yellowMessage("Skills reseted."); + } +} diff --git a/src/client/command/commands/v2/SearchCommand.java b/src/client/command/commands/v2/SearchCommand.java new file mode 100644 index 0000000000..2306f23649 --- /dev/null +++ b/src/client/command/commands/v2/SearchCommand.java @@ -0,0 +1,98 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import provider.MapleData; +import provider.MapleDataProvider; +import provider.MapleDataProviderFactory; +import provider.MapleDataTool; +import server.MapleItemInformationProvider; +import tools.MaplePacketCreator; +import tools.Pair; + +import java.io.File; + +public class SearchCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !search "); + return; + } + StringBuilder sb = new StringBuilder(); + + String search = joinStringFrom(params,1); + long start = System.currentTimeMillis();//for the lulz + MapleData data = null; + MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz")); + if (!params[0].equalsIgnoreCase("ITEM")) { + if (params[0].equalsIgnoreCase("NPC")) { + data = dataProvider.getData("Npc.img"); + } else if (params[0].equalsIgnoreCase("MOB") || params[0].equalsIgnoreCase("MONSTER")) { + data = dataProvider.getData("Mob.img"); + } else if (params[0].equalsIgnoreCase("SKILL")) { + data = dataProvider.getData("Skill.img"); + /*} else if (sub[1].equalsIgnoreCase("MAP")) { + TODO + */ + } else { + sb.append("#bInvalid search.\r\nSyntax: '!search [type] [name]', where [type] is NPC, ITEM, MOB, or SKILL."); + } + if (data != null) { + String name; + for (MapleData searchData : data.getChildren()) { + name = MapleDataTool.getString(searchData.getChildByPath("name"), "NO-NAME"); + if (name.toLowerCase().contains(search.toLowerCase())) { + sb.append("#b").append(Integer.parseInt(searchData.getName())).append("#k - #r").append(name).append("\r\n"); + } + } + } + } else { + for (Pair itemPair : MapleItemInformationProvider.getInstance().getAllItems()) { + if (sb.length() < 32654) {//ohlol + if (itemPair.getRight().toLowerCase().contains(search.toLowerCase())) { + sb.append("#b").append(itemPair.getLeft()).append("#k - #r").append(itemPair.getRight()).append("\r\n"); + } + } else { + sb.append("#bCouldn't load all items, there are too many results.\r\n"); + break; + } + } + } + if (sb.length() == 0) { + sb.append("#bNo ").append(params[0].toLowerCase()).append("s found.\r\n"); + } + sb.append("\r\n#kLoaded within ").append((double) (System.currentTimeMillis() - start) / 1000).append(" seconds.");//because I can, and it's free + + c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, sb.toString(), "00 00", (byte) 0)); + } +} diff --git a/src/client/command/commands/v2/SetStatCommand.java b/src/client/command/commands/v2/SetStatCommand.java new file mode 100644 index 0000000000..b1fabca6b7 --- /dev/null +++ b/src/client/command/commands/v2/SetStatCommand.java @@ -0,0 +1,63 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class SetStatCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !setstat "); + return; + } + + int x; + try { + 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) { + } + } +} diff --git a/src/client/command/commands/v2/SpCommand.java b/src/client/command/commands/v2/SpCommand.java new file mode 100644 index 0000000000..5a610a4d14 --- /dev/null +++ b/src/client/command/commands/v2/SpCommand.java @@ -0,0 +1,68 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import constants.ServerConstants; + +public class SpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !sp [] "); + return; + } + + if (params.length == 1) { + int newSp = Integer.parseInt(params[0]); + if (newSp < 0) newSp = 0; + else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; + + player.setRemainingSp(newSp); + player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + } else { + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + int newSp = Integer.parseInt(params[1]); + if (newSp < 0) newSp = 0; + else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; + + victim.setRemainingSp(newSp); + victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + + player.dropMessage(5, "SP given."); + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } + } +} diff --git a/src/client/command/commands/v2/SummonCommand.java b/src/client/command/commands/v2/SummonCommand.java new file mode 100644 index 0000000000..785d5dfa14 --- /dev/null +++ b/src/client/command/commands/v2/SummonCommand.java @@ -0,0 +1,83 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.channel.Channel; + +public class SummonCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !warphere "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) {//If victim isn't on current channel, loop all channels on current world. + for (Channel ch : Server.getInstance().getChannelsFromWorld(c.getWorld())) { + victim = ch.getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + break;//We found the person, no need to continue the loop. + } + } + } + if (victim != null) { + boolean changingEvent = true; + + if (victim.getEventInstance() != null) { + if (player.getEventInstance() != null && victim.getEventInstance().getLeaderId() == player.getEventInstance().getLeaderId()) { + changingEvent = false; + } else { + victim.getEventInstance().unregisterPlayer(victim); + } + } + //Attempt to join the warpers instance. + if (player.getEventInstance() != null && changingEvent) { + if (player.getClient().getChannel() == victim.getClient().getChannel()) {//just in case.. you never know... + player.getEventInstance().registerPlayer(victim); + victim.changeMap(player.getEventInstance().getMapInstance(player.getMapId()), player.getMap().findClosestPortal(player.getPosition())); + } else { + player.dropMessage("Target isn't on your channel, not able to warp into event instance."); + } + } else {//If victim isn't in an event instance or is in the same event instance as the one the caller is, just warp them. + victim.changeMap(player.getMapId(), player.getMap().findClosestPortal(player.getPosition())); + } + if (player.getClient().getChannel() != victim.getClient().getChannel()) {//And then change channel if needed. + victim.dropMessage("Changing channel, please wait a moment."); + victim.getClient().changeChannel(player.getClient().getChannel()); + } + } else { + player.dropMessage(6, "Unknown player."); + } + } +} diff --git a/src/client/command/commands/v2/UnBugCommand.java b/src/client/command/commands/v2/UnBugCommand.java new file mode 100644 index 0000000000..de7fefd97e --- /dev/null +++ b/src/client/command/commands/v2/UnBugCommand.java @@ -0,0 +1,40 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class UnBugCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.enableActions()); + } +} diff --git a/src/client/command/commands/v2/UnHideCommand.java b/src/client/command/commands/v2/UnHideCommand.java new file mode 100644 index 0000000000..37a8de8539 --- /dev/null +++ b/src/client/command/commands/v2/UnHideCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.SkillFactory; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class UnHideCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); + + } +} diff --git a/src/client/command/commands/v2/UnJailCommand.java b/src/client/command/commands/v2/UnJailCommand.java new file mode 100644 index 0000000000..52b2e86ff7 --- /dev/null +++ b/src/client/command/commands/v2/UnJailCommand.java @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class UnJailCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !unjail "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + if (victim.getJailExpirationTimeLeft() <= 0) { + player.message("This player is already free."); + return; + } + victim.removeJailExpirationTime(); + victim.message("By lack of concrete proof you are now unjailed. Enjoy freedom!"); + player.message(victim.getName() + " was unjailed."); + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v2/WarpCommand.java b/src/client/command/commands/v2/WarpCommand.java new file mode 100644 index 0000000000..95f3af1558 --- /dev/null +++ b/src/client/command/commands/v2/WarpCommand.java @@ -0,0 +1,58 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.maps.MapleMap; + +public class WarpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !warp "); + return; + } + + try { + MapleMap target = c.getChannelServer().getMapFactory().getMap(Integer.parseInt(params[0])); + if (target == null) { + player.yellowMessage("Map ID " + params[0] + " is invalid."); + return; + } + if (player.getEventInstance() != null) { + player.getEventInstance().leftParty(player); + } + player.changeMap(target, target.getRandomPlayerSpawnpoint()); + } catch (Exception ex) { + player.yellowMessage("Map ID " + params[0] + " is invalid."); + } + } +} diff --git a/src/client/command/commands/v2/WarpToCommand.java b/src/client/command/commands/v2/WarpToCommand.java new file mode 100644 index 0000000000..67f5207fdf --- /dev/null +++ b/src/client/command/commands/v2/WarpToCommand.java @@ -0,0 +1,78 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.channel.Channel; + +public class WarpToCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !warpto "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) {//If victim isn't on current channel or isnt a character try and find him by loop all channels on current world. + for (Channel ch : Server.getInstance().getChannelsFromWorld(c.getWorld())) { + victim = ch.getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + break;//We found the person, no need to continue the loop. + } + } + } + if (victim != null) {//If target isn't null attempt to warp. + //Remove warper from current event instance. + if (player.getEventInstance() != null) { + player.getEventInstance().unregisterPlayer(player); + } + //Attempt to join the victims warp instance. + if (victim.getEventInstance() != null) { + if (victim.getClient().getChannel() == player.getClient().getChannel()) {//just in case.. you never know... + //victim.getEventInstance().registerPlayer(player); + player.changeMap(victim.getEventInstance().getMapInstance(victim.getMapId()), victim.getMap().findClosestPortal(victim.getPosition())); + } else { + player.dropMessage(6, "Please change to channel " + victim.getClient().getChannel()); + } + } else {//If victim isn't in an event instance, just warp them. + player.changeMap(victim.getMapId(), victim.getMap().findClosestPortal(victim.getPosition())); + } + if (player.getClient().getChannel() != victim.getClient().getChannel()) {//And then change channel if needed. + player.dropMessage("Changing channel, please wait a moment."); + player.getClient().changeChannel(victim.getClient().getChannel()); + } + } else { + player.dropMessage(6, "Unknown player."); + } + } +} diff --git a/src/client/command/commands/v2/WhereaMiCommand.java b/src/client/command/commands/v2/WhereaMiCommand.java new file mode 100644 index 0000000000..54ff6299e6 --- /dev/null +++ b/src/client/command/commands/v2/WhereaMiCommand.java @@ -0,0 +1,64 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v2; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleMonster; +import server.life.MapleNPC; +import server.maps.MapleMapObject; + +public class WhereaMiCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.yellowMessage("Map ID: " + player.getMap().getId()); + player.yellowMessage("Players on this map:"); + for (MapleMapObject mmo : player.getMap().getPlayers()) { + MapleCharacter chr = (MapleCharacter) mmo; + player.dropMessage(5, ">> " + chr.getName() + " - " + chr.getId() + " - Oid: " + chr.getObjectId()); + } + player.yellowMessage("NPCs on this map:"); + for (MapleMapObject npcs : player.getMap().getMapObjects()) { + if (npcs instanceof MapleNPC) { + MapleNPC npc = (MapleNPC) npcs; + player.dropMessage(5, ">> " + npc.getName() + " - " + npc.getId() + " - Oid: " + npc.getObjectId()); + } + } + player.yellowMessage("Monsters on this map:"); + for (MapleMapObject mobs : player.getMap().getMapObjects()) { + if (mobs instanceof MapleMonster) { + MapleMonster mob = (MapleMonster) mobs; + if (mob.isAlive()) { + player.dropMessage(5, ">> " + mob.getName() + " - " + mob.getId() + " - Oid: " + mob.getObjectId()); + } + } + } + } +} diff --git a/src/client/command/commands/v3/BanCommand.java b/src/client/command/commands/v3/BanCommand.java new file mode 100644 index 0000000000..3d6f6bbdeb --- /dev/null +++ b/src/client/command/commands/v3/BanCommand.java @@ -0,0 +1,96 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import server.TimerManager; +import tools.DatabaseConnection; +import tools.MaplePacketCreator; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class BanCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !ban (Please be descriptive)"); + return; + } + String ign = params[0]; + String reason = joinStringFrom(params, 1); + MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(ign); + if (target != null) { + String readableTargetName = MapleCharacter.makeMapleReadable(target.getName()); + String ip = target.getClient().getSession().getRemoteAddress().toString().split(":")[0]; + //Ban ip + PreparedStatement ps = null; + try { + Connection con = DatabaseConnection.getConnection(); + if (ip.matches("/[0-9]{1,3}\\..*")) { + ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?, ?)"); + ps.setString(1, ip); + ps.setString(2, String.valueOf(target.getClient().getAccID())); + + ps.executeUpdate(); + ps.close(); + } + + con.close(); + } catch (SQLException ex) { + ex.printStackTrace(); + c.getPlayer().message("Error occured while banning IP address"); + c.getPlayer().message(target.getName() + "'s IP was not banned: " + ip); + } + target.getClient().banMacs(); + reason = c.getPlayer().getName() + " banned " + readableTargetName + " for " + reason + " (IP: " + ip + ") " + "(MAC: " + c.getMacs() + ")"; + target.ban(reason); + target.yellowMessage("You have been banned by #b" + c.getPlayer().getName() + " #k."); + target.yellowMessage("Reason: " + reason); + c.announce(MaplePacketCreator.getGMEffect(4, (byte) 0)); + final MapleCharacter rip = target; + TimerManager.getInstance().schedule(new Runnable() { + @Override + public void run() { + rip.getClient().disconnect(false, false); + } + }, 5000); //5 Seconds + Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); + } else if (MapleCharacter.ban(ign, reason, false)) { + c.announce(MaplePacketCreator.getGMEffect(4, (byte) 0)); + Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + ign + " has been banned.")); + } else { + c.announce(MaplePacketCreator.getGMEffect(6, (byte) 1)); + } + } +} diff --git a/src/client/command/commands/v3/ChatCommand.java b/src/client/command/commands/v3/ChatCommand.java new file mode 100644 index 0000000000..298b4c9d32 --- /dev/null +++ b/src/client/command/commands/v3/ChatCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class ChatCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.toggleWhiteChat(); + player.message("Your chat is now " + (player.getWhiteChat() ? " white" : "normal") + "."); + } +} diff --git a/src/client/command/commands/v3/CheckDmgCommand.java b/src/client/command/commands/v3/CheckDmgCommand.java new file mode 100644 index 0000000000..9809288bc8 --- /dev/null +++ b/src/client/command/commands/v3/CheckDmgCommand.java @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleBuffStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class CheckDmgCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + int maxBase = victim.calculateMaxBaseDamage(victim.getTotalWatk()); + Integer watkBuff = victim.getBuffedValue(MapleBuffStat.WATK); + Integer matkBuff = victim.getBuffedValue(MapleBuffStat.MATK); + Integer blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12); + if (watkBuff == null) watkBuff = 0; + if (matkBuff == null) matkBuff = 0; + + player.dropMessage(5, "Cur Str: " + victim.getTotalStr() + " Cur Dex: " + victim.getTotalDex() + " Cur Int: " + victim.getTotalInt() + " Cur Luk: " + victim.getTotalLuk()); + player.dropMessage(5, "Cur WATK: " + victim.getTotalWatk() + " Cur MATK: " + victim.getTotalMagic()); + player.dropMessage(5, "Cur WATK Buff: " + watkBuff + " Cur MATK Buff: " + matkBuff + " Cur Blessing Level: " + blessing); + player.dropMessage(5, victim.getName() + "'s maximum base damage (before skills) is " + maxBase); + } else { + player.message("Player '" + params[0] + "' could not be found on this world."); + } + } +} diff --git a/src/client/command/commands/v3/ClosePortalCommand.java b/src/client/command/commands/v3/ClosePortalCommand.java new file mode 100644 index 0000000000..893d790732 --- /dev/null +++ b/src/client/command/commands/v3/ClosePortalCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class ClosePortalCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !closeportal "); + return; + } + player.getMap().getPortal(params[0]).setPortalState(false); + } +} diff --git a/src/client/command/commands/v3/DebuffCommand.java b/src/client/command/commands/v3/DebuffCommand.java new file mode 100644 index 0000000000..40b6feff6d --- /dev/null +++ b/src/client/command/commands/v3/DebuffCommand.java @@ -0,0 +1,118 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleDisease; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MobSkill; +import server.life.MobSkillFactory; +import server.maps.MapleMapObject; +import server.maps.MapleMapObjectType; + +import java.util.Arrays; + +public class DebuffCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); + return; + } + + MapleDisease disease = null; + MobSkill skill = null; + + switch (params[0].toUpperCase()) { + case "SLOW": + disease = MapleDisease.SLOW; + skill = MobSkillFactory.getMobSkill(126, 7); + break; + + case "SEDUCE": + disease = MapleDisease.SEDUCE; + skill = MobSkillFactory.getMobSkill(128, 7); + break; + + case "ZOMBIFY": + disease = MapleDisease.ZOMBIFY; + skill = MobSkillFactory.getMobSkill(133, 1); + break; + + case "CONFUSE": + disease = MapleDisease.CONFUSE; + skill = MobSkillFactory.getMobSkill(132, 2); + break; + + case "STUN": + disease = MapleDisease.STUN; + skill = MobSkillFactory.getMobSkill(123, 7); + break; + + case "POISON": + disease = MapleDisease.POISON; + skill = MobSkillFactory.getMobSkill(125, 5); + break; + + case "SEAL": + disease = MapleDisease.SEAL; + skill = MobSkillFactory.getMobSkill(120, 1); + break; + + case "DARKNESS": + disease = MapleDisease.DARKNESS; + skill = MobSkillFactory.getMobSkill(121, 1); + break; + + case "WEAKEN": + disease = MapleDisease.WEAKEN; + skill = MobSkillFactory.getMobSkill(122, 1); + break; + + case "CURSE": + disease = MapleDisease.CURSE; + skill = MobSkillFactory.getMobSkill(124, 1); + break; + } + + if (disease == null) { + player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); + return; + } + + for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) { + MapleCharacter chr = (MapleCharacter) mmo; + + if (chr.getId() != player.getId()) { + chr.giveDebuff(disease, skill); + } + } + } +} diff --git a/src/client/command/commands/v3/EndEventCommand.java b/src/client/command/commands/v3/EndEventCommand.java new file mode 100644 index 0000000000..1eb60675d3 --- /dev/null +++ b/src/client/command/commands/v3/EndEventCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class EndEventCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + c.getChannelServer().setEvent(null); + player.dropMessage(5, "You have ended the event. No more players may join."); + } +} diff --git a/src/client/command/commands/v3/ExpedsCommand.java b/src/client/command/commands/v3/ExpedsCommand.java new file mode 100644 index 0000000000..6b90241f5e --- /dev/null +++ b/src/client/command/commands/v3/ExpedsCommand.java @@ -0,0 +1,66 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.channel.Channel; +import server.expeditions.MapleExpedition; + +public class ExpedsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (Channel ch : Server.getInstance().getChannelsFromWorld(c.getWorld())) { + if (ch.getExpeditions().isEmpty()) { + player.yellowMessage("No Expeditions in Channel " + ch.getId()); + continue; + } + player.yellowMessage("Expeditions in Channel " + ch.getId()); + int id = 0; + for (MapleExpedition exped : ch.getExpeditions()) { + id++; + player.yellowMessage("> Expedition " + id); + player.yellowMessage(">> Type: " + exped.getType().toString()); + player.yellowMessage(">> Status: " + (exped.isRegistering() ? "REGISTERING" : "UNDERWAY")); + player.yellowMessage(">> Size: " + exped.getMembers().size()); + player.yellowMessage(">> Leader: " + exped.getLeader().getName()); + int memId = 2; + for (MapleCharacter member : exped.getMembers()) { + if (exped.isLeader(member)) { + continue; + } + player.yellowMessage(">>> Member " + memId + ": " + member.getName()); + memId++; + } + } + } + } +} diff --git a/src/client/command/commands/v3/FaceCommand.java b/src/client/command/commands/v3/FaceCommand.java new file mode 100644 index 0000000000..0611d7a823 --- /dev/null +++ b/src/client/command/commands/v3/FaceCommand.java @@ -0,0 +1,75 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.MapleItemInformationProvider; + +public class FaceCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !face [] "); + return; + } + + try { + if (params.length == 1) { + int itemId = Integer.parseInt(params[0]); + if (!(itemId >= 20000 && itemId < 22000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + player.yellowMessage("Face id '" + params[0] + "' does not exist."); + return; + } + + player.setFace(itemId); + player.updateSingleStat(MapleStat.FACE, itemId); + player.equipChanged(); + } else { + int itemId = Integer.parseInt(params[1]); + if (!(itemId >= 20000 && itemId < 22000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + player.yellowMessage("Face id '" + params[1] + "' does not exist."); + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) { + victim.setFace(itemId); + victim.updateSingleStat(MapleStat.FACE, itemId); + victim.equipChanged(); + } else { + player.yellowMessage("Player '" + params[0] + "' has not been found on this channel."); + } + } + } catch (Exception e) { + } + + } +} diff --git a/src/client/command/commands/v3/FameCommand.java b/src/client/command/commands/v3/FameCommand.java new file mode 100644 index 0000000000..b51d70336c --- /dev/null +++ b/src/client/command/commands/v3/FameCommand.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class FameCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !fame "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.setFame(Integer.parseInt(params[1])); + victim.updateSingleStat(MapleStat.FAME, victim.getFame()); + player.message("FAME given."); + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v3/FlyCommand.java b/src/client/command/commands/v3/FlyCommand.java new file mode 100644 index 0000000000..4929dcaa97 --- /dev/null +++ b/src/client/command/commands/v3/FlyCommand.java @@ -0,0 +1,61 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; + +public class FlyCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { // fly option will become available for any character of that account + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !fly "); + return; + } + + Integer accid = c.getAccID(); + Server srv = Server.getInstance(); + String sendStr = ""; + if (params[0].equalsIgnoreCase("on")) { + sendStr += "Enabled Fly feature (F1). With fly active, you cannot attack."; + if (!srv.canFly(accid)) sendStr += " Re-login to take effect."; + + srv.changeFly(c.getAccID(), true); + } else { + sendStr += "Disabled Fly feature. You can now attack."; + if (srv.canFly(accid)) sendStr += " Re-login to take effect."; + + srv.changeFly(c.getAccID(), false); + } + + player.dropMessage(6, sendStr); + } +} diff --git a/src/client/command/commands/v3/GiveMesosCommand.java b/src/client/command/commands/v3/GiveMesosCommand.java new file mode 100644 index 0000000000..946e828da3 --- /dev/null +++ b/src/client/command/commands/v3/GiveMesosCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class GiveMesosCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !givems [] "); + return; + } + + String recv_; + int value_; + if (params.length == 2) { + recv_ = params[0]; + value_ = Integer.parseInt(params[1]); + } else { + recv_ = c.getPlayer().getName(); + value_ = Integer.parseInt(params[0]); + } + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(recv_); + if (victim != null) { + victim.gainMeso(value_, true); + player.message("MESO given."); + } else { + player.message("Player '" + recv_ + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v3/GiveNxCommand.java b/src/client/command/commands/v3/GiveNxCommand.java new file mode 100644 index 0000000000..6294b98892 --- /dev/null +++ b/src/client/command/commands/v3/GiveNxCommand.java @@ -0,0 +1,61 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class GiveNxCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !givenx [] "); + return; + } + + String recv; + int value; + if (params.length > 1) { + recv = params[0]; + value = Integer.parseInt(params[1]); + } else { + recv = c.getPlayer().getName(); + value = Integer.parseInt(params[0]); + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(recv); + if (victim != null) { + victim.getCashShop().gainCash(1, value); + player.message("NX given."); + } else { + player.message("Player '" + recv + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v3/GiveVpCommand.java b/src/client/command/commands/v3/GiveVpCommand.java new file mode 100644 index 0000000000..ce6b642f97 --- /dev/null +++ b/src/client/command/commands/v3/GiveVpCommand.java @@ -0,0 +1,51 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class GiveVpCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !givevp "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.getClient().addVotePoints(Integer.parseInt(params[1])); + player.message("VP given."); + } else { + player.message("Player '" + params[0] + "' could not be found on this channel."); + } + } +} diff --git a/src/client/command/commands/v3/HairCommand.java b/src/client/command/commands/v3/HairCommand.java new file mode 100644 index 0000000000..b9f3a31058 --- /dev/null +++ b/src/client/command/commands/v3/HairCommand.java @@ -0,0 +1,75 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.MapleItemInformationProvider; + +public class HairCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !hair [] "); + return; + } + + try { + if (params.length == 1) { + int itemId = Integer.parseInt(params[0]); + if (!(itemId >= 30000 && itemId < 35000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + player.yellowMessage("Hair id '" + params[0] + "' does not exist."); + return; + } + + player.setHair(itemId); + player.updateSingleStat(MapleStat.HAIR, itemId); + player.equipChanged(); + } else { + int itemId = Integer.parseInt(params[1]); + if (!(itemId >= 30000 && itemId < 35000) || MapleItemInformationProvider.getInstance().getName(itemId) == null) { + player.yellowMessage("Hair id '" + params[1] + "' does not exist."); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.setHair(itemId); + victim.updateSingleStat(MapleStat.HAIR, itemId); + victim.equipChanged(); + } else { + player.yellowMessage("Player '" + params[0] + "' has not been found on this channel."); + } + } + } catch (Exception e) { + } + } +} diff --git a/src/client/command/commands/v3/HealMapCommand.java b/src/client/command/commands/v3/HealMapCommand.java new file mode 100644 index 0000000000..aedfc4cac8 --- /dev/null +++ b/src/client/command/commands/v3/HealMapCommand.java @@ -0,0 +1,48 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HealMapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + 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()); + } + } + } +} diff --git a/src/client/command/commands/v3/HealPersonCommand.java b/src/client/command/commands/v3/HealPersonCommand.java new file mode 100644 index 0000000000..6c6c0f9aad --- /dev/null +++ b/src/client/command/commands/v3/HealPersonCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HealPersonCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + 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()); + } 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/v3/HpMpCommand.java new file mode 100644 index 0000000000..30b680825d --- /dev/null +++ b/src/client/command/commands/v3/HpMpCommand.java @@ -0,0 +1,62 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HpMpCommand extends Command { + { + setDescription(""); + } + + @Override + 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 = Integer.valueOf(params[1]); + } else if (params.length == 1) { + statUpdate = Integer.valueOf(params[0]); + } else { + player.yellowMessage("Syntax: !hpmp [] "); + } + + if (victim != null) { + victim.setHp(statUpdate); + victim.setMp(statUpdate); + victim.updateSingleStat(MapleStat.HP, statUpdate); + victim.updateSingleStat(MapleStat.MP, statUpdate); + + victim.checkBerserk(victim.isHidden()); + } 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/v3/HurtCommand.java new file mode 100644 index 0000000000..069454b6f9 --- /dev/null +++ b/src/client/command/commands/v3/HurtCommand.java @@ -0,0 +1,47 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class HurtCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.setHp(1); + victim.updateSingleStat(MapleStat.HP, 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/v3/IdCommand.java new file mode 100644 index 0000000000..7248268598 --- /dev/null +++ b/src/client/command/commands/v3/IdCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +public class IdCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !id "); + return; + } + try { + try (BufferedReader dis = new BufferedReader(new InputStreamReader(new URL("http://www.mapletip.com/search_java.php?search_value=" + params[0] + "&check=true").openConnection().getInputStream()))) { + String s; + while ((s = dis.readLine()) != null) { + player.dropMessage(s); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/client/command/commands/v3/IgnoreCommand.java b/src/client/command/commands/v3/IgnoreCommand.java new file mode 100644 index 0000000000..9d58f4e1e3 --- /dev/null +++ b/src/client/command/commands/v3/IgnoreCommand.java @@ -0,0 +1,61 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import tools.MapleLogger; +import tools.MaplePacketCreator; + +public class IgnoreCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !ignore "); + return; + } + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) { + player.message("Player '" + params[0] + "' could not be found on this world."); + return; + } + boolean monitored_ = MapleLogger.ignored.contains(victim.getName()); + if (monitored_) { + MapleLogger.ignored.remove(victim.getName()); + } else { + MapleLogger.ignored.add(victim.getName()); + } + player.yellowMessage(victim.getName() + " is " + (!monitored_ ? "now being ignored." : "no longer being ignored.")); + String message_ = player.getName() + (!monitored_ ? " has started ignoring " : " has stopped ignoring ") + victim.getName() + "."; + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message_)); + + } +} diff --git a/src/client/command/commands/v3/IgnoredCommand.java b/src/client/command/commands/v3/IgnoredCommand.java new file mode 100644 index 0000000000..c4b287477a --- /dev/null +++ b/src/client/command/commands/v3/IgnoredCommand.java @@ -0,0 +1,43 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MapleLogger; + +public class IgnoredCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (String ign : MapleLogger.ignored) { + player.yellowMessage(ign + " is being ignored."); + } + } +} diff --git a/src/client/command/commands/v3/InMapCommand.java b/src/client/command/commands/v3/InMapCommand.java new file mode 100644 index 0000000000..a33d27b7d7 --- /dev/null +++ b/src/client/command/commands/v3/InMapCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class InMapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + String st = ""; + for (MapleCharacter chr : player.getMap().getCharacters()) { + st += chr.getName() + " "; + } + player.message(st); + + } +} diff --git a/src/client/command/commands/v3/KillAllCommand.java b/src/client/command/commands/v3/KillAllCommand.java new file mode 100644 index 0000000000..c942641436 --- /dev/null +++ b/src/client/command/commands/v3/KillAllCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleMonster; +import server.maps.MapleMap; +import server.maps.MapleMapObject; +import server.maps.MapleMapObjectType; + +import java.util.Arrays; +import java.util.List; + +public class KillAllCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleMap map = player.getMap(); + List monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); + int count = 0; + for (MapleMapObject monstermo : monsters) { + MapleMonster monster = (MapleMonster) monstermo; + if (!monster.getStats().isFriendly() && !(monster.getId() >= 8810010 && monster.getId() <= 8810018)) { + map.damageMonster(player, monster, Integer.MAX_VALUE); + count++; + } + } + player.dropMessage(5, "Killed " + count + " monsters."); + } +} diff --git a/src/client/command/commands/v3/KillCommand.java b/src/client/command/commands/v3/KillCommand.java new file mode 100644 index 0000000000..2801828c2e --- /dev/null +++ b/src/client/command/commands/v3/KillCommand.java @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import tools.MaplePacketCreator; + +public class KillCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !kill "); + return; + } + + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + victim.setHpMp(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/v3/KillMapCommand.java new file mode 100644 index 0000000000..12e8421a97 --- /dev/null +++ b/src/client/command/commands/v3/KillMapCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.MapleStat; +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class KillMapCommand extends Command { + { + setDescription(""); + } + + @Override + 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); + } + } +} diff --git a/src/client/command/commands/v3/MaxEnergyCommand.java b/src/client/command/commands/v3/MaxEnergyCommand.java new file mode 100644 index 0000000000..57c8ef545d --- /dev/null +++ b/src/client/command/commands/v3/MaxEnergyCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class MaxEnergyCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + c.getPlayer().setDojoEnergy(10000); + c.announce(MaplePacketCreator.getEnergy("energy", 10000)); + } +} diff --git a/src/client/command/commands/v3/MaxHpMpCommand.java b/src/client/command/commands/v3/MaxHpMpCommand.java new file mode 100644 index 0000000000..55de83e58c --- /dev/null +++ b/src/client/command/commands/v3/MaxHpMpCommand.java @@ -0,0 +1,79 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +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 { + { + setDescription(""); + } + + @Override + 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])); + } else if (params.length == 1) { + statUpdate = Math.max(1, 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)); + + 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()); + } 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/v3/MonitorCommand.java new file mode 100644 index 0000000000..ce20568df6 --- /dev/null +++ b/src/client/command/commands/v3/MonitorCommand.java @@ -0,0 +1,61 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import tools.MapleLogger; +import tools.MaplePacketCreator; + +public class MonitorCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !monitor "); + return; + } + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim == null) { + player.message("Player '" + params[0] + "' could not be found on this world."); + return; + } + boolean monitored = MapleLogger.monitored.contains(victim.getName()); + if (monitored) { + MapleLogger.monitored.remove(victim.getName()); + } else { + MapleLogger.monitored.add(victim.getName()); + } + player.yellowMessage(victim.getName() + " is " + (!monitored ? "now being monitored." : "no longer being monitored.")); + String message = player.getName() + (!monitored ? " has started monitoring " : " has stopped monitoring ") + victim.getName() + "."; + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message)); + + } +} diff --git a/src/client/command/commands/v3/MonitorsCommand.java b/src/client/command/commands/v3/MonitorsCommand.java new file mode 100644 index 0000000000..5adbeca2ad --- /dev/null +++ b/src/client/command/commands/v3/MonitorsCommand.java @@ -0,0 +1,43 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MapleLogger; + +public class MonitorsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (String ign : MapleLogger.monitored) { + player.yellowMessage(ign + " is being monitored."); + } + } +} diff --git a/src/client/command/commands/v3/MusicCommand.java b/src/client/command/commands/v3/MusicCommand.java new file mode 100644 index 0000000000..eb664d228e --- /dev/null +++ b/src/client/command/commands/v3/MusicCommand.java @@ -0,0 +1,213 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class MusicCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final String[] songs = { + "Jukebox/Congratulation", + "Bgm00/SleepyWood", + "Bgm00/FloralLife", + "Bgm00/GoPicnic", + "Bgm00/Nightmare", + "Bgm00/RestNPeace", + "Bgm01/AncientMove", + "Bgm01/MoonlightShadow", + "Bgm01/WhereTheBarlogFrom", + "Bgm01/CavaBien", + "Bgm01/HighlandStar", + "Bgm01/BadGuys", + "Bgm02/MissingYou", + "Bgm02/WhenTheMorningComes", + "Bgm02/EvilEyes", + "Bgm02/JungleBook", + "Bgm02/AboveTheTreetops", + "Bgm03/Subway", + "Bgm03/Elfwood", + "Bgm03/BlueSky", + "Bgm03/Beachway", + "Bgm03/SnowyVillage", + "Bgm04/PlayWithMe", + "Bgm04/WhiteChristmas", + "Bgm04/UponTheSky", + "Bgm04/ArabPirate", + "Bgm04/Shinin'Harbor", + "Bgm04/WarmRegard", + "Bgm05/WolfWood", + "Bgm05/DownToTheCave", + "Bgm05/AbandonedMine", + "Bgm05/MineQuest", + "Bgm05/HellGate", + "Bgm06/FinalFight", + "Bgm06/WelcomeToTheHell", + "Bgm06/ComeWithMe", + "Bgm06/FlyingInABlueDream", + "Bgm06/FantasticThinking", + "Bgm07/WaltzForWork", + "Bgm07/WhereverYouAre", + "Bgm07/FunnyTimeMaker", + "Bgm07/HighEnough", + "Bgm07/Fantasia", + "Bgm08/LetsMarch", + "Bgm08/ForTheGlory", + "Bgm08/FindingForest", + "Bgm08/LetsHuntAliens", + "Bgm08/PlotOfPixie", + "Bgm09/DarkShadow", + "Bgm09/TheyMenacingYou", + "Bgm09/FairyTale", + "Bgm09/FairyTalediffvers", + "Bgm09/TimeAttack", + "Bgm10/Timeless", + "Bgm10/TimelessB", + "Bgm10/BizarreTales", + "Bgm10/TheWayGrotesque", + "Bgm10/Eregos", + "Bgm11/BlueWorld", + "Bgm11/Aquarium", + "Bgm11/ShiningSea", + "Bgm11/DownTown", + "Bgm11/DarkMountain", + "Bgm12/AquaCave", + "Bgm12/DeepSee", + "Bgm12/WaterWay", + "Bgm12/AcientRemain", + "Bgm12/RuinCastle", + "Bgm12/Dispute", + "Bgm13/CokeTown", + "Bgm13/Leafre", + "Bgm13/Minar'sDream", + "Bgm13/AcientForest", + "Bgm13/TowerOfGoddess", + "Bgm14/DragonLoad", + "Bgm14/HonTale", + "Bgm14/CaveOfHontale", + "Bgm14/DragonNest", + "Bgm14/Ariant", + "Bgm14/HotDesert", + "Bgm15/MureungHill", + "Bgm15/MureungForest", + "Bgm15/WhiteHerb", + "Bgm15/Pirate", + "Bgm15/SunsetDesert", + "Bgm16/Duskofgod", + "Bgm16/FightingPinkBeen", + "Bgm16/Forgetfulness", + "Bgm16/Remembrance", + "Bgm16/Repentance", + "Bgm16/TimeTemple", + "Bgm17/MureungSchool1", + "Bgm17/MureungSchool2", + "Bgm17/MureungSchool3", + "Bgm17/MureungSchool4", + "Bgm18/BlackWing", + "Bgm18/DrillHall", + "Bgm18/QueensGarden", + "Bgm18/RaindropFlower", + "Bgm18/WolfAndSheep", + "Bgm19/BambooGym", + "Bgm19/CrystalCave", + "Bgm19/MushCatle", + "Bgm19/RienVillage", + "Bgm19/SnowDrop", + "Bgm20/GhostShip", + "Bgm20/NetsPiramid", + "Bgm20/UnderSubway", + "Bgm21/2021year", + "Bgm21/2099year", + "Bgm21/2215year", + "Bgm21/2230year", + "Bgm21/2503year", + "Bgm21/KerningSquare", + "Bgm21/KerningSquareField", + "Bgm21/KerningSquareSubway", + "Bgm21/TeraForest", + "BgmEvent/FunnyRabbit", + "BgmEvent/FunnyRabbitFaster", + "BgmEvent/wedding", + "BgmEvent/weddingDance", + "BgmEvent/wichTower", + "BgmGL/amoria", + "BgmGL/Amorianchallenge", + "BgmGL/chapel", + "BgmGL/cathedral", + "BgmGL/Courtyard", + "BgmGL/CrimsonwoodKeep", + "BgmGL/CrimsonwoodKeepInterior", + "BgmGL/GrandmastersGauntlet", + "BgmGL/HauntedHouse", + "BgmGL/NLChunt", + "BgmGL/NLCtown", + "BgmGL/NLCupbeat", + "BgmGL/PartyQuestGL", + "BgmGL/PhantomForest", + "BgmJp/Feeling", + "BgmJp/BizarreForest", + "BgmJp/Hana", + "BgmJp/Yume", + "BgmJp/Bathroom", + "BgmJp/BattleField", + "BgmJp/FirstStepMaster", + "BgmMY/Highland", + "BgmMY/KualaLumpur", + "BgmSG/BoatQuay_field", + "BgmSG/BoatQuay_town", + "BgmSG/CBD_field", + "BgmSG/CBD_town", + "BgmSG/Ghostship", + "BgmUI/ShopBgm", + "BgmUI/Title" + }; + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !music "); + for (String s : songs) { + player.yellowMessage(s); + } + return; + } + String song = joinStringFrom(params, 0); + for (String s : songs) { + if (s.equals(song)) { + player.getMap().broadcastMessage(MaplePacketCreator.musicChange(s)); + player.yellowMessage("Now playing song " + song + "."); + break; + } + } + player.yellowMessage("Song not found, please enter a song below."); + for (String s : songs) { + player.yellowMessage(s); + } + } +} diff --git a/src/client/command/commands/v3/MuteMapCommand.java b/src/client/command/commands/v3/MuteMapCommand.java new file mode 100644 index 0000000000..45bb445ba7 --- /dev/null +++ b/src/client/command/commands/v3/MuteMapCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class MuteMapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (player.getMap().isMuted()) { + player.getMap().setMuted(false); + player.dropMessage(5, "The map you are in has been un-muted."); + } else { + player.getMap().setMuted(true); + player.dropMessage(5, "The map you are in has been muted."); + } + } +} diff --git a/src/client/command/commands/v3/NightCommand.java b/src/client/command/commands/v3/NightCommand.java new file mode 100644 index 0000000000..ec1eb7b9ed --- /dev/null +++ b/src/client/command/commands/v3/NightCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class NightCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().broadcastNightEffect(); + player.yellowMessage("Done."); + } +} diff --git a/src/client/command/commands/v3/NoticeCommand.java b/src/client/command/commands/v3/NoticeCommand.java new file mode 100644 index 0000000000..8c22496d9f --- /dev/null +++ b/src/client/command/commands/v3/NoticeCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import tools.MaplePacketCreator; + +public class NoticeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[Notice] " + joinStringFrom(params, 0))); + } +} diff --git a/src/client/command/commands/v3/NpcCommand.java b/src/client/command/commands/v3/NpcCommand.java new file mode 100644 index 0000000000..d5d68d0cf9 --- /dev/null +++ b/src/client/command/commands/v3/NpcCommand.java @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; +import server.life.MapleNPC; +import tools.MaplePacketCreator; + +public class NpcCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !npc "); + return; + } + MapleNPC npc = MapleLifeFactory.getNPC(Integer.parseInt(params[0])); + if (npc != null) { + npc.setPosition(player.getPosition()); + npc.setCy(player.getPosition().y); + npc.setRx0(player.getPosition().x + 50); + npc.setRx1(player.getPosition().x - 50); + npc.setFh(player.getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId()); + player.getMap().addMapObject(npc); + player.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc)); + } + } +} diff --git a/src/client/command/commands/v3/OnlineTwoCommand.java b/src/client/command/commands/v3/OnlineTwoCommand.java new file mode 100644 index 0000000000..2f160bb73a --- /dev/null +++ b/src/client/command/commands/v3/OnlineTwoCommand.java @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.channel.Channel; + +public class OnlineTwoCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + int total = 0; + for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) { + int size = ch.getPlayerStorage().getAllCharacters().size(); + total += size; + String s = "(Channel " + ch.getId() + " Online: " + size + ") : "; + if (ch.getPlayerStorage().getAllCharacters().size() < 50) { + for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) { + s += MapleCharacter.makeMapleReadable(chr.getName()) + ", "; + } + player.dropMessage(6, s.substring(0, s.length() - 2)); + } + } + + //player.dropMessage(6, "There are a total of " + total + " players online."); + player.showHint("Players online: #e#r" + total + "#k#n.", 300); + } +} diff --git a/src/client/command/commands/v3/OpenPortalCommand.java b/src/client/command/commands/v3/OpenPortalCommand.java new file mode 100644 index 0000000000..14f5ee6598 --- /dev/null +++ b/src/client/command/commands/v3/OpenPortalCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class OpenPortalCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !openportal "); + return; + } + player.getMap().getPortal(params[0]).setPortalState(true); + } +} diff --git a/src/client/command/commands/v3/PeCommand.java b/src/client/command/commands/v3/PeCommand.java new file mode 100644 index 0000000000..1d1353a505 --- /dev/null +++ b/src/client/command/commands/v3/PeCommand.java @@ -0,0 +1,78 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.MaplePacketHandler; +import net.PacketProcessor; +import tools.FilePrinter; +import tools.HexTool; +import tools.data.input.ByteArrayByteStream; +import tools.data.input.GenericSeekableLittleEndianAccessor; +import tools.data.input.SeekableLittleEndianAccessor; +import tools.data.output.MaplePacketLittleEndianWriter; + +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Properties; + +public class PeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + String packet = ""; + try { + InputStreamReader is = new FileReader("pe.txt"); + Properties packetProps = new Properties(); + packetProps.load(is); + is.close(); + packet = packetProps.getProperty("pe"); + } catch (IOException ex) { + ex.printStackTrace(); + player.yellowMessage("Failed to load pe.txt"); + return; + + } + MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); + mplew.write(HexTool.getByteArrayFromHexString(packet)); + SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(mplew.getPacket())); + short packetId = slea.readShort(); + final MaplePacketHandler packetHandler = PacketProcessor.getProcessor(0, c.getChannel()).getHandler(packetId); + if (packetHandler != null && packetHandler.validateState(c)) { + try { + player.yellowMessage("Receiving: " + packet); + packetHandler.handlePacket(slea, c); + } catch (final Throwable t) { + FilePrinter.printError(FilePrinter.PACKET_HANDLER + packetHandler.getClass().getName() + ".txt", t, "Error for " + (c.getPlayer() == null ? "" : "player ; " + c.getPlayer() + " on map ; " + c.getPlayer().getMapId() + " - ") + "account ; " + c.getAccountName() + "\r\n" + slea.toString()); + } + } + } +} diff --git a/src/client/command/commands/v3/PosCommand.java b/src/client/command/commands/v3/PosCommand.java new file mode 100644 index 0000000000..8427f65e2f --- /dev/null +++ b/src/client/command/commands/v3/PosCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class PosCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + float xpos = player.getPosition().x; + float ypos = player.getPosition().y; + float fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId(); + player.dropMessage(6, "Position: (" + xpos + ", " + ypos + ")"); + player.dropMessage(6, "Foothold ID: " + fh); + } +} diff --git a/src/client/command/commands/v3/QuestCompleteCommand.java b/src/client/command/commands/v3/QuestCompleteCommand.java new file mode 100644 index 0000000000..591d30efa5 --- /dev/null +++ b/src/client/command/commands/v3/QuestCompleteCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.quest.MapleQuest; + +public class QuestCompleteCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1){ + player.yellowMessage("Syntax: !completequest "); + return; + } + + int questId = Integer.parseInt(params[0]); + + if (player.getQuestStatus(questId) == 1) { + MapleQuest quest = MapleQuest.getInstance(questId); + if (quest != null) { + int npcid = quest.getNpcRequirement(true); + quest.forceComplete(player, npcid); + player.dropMessage(5, "QUEST " + questId + " completed."); + } else { // should not occur + player.dropMessage(5, "QUESTID " + questId + " is invalid."); + } + } else { + player.dropMessage(5, "QUESTID " + questId + " not started or already completed."); + } + } +} diff --git a/src/client/command/commands/v3/QuestResetCommand.java b/src/client/command/commands/v3/QuestResetCommand.java new file mode 100644 index 0000000000..4f32d2ac4e --- /dev/null +++ b/src/client/command/commands/v3/QuestResetCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.quest.MapleQuest; + +public class QuestResetCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1){ + player.yellowMessage("Syntax: !resetquest "); + return; + } + + int questid_ = Integer.parseInt(params[0]); + + if (player.getQuestStatus(questid_) != 0) { + MapleQuest quest = MapleQuest.getInstance(questid_); + if (quest != null) { + quest.reset(player); + player.dropMessage(5, "QUEST " + questid_ + " reseted."); + } else { // should not occur + player.dropMessage(5, "QUESTID " + questid_ + " is invalid."); + } + } + } +} diff --git a/src/client/command/commands/v3/QuestStartCommand.java b/src/client/command/commands/v3/QuestStartCommand.java new file mode 100644 index 0000000000..e25e173378 --- /dev/null +++ b/src/client/command/commands/v3/QuestStartCommand.java @@ -0,0 +1,60 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.quest.MapleQuest; + +public class QuestStartCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1){ + player.yellowMessage("Syntax: !startquest "); + return; + } + + int questid = Integer.parseInt(params[0]); + + if (player.getQuestStatus(questid) == 0) { + MapleQuest quest = MapleQuest.getInstance(questid); + if (quest != null) { + int npcid = quest.getNpcRequirement(false); + quest.forceStart(player, npcid); + player.dropMessage(5, "QUEST " + questid + " started."); + } else { + player.dropMessage(5, "QUESTID " + questid + " is invalid."); + } + } else { + player.dropMessage(5, "QUESTID " + questid + " already started/completed."); + } + } +} diff --git a/src/client/command/commands/v3/ReloadDropsCommand.java b/src/client/command/commands/v3/ReloadDropsCommand.java new file mode 100644 index 0000000000..330d40a515 --- /dev/null +++ b/src/client/command/commands/v3/ReloadDropsCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleMonsterInformationProvider; + +public class ReloadDropsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleMonsterInformationProvider.getInstance().clearDrops(); + player.dropMessage(5, "Reloaded Drops"); + } +} diff --git a/src/client/command/commands/v3/ReloadEventsCommand.java b/src/client/command/commands/v3/ReloadEventsCommand.java new file mode 100644 index 0000000000..0fec0a7f02 --- /dev/null +++ b/src/client/command/commands/v3/ReloadEventsCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.channel.Channel; + +public class ReloadEventsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (Channel ch : Server.getInstance().getAllChannels()) { + ch.reloadEventScriptManager(); + } + player.dropMessage(5, "Reloaded Events"); + } +} diff --git a/src/client/command/commands/v3/ReloadMapCommand.java b/src/client/command/commands/v3/ReloadMapCommand.java new file mode 100644 index 0000000000..1e0ea36300 --- /dev/null +++ b/src/client/command/commands/v3/ReloadMapCommand.java @@ -0,0 +1,50 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.maps.MapleMap; + +public class ReloadMapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleMap oldMap = c.getPlayer().getMap(); + MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId()); + int callerid = c.getPlayer().getId(); + + for (MapleCharacter chr : oldMap.getCharacters()) { + chr.changeMap(newMap); + if (chr.getId() != callerid) + chr.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience."); + } + newMap.respawn(); + } +} diff --git a/src/client/command/commands/v3/ReloadPortalsCommand.java b/src/client/command/commands/v3/ReloadPortalsCommand.java new file mode 100644 index 0000000000..9fdd32f8fd --- /dev/null +++ b/src/client/command/commands/v3/ReloadPortalsCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import scripting.portal.PortalScriptManager; + +public class ReloadPortalsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + PortalScriptManager.getInstance().reloadPortalScripts(); + player.dropMessage(5, "Reloaded Portals"); + } +} diff --git a/src/client/command/commands/v3/ReloadShopsCommand.java b/src/client/command/commands/v3/ReloadShopsCommand.java new file mode 100644 index 0000000000..3b10854c83 --- /dev/null +++ b/src/client/command/commands/v3/ReloadShopsCommand.java @@ -0,0 +1,40 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import server.MapleShopFactory; + + +public class ReloadShopsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleShopFactory.getInstance().reloadShops(); + } +} diff --git a/src/client/command/commands/v3/RipCommand.java b/src/client/command/commands/v3/RipCommand.java new file mode 100644 index 0000000000..f34bf0ccf8 --- /dev/null +++ b/src/client/command/commands/v3/RipCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import tools.MaplePacketCreator; + +public class RipCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.serverNotice(6, "[RIP]: " + joinStringFrom(params, 1))); + } +} diff --git a/src/client/command/commands/v3/SeedCommand.java b/src/client/command/commands/v3/SeedCommand.java new file mode 100644 index 0000000000..8f7c93b4da --- /dev/null +++ b/src/client/command/commands/v3/SeedCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Item; + +import java.awt.*; + +public class SeedCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (player.getMapId() != 910010000) { + player.yellowMessage("This command can only be used in HPQ."); + return; + } + Point pos[] = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)}; + int seed[] = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098}; + for (int i = 0; i < pos.length; i++) { + Item item = new Item(seed[i], (byte) 0, (short) 1); + player.getMap().spawnItemDrop(player, player, item, pos[i], false, true); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/client/command/commands/v3/SpawnCommand.java b/src/client/command/commands/v3/SpawnCommand.java new file mode 100644 index 0000000000..144f372072 --- /dev/null +++ b/src/client/command/commands/v3/SpawnCommand.java @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; +import server.life.MapleMonster; + +public class SpawnCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !spawn "); + return; + } + + MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(params[0])); + if (monster == null) { + return; + } + if (params.length == 2) { + for (int i = 0; i < Integer.parseInt(params[1]); i++) { + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition()); + } + } else { + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(params[0])), player.getPosition()); + } + } +} diff --git a/src/client/command/commands/v3/StartEventCommand.java b/src/client/command/commands/v3/StartEventCommand.java new file mode 100644 index 0000000000..f5b406c05d --- /dev/null +++ b/src/client/command/commands/v3/StartEventCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.events.gm.MapleEvent; + +public class StartEventCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + int players = 50; + if (params.length > 1) + players = Integer.parseInt(params[0]); + c.getChannelServer().setEvent(new MapleEvent(player.getMapId(), players)); + player.dropMessage(5, "The event has been set on " + player.getMap().getMapName() + " and will allow " + players + " players to join."); + } +} diff --git a/src/client/command/commands/v3/ToggleCouponCommand.java b/src/client/command/commands/v3/ToggleCouponCommand.java new file mode 100644 index 0000000000..87c08c5947 --- /dev/null +++ b/src/client/command/commands/v3/ToggleCouponCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; + +public class ToggleCouponCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !togglecoupon "); + return; + } + Server.getInstance().toggleCoupon(Integer.parseInt(params[0])); + } +} diff --git a/src/client/command/commands/v3/UnBanCommand.java b/src/client/command/commands/v3/UnBanCommand.java new file mode 100644 index 0000000000..54f5782a35 --- /dev/null +++ b/src/client/command/commands/v3/UnBanCommand.java @@ -0,0 +1,68 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.DatabaseConnection; + +import java.sql.Connection; +import java.sql.PreparedStatement; + +public class UnBanCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !unban "); + return; + } + + try { + Connection con = DatabaseConnection.getConnection(); + int aid = MapleCharacter.getAccountIdByName(params[0]); + + PreparedStatement p = con.prepareStatement("UPDATE accounts SET banned = -1 WHERE id = " + aid); + p.executeUpdate(); + + p = con.prepareStatement("DELETE FROM ipbans WHERE aid = " + aid); + p.executeUpdate(); + + p = con.prepareStatement("DELETE FROM macbans WHERE aid = " + aid); + p.executeUpdate(); + + con.close(); + } catch (Exception e) { + e.printStackTrace(); + player.message("Failed to unban " + params[0]); + return; + } + player.message("Unbanned " + params[0]); + } +} diff --git a/src/client/command/commands/v3/WarpSnowBallCommand.java b/src/client/command/commands/v3/WarpSnowBallCommand.java new file mode 100644 index 0000000000..2d62daf4b6 --- /dev/null +++ b/src/client/command/commands/v3/WarpSnowBallCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v3; + + import client.command.Command; + import client.MapleClient; + import client.MapleCharacter; + + import java.util.ArrayList; + import java.util.List; + +public class WarpSnowBallCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + List chars = new ArrayList<>(player.getMap().getCharacters()); + for (MapleCharacter chr : chars) { + chr.changeMap(109060000, chr.getTeam()); + } + } +} diff --git a/src/client/command/commands/v4/CakeCommand.java b/src/client/command/commands/v4/CakeCommand.java new file mode 100644 index 0000000000..91e6c86276 --- /dev/null +++ b/src/client/command/commands/v4/CakeCommand.java @@ -0,0 +1,51 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; +import server.life.MapleMonster; + +public class CakeCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleMonster monster = MapleLifeFactory.getMonster(9400606); + if (params.length == 1) { + double mobHp = Double.parseDouble(params[0]); + int newHp = (mobHp <= 0) ? Integer.MAX_VALUE : ((mobHp > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) mobHp); + + monster.getStats().setHp(newHp); + monster.setStartingHp(newHp); + } + + player.getMap().spawnMonsterOnGroundBelow(monster, player.getPosition()); + } +} diff --git a/src/client/command/commands/v4/DropRateCommand.java b/src/client/command/commands/v4/DropRateCommand.java new file mode 100644 index 0000000000..783f0d3f22 --- /dev/null +++ b/src/client/command/commands/v4/DropRateCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class DropRateCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !droprate "); + return; + } + + int droprate = Math.max(Integer.parseInt(params[0]), 1); + c.getWorldServer().setDropRate(droprate); + c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Drop Rate has been changed to " + droprate + "x.")); + + } +} diff --git a/src/client/command/commands/v4/ExpRateCommand.java b/src/client/command/commands/v4/ExpRateCommand.java new file mode 100644 index 0000000000..50026dde88 --- /dev/null +++ b/src/client/command/commands/v4/ExpRateCommand.java @@ -0,0 +1,48 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class ExpRateCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !exprate "); + return; + } + + int exprate = Math.max(Integer.parseInt(params[0]), 1); + c.getWorldServer().setExpRate(exprate); + c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Exp Rate has been changed to " + exprate + "x.")); + } +} diff --git a/src/client/command/commands/v4/ForceVacCommand.java b/src/client/command/commands/v4/ForceVacCommand.java new file mode 100644 index 0000000000..cdb5fd202b --- /dev/null +++ b/src/client/command/commands/v4/ForceVacCommand.java @@ -0,0 +1,76 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.MaplePet; +import client.inventory.manipulator.MapleInventoryManipulator; +import server.maps.MapleMapItem; +import server.maps.MapleMapObject; +import server.maps.MapleMapObjectType; +import tools.MaplePacketCreator; + +import java.util.Arrays; +import java.util.List; + +public class ForceVacCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); + for (MapleMapObject item : items) { + MapleMapItem mapItem = (MapleMapItem) item; + + mapItem.lockItem(); + try { + if (mapItem.isPickedUp()) continue; + + if (mapItem.getMeso() > 0) { + player.gainMeso(mapItem.getMeso(), true); + } else if (mapItem.getItemId() == 4031865 || mapItem.getItemId() == 4031866) { + // Add NX to account, show effect and make item disappear + player.getCashShop().gainCash(1, mapItem.getItemId() == 4031865 ? 100 : 250); + } else if (mapItem.getItem().getItemId() >= 5000000 && mapItem.getItem().getItemId() <= 5000100) { + int petId = MaplePet.createPet(mapItem.getItem().getItemId()); + if (petId == -1) { + continue; + } + MapleInventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); + } else { + MapleInventoryManipulator.addFromDrop(c, mapItem.getItem(), true); + } + + player.getMap().pickItemDrop(MaplePacketCreator.removeItemFromMap(mapItem.getObjectId(), 2, player.getId()), mapItem); + } finally { + mapItem.unlockItem(); + } + } + } +} diff --git a/src/client/command/commands/v4/HorntailCommand.java b/src/client/command/commands/v4/HorntailCommand.java new file mode 100644 index 0000000000..a853f81245 --- /dev/null +++ b/src/client/command/commands/v4/HorntailCommand.java @@ -0,0 +1,46 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.maps.MapleMap; + +import java.awt.*; + +public class HorntailCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + final Point targetPoint = player.getPosition(); + final MapleMap targetMap = player.getMap(); + + targetMap.spawnHorntailOnGroundBelow(targetPoint); + } +} diff --git a/src/client/command/commands/v4/ItemVacCommand.java b/src/client/command/commands/v4/ItemVacCommand.java new file mode 100644 index 0000000000..e17861a824 --- /dev/null +++ b/src/client/command/commands/v4/ItemVacCommand.java @@ -0,0 +1,48 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.maps.MapleMapObject; +import server.maps.MapleMapObjectType; + +import java.util.Arrays; +import java.util.List; + +public class ItemVacCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + List list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); + for (MapleMapObject item : list) { + player.pickupItem(item); + } + } +} diff --git a/src/client/command/commands/v4/MesoRateCommand.java b/src/client/command/commands/v4/MesoRateCommand.java new file mode 100644 index 0000000000..9b2dd45beb --- /dev/null +++ b/src/client/command/commands/v4/MesoRateCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class MesoRateCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !mesorate "); + return; + } + + int mesorate = Math.max(Integer.parseInt(params[0]), 1); + c.getWorldServer().setMesoRate(mesorate); + c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Meso Rate has been changed to " + mesorate + "x.")); + + } +} diff --git a/src/client/command/commands/v4/PapCommand.java b/src/client/command/commands/v4/PapCommand.java new file mode 100644 index 0000000000..1f03cb47e4 --- /dev/null +++ b/src/client/command/commands/v4/PapCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; + +public class PapCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition()); + } +} diff --git a/src/client/command/commands/v4/PianusCommand.java b/src/client/command/commands/v4/PianusCommand.java new file mode 100644 index 0000000000..9681481f4f --- /dev/null +++ b/src/client/command/commands/v4/PianusCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; + +public class PianusCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition()); + } +} diff --git a/src/client/command/commands/v4/PinkbeanCommand.java b/src/client/command/commands/v4/PinkbeanCommand.java new file mode 100644 index 0000000000..45db91dd95 --- /dev/null +++ b/src/client/command/commands/v4/PinkbeanCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; + +public class PinkbeanCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8820001), player.getPosition()); + + } +} diff --git a/src/client/command/commands/v4/PlayerNpcCommand.java b/src/client/command/commands/v4/PlayerNpcCommand.java new file mode 100644 index 0000000000..68aaec60bb --- /dev/null +++ b/src/client/command/commands/v4/PlayerNpcCommand.java @@ -0,0 +1,48 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MaplePlayerNPC; + +public class PlayerNpcCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !playernpc "); + return; + } + + if (!MaplePlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]))) { + player.dropMessage(5, "Could not deploy PlayerNPC. Either there's no room available here or depleted out scriptids to use."); + } + } +} diff --git a/src/client/command/commands/v4/PlayerNpcRemoveCommand.java b/src/client/command/commands/v4/PlayerNpcRemoveCommand.java new file mode 100644 index 0000000000..95c6f02c2f --- /dev/null +++ b/src/client/command/commands/v4/PlayerNpcRemoveCommand.java @@ -0,0 +1,45 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MaplePlayerNPC; + +public class PlayerNpcRemoveCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !playernpcremove "); + return; + } + MaplePlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(params[0])); + } +} diff --git a/src/client/command/commands/v4/ProItemCommand.java b/src/client/command/commands/v4/ProItemCommand.java new file mode 100644 index 0000000000..8fbb431a51 --- /dev/null +++ b/src/client/command/commands/v4/ProItemCommand.java @@ -0,0 +1,83 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Equip; +import client.inventory.Item; +import client.inventory.MapleInventoryType; +import client.inventory.manipulator.MapleInventoryManipulator; +import constants.ItemConstants; +import server.MapleItemInformationProvider; + +public class ProItemCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !proitem "); + return; + } + int itemid = Integer.parseInt(params[0]); + short multiply = Short.parseShort(params[1]); + + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + MapleInventoryType type = ItemConstants.getInventoryType(itemid); + if (type.equals(MapleInventoryType.EQUIP)) { + Item it = ii.getEquipById(itemid); + it.setOwner(player.getName()); + + hardsetItemStats((Equip) it, multiply); + MapleInventoryManipulator.addFromDrop(c, it); + } else { + player.dropMessage(6, "Make sure it's an equippable item."); + } + } + private static void hardsetItemStats(Equip equip, short stat) { + equip.setStr(stat); + equip.setDex(stat); + equip.setInt(stat); + equip.setLuk(stat); + equip.setMatk(stat); + equip.setWatk(stat); + equip.setAcc(stat); + equip.setAvoid(stat); + equip.setJump(stat); + equip.setSpeed(stat); + equip.setWdef(stat); + equip.setMdef(stat); + equip.setHp(stat); + equip.setMp(stat); + + byte flag = equip.getFlag(); + flag |= ItemConstants.UNTRADEABLE; + equip.setFlag(flag); + } +} diff --git a/src/client/command/commands/v4/QuestRateCommand.java b/src/client/command/commands/v4/QuestRateCommand.java new file mode 100644 index 0000000000..43f329e852 --- /dev/null +++ b/src/client/command/commands/v4/QuestRateCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class QuestRateCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !questrate "); + return; + } + + int questrate = Math.max(Integer.parseInt(params[0]), 1); + c.getWorldServer().setQuestRate(questrate); + c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Quest Rate has been changed to " + questrate + "x.")); + + } +} diff --git a/src/client/command/commands/v4/ServerMessageCommand.java b/src/client/command/commands/v4/ServerMessageCommand.java new file mode 100644 index 0000000000..00b02992c3 --- /dev/null +++ b/src/client/command/commands/v4/ServerMessageCommand.java @@ -0,0 +1,40 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class ServerMessageCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + //MapleCharacter player = c.getPlayer(); + c.getWorldServer().setServerMessage(joinStringFrom(params, 0)); + } +} diff --git a/src/client/command/commands/v4/SetQStatCommand.java b/src/client/command/commands/v4/SetQStatCommand.java new file mode 100644 index 0000000000..f79abe5143 --- /dev/null +++ b/src/client/command/commands/v4/SetQStatCommand.java @@ -0,0 +1,81 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Equip; +import client.inventory.MapleInventory; +import client.inventory.MapleInventoryType; +import constants.ItemConstants; + +public class SetQStatCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !seteqstat "); + return; + } + + int newStat = Integer.parseInt(params[0]); + MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP); + + for (byte i = 1; i <= equip.getSlotLimit(); i++) { + try { + Equip eu = (Equip) equip.getItem(i); + if (eu == null) continue; + + short incval = (short) newStat; + eu.setWdef(incval); + eu.setAcc(incval); + eu.setAvoid(incval); + eu.setJump(incval); + eu.setMatk(incval); + eu.setMdef(incval); + eu.setHp(incval); + eu.setMp(incval); + eu.setSpeed(incval); + eu.setWatk(incval); + eu.setDex(incval); + eu.setInt(incval); + eu.setStr(incval); + eu.setLuk(incval); + + byte flag = eu.getFlag(); + flag |= ItemConstants.UNTRADEABLE; + eu.setFlag(flag); + + player.forceUpdateItem(eu); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/client/command/commands/v4/TravelRateCommand.java b/src/client/command/commands/v4/TravelRateCommand.java new file mode 100644 index 0000000000..acd2092f9b --- /dev/null +++ b/src/client/command/commands/v4/TravelRateCommand.java @@ -0,0 +1,48 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class TravelRateCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !travelrate "); + return; + } + + int travelrate = Math.max(Integer.parseInt(params[0]), 1); + c.getWorldServer().setTravelRate(travelrate); + c.getWorldServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "[Rate] Travel Rate has been changed to " + travelrate + "x.")); + } +} diff --git a/src/client/command/commands/v4/ZakumCommand.java b/src/client/command/commands/v4/ZakumCommand.java new file mode 100644 index 0000000000..fe2b22aacf --- /dev/null +++ b/src/client/command/commands/v4/ZakumCommand.java @@ -0,0 +1,44 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v4; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MapleLifeFactory; + +public class ZakumCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + player.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8800000), player.getPosition()); + for (int x = 8800003; x < 8800011; x++) { + player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(x), player.getPosition()); + } + } +} diff --git a/src/client/command/commands/v5/DebugCommand.java b/src/client/command/commands/v5/DebugCommand.java new file mode 100644 index 0000000000..df8c3a3a34 --- /dev/null +++ b/src/client/command/commands/v5/DebugCommand.java @@ -0,0 +1,162 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v5; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import server.MaplePortal; +import server.TimerManager; +import server.life.MapleMonster; +import server.life.SpawnPoint; +import server.maps.MapleMapObject; +import server.maps.MapleMapObjectType; +import server.maps.MapleReactor; +import tools.MaplePacketCreator; + +import java.awt.*; +import java.util.Arrays; +import java.util.List; + +public class DebugCommand extends Command { + private final static String debugTypes[] = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", ""}; + + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.yellowMessage("Syntax: !debug "); + return; + } + + switch (params[0]) { + case "type": + case "help": + String msgTypes = "Available #bdebug types#k:\r\n\r\n"; + for(int i = 0; i < debugTypes.length; i++) { + msgTypes += ("#L" + i + "#" + debugTypes[i] + "#l\r\n"); + } + + player.announce(MaplePacketCreator.getNPCTalk(9201143, (byte) 0, msgTypes, "00 00", (byte) 0)); + break; + + case "monster": + List monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)); + for (MapleMapObject monstermo : monsters) { + MapleMonster monster = (MapleMonster) monstermo; + player.message("Monster ID: " + monster.getId() + " Aggro target: " + ((monster.getController() != null) ? monster.getController().getName() : "")); + } + break; + + case "packet": + player.getMap().broadcastMessage(MaplePacketCreator.customPacket(joinStringFrom(params, 1))); + break; + + case "portal": + MaplePortal portal = player.getMap().findClosestPortal(player.getPosition()); + if (portal != null) + player.dropMessage(6, "Closest portal: " + portal.getId() + " '" + portal.getName() + "' Type: " + portal.getType() + " --> toMap: " + portal.getTargetMapId() + " scriptname: '" + portal.getScriptName() + "' state: " + portal.getPortalState() + "."); + else player.dropMessage(6, "There is no portal on this map."); + break; + + case "spawnpoint": + SpawnPoint sp = player.getMap().findClosestSpawnpoint(player.getPosition()); + if (sp != null) + player.dropMessage(6, "Closest mob spawn point: " + " Position: x " + sp.getPosition().getX() + " y " + sp.getPosition().getY() + " Spawns mobid: '" + sp.getMonsterId() + "' --> canSpawn: " + !sp.getDenySpawn() + " canSpawnRightNow: " + sp.shouldSpawn() + "."); + else player.dropMessage(6, "There is no mob spawn point on this map."); + break; + + case "pos": + player.dropMessage(6, "Current map position: (" + player.getPosition().getX() + ", " + player.getPosition().getY() + ")."); + break; + + case "map": + player.dropMessage(6, "Current map id " + player.getMap().getId() + ", event: '" + ((player.getMap().getEventInstance() != null) ? player.getMap().getEventInstance().getName() : "null") + "'; Players: " + player.getMap().getAllPlayers().size() + ", Mobs: " + player.getMap().countMonsters() + ", Reactors: " + player.getMap().countReactors() + ", Items: " + player.getMap().countItems() + ", Objects: " + player.getMap().getMapObjects().size() + "."); + break; + + case "mobsp": + player.getMap().reportMonsterSpawnPoints(player); + break; + + case "event": + if (player.getEventInstance() == null) player.dropMessage(6, "Player currently not in an event."); + else player.dropMessage(6, "Current event name: " + player.getEventInstance().getName() + "."); + break; + + case "areas": + player.dropMessage(6, "Configured areas on map " + player.getMapId() + ":"); + + byte index = 0; + for (Rectangle rect : player.getMap().getAreas()) { + player.dropMessage(6, "Id: " + index + " -> posX: " + rect.getX() + " posY: '" + rect.getY() + "' dX: " + rect.getWidth() + " dY: " + rect.getHeight() + "."); + index++; + } + break; + + case "reactors": + player.dropMessage(6, "Current reactor states on map " + player.getMapId() + ":"); + + for (MapleMapObject mmo : player.getMap().getReactors()) { + MapleReactor mr = (MapleReactor) mmo; + player.dropMessage(6, "Id: " + mr.getId() + " Oid: " + mr.getObjectId() + " name: '" + mr.getName() + "' -> Type: " + mr.getReactorType() + " State: " + mr.getState() + " Event State: " + mr.getEventState() + " Position: x " + mr.getPosition().getX() + " y " + mr.getPosition().getY() + "."); + } + break; + + case "servercoupons": + case "coupons": + String s = "Currently active SERVER coupons: "; + for (Integer i : Server.getInstance().getActiveCoupons()) { + s += (i + " "); + } + + player.dropMessage(6, s); + break; + + case "playercoupons": + String st = "Currently active PLAYER coupons: "; + for (Integer i : player.getActiveCoupons()) { + st += (i + " "); + } + + player.dropMessage(6, st); + break; + + case "timer": + TimerManager tMan = TimerManager.getInstance(); + player.dropMessage(6, "Total Task: " + tMan.getTaskCount() + " Current Task: " + tMan.getQueuedTasks() + " Active Task: " + tMan.getActiveCount() + " Completed Task: " + tMan.getCompletedTaskCount()); + break; + + case "marriage": + c.getChannelServer().debugMarriageStatus(); + break; + + } + } +} diff --git a/src/client/command/commands/v5/SetCommand.java b/src/client/command/commands/v5/SetCommand.java new file mode 100644 index 0000000000..a01613e27f --- /dev/null +++ b/src/client/command/commands/v5/SetCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v5; + +import client.command.Command; +import client.MapleClient; +import constants.ServerConstants; + +public class SetCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + for (int i = 0; i < params.length; i++) { + ServerConstants.DEBUG_VALUES[i] = Integer.parseInt(params[i]); + } + } +} diff --git a/src/client/command/commands/v5/ShowPacketsCommand.java b/src/client/command/commands/v5/ShowPacketsCommand.java new file mode 100644 index 0000000000..284cab3b5b --- /dev/null +++ b/src/client/command/commands/v5/ShowPacketsCommand.java @@ -0,0 +1,39 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v5; + +import client.command.Command; +import client.MapleClient; +import constants.ServerConstants; + +public class ShowPacketsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET = !ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET; + } +} diff --git a/src/client/command/commands/v6/ClearQuestCacheCommand.java b/src/client/command/commands/v6/ClearQuestCacheCommand.java new file mode 100644 index 0000000000..bec633bf5f --- /dev/null +++ b/src/client/command/commands/v6/ClearQuestCacheCommand.java @@ -0,0 +1,42 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.quest.MapleQuest; + +public class ClearQuestCacheCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + MapleQuest.clearCache(); + player.dropMessage(5, "Quest Cache Cleared."); + } +} diff --git a/src/client/command/commands/v6/ClearQuestCommand.java b/src/client/command/commands/v6/ClearQuestCommand.java new file mode 100644 index 0000000000..db8b5ebefa --- /dev/null +++ b/src/client/command/commands/v6/ClearQuestCommand.java @@ -0,0 +1,47 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.quest.MapleQuest; + +public class ClearQuestCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.dropMessage(5, "Please include a quest ID."); + return; + } + MapleQuest.clearCache(Integer.parseInt(params[0])); + player.dropMessage(5, "Quest Cache for quest " + params[0] + " cleared."); + + } +} diff --git a/src/client/command/commands/v6/DCAllCommand.java b/src/client/command/commands/v6/DCAllCommand.java new file mode 100644 index 0000000000..382935ea18 --- /dev/null +++ b/src/client/command/commands/v6/DCAllCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.world.World; + +public class DCAllCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (World world : Server.getInstance().getWorlds()) { + for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + if (!chr.isGM()) { + chr.getClient().disconnect(false, false); + } + } + } + player.message("All players successfully disconnected."); + } +} diff --git a/src/client/command/commands/v6/EraseAllPNpcsCommand.java b/src/client/command/commands/v6/EraseAllPNpcsCommand.java new file mode 100644 index 0000000000..7d32d5f12f --- /dev/null +++ b/src/client/command/commands/v6/EraseAllPNpcsCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import server.life.MaplePlayerNPC; + +public class EraseAllPNpcsCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + //MapleCharacter player = c.getPlayer(); + MaplePlayerNPC.removeAllPlayerNPC(); + } +} diff --git a/src/client/command/commands/v6/FredCommand.java b/src/client/command/commands/v6/FredCommand.java new file mode 100644 index 0000000000..85a2424ed3 --- /dev/null +++ b/src/client/command/commands/v6/FredCommand.java @@ -0,0 +1,41 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import tools.MaplePacketCreator; + +public class FredCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + c.announce(MaplePacketCreator.fredrickMessage(Byte.valueOf(params[0]))); + + } +} diff --git a/src/client/command/commands/v6/GetAccCommand.java b/src/client/command/commands/v6/GetAccCommand.java new file mode 100644 index 0000000000..74487fae74 --- /dev/null +++ b/src/client/command/commands/v6/GetAccCommand.java @@ -0,0 +1,49 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class GetAccCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1) { + player.yellowMessage("Syntax: !getacc "); + return; + } + MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]); + if (victim != null) { + player.message(victim.getName() + "'s account name is " + victim.getClient().getAccountName() + "."); + } else { + player.message("Player '" + params[0] + "' could not be found on this world."); + } + } +} diff --git a/src/client/command/commands/v6/MapPlayersCommand.java b/src/client/command/commands/v6/MapPlayersCommand.java new file mode 100644 index 0000000000..93bd128a33 --- /dev/null +++ b/src/client/command/commands/v6/MapPlayersCommand.java @@ -0,0 +1,55 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.world.World; + +public class MapPlayersCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + String names = ""; + int map = player.getMapId(); + for (World world : Server.getInstance().getWorlds()) { + for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + int curMap = chr.getMapId(); + String hp = Integer.toString(chr.getHp()); + String maxhp = Integer.toString(chr.getMaxHp()); + String name = chr.getName() + ": " + hp + "/" + maxhp; + if (map == curMap) { + names = names.equals("") ? name : (names + ", " + name); + } + } + } + player.message("These b lurkin: " + names); + } +} diff --git a/src/client/command/commands/v6/SaveAllCommand.java b/src/client/command/commands/v6/SaveAllCommand.java new file mode 100644 index 0000000000..dd0d2a87eb --- /dev/null +++ b/src/client/command/commands/v6/SaveAllCommand.java @@ -0,0 +1,50 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.world.World; +import tools.MaplePacketCreator; + +public class SaveAllCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + for (World world : Server.getInstance().getWorlds()) { + for (MapleCharacter chr : world.getPlayerStorage().getAllCharacters()) { + chr.saveCharToDB(); + } + } + String message = player.getName() + " used !saveall."; + Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, message)); + player.message("All players saved successfully."); + } +} diff --git a/src/client/command/commands/v6/ServerAddChannelCommand.java b/src/client/command/commands/v6/ServerAddChannelCommand.java new file mode 100644 index 0000000000..e75e232f77 --- /dev/null +++ b/src/client/command/commands/v6/ServerAddChannelCommand.java @@ -0,0 +1,69 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; + +public class ServerAddChannelCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.dropMessage(5, "Syntax: @addchannel "); + return; + } + + final int worldid = Integer.parseInt(params[0]); + + new Thread(new Runnable() { + @Override + public void run() { + int chid = Server.getInstance().addChannel(worldid); + if(player.isLoggedinWorld()) { + if(chid >= 0) { + player.dropMessage(5, "NEW Channel " + chid + " successfully deployed on world " + worldid + "."); + } else { + if(chid == -3) { + player.dropMessage(5, "Invalid worldid detected. Channel creation aborted."); + } else if(chid == -2) { + player.dropMessage(5, "Reached channel limit on worldid " + worldid + ". Channel creation aborted."); + } else if(chid == -1) { + player.dropMessage(5, "Error detected when loading the 'world.ini' file. Channel creation aborted."); + } else { + player.dropMessage(5, "NEW Channel failed to be deployed. Check if the needed port is already in use or other limitations are taking place."); + } + } + } + } + }).start(); + } +} diff --git a/src/client/command/commands/v6/ServerAddWorldCommand.java b/src/client/command/commands/v6/ServerAddWorldCommand.java new file mode 100644 index 0000000000..9414a5391c --- /dev/null +++ b/src/client/command/commands/v6/ServerAddWorldCommand.java @@ -0,0 +1,59 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; + +public class ServerAddWorldCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final MapleCharacter player = c.getPlayer(); + + new Thread(new Runnable() { + @Override + public void run() { + int wid = Server.getInstance().addWorld(); + + if(player.isLoggedinWorld()) { + if(wid >= 0) { + player.dropMessage(5, "NEW World " + wid + " successfully deployed."); + } else { + if(wid == -2) { + player.dropMessage(5, "Error detected when loading the 'world.ini' file. World creation aborted."); + } else { + player.dropMessage(5, "NEW World failed to be deployed. Check if needed ports are already in use or maximum world count has been reached."); + } + } + } + } + }).start(); + } +} diff --git a/src/client/command/commands/v6/ServerRemoveChannelCommand.java b/src/client/command/commands/v6/ServerRemoveChannelCommand.java new file mode 100644 index 0000000000..95f00ae768 --- /dev/null +++ b/src/client/command/commands/v6/ServerRemoveChannelCommand.java @@ -0,0 +1,61 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; + +public class ServerRemoveChannelCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final MapleCharacter player = c.getPlayer(); + + if (params.length < 1) { + player.dropMessage(5, "Syntax: @removechannel "); + return; + } + + final int worldId = Integer.parseInt(params[0]); + new Thread(new Runnable() { + @Override + public void run() { + if(Server.getInstance().removeChannel(worldId)) { + if(player.isLoggedinWorld()) { + player.dropMessage(5, "Successfully removed a channel on World " + worldId + ". Current channel count: " + Server.getInstance().getWorld(worldId).getChannelsSize() + "."); + } + } else { + if(player.isLoggedinWorld()) { + player.dropMessage(5, "Failed to remove last Channel on world " + worldId + ". Check if either that world exists or there are people currently playing there."); + } + } + } + }).start(); + } +} diff --git a/src/client/command/commands/v6/ServerRemoveWorldCommand.java b/src/client/command/commands/v6/ServerRemoveWorldCommand.java new file mode 100644 index 0000000000..217d74d018 --- /dev/null +++ b/src/client/command/commands/v6/ServerRemoveWorldCommand.java @@ -0,0 +1,65 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.MapleCharacter; +import client.command.Command; +import client.MapleClient; +import net.server.Server; + +public class ServerRemoveWorldCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + final MapleCharacter player = c.getPlayer(); + + final int rwid = Server.getInstance().getWorldsSize() - 1; + if(rwid <= 0) { + player.dropMessage(5, "Unable to remove world 0."); + return; + } + + new Thread(new Runnable() { + @Override + public void run() { + if(Server.getInstance().removeWorld()) { + if(player.isLoggedinWorld()) { + player.dropMessage(5, "Successfully removed a world. Current world count: " + Server.getInstance().getWorldsSize() + "."); + } + } else { + if(player.isLoggedinWorld()) { + if(rwid < 0) { + player.dropMessage(5, "No registered worlds to remove."); + } else { + player.dropMessage(5, "Failed to remove world " + rwid + ". Check if there are people currently playing there."); + } + } + } + } + }).start(); + } +} diff --git a/src/client/command/commands/v6/SetGmLevelCommand.java b/src/client/command/commands/v6/SetGmLevelCommand.java new file mode 100644 index 0000000000..f746b86e8b --- /dev/null +++ b/src/client/command/commands/v6/SetGmLevelCommand.java @@ -0,0 +1,55 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; + +public class SetGmLevelCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 2) { + player.yellowMessage("Syntax: !setgmlevel "); + return; + } + + int newLevel = Integer.parseInt(params[1]); + MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]); + if (target != null) { + target.setGMLevel(newLevel); + target.getClient().setGMLevel(newLevel); + + target.dropMessage("You are now a level " + newLevel + " GM. See @commands for a list of available commands."); + player.dropMessage(target + " is now a level " + newLevel + " GM."); + } else { + player.dropMessage("Player '" + params[0] + "' was not found on this channel."); + } + } +} diff --git a/src/client/command/commands/v6/ShutdownCommand.java b/src/client/command/commands/v6/ShutdownCommand.java new file mode 100644 index 0000000000..f678d5e6ab --- /dev/null +++ b/src/client/command/commands/v6/ShutdownCommand.java @@ -0,0 +1,69 @@ +/* + This file is part of the HeavenMS MapleStory Server, commands OdinMS-based + 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 . +*/ + +/* + @Author: Arthur L - Refactored command content into modules +*/ +package client.command.commands.v6; + +import client.command.Command; +import client.MapleClient; +import client.MapleCharacter; +import net.server.Server; +import net.server.world.World; + +public class ShutdownCommand extends Command { + { + setDescription(""); + } + + @Override + public void execute(MapleClient c, String[] params) { + MapleCharacter player = c.getPlayer(); + if (params.length < 1){ + player.yellowMessage("Syntax: !shutdown [