diff --git a/README.txt b/README.txt index 3ffda913f7..baf6fadbd1 100644 --- a/README.txt +++ b/README.txt @@ -86,12 +86,9 @@ The client's set-up is quite straightforward: - Extract into the client folder the "localhost.exe" from Localhostv83. - Overwrite the original WZ files with the ones provided from "client_wz" folder on the Google Drive. -If you are not using "localhost" as the target IP on the server's config file, you will need to HEX-EDIT "localhost.exe" to fetch your IP. The "localhost.exe" uses the following byte addresses to store the server's IP address: - - 006FE084; - - 006FE094; - - 006FE0A4; +If you are not using "localhost" as the target IP on the server's config file, you will need to HEX-EDIT "localhost.exe" to fetch your IP. Track down all IP locations by searching for "Text String" "127.0.0.1", and applying the changes wherever it fits. -To hex-edit, install the Neo Hex Editor from "free-hex-editor-neo.exe" and follow their instructions. Once done, open "localhost.exe" for editing and overwrite the IP values under these 3 addresses. Save the changes and exit the editor. +To hex-edit, install the Neo Hex Editor from "free-hex-editor-neo.exe" and follow their instructions. Once done, open "localhost.exe" for editing and overwrite the IP values under the 3 addresses. Save the changes and exit the editor. Open the "localhost.exe" client. If by any means the program did not open, and checking que server log your ping has been listened and you are using Windows 8 or 10, it probably might be some compatibility issue. Extract "lolwut.exe" from "lolwut-v0.01.rar" and place it on the MapleStory client folder ("C:\Nexon\MapleStory"). Your "localhost.exe" property settings must follow these: - Run in compatibility mode: Windows 7; @@ -101,8 +98,6 @@ Open the "localhost.exe" client. If by any means the program did not open, and c - Run as an administrator; - Opening "lolwut.exe", use Fraysa's method. -Alternatively, there is available the No-Damage Cap version of the MapleStory client. Just extract and use the "localhost.exe" from the one package with the given name. - Important: should the client being refused to connect to the game server, it may be because firewall issues. Head to the end of this file to proceed to enabling this connection with the computer's firewall. Alternatively, one can deactivate the firewall and try opening the client again. ---- Important note about CLIENT EDITING ---- diff --git a/build/built-jar.properties b/build/built-jar.properties index 556323e7c3..f40fdfc874 100644 --- a/build/built-jar.properties +++ b/build/built-jar.properties @@ -1,4 +1,4 @@ -#Fri, 18 Aug 2017 19:17:13 -0300 +#Wed, 23 Aug 2017 17:38:01 -0300 C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2= diff --git a/build/classes/client/BuddyList$BuddyAddResult.class b/build/classes/client/BuddyList$BuddyAddResult.class index da3b3bb45b..b8f880dfe5 100644 Binary files a/build/classes/client/BuddyList$BuddyAddResult.class and b/build/classes/client/BuddyList$BuddyAddResult.class differ diff --git a/build/classes/client/BuddyList$BuddyOperation.class b/build/classes/client/BuddyList$BuddyOperation.class index 59ea13c416..1c494be7ba 100644 Binary files a/build/classes/client/BuddyList$BuddyOperation.class and b/build/classes/client/BuddyList$BuddyOperation.class differ diff --git a/build/classes/client/BuddyList.class b/build/classes/client/BuddyList.class index 4e24467222..b14d0d741e 100644 Binary files a/build/classes/client/BuddyList.class and b/build/classes/client/BuddyList.class differ diff --git a/build/classes/client/MapleCharacter$1.class b/build/classes/client/MapleCharacter$1.class index 2311442164..8a04954114 100644 Binary files a/build/classes/client/MapleCharacter$1.class and b/build/classes/client/MapleCharacter$1.class differ diff --git a/build/classes/client/MapleCharacter$10.class b/build/classes/client/MapleCharacter$10.class index ff12f236e0..b59676cd6c 100644 Binary files a/build/classes/client/MapleCharacter$10.class and b/build/classes/client/MapleCharacter$10.class differ diff --git a/build/classes/client/MapleCharacter$11.class b/build/classes/client/MapleCharacter$11.class index e70e908961..cf86405a35 100644 Binary files a/build/classes/client/MapleCharacter$11.class and b/build/classes/client/MapleCharacter$11.class differ diff --git a/build/classes/client/MapleCharacter$12.class b/build/classes/client/MapleCharacter$12.class index b8078e1fd5..e47f162478 100644 Binary files a/build/classes/client/MapleCharacter$12.class and b/build/classes/client/MapleCharacter$12.class differ diff --git a/build/classes/client/MapleCharacter$13.class b/build/classes/client/MapleCharacter$13.class index 0138105380..5bcad92ca5 100644 Binary files a/build/classes/client/MapleCharacter$13.class and b/build/classes/client/MapleCharacter$13.class differ diff --git a/build/classes/client/MapleCharacter$14.class b/build/classes/client/MapleCharacter$14.class index b30e3e60b9..ee94bbe995 100644 Binary files a/build/classes/client/MapleCharacter$14.class and b/build/classes/client/MapleCharacter$14.class differ diff --git a/build/classes/client/MapleCharacter$15.class b/build/classes/client/MapleCharacter$15.class index 672e38c1fc..834acdfdec 100644 Binary files a/build/classes/client/MapleCharacter$15.class and b/build/classes/client/MapleCharacter$15.class differ diff --git a/build/classes/client/MapleCharacter$16.class b/build/classes/client/MapleCharacter$16.class index 62a990f13e..2689fe7571 100644 Binary files a/build/classes/client/MapleCharacter$16.class and b/build/classes/client/MapleCharacter$16.class differ diff --git a/build/classes/client/MapleCharacter$17.class b/build/classes/client/MapleCharacter$17.class index 2cc91d2568..4d569bc808 100644 Binary files a/build/classes/client/MapleCharacter$17.class and b/build/classes/client/MapleCharacter$17.class differ diff --git a/build/classes/client/MapleCharacter$18.class b/build/classes/client/MapleCharacter$18.class index 2757543d29..7cdba832b3 100644 Binary files a/build/classes/client/MapleCharacter$18.class and b/build/classes/client/MapleCharacter$18.class differ diff --git a/build/classes/client/MapleCharacter$19.class b/build/classes/client/MapleCharacter$19.class index c4d3dd6c84..7efe5ee4cc 100644 Binary files a/build/classes/client/MapleCharacter$19.class and b/build/classes/client/MapleCharacter$19.class differ diff --git a/build/classes/client/MapleCharacter$2.class b/build/classes/client/MapleCharacter$2.class index 58f8ac90fe..a56e5b0c1f 100644 Binary files a/build/classes/client/MapleCharacter$2.class and b/build/classes/client/MapleCharacter$2.class differ diff --git a/build/classes/client/MapleCharacter$20.class b/build/classes/client/MapleCharacter$20.class index f1da2dae69..7dfb29abe7 100644 Binary files a/build/classes/client/MapleCharacter$20.class and b/build/classes/client/MapleCharacter$20.class differ diff --git a/build/classes/client/MapleCharacter$3.class b/build/classes/client/MapleCharacter$3.class index 6b5a4fa949..667bdc97b2 100644 Binary files a/build/classes/client/MapleCharacter$3.class and b/build/classes/client/MapleCharacter$3.class differ diff --git a/build/classes/client/MapleCharacter$4.class b/build/classes/client/MapleCharacter$4.class index 5179a83628..fb8f243c1b 100644 Binary files a/build/classes/client/MapleCharacter$4.class and b/build/classes/client/MapleCharacter$4.class differ diff --git a/build/classes/client/MapleCharacter$5.class b/build/classes/client/MapleCharacter$5.class index 5d9fc699d3..671aa574ef 100644 Binary files a/build/classes/client/MapleCharacter$5.class and b/build/classes/client/MapleCharacter$5.class differ diff --git a/build/classes/client/MapleCharacter$6.class b/build/classes/client/MapleCharacter$6.class index d2ec9bd2a4..0c0ce34325 100644 Binary files a/build/classes/client/MapleCharacter$6.class and b/build/classes/client/MapleCharacter$6.class differ diff --git a/build/classes/client/MapleCharacter$7.class b/build/classes/client/MapleCharacter$7.class index 74c6f9cafc..5154e2edca 100644 Binary files a/build/classes/client/MapleCharacter$7.class and b/build/classes/client/MapleCharacter$7.class differ diff --git a/build/classes/client/MapleCharacter$8.class b/build/classes/client/MapleCharacter$8.class index 785579fa2c..bd09633639 100644 Binary files a/build/classes/client/MapleCharacter$8.class and b/build/classes/client/MapleCharacter$8.class differ diff --git a/build/classes/client/MapleCharacter$9.class b/build/classes/client/MapleCharacter$9.class index 7b4784c828..b1e800c73a 100644 Binary files a/build/classes/client/MapleCharacter$9.class and b/build/classes/client/MapleCharacter$9.class differ diff --git a/build/classes/client/MapleCharacter$CancelCooldownAction.class b/build/classes/client/MapleCharacter$CancelCooldownAction.class index 3f22e0e7fb..3bba687849 100644 Binary files a/build/classes/client/MapleCharacter$CancelCooldownAction.class and b/build/classes/client/MapleCharacter$CancelCooldownAction.class differ diff --git a/build/classes/client/MapleCharacter$FameStatus.class b/build/classes/client/MapleCharacter$FameStatus.class index 7d32e89a60..0f2c458f65 100644 Binary files a/build/classes/client/MapleCharacter$FameStatus.class and b/build/classes/client/MapleCharacter$FameStatus.class differ diff --git a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class index 9462a8b857..350cd71520 100644 Binary files a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class and b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class index 38543e04c1..bffdc5eeb5 100644 Binary files a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class and b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$SkillEntry.class b/build/classes/client/MapleCharacter$SkillEntry.class index 57c7768913..3060f46d03 100644 Binary files a/build/classes/client/MapleCharacter$SkillEntry.class and b/build/classes/client/MapleCharacter$SkillEntry.class differ diff --git a/build/classes/client/MapleCharacter.class b/build/classes/client/MapleCharacter.class index 6d402e5c06..795f923135 100644 Binary files a/build/classes/client/MapleCharacter.class and b/build/classes/client/MapleCharacter.class differ diff --git a/build/classes/client/MapleClient$1.class b/build/classes/client/MapleClient$1.class index 77502c8a71..03d0bf1476 100644 Binary files a/build/classes/client/MapleClient$1.class and b/build/classes/client/MapleClient$1.class differ diff --git a/build/classes/client/MapleClient$CharNameAndId.class b/build/classes/client/MapleClient$CharNameAndId.class index 6de564b57e..32e714b0e5 100644 Binary files a/build/classes/client/MapleClient$CharNameAndId.class and b/build/classes/client/MapleClient$CharNameAndId.class differ diff --git a/build/classes/client/MapleClient.class b/build/classes/client/MapleClient.class index e3a5a1afbf..f840cd254f 100644 Binary files a/build/classes/client/MapleClient.class and b/build/classes/client/MapleClient.class differ diff --git a/build/classes/client/MapleFamily.class b/build/classes/client/MapleFamily.class index 7375bb9ab6..c18debadfb 100644 Binary files a/build/classes/client/MapleFamily.class and b/build/classes/client/MapleFamily.class differ diff --git a/build/classes/client/MapleRing.class b/build/classes/client/MapleRing.class index 1fc16f3493..35565f184c 100644 Binary files a/build/classes/client/MapleRing.class and b/build/classes/client/MapleRing.class differ diff --git a/build/classes/client/MonsterBook.class b/build/classes/client/MonsterBook.class index 998f3b66ad..643c23d0ee 100644 Binary files a/build/classes/client/MonsterBook.class and b/build/classes/client/MonsterBook.class differ diff --git a/build/classes/client/command/Commands$1.class b/build/classes/client/command/Commands$1.class index cc084ffe4f..4fc14fd5d0 100644 Binary files a/build/classes/client/command/Commands$1.class and b/build/classes/client/command/Commands$1.class differ diff --git a/build/classes/client/command/Commands.class b/build/classes/client/command/Commands.class index 323adb5970..4badeecabf 100644 Binary files a/build/classes/client/command/Commands.class and b/build/classes/client/command/Commands.class differ diff --git a/build/classes/client/inventory/ItemFactory.class b/build/classes/client/inventory/ItemFactory.class index 790f63a05a..c94d34c576 100644 Binary files a/build/classes/client/inventory/ItemFactory.class and b/build/classes/client/inventory/ItemFactory.class differ diff --git a/build/classes/client/inventory/MapleInventory.class b/build/classes/client/inventory/MapleInventory.class index 2d17a7e761..066db5de3d 100644 Binary files a/build/classes/client/inventory/MapleInventory.class and b/build/classes/client/inventory/MapleInventory.class differ diff --git a/build/classes/client/inventory/MaplePet.class b/build/classes/client/inventory/MaplePet.class index 1af0996bf5..a620cb41d3 100644 Binary files a/build/classes/client/inventory/MaplePet.class and b/build/classes/client/inventory/MaplePet.class differ diff --git a/build/classes/constants/ItemConstants.class b/build/classes/constants/ItemConstants.class index aa29dccc02..0bd1db2154 100644 Binary files a/build/classes/constants/ItemConstants.class and b/build/classes/constants/ItemConstants.class differ diff --git a/build/classes/constants/ServerConstants.class b/build/classes/constants/ServerConstants.class index 834a1922ca..e95e0769ad 100644 Binary files a/build/classes/constants/ServerConstants.class and b/build/classes/constants/ServerConstants.class differ diff --git a/build/classes/net/server/RankingWorker.class b/build/classes/net/server/RankingWorker.class index 4f6f35c99d..e0745771b8 100644 Binary files a/build/classes/net/server/RankingWorker.class and b/build/classes/net/server/RankingWorker.class differ diff --git a/build/classes/net/server/Server$1.class b/build/classes/net/server/Server$1.class index b11ad5eae6..1e0c156886 100644 Binary files a/build/classes/net/server/Server$1.class and b/build/classes/net/server/Server$1.class differ diff --git a/build/classes/net/server/Server.class b/build/classes/net/server/Server.class index 96c52eee12..9616deba4e 100644 Binary files a/build/classes/net/server/Server.class and b/build/classes/net/server/Server.class differ diff --git a/build/classes/net/server/channel/handlers/BBSOperationHandler.class b/build/classes/net/server/channel/handlers/BBSOperationHandler.class index 6d589a651e..314ce3baee 100644 Binary files a/build/classes/net/server/channel/handlers/BBSOperationHandler.class and b/build/classes/net/server/channel/handlers/BBSOperationHandler.class differ diff --git a/build/classes/net/server/channel/handlers/BuddylistModifyHandler.class b/build/classes/net/server/channel/handlers/BuddylistModifyHandler.class index fb9a95ed9f..d6540d23e1 100644 Binary files a/build/classes/net/server/channel/handlers/BuddylistModifyHandler.class and b/build/classes/net/server/channel/handlers/BuddylistModifyHandler.class differ diff --git a/build/classes/net/server/channel/handlers/CouponCodeHandler.class b/build/classes/net/server/channel/handlers/CouponCodeHandler.class index 0a757825b3..cfeb18bc5b 100644 Binary files a/build/classes/net/server/channel/handlers/CouponCodeHandler.class and b/build/classes/net/server/channel/handlers/CouponCodeHandler.class differ diff --git a/build/classes/net/server/channel/handlers/DueyHandler.class b/build/classes/net/server/channel/handlers/DueyHandler.class index 814567d104..4ad392c372 100644 Binary files a/build/classes/net/server/channel/handlers/DueyHandler.class and b/build/classes/net/server/channel/handlers/DueyHandler.class differ diff --git a/build/classes/net/server/channel/handlers/EnterMTSHandler.class b/build/classes/net/server/channel/handlers/EnterMTSHandler.class index 30e714b28f..a6bb2845b2 100644 Binary files a/build/classes/net/server/channel/handlers/EnterMTSHandler.class and b/build/classes/net/server/channel/handlers/EnterMTSHandler.class differ diff --git a/build/classes/net/server/channel/handlers/FredrickHandler.class b/build/classes/net/server/channel/handlers/FredrickHandler.class index 6127559957..73b7ec0f82 100644 Binary files a/build/classes/net/server/channel/handlers/FredrickHandler.class and b/build/classes/net/server/channel/handlers/FredrickHandler.class differ diff --git a/build/classes/net/server/channel/handlers/MTSHandler.class b/build/classes/net/server/channel/handlers/MTSHandler.class index 62b0587eab..0a7a5679e4 100644 Binary files a/build/classes/net/server/channel/handlers/MTSHandler.class and b/build/classes/net/server/channel/handlers/MTSHandler.class differ diff --git a/build/classes/net/server/channel/handlers/NoteActionHandler.class b/build/classes/net/server/channel/handlers/NoteActionHandler.class index 61f90e2a0e..209dce0ed8 100644 Binary files a/build/classes/net/server/channel/handlers/NoteActionHandler.class and b/build/classes/net/server/channel/handlers/NoteActionHandler.class differ diff --git a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class index 9c56f045d6..a2dda463c3 100644 Binary files a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class and b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class differ diff --git a/build/classes/net/server/channel/handlers/ReportHandler.class b/build/classes/net/server/channel/handlers/ReportHandler.class index 6e518873b7..cdac6acf26 100644 Binary files a/build/classes/net/server/channel/handlers/ReportHandler.class and b/build/classes/net/server/channel/handlers/ReportHandler.class differ diff --git a/build/classes/net/server/channel/handlers/RingActionHandler.class b/build/classes/net/server/channel/handlers/RingActionHandler.class index da9dcca963..bafa90d34a 100644 Binary files a/build/classes/net/server/channel/handlers/RingActionHandler.class and b/build/classes/net/server/channel/handlers/RingActionHandler.class differ diff --git a/build/classes/net/server/channel/handlers/ScrollHandler.class b/build/classes/net/server/channel/handlers/ScrollHandler.class index 1cb4b41be5..1da72f6522 100644 Binary files a/build/classes/net/server/channel/handlers/ScrollHandler.class and b/build/classes/net/server/channel/handlers/ScrollHandler.class differ diff --git a/build/classes/net/server/channel/handlers/SpawnPetHandler.class b/build/classes/net/server/channel/handlers/SpawnPetHandler.class index 69282f1923..ce7ffa202c 100644 Binary files a/build/classes/net/server/channel/handlers/SpawnPetHandler.class and b/build/classes/net/server/channel/handlers/SpawnPetHandler.class differ diff --git a/build/classes/net/server/channel/handlers/UseItemHandler.class b/build/classes/net/server/channel/handlers/UseItemHandler.class index e0dcc94650..ce4121609c 100644 Binary files a/build/classes/net/server/channel/handlers/UseItemHandler.class and b/build/classes/net/server/channel/handlers/UseItemHandler.class differ diff --git a/build/classes/net/server/channel/handlers/WhisperHandler.class b/build/classes/net/server/channel/handlers/WhisperHandler.class index d2a582538e..e7d2a198b1 100644 Binary files a/build/classes/net/server/channel/handlers/WhisperHandler.class and b/build/classes/net/server/channel/handlers/WhisperHandler.class differ diff --git a/build/classes/net/server/guild/MapleAlliance.class b/build/classes/net/server/guild/MapleAlliance.class index c7f0035532..6f98eb2b78 100644 Binary files a/build/classes/net/server/guild/MapleAlliance.class and b/build/classes/net/server/guild/MapleAlliance.class differ diff --git a/build/classes/net/server/guild/MapleGuild.class b/build/classes/net/server/guild/MapleGuild.class index da8d12e1ab..463fab59ef 100644 Binary files a/build/classes/net/server/guild/MapleGuild.class and b/build/classes/net/server/guild/MapleGuild.class differ diff --git a/build/classes/net/server/handlers/login/ViewCharHandler.class b/build/classes/net/server/handlers/login/ViewCharHandler.class index e7301e5095..91c6f73d93 100644 Binary files a/build/classes/net/server/handlers/login/ViewCharHandler.class and b/build/classes/net/server/handlers/login/ViewCharHandler.class differ diff --git a/build/classes/net/server/world/World$1.class b/build/classes/net/server/world/World$1.class index 97fa97b0eb..26812bbc32 100644 Binary files a/build/classes/net/server/world/World$1.class and b/build/classes/net/server/world/World$1.class differ diff --git a/build/classes/net/server/world/World.class b/build/classes/net/server/world/World.class index b89946e959..7c1bd5d4fd 100644 Binary files a/build/classes/net/server/world/World.class and b/build/classes/net/server/world/World.class differ diff --git a/build/classes/scripting/AbstractPlayerInteraction.class b/build/classes/scripting/AbstractPlayerInteraction.class index 26fa34cd0b..94af2a9164 100644 Binary files a/build/classes/scripting/AbstractPlayerInteraction.class and b/build/classes/scripting/AbstractPlayerInteraction.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$1.class b/build/classes/scripting/event/EventInstanceManager$1.class index 1e39f0b70e..2d548d205b 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$1.class and b/build/classes/scripting/event/EventInstanceManager$1.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$2.class b/build/classes/scripting/event/EventInstanceManager$2.class index 56fdf62635..0e92885d80 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$2.class and b/build/classes/scripting/event/EventInstanceManager$2.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$3.class b/build/classes/scripting/event/EventInstanceManager$3.class index 454389bfc6..3379773f99 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$3.class and b/build/classes/scripting/event/EventInstanceManager$3.class differ diff --git a/build/classes/scripting/event/EventInstanceManager.class b/build/classes/scripting/event/EventInstanceManager.class index 35b8d9df15..3eff11e8db 100644 Binary files a/build/classes/scripting/event/EventInstanceManager.class and b/build/classes/scripting/event/EventInstanceManager.class differ diff --git a/build/classes/scripting/portal/PortalPlayerInteraction.class b/build/classes/scripting/portal/PortalPlayerInteraction.class index 7374d3574b..abd41666e6 100644 Binary files a/build/classes/scripting/portal/PortalPlayerInteraction.class and b/build/classes/scripting/portal/PortalPlayerInteraction.class differ diff --git a/build/classes/scripting/reactor/ReactorScriptManager.class b/build/classes/scripting/reactor/ReactorScriptManager.class index d02660fd8c..7da92e2daa 100644 Binary files a/build/classes/scripting/reactor/ReactorScriptManager.class and b/build/classes/scripting/reactor/ReactorScriptManager.class differ diff --git a/build/classes/server/CashShop$CashItemFactory.class b/build/classes/server/CashShop$CashItemFactory.class index 5e8c210d89..d63e6359f0 100644 Binary files a/build/classes/server/CashShop$CashItemFactory.class and b/build/classes/server/CashShop$CashItemFactory.class differ diff --git a/build/classes/server/CashShop.class b/build/classes/server/CashShop.class index 69a7ed91a4..978ab0c668 100644 Binary files a/build/classes/server/CashShop.class and b/build/classes/server/CashShop.class differ diff --git a/build/classes/server/MakerItemFactory$MakerItemCreateEntry.class b/build/classes/server/MakerItemFactory$MakerItemCreateEntry.class index e3b05ef732..9e8d530e98 100644 Binary files a/build/classes/server/MakerItemFactory$MakerItemCreateEntry.class and b/build/classes/server/MakerItemFactory$MakerItemCreateEntry.class differ diff --git a/build/classes/server/MakerItemFactory.class b/build/classes/server/MakerItemFactory.class index d20dec477b..96c2da239c 100644 Binary files a/build/classes/server/MakerItemFactory.class and b/build/classes/server/MakerItemFactory.class differ diff --git a/build/classes/server/MapleItemInformationProvider$1.class b/build/classes/server/MapleItemInformationProvider$1.class index def2e8a947..cb45b48a6d 100644 Binary files a/build/classes/server/MapleItemInformationProvider$1.class and b/build/classes/server/MapleItemInformationProvider$1.class differ diff --git a/build/classes/server/MapleItemInformationProvider$RewardItem.class b/build/classes/server/MapleItemInformationProvider$RewardItem.class index 2a3b667040..e98508805f 100644 Binary files a/build/classes/server/MapleItemInformationProvider$RewardItem.class and b/build/classes/server/MapleItemInformationProvider$RewardItem.class differ diff --git a/build/classes/server/MapleItemInformationProvider$scriptedItem.class b/build/classes/server/MapleItemInformationProvider$scriptedItem.class index e7f80b5d43..5dafa5ea13 100644 Binary files a/build/classes/server/MapleItemInformationProvider$scriptedItem.class and b/build/classes/server/MapleItemInformationProvider$scriptedItem.class differ diff --git a/build/classes/server/MapleItemInformationProvider.class b/build/classes/server/MapleItemInformationProvider.class index 294ac70745..c746ba12f4 100644 Binary files a/build/classes/server/MapleItemInformationProvider.class and b/build/classes/server/MapleItemInformationProvider.class differ diff --git a/build/classes/server/MapleShop.class b/build/classes/server/MapleShop.class index f7350cb27d..2317422a10 100644 Binary files a/build/classes/server/MapleShop.class and b/build/classes/server/MapleShop.class differ diff --git a/build/classes/server/MapleStorage$1.class b/build/classes/server/MapleStorage$1.class index 7b9bc75800..6be26693a1 100644 Binary files a/build/classes/server/MapleStorage$1.class and b/build/classes/server/MapleStorage$1.class differ diff --git a/build/classes/server/MapleStorage.class b/build/classes/server/MapleStorage.class index dd3e186371..9c0d792019 100644 Binary files a/build/classes/server/MapleStorage.class and b/build/classes/server/MapleStorage.class differ diff --git a/build/classes/server/life/MapleMonsterInformationProvider.class b/build/classes/server/life/MapleMonsterInformationProvider.class index 41af8e6a3f..2ac13296f3 100644 Binary files a/build/classes/server/life/MapleMonsterInformationProvider.class and b/build/classes/server/life/MapleMonsterInformationProvider.class differ diff --git a/build/classes/server/maps/HiredMerchant$SoldItem.class b/build/classes/server/maps/HiredMerchant$SoldItem.class index 7c12f01051..b0763fb4cd 100644 Binary files a/build/classes/server/maps/HiredMerchant$SoldItem.class and b/build/classes/server/maps/HiredMerchant$SoldItem.class differ diff --git a/build/classes/server/maps/HiredMerchant.class b/build/classes/server/maps/HiredMerchant.class index fc6d7aa910..e8e60ba291 100644 Binary files a/build/classes/server/maps/HiredMerchant.class and b/build/classes/server/maps/HiredMerchant.class differ diff --git a/build/classes/server/maps/MapleMap.class b/build/classes/server/maps/MapleMap.class index e732fbe89f..cad0c6c51e 100644 Binary files a/build/classes/server/maps/MapleMap.class and b/build/classes/server/maps/MapleMap.class differ diff --git a/build/classes/server/maps/MapleMapFactory.class b/build/classes/server/maps/MapleMapFactory.class index d2b770fadb..fef6d11f63 100644 Binary files a/build/classes/server/maps/MapleMapFactory.class and b/build/classes/server/maps/MapleMapFactory.class differ diff --git a/build/classes/server/maps/PlayerNPCs.class b/build/classes/server/maps/PlayerNPCs.class index 69c7179517..90ebb80282 100644 Binary files a/build/classes/server/maps/PlayerNPCs.class and b/build/classes/server/maps/PlayerNPCs.class differ diff --git a/build/classes/server/partyquest/MonsterCarnival.class b/build/classes/server/partyquest/MonsterCarnival.class index 984ddd6505..22b30aedc0 100644 Binary files a/build/classes/server/partyquest/MonsterCarnival.class and b/build/classes/server/partyquest/MonsterCarnival.class differ diff --git a/build/classes/server/quest/MapleQuest$1.class b/build/classes/server/quest/MapleQuest$1.class index d0f505f6bc..8b9994c09c 100644 Binary files a/build/classes/server/quest/MapleQuest$1.class and b/build/classes/server/quest/MapleQuest$1.class differ diff --git a/build/classes/server/quest/MapleQuest.class b/build/classes/server/quest/MapleQuest.class index 73a49d7865..fa5261cb6b 100644 Binary files a/build/classes/server/quest/MapleQuest.class and b/build/classes/server/quest/MapleQuest.class differ diff --git a/build/classes/server/quest/MapleQuestRequirementType.class b/build/classes/server/quest/MapleQuestRequirementType.class index 66bcfb12e8..b9bf58e1a8 100644 Binary files a/build/classes/server/quest/MapleQuestRequirementType.class and b/build/classes/server/quest/MapleQuestRequirementType.class differ diff --git a/build/classes/server/quest/requirements/MesoRequirement.class b/build/classes/server/quest/requirements/MesoRequirement.class new file mode 100644 index 0000000000..553d26576c Binary files /dev/null and b/build/classes/server/quest/requirements/MesoRequirement.class differ diff --git a/build/classes/tools/DatabaseConnection$1.class b/build/classes/tools/DatabaseConnection$1.class deleted file mode 100644 index 833f132974..0000000000 Binary files a/build/classes/tools/DatabaseConnection$1.class and /dev/null differ diff --git a/build/classes/tools/DatabaseConnection$ThreadLocalConnection.class b/build/classes/tools/DatabaseConnection$ThreadLocalConnection.class deleted file mode 100644 index 7a18839058..0000000000 Binary files a/build/classes/tools/DatabaseConnection$ThreadLocalConnection.class and /dev/null differ diff --git a/build/classes/tools/DatabaseConnection.class b/build/classes/tools/DatabaseConnection.class index e69bc82c64..42ec1c9e25 100644 Binary files a/build/classes/tools/DatabaseConnection.class and b/build/classes/tools/DatabaseConnection.class differ diff --git a/build/classes/tools/MaplePacketCreator$1.class b/build/classes/tools/MaplePacketCreator$1.class index 44a9b4e814..bf10881eaf 100644 Binary files a/build/classes/tools/MaplePacketCreator$1.class and b/build/classes/tools/MaplePacketCreator$1.class differ diff --git a/build/classes/tools/MaplePacketCreator$2.class b/build/classes/tools/MaplePacketCreator$2.class index c3a90e0387..1d30e30bd9 100644 Binary files a/build/classes/tools/MaplePacketCreator$2.class and b/build/classes/tools/MaplePacketCreator$2.class differ diff --git a/build/classes/tools/MaplePacketCreator.class b/build/classes/tools/MaplePacketCreator.class index f15cf30954..86bcbb35c2 100644 Binary files a/build/classes/tools/MaplePacketCreator.class and b/build/classes/tools/MaplePacketCreator.class differ diff --git a/cores/commons-dbcp2-2.1.1.jar b/cores/commons-dbcp2-2.1.1.jar new file mode 100644 index 0000000000..674f367638 Binary files /dev/null and b/cores/commons-dbcp2-2.1.1.jar differ diff --git a/cores/commons-pool2-2.4.2.jar b/cores/commons-pool2-2.4.2.jar new file mode 100644 index 0000000000..fdf8b6faaf Binary files /dev/null and b/cores/commons-pool2-2.4.2.jar differ diff --git a/dist/MapleSolaxia.jar b/dist/MapleSolaxia.jar index 6c535bc3f5..279355d04a 100644 Binary files a/dist/MapleSolaxia.jar and b/dist/MapleSolaxia.jar differ diff --git a/dist/lib/commons-dbcp2-2.1.1.jar b/dist/lib/commons-dbcp2-2.1.1.jar new file mode 100644 index 0000000000..674f367638 Binary files /dev/null and b/dist/lib/commons-dbcp2-2.1.1.jar differ diff --git a/dist/lib/commons-pool2-2.4.2.jar b/dist/lib/commons-pool2-2.4.2.jar new file mode 100644 index 0000000000..fdf8b6faaf Binary files /dev/null and b/dist/lib/commons-pool2-2.4.2.jar differ diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index 0c004cf755..61c1e76156 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -464,4 +464,15 @@ Consertado comandos de hair e face. 18 Agosto 2017, Consertado skill Dispel não aparecendo efeito aos outros jogadores. Atualizados alguns scripts de viagens transferindo jogadores a pontos aleatorios nas chegadas. -Atualizado relatorio de drop data no monster book. \ No newline at end of file +Atualizado relatorio de drop data no monster book. + +20 - 22 Agosto 2017, +Refatoradas algumas referências de identificação de itens, quando constantes, para ser realizados pelo classe estática ItemConstants ao invés da classe MapleItemInformationProvider. +Adicionados door portals em Kerning City Square. +Refatorado acesso ao DB. Conexões agora podem ser lançadas em paralelo, com um limite máximo de conexões. Excedente espera até que um fique livre. +Adicionado MESO como quest RequirementType. Quests agora podem checar por meso de um jogador. +Mais drop data e HPBar em bosses. + +23 Agosto 2017, +Consertado problema com overflow ao scrollar equips resultando em equips com stats negativos. +Consertado pets não expirando corretamente (possivelmente crashando o cliente se no meio do jogo). \ No newline at end of file diff --git a/docs/todo.txt b/docs/todo.txt index ada33b571c..225067fe60 100644 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -37,6 +37,7 @@ ToDo / Missing features list: --------------------------- ** Skills ** +- Some pirate skills incomplete or not implemented yet. --------------------------- diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 17bc047d72..8123295f7c 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,11 +3,28 @@ - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/PinkBeanBattle.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/MaplePet.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Item.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/PacketProcessor.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/AbstractPlayerInteraction.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/ServerConstants.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/SpawnPetHandler.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/quest/2230.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleItemInformationProvider.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/MaplePacketCreator.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/MapleInventory.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Equip.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/ItemRewardHandler.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/ItemMoveHandler.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/NPC%20Base.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/Randomizer.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleRing.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleQuestStatus.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventInstanceManager.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleInventoryManipulator.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/npc/NPCConversationManager.java file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/life/MapleLifeFactory.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/life/MapleMonster.java diff --git a/nbproject/project.properties b/nbproject/project.properties index 4fafbef26f..51265dab74 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -28,6 +28,8 @@ dist.jar=${dist.dir}/MapleSolaxia.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= +file.reference.commons-dbcp2-2.1.1.jar=cores/commons-dbcp2-2.1.1.jar +file.reference.commons-pool2-2.4.2.jar=cores/commons-pool2-2.4.2.jar file.reference.MapleSolaxia-src=src file.reference.mina-core-2.0.7.jar=C:\\Users\\Tyler\\Desktop\\MoopleDev\\dist\\mina-core-2.0.7.jar file.reference.mysql-connector-java-bin.jar=C:\\Users\\Tyler\\Desktop\\MoopleDev\\dist\\mysql-connector-java-bin.jar @@ -41,7 +43,9 @@ javac.classpath=\ ${file.reference.mina-core-2.0.7.jar}:\ ${file.reference.mysql-connector-java-bin.jar}:\ ${file.reference.slf4j-api-1.6.6.jar}:\ - ${file.reference.slf4j-jdk14-1.7.5.jar} + ${file.reference.slf4j-jdk14-1.7.5.jar}:\ + ${file.reference.commons-dbcp2-2.1.1.jar}:\ + ${file.reference.commons-pool2-2.4.2.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/scripts/npc/2111025.js b/scripts/npc/2111025.js new file mode 100644 index 0000000000..bd91cda971 --- /dev/null +++ b/scripts/npc/2111025.js @@ -0,0 +1,29 @@ +/* + 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 . +*/ +/* + Control Device + */ + +function start() { + cm.sendNext ("This control device seems to be monitoring something..."); + cm.dispose(); +} \ No newline at end of file diff --git a/scripts/npc/2111026.js b/scripts/npc/2111026.js new file mode 100644 index 0000000000..a3b8356f8b --- /dev/null +++ b/scripts/npc/2111026.js @@ -0,0 +1,29 @@ +/* + 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 . +*/ +/* + Incomplete Magic Square + */ + +function start() { + cm.sendNext ("This chalkboard has some hard-founded studies annotated on it..."); + cm.dispose(); +} \ No newline at end of file diff --git a/scripts/npc/9000020.js b/scripts/npc/9000020.js index 237cd1c7a4..6e218669a5 100644 --- a/scripts/npc/9000020.js +++ b/scripts/npc/9000020.js @@ -47,9 +47,9 @@ function action(mode, type, selection) { } } else if (status == 2) { var map = cm.getPlayer().getSavedLocation("WORLDTOUR"); - if (map == undefined) - map = 104000000; - cm.warp(map, parseInt(Math.random() * 5)); + if (map == undefined) map = 104000000; + + cm.warp(map); cm.dispose(); } } else { @@ -69,7 +69,7 @@ function action(mode, type, selection) { } else if (status == 4) { cm.gainMeso(-3000); cm.getPlayer().saveLocation("WORLDTOUR"); - cm.warp(800000000); + cm.warp(800000000, 0); cm.dispose(); } } diff --git a/scripts/quest/2230.js b/scripts/quest/2230.js index 6a1ea10a21..ff8baffe1e 100644 --- a/scripts/quest/2230.js +++ b/scripts/quest/2230.js @@ -53,10 +53,16 @@ function end(mode, type, selection) { if (mode == -1) { qm.dispose(); } else { + if (mode == 0 && type > 0) { + qm.dispose(); + return; + } + if (mode == 1) status++; else status--; + if (status == 0) qm.sendSimple("Hello, traveler... You have finally come to see me. Have you fulfilled your duties? \r\n #b#L0#What duties? Who are you?#l#k"); else if (selection == 0 && status == 1) { @@ -70,7 +76,7 @@ function end(mode, type, selection) { } else if (status == 5) { qm.sendYesNo("Now do you understand? Every action comes with consequences, and pets are no exception. The egg of the snail shall hatch soon."); } else if (status == 6) { - qm.gainItem(5000054, 1, false, true, 5 * 60 * 60 * 1000); // rune snail (5hrs) + qm.gainItem(5000054, 1, false, true, 5 * 1000); // rune snail (5hrs) qm.gainItem(4032086, -1); // Mysterious Egg * -1 qm.forceCompleteQuest(); diff --git a/sql/db_drops.sql b/sql/db_drops.sql index c4217d47a0..f587678cea 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -1566,7 +1566,7 @@ USE `maplesolaxia`; (2230103, 4000097, 1, 1, 0, 200000), (2230103, 4030016, 1, 1, 0, 10000), (2230103, 4030012, 1, 1, 0, 10000), -(2230103, 4031072, 1, 1, 0, 7000), +(2230103, 4031072, 1, 1, 9004, 7000), (2230103, 4131000, 1, 1, 0, 3000), (2230103, 2000000, 1, 1, 0, 40000), (2230103, 2000001, 1, 1, 0, 40000), @@ -19705,7 +19705,48 @@ USE `maplesolaxia`; (6090003, 0, 600, 800, 0, 400000), (6090004, 0, 1000, 1100, 0, 400000), (5090000, 0, 800, 920, 0, 400000), -(5090001, 0, 1700, 1750, 0, 400000); +(5090001, 0, 1700, 1750, 0, 400000), + +(7090000, 1402015, 1, 1, 0, 8500), +(7090000, 1092016, 1, 1, 0, 8500), +(7090000, 1382039, 1, 1, 0, 8500), +(7090000, 1051054, 1, 1, 0, 8500), +(7090000, 1452014, 1, 1, 0, 8500), +(7090000, 1082107, 1, 1, 0, 8500), +(7090000, 1472027, 1, 1, 0, 8500), +(7090000, 1041102, 1, 1, 0, 8500), +(7090000, 1492022, 1, 1, 0, 8500), +(7090000, 1072309, 1, 1, 0, 8500), +(7090000, 1032020, 1, 1, 0, 8500), +(7090000, 1102023, 1, 1, 0, 8500), +(7090000, 2041014, 1, 1, 0, 4500), +(7090000, 2040519, 1, 1, 0, 4500), +(7090000, 2044601, 1, 1, 0, 4500), +(7090000, 2044705, 1, 1, 0, 4500), +(7090000, 2044809, 1, 1, 0, 4500), +(7090000, 2022130, 1, 1, 0, 200000), +(7090000, 2022191, 1, 1, 0, 200000), +(7090000, 0, 800, 920, 0, 400000), +(8090000, 1040104, 1, 1, 0, 8500), +(8090000, 1412009, 1, 1, 0, 8500), +(8090000, 1072207, 1, 1, 0, 8500), +(8090000, 1382008, 1, 1, 0, 8500), +(8090000, 1050077, 1, 1, 0, 8500), +(8090000, 1462012, 1, 1, 0, 8500), +(8090000, 1002327, 1, 1, 0, 8500), +(8090000, 1332023, 1, 1, 0, 8500), +(8090000, 1082210, 1, 1, 0, 8500), +(8090000, 1482011, 1, 1, 0, 8500), +(8090000, 1032020, 1, 1, 0, 8500), +(8090000, 1102023, 1, 1, 0, 8500), +(8090000, 2041014, 1, 1, 0, 4500), +(8090000, 2040519, 1, 1, 0, 4500), +(8090000, 2044601, 1, 1, 0, 4500), +(8090000, 2044705, 1, 1, 0, 4500), +(8090000, 2044809, 1, 1, 0, 4500), +(8090000, 2022130, 1, 1, 0, 200000), +(8090000, 2022191, 1, 1, 0, 200000), +(8090000, 0, 1000, 1100, 0, 400000); # (dropperid, itemid, minqty, maxqty, questid, chance) @@ -19722,11 +19763,6 @@ USE `maplesolaxia`; FROM temp_data WHERE temp_data.dropperid = 8820001; - INSERT INTO temp_data (dropperid, itemid, minqty, maxqty, questid, chance) - SELECT dropperid, itemid, minqty, maxqty, questid, chance - FROM table1 - WHERE condition; - # reinsert other Freezer's data INSERT IGNORE INTO temp_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES (9420501, 0, 92, 138, 0, 400000), @@ -20667,7 +20703,8 @@ USE `maplesolaxia`; (9102001, 2010004, 2, -1), (9102001, 2020000, 2, -1), (9102001, 2020001, 2, -1), - (9102001, 2020002, 2, -1); + (9102001, 2020002, 2, -1), + (2002018, 4161014, 1, 3099); # updates info for all cards on monster book DROP TABLE `monstercarddata`; diff --git a/src/client/BuddyList.java b/src/client/BuddyList.java index 1c1dc1d18c..c2e3dc0a11 100644 --- a/src/client/BuddyList.java +++ b/src/client/BuddyList.java @@ -23,6 +23,7 @@ package client; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.Connection; import java.sql.SQLException; import java.util.Collection; import java.util.Deque; @@ -109,7 +110,9 @@ public class BuddyList { public void loadFromDb(int characterId) { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT b.buddyid, b.pending, b.group, c.name as buddyname FROM buddies as b, characters as c WHERE c.id = b.buddyid AND b.characterid = ?"); + Connection con = DatabaseConnection.getConnection(); + + PreparedStatement ps = con.prepareStatement("SELECT b.buddyid, b.pending, b.group, c.name as buddyname FROM buddies as b, characters as c WHERE c.id = b.buddyid AND b.characterid = ?"); ps.setInt(1, characterId); ResultSet rs = ps.executeQuery(); while (rs.next()) { @@ -121,10 +124,11 @@ public class BuddyList { } rs.close(); ps.close(); - ps = DatabaseConnection.getConnection().prepareStatement("DELETE FROM buddies WHERE pending = 1 AND characterid = ?"); + ps = con.prepareStatement("DELETE FROM buddies WHERE pending = 1 AND characterid = ?"); ps.setInt(1, characterId); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 8c22fb54a1..a2e92291ea 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -622,7 +622,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.setInt(2, accountid); ps.executeUpdate(); } - } catch (Exception e) { + con.close(); + } catch (SQLException e) { e.printStackTrace(); } @@ -630,9 +631,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static boolean ban(String id, String reason, boolean accountId) { PreparedStatement ps = null; - ResultSet rs = null; + ResultSet rs = null; + Connection con = null; try { - Connection con = DatabaseConnection.getConnection(); + con = DatabaseConnection.getConnection(); + if (id.matches("/[0-9]{1,3}\\..*")) { ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?)"); ps.setString(1, id); @@ -649,16 +652,22 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { boolean ret = false; ps.setString(1, id); rs = ps.executeQuery(); - if (rs.next()) { - try (PreparedStatement psb = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET banned = 1, banreason = ? WHERE id = ?")) { - psb.setString(1, reason); - psb.setInt(2, rs.getInt(1)); - psb.executeUpdate(); - } - ret = true; + if (rs.next()) { + Connection con2 = DatabaseConnection.getConnection(); + + try (PreparedStatement psb = con2.prepareStatement("UPDATE accounts SET banned = 1, banreason = ? WHERE id = ?")) { + psb.setString(1, reason); + psb.setInt(2, rs.getInt(1)); + psb.executeUpdate(); + } finally { + con2.close(); + } + ret = true; } - rs.close(); + + rs.close(); ps.close(); + con.close(); return ret; } catch (SQLException ex) { ex.printStackTrace(); @@ -670,6 +679,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (rs != null && !rs.isClosed()) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1395,6 +1407,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.setInt(1, skill.getId()); ps.setInt(2, id); ps.execute(); + } finally { + con.close(); } } catch (SQLException ex) { ex.printStackTrace(); @@ -1464,10 +1478,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (id / 1000000 == 2) { MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); if (ii.isConsumeOnPickup(id)) { - if (ii.isPartyItem(id)) { + if (ItemConstants.isPartyItem(id)) { List pchr = c.getPlayer().getPartyMembersOnSameMap(); - if(!ii.isPartyAllcure(id)) { + if(!ItemConstants.isPartyAllcure(id)) { if(!pchr.isEmpty()) { for (MapleCharacter mc : pchr) { ii.getItemEffect(id).applyTo(mc); @@ -1663,6 +1677,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { try (PreparedStatement ps = con.prepareStatement("DELETE FROM guilds WHERE guildid = ?")) { ps.setInt(1, id); ps.execute(); + } finally { + con.close(); } } catch (SQLException ex) { ex.printStackTrace(); @@ -1697,8 +1713,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static boolean deleteCharFromDB(MapleCharacter player) { int cid = player.getId(), accId = -1, world = 0; - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT accountid, world FROM characters WHERE id = ?")) { ps.setInt(1, cid); @@ -2297,7 +2315,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { expiretask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - MapleItemInformationProvider miip = MapleItemInformationProvider.getInstance(); boolean deletedCoupon = false; long expiration, currenttime = System.currentTimeMillis(); @@ -2323,12 +2340,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } else if (expiration != -1 && expiration < currenttime) { client.announce(MaplePacketCreator.itemExpired(item.getItemId())); toberemove.add(item); - if(miip.isRateCoupon(item.getItemId())) { + if(ItemConstants.isRateCoupon(item.getItemId())) { deletedCoupon = true; } } } for (Item item : toberemove) { + if(item.getPetId() > -1) unequipPet(getPet(getPetIndex(item.getPetId())), true); MapleInventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true); } toberemove.clear(); @@ -2532,7 +2550,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { Map character = new LinkedHashMap<>(); try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `id`, `accountid`, `name` FROM `characters` WHERE `name` = ?")) { + Connection con = DatabaseConnection.getConnection(); + + try (PreparedStatement ps = con.prepareStatement("SELECT `id`, `accountid`, `name` FROM `characters` WHERE `name` = ?")) { ps.setString(1, name); try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { @@ -2545,6 +2565,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { character.put(rs.getMetaData().getColumnLabel(i), rs.getString(i)); } } + } finally { + con.close(); } } catch (SQLException sqle) { sqle.printStackTrace(); @@ -2855,7 +2877,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static int getAccountIdByName(String name) { try { int id; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT accountid FROM characters WHERE name = ?")) { + Connection con = DatabaseConnection.getConnection(); + + try (PreparedStatement ps = con.prepareStatement("SELECT accountid FROM characters WHERE name = ?")) { ps.setString(1, name); try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { @@ -2865,6 +2889,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } id = rs.getInt("accountid"); } + } finally { + con.close(); } return id; } catch (Exception e) { @@ -2876,7 +2902,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static int getIdByName(String name) { try { int id; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT id FROM characters WHERE name = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT id FROM characters WHERE name = ?")) { ps.setString(1, name); try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { @@ -2886,6 +2913,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } id = rs.getInt("id"); } + } finally { + con.close(); } return id; } catch (Exception e) { @@ -2897,7 +2926,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static String getNameById(int id) { try { String name; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT name FROM characters WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT name FROM characters WHERE id = ?")) { ps.setInt(1, id); try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { @@ -2907,6 +2937,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } name = rs.getString("name"); } + } finally { + con.close(); } return name; } catch (Exception e) { @@ -3715,11 +3747,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { lastfametime = System.currentTimeMillis(); lastmonthfameids.add(Integer.valueOf(to.getId())); try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO famelog (characterid, characterid_to) VALUES (?, ?)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("INSERT INTO famelog (characterid, characterid_to) VALUES (?, ?)")) { ps.setInt(1, getId()); ps.setInt(2, to.getId()); ps.executeUpdate(); } + finally { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -3794,7 +3830,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public boolean isBeginnerJob() { - return (getJob().getId() == 0 || getJob().getId() == 1000 || getJob().getId() == 2000) && getLevel() < 11; + return (getJob().getId() == 0 || getJob().getId() == 1000 || getJob().getId() == 2000); } public boolean isGM() { @@ -3832,7 +3868,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { int improvingMaxHPLevel = 0; int improvingMaxMPLevel = 0; - if (isBeginnerJob()) { + if (isBeginnerJob() && getLevel() < 11) { remainingAp = 0; if (getLevel() < 6) { str += 5; @@ -3904,9 +3940,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (level == 200) { exp.set(0); } - hp = maxhp; - mp = maxmp; recalcLocalStats(); + hp = localmaxhp; + mp = localmaxmp; List> statup = new ArrayList<>(10); statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp)); statup.add(new Pair<>(MapleStat.HP, localmaxhp)); @@ -4116,10 +4152,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { dropCoupon = 1; } - private boolean isExpCoupon(int couponId) { - return couponId / 1000 == 5211; - } - private int getCouponMultiplier(int couponId) { return activeCouponRates.get(couponId); } @@ -4152,7 +4184,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { int couponQty = coupon.getValue(); commitBuffCoupon(couponId); - if(isExpCoupon(couponId)) setExpCouponRate(couponId, couponQty); + if(ItemConstants.isExpCoupon(couponId)) setExpCouponRate(couponId, couponQty); else setDropCouponRate(couponId, couponQty); } } @@ -4162,7 +4194,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { for(Entry coupon: activeCoupons.entrySet()) { int couponId = coupon.getKey(); - if(isExpCoupon(couponId)) { + if(ItemConstants.isExpCoupon(couponId)) { if(maxExpRate < getCouponMultiplier(couponId)) { maxExpCouponId = couponId; maxExpRate = getCouponMultiplier(couponId); @@ -4199,7 +4231,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { List active = Server.getInstance().getActiveCoupons(); for(Item it: this.getInventory(MapleInventoryType.CASH).list()) { - if(MapleItemInformationProvider.getInstance().isRateCoupon(it.getItemId()) && active.contains(it.getItemId())) { + if(ItemConstants.isRateCoupon(it.getItemId()) && active.contains(it.getItemId())) { Integer count = activeCoupons.get(it.getItemId()); if(count != null) activeCoupons.put(it.getItemId(), count + 1); @@ -4231,10 +4263,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { chrLock.unlock(); } - MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); - for (MapleBuffStatValueHolder mbsvh : allBuffs) { - if (ii.isRateCoupon(mbsvh.effect.getSourceId())) { + if (ItemConstants.isRateCoupon(mbsvh.effect.getSourceId())) { cancelEffect(mbsvh.effect, false, mbsvh.startTime); } } @@ -4249,6 +4279,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { MapleCharacter ret = new MapleCharacter(); ret.client = client; ret.id = charid; + Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE id = ?"); ps.setInt(1, charid); @@ -4570,6 +4601,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.maplemount.setTiredness(mounttiredness); ret.maplemount.setActive(false); + con.close(); return ret; } catch (SQLException | RuntimeException e) { e.printStackTrace(); @@ -4723,6 +4755,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } ps.close(); rs.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -5183,6 +5216,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } ps.executeBatch(); } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } @@ -5191,13 +5226,16 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void saveGuildStatus() { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET guildid = ?, guildrank = ?, allianceRank = ? WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET guildid = ?, guildrank = ?, allianceRank = ? WHERE id = ?")) { ps.setInt(1, guildid); ps.setInt(2, guildRank); ps.setInt(3, allianceRank); ps.setInt(4, id); ps.executeUpdate(); } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } @@ -5209,13 +5247,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public final boolean insertNewChar() { - final Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps = null; try { + con = DatabaseConnection.getConnection(); + con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); con.setAutoCommit(false); - ps = con.prepareStatement("INSERT INTO characters (str, dex, luk, `int`, gm, skincolor, gender, job, hair, face, map, meso, spawnpoint, accountid, name, world) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", DatabaseConnection.RETURN_GENERATED_KEYS); + ps = con.prepareStatement("INSERT INTO characters (str, dex, luk, `int`, gm, skincolor, gender, job, hair, face, map, meso, spawnpoint, accountid, name, world) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS); ps.setInt(1, 12); ps.setInt(2, 5); ps.setInt(3, 4); @@ -5303,6 +5343,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } con.setAutoCommit(true); con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -5313,8 +5354,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public synchronized void saveToDB() { Calendar c = Calendar.getInstance(); FilePrinter.print(FilePrinter.SAVING_CHARACTER, "Attempting to save " + name + " at " + c.getTime().toString()); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); con.setAutoCommit(false); PreparedStatement ps; @@ -5585,6 +5627,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { try { con.setAutoCommit(true); con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); + con.close(); } catch (Exception e) { e.printStackTrace(); } @@ -5632,13 +5675,16 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void sendNote(String to, String msg, byte fame) throws SQLException { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`, `fame`) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`, `fame`) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { ps.setString(1, to); ps.setString(2, this.getName()); ps.setString(3, msg); ps.setLong(4, System.currentTimeMillis()); ps.setByte(5, fame); ps.executeUpdate(); + } finally { + con.close(); } } @@ -5759,11 +5805,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setHasMerchant(boolean set) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET HasMerchant = ? WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET HasMerchant = ? WHERE id = ?")) { ps.setInt(1, set ? 1 : 0); ps.setInt(2, id); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -5772,11 +5822,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void addMerchantMesos(int add) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET MerchantMesos = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET MerchantMesos = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { ps.setInt(1, merchantmeso + add); ps.setInt(2, id); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); return; @@ -5786,11 +5839,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void setMerchantMeso(int set) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET MerchantMesos = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET MerchantMesos = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { ps.setInt(1, set); ps.setInt(2, id); ps.executeUpdate(); } + con.close(); } catch (SQLException e) { e.printStackTrace(); return; @@ -5969,11 +6024,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void changeName(String name) { this.name = name; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE `characters` SET `name` = ? WHERE `id` = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("UPDATE `characters` SET `name` = ? WHERE `id` = ?"); ps.setString(1, name); ps.setInt(2, id); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -6157,7 +6214,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void showNote() { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM notes WHERE `to`=? AND `deleted` = 0", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT * FROM notes WHERE `to`=? AND `deleted` = 0", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)) { ps.setString(1, this.getName()); try (ResultSet rs = ps.executeQuery()) { rs.last(); @@ -6166,6 +6224,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { client.announce(MaplePacketCreator.showNotes(rs, count)); } } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -6522,6 +6582,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.setInt(3, reason); ps.setInt(4, accountid); ps.executeUpdate(); + } finally { + con.close(); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index b45bce0ef3..7794531aec 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -180,7 +180,8 @@ public class MapleClient { PreparedStatement ps; List chars = new ArrayList<>(15); try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT id, name FROM characters WHERE accountid = ? AND world = ?"); + Connection con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT id, name FROM characters WHERE accountid = ? AND world = ?"); ps.setInt(1, this.getAccID()); ps.setInt(2, serverId); try (ResultSet rs = ps.executeQuery()) { @@ -189,6 +190,7 @@ public class MapleClient { } } ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -202,7 +204,8 @@ public class MapleClient { public boolean hasBannedIP() { boolean ret = false; try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT COUNT(*) FROM ipbans WHERE ? LIKE CONCAT(ip, '%')")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM ipbans WHERE ? LIKE CONCAT(ip, '%')")) { ps.setString(1, session.getRemoteAddress().toString()); try (ResultSet rs = ps.executeQuery()) { rs.next(); @@ -211,6 +214,7 @@ public class MapleClient { } } } + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -222,7 +226,8 @@ public class MapleClient { return voteTime; } try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT date FROM bit_votingrecords WHERE UPPER(account) = UPPER(?)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT date FROM bit_votingrecords WHERE UPPER(account) = UPPER(?)")) { ps.setString(1, accountName); try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { @@ -231,6 +236,7 @@ public class MapleClient { voteTime = rs.getInt("date"); } } + con.close(); } catch (SQLException e) { FilePrinter.printError("hasVotedAlready.txt", e); return -1; @@ -255,8 +261,10 @@ public class MapleClient { boolean ret = false; PreparedStatement ps = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT COUNT(*) FROM hwidbans WHERE hwid LIKE ?"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT COUNT(*) FROM hwidbans WHERE hwid LIKE ?"); ps.setString(1, hwid); ResultSet rs = ps.executeQuery(); if(rs != null && rs.next()) { @@ -270,6 +278,10 @@ public class MapleClient { if(ps != null && !ps.isClosed()) { ps.close(); } + + if(con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e){ e.printStackTrace(); } @@ -293,7 +305,9 @@ public class MapleClient { } } sql.append(")"); - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement(sql.toString())) { + + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement(sql.toString())) { i = 0; for (String mac : macs) { i++; @@ -305,7 +319,9 @@ public class MapleClient { ret = true; } } - } + } finally { + con.close(); + } } catch (Exception e) { e.printStackTrace(); } @@ -314,21 +330,25 @@ public class MapleClient { private void loadHWIDIfNescessary() throws SQLException { if(hwid == null) { - try(PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT hwid FROM accounts WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try(PreparedStatement ps = con.prepareStatement("SELECT hwid FROM accounts WHERE id = ?")) { ps.setInt(1, accId); try(ResultSet rs = ps.executeQuery()) { if(rs.next()) { hwid = rs.getString("hwid"); } } - } + } finally { + con.close(); + } } } // TODO: Recode to close statements... private void loadMacsIfNescessary() throws SQLException { if (macs.isEmpty()) { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT macs FROM accounts WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT macs FROM accounts WHERE id = ?")) { ps.setInt(1, accId); try (ResultSet rs = ps.executeQuery()) { if (rs.next()) { @@ -339,15 +359,19 @@ public class MapleClient { } } } - } + } finally { + con.close(); + } } } public void banHWID() { - Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = null; + Connection con = null; try { loadHWIDIfNescessary(); + + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("INSERT INTO hwidbans (hwid) VALUES (?)"); ps.setString(1, hwid); ps.executeUpdate(); @@ -355,8 +379,12 @@ public class MapleClient { e.printStackTrace(); } finally { try { - if(ps != null && !ps.isClosed()) + if(ps != null && !ps.isClosed()) { ps.close(); + } + if(con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -364,9 +392,11 @@ public class MapleClient { } public void banMacs() { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { loadMacsIfNescessary(); + + con = DatabaseConnection.getConnection(); List filtered = new LinkedList<>(); try (PreparedStatement ps = con.prepareStatement("SELECT filter FROM macfilters"); ResultSet rs = ps.executeQuery()) { while (rs.next()) { @@ -389,6 +419,8 @@ public class MapleClient { } } } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -408,11 +440,14 @@ public class MapleClient { public void setPin(String pin) { this.pin = pin; try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET pin = ? WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET pin = ? WHERE id = ?")) { ps.setString(1, pin); ps.setInt(2, accId); ps.executeUpdate(); - } + } finally { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -437,11 +472,14 @@ public class MapleClient { public void setPic(String pic) { this.pic = pic; try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET pic = ? WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET pic = ? WHERE id = ?")) { ps.setString(1, pic); ps.setInt(2, accId); ps.executeUpdate(); - } + } finally { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -471,10 +509,11 @@ public class MapleClient { getSession().close(true); } int loginok = 5; - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT id, password, salt, gender, banned, gm, pin, pic, characterslots, tos FROM accounts WHERE name = ?"); ps.setString(1, login); rs = ps.executeQuery(); @@ -522,6 +561,9 @@ public class MapleClient { if (rs != null && !rs.isClosed()) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -533,11 +575,12 @@ public class MapleClient { } public Calendar getTempBanCalendar() { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps = null; ResultSet rs = null; final Calendar lTempban = Calendar.getInstance(); try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT `tempban` FROM accounts WHERE id = ?"); ps.setInt(1, getAccID()); rs = ps.executeQuery(); @@ -560,6 +603,9 @@ public class MapleClient { if (rs != null) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -595,8 +641,10 @@ public class MapleClient { this.hwid = hwid.toString(); PreparedStatement ps = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET hwid = ? WHERE id = ?"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("UPDATE accounts SET hwid = ? WHERE id = ?"); ps.setString(1, this.hwid); ps.setInt(2, accId); ps.executeUpdate(); @@ -608,6 +656,9 @@ public class MapleClient { if(ps != null && !ps.isClosed()) { ps.close(); } + if(con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -629,8 +680,10 @@ public class MapleClient { newMacData.append(", "); } } + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET macs = ? WHERE id = ?"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("UPDATE accounts SET macs = ? WHERE id = ?"); ps.setString(1, newMacData.toString()); ps.setInt(2, accId); ps.executeUpdate(); @@ -642,8 +695,11 @@ public class MapleClient { if (ps != null && !ps.isClosed()) { ps.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException ex) { - ex.printStackTrace(); + ex.printStackTrace(); } } } @@ -664,6 +720,8 @@ public class MapleClient { ps.setInt(2, getAccID()); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -714,6 +772,8 @@ public class MapleClient { } else { loggedIn = false; } + + con.close(); return state; } catch (SQLException e) { loggedIn = false; @@ -1006,7 +1066,8 @@ public class MapleClient { return true; } try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `tos` FROM accounts WHERE id = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT `tos` FROM accounts WHERE id = ?"); ps.setInt(1, accId); ResultSet rs = ps.executeQuery(); @@ -1017,10 +1078,11 @@ public class MapleClient { } ps.close(); rs.close(); - ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET tos = 1 WHERE id = ?"); + ps = con.prepareStatement("UPDATE accounts SET tos = 1 WHERE id = ?"); ps.setInt(1, accId); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -1030,7 +1092,8 @@ public class MapleClient { public int getVotePoints(){ int points = 0; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `votes` FROM accounts WHERE id = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT `votes` FROM accounts WHERE id = ?"); ps.setInt(1, accId); ResultSet rs = ps.executeQuery(); @@ -1040,6 +1103,7 @@ public class MapleClient { ps.close(); rs.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -1070,6 +1134,8 @@ public class MapleClient { ps.setInt(2, accId); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -1107,15 +1173,19 @@ public class MapleClient { public boolean gainCharacterSlot() { if (characterSlots < 15) { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET characterslots = ? WHERE id = ?")) { ps.setInt(1, this.characterSlots += 1); ps.setInt(2, accId); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { - e.printStackTrace(); + e.printStackTrace(); } return true; } @@ -1123,10 +1193,11 @@ public class MapleClient { } public final byte getGReason() { - final Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT `greason` FROM `accounts` WHERE id = ?"); ps.setInt(1, accId); rs = ps.executeQuery(); @@ -1143,8 +1214,11 @@ public class MapleClient { if (rs != null) { rs.close(); } + if (con != null) { + con.close(); + } } catch (SQLException e) { - e.printStackTrace(); + e.printStackTrace(); } } return 0; @@ -1156,12 +1230,16 @@ public class MapleClient { public void setGender(byte m) { this.gender = m; + Connection con = null; try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET gender = ? WHERE id = ?")) { + con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET gender = ? WHERE id = ?")) { ps.setByte(1, gender); ps.setInt(2, accId); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/client/MapleFamily.java b/src/client/MapleFamily.java index f9953e5476..781cbcb87a 100644 --- a/src/client/MapleFamily.java +++ b/src/client/MapleFamily.java @@ -21,6 +21,7 @@ */ package client; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -38,7 +39,8 @@ public class MapleFamily { public MapleFamily(int cid) { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT familyid FROM family_character WHERE cid = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT familyid FROM family_character WHERE cid = ?"); ps.setInt(1, cid); ResultSet rs = ps.executeQuery(); if (rs.next()) { @@ -46,6 +48,7 @@ public class MapleFamily { } ps.close(); rs.close(); + con.close(); getMapleFamily(); } catch (SQLException ex) { ex.printStackTrace(); @@ -54,7 +57,8 @@ public class MapleFamily { private static void getMapleFamily() { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM family_character WHERE familyid = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM family_character WHERE familyid = ?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); while (rs.next()) { @@ -72,6 +76,7 @@ public class MapleFamily { } rs.close(); ps.close(); + con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } diff --git a/src/client/MapleRing.java b/src/client/MapleRing.java index ec180d51d0..12c4fbde2e 100644 --- a/src/client/MapleRing.java +++ b/src/client/MapleRing.java @@ -51,7 +51,7 @@ public class MapleRing implements Comparable { public static MapleRing loadFromDb(int ringId) { try { MapleRing ret = null; - Connection con = DatabaseConnection.getConnection(); // Get a connection to the database + Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM rings WHERE id = ?"); // Get ring details.. ps.setInt(1, ringId); ResultSet rs = ps.executeQuery(); @@ -60,6 +60,7 @@ public class MapleRing implements Comparable { } rs.close(); ps.close(); + con.close(); return ret; } catch (SQLException ex) { ex.printStackTrace(); @@ -102,6 +103,7 @@ public class MapleRing implements Comparable { ps.setInt(2, ringID[0]); ps.executeUpdate(); ps.close(); + con.close(); return ringID[0]; } catch (SQLException ex) { ex.printStackTrace(); diff --git a/src/client/MonsterBook.java b/src/client/MonsterBook.java index 7f091b2c86..3a53786194 100644 --- a/src/client/MonsterBook.java +++ b/src/client/MonsterBook.java @@ -91,7 +91,8 @@ public final class MonsterBook { } public void loadCards(final int charid) throws SQLException { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT cardid, level FROM monsterbook WHERE charid = ? ORDER BY cardid ASC")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT cardid, level FROM monsterbook WHERE charid = ? ORDER BY cardid ASC")) { ps.setInt(1, charid); try (ResultSet rs = ps.executeQuery()) { int cardid, level; @@ -107,6 +108,8 @@ public final class MonsterBook { } } } + + con.close(); calculateLevel(); } @@ -139,6 +142,7 @@ public final class MonsterBook { ps = con.prepareStatement(query.toString()); ps.execute(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/client/command/Commands.java b/src/client/command/Commands.java index 861f9b9644..5188b3f8a6 100644 --- a/src/client/command/Commands.java +++ b/src/client/command/Commands.java @@ -450,7 +450,8 @@ public class Commands { Pair data = listIterator.next(); output += "#b" + data.getRight() + "#k is dropped by:\r\n"; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM drop_data WHERE itemid = ? LIMIT 50"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM drop_data WHERE itemid = ? LIMIT 50"); ps.setInt(1, data.getLeft()); ResultSet rs = ps.executeQuery(); while(rs.next()) { @@ -461,6 +462,7 @@ public class Commands { } rs.close(); ps.close(); + con.close(); } catch (Exception e) { player.dropMessage("There was a problem retreiving the required data. Please try again."); e.printStackTrace(); @@ -641,13 +643,16 @@ public class Commands { case "ranks": PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().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"); + 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 { @@ -658,6 +663,9 @@ public class Commands { if(rs != null && !rs.isClosed()) { rs.close(); } + if(con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1774,6 +1782,8 @@ public class Commands { ps.executeUpdate(); ps.close(); } + + con.close(); } catch (SQLException ex) { ex.printStackTrace(); c.getPlayer().message("Error occured while banning IP address"); @@ -1819,6 +1829,8 @@ public class Commands { 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]); diff --git a/src/client/inventory/ItemFactory.java b/src/client/inventory/ItemFactory.java index 1d6201c68a..7b4461456f 100644 --- a/src/client/inventory/ItemFactory.java +++ b/src/client/inventory/ItemFactory.java @@ -61,6 +61,7 @@ public enum ItemFactory { PreparedStatement ps = null; ResultSet rs = null; + Connection con = DatabaseConnection.getConnection(); try { StringBuilder query = new StringBuilder(); query.append("SELECT * FROM `inventoryitems` LEFT JOIN `inventoryequipment` USING(`inventoryitemid`) WHERE `type` = ? AND `"); @@ -70,8 +71,7 @@ public enum ItemFactory { query.append(" AND `inventorytype` = ").append(MapleInventoryType.EQUIPPED.getType()); } - - ps = DatabaseConnection.getConnection().prepareStatement(query.toString()); + ps = con.prepareStatement(query.toString()); ps.setInt(1, value); ps.setInt(2, id); rs = ps.executeQuery(); @@ -120,13 +120,17 @@ public enum ItemFactory { rs.close(); ps.close(); + con.close(); } finally { - if (rs != null) { + if (rs != null && !rs.isClosed()) { rs.close(); } - if (ps != null) { + if (ps != null && !ps.isClosed()) { ps.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } return items; } diff --git a/src/client/inventory/MapleInventory.java b/src/client/inventory/MapleInventory.java index a5886d5567..94c8e1aa89 100644 --- a/src/client/inventory/MapleInventory.java +++ b/src/client/inventory/MapleInventory.java @@ -232,7 +232,7 @@ public class MapleInventory implements Iterable { public void addSlot(short slot, Item item) { inventory.put(slot, item); - if(MapleItemInformationProvider.getInstance().isRateCoupon(item.getItemId())) { + if(ItemConstants.isRateCoupon(item.getItemId())) { owner.updateCouponRates(); } } @@ -240,7 +240,7 @@ public class MapleInventory implements Iterable { public void removeSlot(short slot) { Item item = inventory.remove(slot); - if(item != null && MapleItemInformationProvider.getInstance().isRateCoupon(item.getItemId())) { + if(item != null && ItemConstants.isRateCoupon(item.getItemId())) { owner.updateCouponRates(); } } diff --git a/src/client/inventory/MaplePet.java b/src/client/inventory/MaplePet.java index 6ab8849fb6..c6bbf8c5dd 100644 --- a/src/client/inventory/MaplePet.java +++ b/src/client/inventory/MaplePet.java @@ -34,6 +34,7 @@ import server.movement.AbsoluteLifeMovement; import server.movement.LifeMovement; import server.movement.LifeMovementFragment; import client.MapleCharacter; +import java.sql.Connection; import tools.MaplePacketCreator; /** @@ -60,7 +61,8 @@ public class MaplePet extends Item { public static MaplePet loadFromDb(int itemid, short position, int petid) { try { MaplePet ret = new MaplePet(itemid, position, petid); - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT name, level, closeness, fullness, summoned FROM pets WHERE petid = ?"); // Get pet details.. + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT name, level, closeness, fullness, summoned FROM pets WHERE petid = ?"); // Get pet details.. ps.setInt(1, petid); ResultSet rs = ps.executeQuery(); rs.next(); @@ -71,6 +73,7 @@ public class MaplePet extends Item { ret.setSummoned(rs.getInt("summoned") == 1); rs.close(); ps.close(); + con.close(); return ret; } catch (SQLException e) { e.printStackTrace(); @@ -80,7 +83,8 @@ public class MaplePet extends Item { public void saveToDb() { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE pets SET name = ?, level = ?, closeness = ?, fullness = ?, summoned = ? WHERE petid = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("UPDATE pets SET name = ?, level = ?, closeness = ?, fullness = ?, summoned = ? WHERE petid = ?"); ps.setString(1, getName()); ps.setInt(2, getLevel()); ps.setInt(3, getCloseness()); @@ -89,6 +93,7 @@ public class MaplePet extends Item { ps.setInt(6, getUniqueId()); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -96,7 +101,8 @@ public class MaplePet extends Item { public static int createPet(int itemid) { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO pets (name, level, closeness, fullness, summoned) VALUES (?, 1, 0, 100, 0)", Statement.RETURN_GENERATED_KEYS); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("INSERT INTO pets (name, level, closeness, fullness, summoned) VALUES (?, 1, 0, 100, 0)", Statement.RETURN_GENERATED_KEYS); ps.setString(1, MapleItemInformationProvider.getInstance().getName(itemid)); ps.executeUpdate(); ResultSet rs = ps.getGeneratedKeys(); @@ -106,6 +112,7 @@ public class MaplePet extends Item { } rs.close(); ps.close(); + con.close(); return ret; } catch (SQLException e) { e.printStackTrace(); @@ -115,7 +122,8 @@ public class MaplePet extends Item { public static int createPet(int itemid, byte level, int closeness, int fullness) { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO pets (name, level, closeness, fullness, summoned) VALUES (?, ?, ?, ?, 0)", Statement.RETURN_GENERATED_KEYS); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("INSERT INTO pets (name, level, closeness, fullness, summoned) VALUES (?, ?, ?, ?, 0)", Statement.RETURN_GENERATED_KEYS); ps.setString(1, MapleItemInformationProvider.getInstance().getName(itemid)); ps.setByte(2, level); ps.setInt(3, closeness); @@ -125,9 +133,10 @@ public class MaplePet extends Item { int ret = -1; if (rs.next()) { ret = rs.getInt(1); - rs.close(); - ps.close(); } + rs.close(); + ps.close(); + con.close(); return ret; } catch (SQLException e) { e.printStackTrace(); diff --git a/src/constants/ItemConstants.java b/src/constants/ItemConstants.java index e921af981f..11cbff3ade 100644 --- a/src/constants/ItemConstants.java +++ b/src/constants/ItemConstants.java @@ -26,6 +26,7 @@ import client.inventory.MapleInventoryType; /** * * @author Jay Estrella + * @author Ronan */ public final class ItemConstants { public final static int LOCK = 0x01; @@ -89,6 +90,45 @@ public final class ItemConstants { public static boolean isPet(int itemId) { return itemId / 1000 == 5000; } + + public static boolean isTownScroll(int itemId) { + return itemId >= 2030000 && itemId < 2030021; + } + + public static boolean isAntibanishScroll(int itemId) { + return itemId == 2030100; + } + + public static boolean isCleanSlate(int scrollId) { + return scrollId > 2048999 && scrollId < 2049004; + } + + public static boolean isFlagModifier(int scrollId, byte flag) { + if(scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) return true; + if(scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES)) return true; + return false; + } + + public static boolean isChaosScroll(int scrollId) { + return scrollId >= 2049100 && scrollId <= 2049103; + } + + public static boolean isRateCoupon(int itemId) { + int itemType = itemId / 1000; + return itemType == 5211 || itemType == 5360; + } + + public static boolean isExpCoupon(int couponId) { + return couponId / 1000 == 5211; + } + + public static boolean isPartyItem(int itemId) { + return itemId >= 2022430 && itemId <= 2022433; + } + + public static boolean isPartyAllcure(int itemId) { + return itemId == 2022433; + } public static MapleInventoryType getInventoryType(final int itemId) { final byte type = (byte) (itemId / 1000000); diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index b91159e8d9..3090bc5b4e 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -4,6 +4,11 @@ import java.io.FileInputStream; import java.util.Properties; public class ServerConstants { + //Database Configuration + public static String DB_URL = ""; + public static String DB_USER = ""; + public static String DB_PASS = ""; + public static final short DB_EXPERIMENTAL_POOLS = 4; //[EXPERIMENTAL] Installs a set number of database drivers/pools to hub connections. Set 0 to default. //World And Version public static short VERSION = 83; @@ -21,11 +26,6 @@ public class ServerConstants { //Ip Configuration public static String HOST; - //Database Configuration - public static String DB_URL = ""; - public static String DB_USER = ""; - public static String DB_PASS = ""; - //Other Configuration public static boolean JAVA_8; public static boolean SHUTDOWNHOOK; @@ -59,7 +59,7 @@ public class ServerConstants { //Dangling Items Configuration public static final int ITEM_EXPIRE_TIME = 3 * 60 * 1000; //Time before items start disappearing. Recommended to be set up to 3 minutes. public static final int ITEM_MONITOR_TIME = 5 * 60 * 1000; //Interval between item monitoring task on maps, which checks for dangling item objects on the map item history. - public static final int ITEM_LIMIT_ON_MAP = 777; //Max number of items allowed on a map. + public static final int ITEM_LIMIT_ON_MAP = 250; //Max number of items allowed on a map. //Some Gameplay Enhancing Configuration public static final boolean USE_PERFECT_SCROLLING = true; //Scrolls doesn't use slots upon failure. diff --git a/src/net/server/RankingWorker.java b/src/net/server/RankingWorker.java index 5f01b25274..586d4877bc 100644 --- a/src/net/server/RankingWorker.java +++ b/src/net/server/RankingWorker.java @@ -99,12 +99,14 @@ public class RankingWorker implements Runnable { con.setAutoCommit(true); lastUpdate = System.currentTimeMillis(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); try { con.rollback(); con.setAutoCommit(true); + if(!con.isClosed()) con.close(); } catch (SQLException ex2) { ex2.printStackTrace(); } diff --git a/src/net/server/Server.java b/src/net/server/Server.java index 64c6769b3a..15829bee70 100644 --- a/src/net/server/Server.java +++ b/src/net/server/Server.java @@ -55,13 +55,13 @@ import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import server.CashShop.CashItemFactory; -import server.MapleItemInformationProvider; import server.TimerManager; import tools.DatabaseConnection; import tools.FilePrinter; import tools.Pair; import client.MapleCharacter; import client.SkillFactory; +import constants.ItemConstants; import constants.ServerConstants; import java.util.Calendar; import server.quest.MapleQuest; @@ -173,7 +173,7 @@ public class Server implements Runnable { } public void toggleCoupon(Integer couponId) { - if(MapleItemInformationProvider.getInstance().isRateCoupon(couponId)) { + if(ItemConstants.isRateCoupon(couponId)) { synchronized(activeCoupons) { if(activeCoupons.contains(couponId)) { activeCoupons.remove(couponId); @@ -219,8 +219,9 @@ public class Server implements Runnable { ex.printStackTrace(); try { - if(con != null && !con.isClosed()) + if(con != null && !con.isClosed()) { con.close(); + } } catch (SQLException ex2) { ex2.printStackTrace(); } @@ -245,9 +246,9 @@ public class Server implements Runnable { if(ServerConstants.SHUTDOWNHOOK) Runtime.getRuntime().addShutdownHook(new Thread(shutdown(false))); - //DatabaseConnection.getConnection(); - Connection c = DatabaseConnection.getConnection(); + Connection c = null; try { + c = DatabaseConnection.getConnection(); PreparedStatement ps = c.prepareStatement("UPDATE accounts SET loggedin = 0"); ps.executeUpdate(); ps.close(); @@ -257,6 +258,8 @@ public class Server implements Runnable { loadCouponRates(c); updateActiveCoupons(); + + c.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } diff --git a/src/net/server/channel/handlers/BBSOperationHandler.java b/src/net/server/channel/handlers/BBSOperationHandler.java index 18616899f3..9e11ac86f4 100644 --- a/src/net/server/channel/handlers/BBSOperationHandler.java +++ b/src/net/server/channel/handlers/BBSOperationHandler.java @@ -97,12 +97,15 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { private static void listBBSThreads(MapleClient c, int start) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM bbs_threads WHERE guildid = ? ORDER BY localthreadid DESC")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT * FROM bbs_threads WHERE guildid = ? ORDER BY localthreadid DESC")) { ps.setInt(1, c.getPlayer().getGuildId()); try (ResultSet rs = ps.executeQuery()) { c.announce(MaplePacketCreator.BBSThreadList(rs, start)); } } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } @@ -112,8 +115,9 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { if (c.getPlayer().getGuildId() <= 0) { return; } - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT threadid FROM bbs_threads WHERE guildid = ? AND localthreadid = ?"); ps.setInt(1, c.getPlayer().getGuildId()); ps.setInt(2, localthreadid); @@ -137,6 +141,7 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { ps.setInt(1, threadid); ps.execute(); ps.close(); + con.close(); displayThread(c, localthreadid); } catch (SQLException se) { se.printStackTrace(); @@ -149,7 +154,8 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { return; } try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE bbs_threads SET `name` = ?, `timestamp` = ?, " + "`icon` = ?, " + "`startpost` = ? WHERE guildid = ? AND localthreadid = ? AND (postercid = ? OR ?)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE bbs_threads SET `name` = ?, `timestamp` = ?, " + "`icon` = ?, " + "`startpost` = ? WHERE guildid = ? AND localthreadid = ? AND (postercid = ? OR ?)")) { ps.setString(1, title); ps.setLong(2, System.currentTimeMillis()); ps.setInt(3, icon); @@ -160,6 +166,7 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { ps.setBoolean(8, c.getGuildRank() < 3); ps.execute(); } + con.close(); displayThread(client, localthreadid); } catch (SQLException se) { se.printStackTrace(); @@ -194,6 +201,7 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { ps.setInt(7, nextId); ps.execute(); ps.close(); + con.close(); displayThread(client, nextId); } catch (SQLException se) { se.printStackTrace(); @@ -206,8 +214,9 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { if (mc.getGuildId() <= 0) { return; } - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT threadid, postercid FROM bbs_threads WHERE guildid = ? AND localthreadid = ?"); ps.setInt(1, mc.getGuildId()); ps.setInt(2, localthreadid); @@ -233,6 +242,7 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { ps.execute(); threadRS.close(); ps.close(); + con.close(); } catch (SQLException se) { se.printStackTrace(); } @@ -244,8 +254,9 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { return; } int threadid; - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT postercid, threadid FROM bbs_replies WHERE replyid = ?"); ps.setInt(1, replyid); ResultSet rs = ps.executeQuery(); @@ -270,6 +281,7 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { ps.setInt(1, threadid); ps.execute(); ps.close(); + con.close(); displayThread(client, threadid, false); } catch (SQLException se) { se.printStackTrace(); @@ -285,8 +297,9 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { if (mc.getGuildId() <= 0) { return; } - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps2; try (PreparedStatement ps = con.prepareStatement("SELECT * FROM bbs_threads WHERE guildid = ? AND " + (bIsThreadIdLocal ? "local" : "") + "threadid = ?")) { ps.setInt(1, mc.getGuildId()); @@ -310,6 +323,8 @@ public final class BBSOperationHandler extends AbstractMaplePacketHandler { if (ps2 != null) { ps2.close(); } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } catch (RuntimeException re) {//btw we get this everytime for some reason, but replies work! diff --git a/src/net/server/channel/handlers/BuddylistModifyHandler.java b/src/net/server/channel/handlers/BuddylistModifyHandler.java index be781a0510..f7f1d6aedd 100644 --- a/src/net/server/channel/handlers/BuddylistModifyHandler.java +++ b/src/net/server/channel/handlers/BuddylistModifyHandler.java @@ -72,6 +72,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler { } } } + con.close(); return ret; } @@ -129,6 +130,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } if (buddyAddResult == BuddyAddResult.BUDDYLIST_FULL) { c.announce(MaplePacketCreator.serverNotice(1, "\"" + addName + "\"'s Buddylist is full")); @@ -146,6 +148,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler { ps.setInt(2, player.getId()); ps.executeUpdate(); } + con.close(); } buddylist.put(new BuddylistEntry(charWithId.getName(), group, otherCid, displayChannel, true)); c.announce(MaplePacketCreator.updateBuddylist(buddylist.getBuddies())); @@ -177,6 +180,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler { } } } + con.close(); } else { otherName = otherChar.getName(); } diff --git a/src/net/server/channel/handlers/CouponCodeHandler.java b/src/net/server/channel/handlers/CouponCodeHandler.java index b4d6df509e..55bd9cbb0f 100644 --- a/src/net/server/channel/handlers/CouponCodeHandler.java +++ b/src/net/server/channel/handlers/CouponCodeHandler.java @@ -58,6 +58,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler { ps.setString(2, code); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -90,7 +91,8 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler { private int getNXCode(String code, String type) { int item = -1; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `" + type + "` FROM nxcode WHERE code = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT `" + type + "` FROM nxcode WHERE code = ?"); ps.setString(1, code); ResultSet rs = ps.executeQuery(); while (rs.next()) { @@ -98,6 +100,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } @@ -106,7 +109,8 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler { private boolean getNXCodeValid(String code, boolean validcode) { try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `valid` FROM nxcode WHERE code = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT `valid` FROM nxcode WHERE code = ?"); ps.setString(1, code); ResultSet rs = ps.executeQuery(); while (rs.next()) { @@ -114,6 +118,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/net/server/channel/handlers/DueyHandler.java b/src/net/server/channel/handlers/DueyHandler.java index bc08736817..ee29cdc5e8 100644 --- a/src/net/server/channel/handlers/DueyHandler.java +++ b/src/net/server/channel/handlers/DueyHandler.java @@ -78,7 +78,8 @@ public final class DueyHandler extends AbstractMaplePacketHandler { if (accountid) { text = "SELECT id,accountid FROM characters WHERE name = ?"; } - ps = DatabaseConnection.getConnection().prepareStatement(text); + Connection con = DatabaseConnection.getConnection(); + ps = con.prepareStatement(text); ps.setString(1, name); int id_; try (ResultSet rs = ps.executeQuery()) { @@ -90,6 +91,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler { id_ = accountid ? rs.getInt("accountid") : rs.getInt("id"); } ps.close(); + con.close(); return id_; } catch (SQLException e) { e.printStackTrace(); @@ -177,8 +179,9 @@ public final class DueyHandler extends AbstractMaplePacketHandler { int packageid = slea.readInt(); List packages = new LinkedList<>(); DueyPackages dp = null; - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); DueyPackages dueypack; try (PreparedStatement ps = con.prepareStatement("SELECT * FROM dueypackages LEFT JOIN dueyitems USING (PackageId) WHERE PackageId = ?")) { ps.setInt(1, packageid); @@ -223,6 +226,8 @@ public final class DueyHandler extends AbstractMaplePacketHandler { removeItemFromDB(packageid); c.announce(MaplePacketCreator.removeItemFromDuey(false, packageid)); + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -234,8 +239,9 @@ public final class DueyHandler extends AbstractMaplePacketHandler { } private void addItemToDB(Item item, int quantity, int mesos, String sName, int recipientID) { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); try (PreparedStatement ps = con.prepareStatement("INSERT INTO dueypackages (RecieverId, SenderName, Mesos, TimeStamp, Checked, Type) VALUES (?, ?, ?, ?, ?, ?)")) { ps.setInt(1, recipientID); ps.setString(2, sName); @@ -287,6 +293,8 @@ public final class DueyHandler extends AbstractMaplePacketHandler { } } } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -294,8 +302,9 @@ public final class DueyHandler extends AbstractMaplePacketHandler { public static List loadItems(MapleCharacter chr) { List packages = new LinkedList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); try (PreparedStatement ps = con.prepareStatement("SELECT * FROM dueypackages dp LEFT JOIN dueyitems di ON dp.PackageId=di.PackageId WHERE RecieverId = ?")) { ps.setInt(1, chr.getId()); try (ResultSet rs = ps.executeQuery()) { @@ -309,6 +318,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler { } } + con.close(); return packages; } catch (SQLException e) { e.printStackTrace(); @@ -346,8 +356,10 @@ public final class DueyHandler extends AbstractMaplePacketHandler { } private void removeItemFromDB(int packageid) { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("DELETE FROM dueypackages WHERE PackageId = ?"); ps.setInt(1, packageid); ps.executeUpdate(); @@ -356,6 +368,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler { ps.setInt(1, packageid); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/net/server/channel/handlers/EnterMTSHandler.java b/src/net/server/channel/handlers/EnterMTSHandler.java index 6cda6936c1..d932bc4b50 100644 --- a/src/net/server/channel/handlers/EnterMTSHandler.java +++ b/src/net/server/channel/handlers/EnterMTSHandler.java @@ -75,7 +75,8 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { List items = new ArrayList<>(); int pages = 0; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM mts_items WHERE tab = 1 AND transfer = 0 ORDER BY id DESC LIMIT 16, 16"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = 1 AND transfer = 0 ORDER BY id DESC LIMIT 16, 16"); ResultSet rs = ps.executeQuery(); while (rs.next()) { if (rs.getInt("type") != 1) { @@ -110,13 +111,15 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); - ps = DatabaseConnection.getConnection().prepareStatement("SELECT COUNT(*) FROM mts_items"); + + ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items"); rs = ps.executeQuery(); if (rs.next()) { pages = (int) Math.ceil(rs.getInt(1) / 16); } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -128,7 +131,8 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { private List getNotYetSold(int cid) { List items = new ArrayList<>(); try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM mts_items WHERE seller = ? AND transfer = 0 ORDER BY id DESC")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT * FROM mts_items WHERE seller = ? AND transfer = 0 ORDER BY id DESC")) { ps.setInt(1, cid); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { @@ -164,6 +168,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { } } } + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -210,6 +215,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { } } } + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/net/server/channel/handlers/FredrickHandler.java b/src/net/server/channel/handlers/FredrickHandler.java index c724486556..b1a931f1b3 100644 --- a/src/net/server/channel/handlers/FredrickHandler.java +++ b/src/net/server/channel/handlers/FredrickHandler.java @@ -113,6 +113,7 @@ public class FredrickHandler extends AbstractMaplePacketHandler { ps.setInt(2, chr.getId()); ps.execute(); } + con.close(); return true; } catch (SQLException e) { e.printStackTrace(); diff --git a/src/net/server/channel/handlers/MTSHandler.java b/src/net/server/channel/handlers/MTSHandler.java index 1de09d91bf..d55fff8405 100644 --- a/src/net/server/channel/handlers/MTSHandler.java +++ b/src/net/server/channel/handlers/MTSHandler.java @@ -101,8 +101,10 @@ public final class MTSHandler extends AbstractMaplePacketHandler { MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(itemid); Item i = c.getPlayer().getInventory(type).getItem(slot).copy(); if (i != null && c.getPlayer().getMeso() >= 5000) { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items WHERE seller = ?"); ps.setInt(1, c.getPlayer().getId()); ResultSet rs = ps.executeQuery(); @@ -201,6 +203,8 @@ public final class MTSHandler extends AbstractMaplePacketHandler { ps.executeUpdate(); ps.close(); MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false); + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -254,8 +258,9 @@ public final class MTSHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.notYetSoldInv(getNotYetSold(c.getPlayer().getId()))); } else if (op == 7) { //cancel sale int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE mts_items SET transfer = 1 WHERE id = ? AND seller = ?"); ps.setInt(1, id); ps.setInt(2, c.getPlayer().getId()); @@ -265,6 +270,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { ps.setInt(1, id); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -274,10 +280,11 @@ public final class MTSHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.transferInventory(getTransfer(c.getPlayer().getId()))); } else if (op == 8) { //transfer item from transfer inv. int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_items WHERE seller = ? AND transfer = 1 AND id= ? ORDER BY id DESC"); ps.setInt(1, c.getPlayer().getId()); ps.setInt(2, id); @@ -329,14 +336,16 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); System.out.println("MTS Transfer error: " + e); } } else if (op == 9) { //add to cart int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); try (PreparedStatement ps1 = con.prepareStatement("SELECT * FROM mts_items WHERE id = ? AND seller <> ?")) { ps1.setInt(1, id);//Previene que agregues al cart tus propios items ps1.setInt(2, c.getPlayer().getId()); @@ -357,6 +366,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } } } + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -367,13 +377,15 @@ public final class MTSHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.notYetSoldInv(getNotYetSold(c.getPlayer().getId()))); } else if (op == 10) { //delete from cart int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); try (PreparedStatement ps = con.prepareStatement("DELETE FROM mts_cart WHERE itemid = ? AND cid = ?")) { ps.setInt(1, id); ps.setInt(2, c.getPlayer().getId()); ps.executeUpdate(); } + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -386,10 +398,11 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } else if (op == 14) { //buy auction item now } else if (op == 16) { //buy int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_items WHERE id = ? ORDER BY id DESC"); ps.setInt(1, id); rs = ps.executeQuery(); @@ -442,16 +455,18 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); c.announce(MaplePacketCreator.MTSFailBuy()); } } else if (op == 17) { //buy from cart int id = slea.readInt(); //id of the item - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_items WHERE id = ? ORDER BY id DESC"); ps.setInt(1, id); rs = ps.executeQuery(); @@ -500,6 +515,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); c.announce(MaplePacketCreator.MTSFailBuy()); @@ -514,10 +530,11 @@ public final class MTSHandler extends AbstractMaplePacketHandler { public List getNotYetSold(int cid) { List items = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_items WHERE seller = ? AND transfer = 0 ORDER BY id DESC"); ps.setInt(1, cid); rs = ps.executeQuery(); @@ -554,6 +571,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -562,11 +580,12 @@ public final class MTSHandler extends AbstractMaplePacketHandler { public byte[] getCart(int cid) { List items = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; int pages = 0; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_cart WHERE cid = ? ORDER BY id DESC"); ps.setInt(1, cid); rs = ps.executeQuery(); @@ -620,6 +639,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -628,10 +648,11 @@ public final class MTSHandler extends AbstractMaplePacketHandler { public List getTransfer(int cid) { List items = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM mts_items WHERE transfer = 1 AND seller = ? ORDER BY id DESC"); ps.setInt(1, cid); rs = ps.executeQuery(); @@ -668,6 +689,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -676,11 +698,12 @@ public final class MTSHandler extends AbstractMaplePacketHandler { private static byte[] getMTS(int tab, int type, int page) { List items = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; int pages = 0; try { + con = DatabaseConnection.getConnection(); if (type != 0) { ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = ? AND type = ? AND transfer = 0 ORDER BY id DESC LIMIT ?, 16"); } else { @@ -741,6 +764,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -768,11 +792,12 @@ public final class MTSHandler extends AbstractMaplePacketHandler { } else { listaitems = " AND sellername LIKE CONCAT('%','" + search + "', '%')"; } - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps; ResultSet rs; int pages = 0; try { + con = DatabaseConnection.getConnection(); if (type != 0) { ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = ? " + listaitems + " AND type = ? AND transfer = 0 ORDER BY id DESC LIMIT ?, 16"); } else { @@ -835,6 +860,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler { rs.close(); ps.close(); } + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/net/server/channel/handlers/NoteActionHandler.java b/src/net/server/channel/handlers/NoteActionHandler.java index a5d4f45111..acb8e9ae9b 100644 --- a/src/net/server/channel/handlers/NoteActionHandler.java +++ b/src/net/server/channel/handlers/NoteActionHandler.java @@ -30,6 +30,7 @@ import tools.DatabaseConnection; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; import client.MapleClient; +import java.sql.Connection; public final class NoteActionHandler extends AbstractMaplePacketHandler { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { @@ -56,17 +57,19 @@ public final class NoteActionHandler extends AbstractMaplePacketHandler { slea.readByte(); //Fame, but we read it from the database :) PreparedStatement ps; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT `fame` FROM notes WHERE id=? AND deleted=0"); + Connection con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT `fame` FROM notes WHERE id=? AND deleted=0"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if (rs.next()) fame += rs.getInt("fame"); rs.close(); - ps = DatabaseConnection.getConnection().prepareStatement("UPDATE notes SET `deleted` = 1 WHERE id = ?"); + ps = con.prepareStatement("UPDATE notes SET `deleted` = 1 WHERE id = ?"); ps.setInt(1, id); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/net/server/channel/handlers/PlayerLoggedinHandler.java b/src/net/server/channel/handlers/PlayerLoggedinHandler.java index f798211bfe..6ddefbba5c 100644 --- a/src/net/server/channel/handlers/PlayerLoggedinHandler.java +++ b/src/net/server/channel/handlers/PlayerLoggedinHandler.java @@ -113,20 +113,23 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { if (buffs != null) { player.silentGiveBuffs(buffs); } - Connection con = DatabaseConnection.getConnection(); + Connection con = null; PreparedStatement ps = null; PreparedStatement pss = null; ResultSet rs = null; try { + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT Mesos FROM dueypackages WHERE RecieverId = ? and Checked = 1"); ps.setInt(1, player.getId()); rs = ps.executeQuery(); if (rs.next()) { try { - pss = DatabaseConnection.getConnection().prepareStatement("UPDATE dueypackages SET Checked = 0 where RecieverId = ?"); + Connection con2 = DatabaseConnection.getConnection(); + pss = con2.prepareStatement("UPDATE dueypackages SET Checked = 0 where RecieverId = ?"); pss.setInt(1, player.getId()); pss.executeUpdate(); pss.close(); + con2.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -145,6 +148,9 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { if (ps != null) { ps.close(); } + if (con != null) { + con.close(); + } } catch (SQLException ex) { //ignore ex.printStackTrace(); diff --git a/src/net/server/channel/handlers/ReportHandler.java b/src/net/server/channel/handlers/ReportHandler.java index fca504e1b3..f45bc24e3f 100644 --- a/src/net/server/channel/handlers/ReportHandler.java +++ b/src/net/server/channel/handlers/ReportHandler.java @@ -84,8 +84,9 @@ public final class ReportHandler extends AbstractMaplePacketHandler { public void addReport(int reporterid, int victimid, int reason, String description, String chatlog) { Calendar calendar = Calendar.getInstance(); Timestamp currentTimestamp = new java.sql.Timestamp(calendar.getTime().getTime()); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO reports (`reporttime`, `reporterid`, `victimid`, `reason`, `chatlog`, `description`) VALUES (?, ?, ?, ?, ?, ?)"); ps.setString(1, currentTimestamp.toGMTString().toString()); ps.setInt(2, reporterid); @@ -96,6 +97,7 @@ public final class ReportHandler extends AbstractMaplePacketHandler { ps.addBatch(); ps.executeBatch(); ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/net/server/channel/handlers/RingActionHandler.java b/src/net/server/channel/handlers/RingActionHandler.java index e3f88e393a..b9ee5d093d 100644 --- a/src/net/server/channel/handlers/RingActionHandler.java +++ b/src/net/server/channel/handlers/RingActionHandler.java @@ -83,6 +83,7 @@ public final class RingActionHandler extends AbstractMaplePacketHandler { ps.setInt(2, player.getPartner().getId()); ps.executeUpdate(); ps.close(); + con.close(); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/src/net/server/channel/handlers/ScrollHandler.java b/src/net/server/channel/handlers/ScrollHandler.java index 8549b33440..3c21aa62a3 100644 --- a/src/net/server/channel/handlers/ScrollHandler.java +++ b/src/net/server/channel/handlers/ScrollHandler.java @@ -69,7 +69,7 @@ public final class ScrollHandler extends AbstractMaplePacketHandler { Item scroll = useInventory.getItem(slot); Item wscroll = null; - if (((Equip) toScroll).getUpgradeSlots() < 1 && !isCleanSlate(scroll.getItemId())) { + if (((Equip) toScroll).getUpgradeSlots() < 1 && !ItemConstants.isCleanSlate(scroll.getItemId())) { c.announce(MaplePacketCreator.getInventoryFull()); return; } @@ -85,24 +85,24 @@ public final class ScrollHandler extends AbstractMaplePacketHandler { } } - if (!isChaosScroll(scroll.getItemId()) && !isCleanSlate(scroll.getItemId())) { + if (!ItemConstants.isChaosScroll(scroll.getItemId()) && !ItemConstants.isCleanSlate(scroll.getItemId())) { if (!canScroll(scroll.getItemId(), toScroll.getItemId())) { return; } } - if (isCleanSlate(scroll.getItemId()) && !(toScroll.getLevel() + toScroll.getUpgradeSlots() < ii.getEquipStats(toScroll.getItemId()).get("tuc"))) { //upgrade slots can be over because of hammers + if (ItemConstants.isCleanSlate(scroll.getItemId()) && !(toScroll.getLevel() + toScroll.getUpgradeSlots() < ii.getEquipStats(toScroll.getItemId()).get("tuc"))) { //upgrade slots can be over because of hammers return; } Equip scrolled = (Equip) ii.scrollEquipWithId(toScroll, scroll.getItemId(), whiteScroll, c.getPlayer().isGM()); ScrollResult scrollSuccess = Equip.ScrollResult.FAIL; // fail if (scrolled == null) { scrollSuccess = Equip.ScrollResult.CURSE; - } else if (scrolled.getLevel() > oldLevel || (isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() == oldSlots + 1) || isFlagModifier(scroll.getItemId(), scrolled.getFlag())) { + } else if (scrolled.getLevel() > oldLevel || (ItemConstants.isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() == oldSlots + 1) || ItemConstants.isFlagModifier(scroll.getItemId(), scrolled.getFlag())) { scrollSuccess = Equip.ScrollResult.SUCCESS; } MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, scroll.getPosition(), (short) 1, false); - if (whiteScroll && !isCleanSlate(scroll.getItemId())) { + if (whiteScroll && !ItemConstants.isCleanSlate(scroll.getItemId())) { MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, wscroll.getPosition(), (short) 1, false, false); } final List mods = new ArrayList<>(); @@ -124,20 +124,6 @@ public final class ScrollHandler extends AbstractMaplePacketHandler { } } - private boolean isFlagModifier(int scrollId, byte flag) { - if(scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) return true; - if(scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES)) return true; - return false; - } - - private boolean isCleanSlate(int scrollId) { - return scrollId > 2048999 && scrollId < 2049004; - } - - private boolean isChaosScroll(int scrollId) { - return scrollId >= 2049100 && scrollId <= 2049103; - } - public boolean canScroll(int scrollid, int itemid) { int sid = scrollid / 100; diff --git a/src/net/server/channel/handlers/SpawnPetHandler.java b/src/net/server/channel/handlers/SpawnPetHandler.java index 27590c28b4..c352d974b4 100644 --- a/src/net/server/channel/handlers/SpawnPetHandler.java +++ b/src/net/server/channel/handlers/SpawnPetHandler.java @@ -30,6 +30,7 @@ import client.inventory.MapleInventoryType; import client.inventory.MaplePet; import client.inventory.PetDataFactory; import client.SkillFactory; +import java.sql.Connection; import java.sql.SQLException; import tools.DatabaseConnection; import net.AbstractMaplePacketHandler; @@ -66,10 +67,12 @@ public final class SpawnPetHandler extends AbstractMaplePacketHandler { return; } try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("DELETE FROM pets WHERE `petid` = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE `petid` = ?"); ps.setInt(1, pet.getUniqueId()); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/net/server/channel/handlers/UseItemHandler.java b/src/net/server/channel/handlers/UseItemHandler.java index e7121371a0..188db87b10 100644 --- a/src/net/server/channel/handlers/UseItemHandler.java +++ b/src/net/server/channel/handlers/UseItemHandler.java @@ -25,6 +25,7 @@ import client.MapleClient; import client.MapleDisease; import client.inventory.Item; import client.inventory.MapleInventoryType; +import constants.ItemConstants; import net.AbstractMaplePacketHandler; import server.MapleInventoryManipulator; import server.MapleItemInformationProvider; @@ -66,13 +67,13 @@ public final class UseItemHandler extends AbstractMaplePacketHandler { remove(c, slot); return; } - else if (isTownScroll(itemId)) { + else if (ItemConstants.isTownScroll(itemId)) { if (ii.getItemEffect(toUse.getItemId()).applyTo(c.getPlayer())) { remove(c, slot); } return; } - else if (isAntibanishScroll(itemId)) { + else if (ItemConstants.isAntibanishScroll(itemId)) { if (ii.getItemEffect(toUse.getItemId()).applyTo(c.getPlayer())) { remove(c, slot); } else { @@ -92,12 +93,4 @@ public final class UseItemHandler extends AbstractMaplePacketHandler { MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false); c.announce(MaplePacketCreator.enableActions()); } - - private static boolean isTownScroll(int itemId) { - return itemId >= 2030000 && itemId < 2030021; - } - - private static boolean isAntibanishScroll(int itemId) { - return itemId == 2030100; - } } diff --git a/src/net/server/channel/handlers/WhisperHandler.java b/src/net/server/channel/handlers/WhisperHandler.java index bd6cc1f592..62dbaaa0ee 100644 --- a/src/net/server/channel/handlers/WhisperHandler.java +++ b/src/net/server/channel/handlers/WhisperHandler.java @@ -35,6 +35,7 @@ import tools.data.input.SeekableLittleEndianAccessor; import client.MapleCharacter; import client.MapleClient; import client.autoban.AutobanFactory; +import java.sql.Connection; /** * @@ -93,7 +94,8 @@ public final class WhisperHandler extends AbstractMaplePacketHandler { } } else { // not found try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT gm FROM characters WHERE name = ?"); + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT gm FROM characters WHERE name = ?"); ps.setString(1, recipient); ResultSet rs = ps.executeQuery(); if (rs.next()) { @@ -104,6 +106,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler { } rs.close(); ps.close(); + con.close(); byte channel = (byte) (c.getWorldServer().find(recipient) - 1); if (channel > -1) { c.announce(MaplePacketCreator.getFindReply(recipient, channel, 3)); diff --git a/src/net/server/guild/MapleAlliance.java b/src/net/server/guild/MapleAlliance.java index 0128d25c29..2a806bd517 100644 --- a/src/net/server/guild/MapleAlliance.java +++ b/src/net/server/guild/MapleAlliance.java @@ -64,7 +64,8 @@ public class MapleAlliance { } try { ResultSet rs; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT name FROM alliance WHERE name = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT name FROM alliance WHERE name = ?")) { ps.setString(1, name); rs = ps.executeQuery(); if (rs.next()) { @@ -74,6 +75,7 @@ public class MapleAlliance { } } rs.close(); + con.close(); return true; } catch (SQLException e) { e.printStackTrace(); @@ -166,7 +168,6 @@ public class MapleAlliance { ps.close(); con.close(); - } catch (SQLException e) { e.printStackTrace(); return null; @@ -217,7 +218,6 @@ public class MapleAlliance { ps.close(); rs.close(); - con.close(); } catch (SQLException e) { e.printStackTrace(); diff --git a/src/net/server/guild/MapleGuild.java b/src/net/server/guild/MapleGuild.java index 0caf005bd5..cc729cb849 100644 --- a/src/net/server/guild/MapleGuild.java +++ b/src/net/server/guild/MapleGuild.java @@ -58,8 +58,9 @@ public class MapleGuild { public MapleGuild(int guildid, int world) { this.world = world; members = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM guilds WHERE guildid = " + guildid); ResultSet rs = ps.executeQuery(); if (!rs.first()) { @@ -99,6 +100,7 @@ public class MapleGuild { ps.close(); rs.close(); + con.close(); } catch (SQLException se) { se.printStackTrace(); System.out.println("Unable to read guild information from sql" + se); @@ -169,6 +171,8 @@ public class MapleGuild { ps.close(); this.broadcast(MaplePacketCreator.guildDisband(this.id)); } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } @@ -413,13 +417,16 @@ public class MapleGuild { Server.getInstance().getWorld(mgc.getWorld()).setGuildAndRank(cid, 0, 5); } else { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`) VALUES (?, ?, ?, ?)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("INSERT INTO notes (`to`, `from`, `message`, `timestamp`) VALUES (?, ?, ?, ?)")) { ps.setString(1, mgc.getName()); ps.setString(2, initiator.getName()); ps.setString(3, "You have been expelled from the guild."); ps.setLong(4, System.currentTimeMillis()); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); System.out.println("expelMember - MapleGuild " + e); @@ -572,11 +579,13 @@ public class MapleGuild { public static void displayGuildRanks(MapleClient c, int npcid) { try { ResultSet rs; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT `name`, `GP`, `logoBG`, `logoBGColor`, `logo`, `logoColor` FROM guilds WHERE NOT `guildid` = '1' ORDER BY `GP` DESC LIMIT 50")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT `name`, `GP`, `logoBG`, `logoBGColor`, `logo`, `logoColor` FROM guilds WHERE NOT `guildid` = '1' ORDER BY `GP` DESC LIMIT 50")) { rs = ps.executeQuery(); c.announce(MaplePacketCreator.showGuildRanks(npcid, rs)); } rs.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); System.out.println("failed to display guild ranks. " + e); @@ -590,11 +599,14 @@ public class MapleGuild { public void setAllianceId(int aid) { this.allianceId = aid; try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE guilds SET allianceId = ? WHERE guildid = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE guilds SET allianceId = ? WHERE guildid = ?")) { ps.setInt(1, aid); ps.setInt(2, id); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } @@ -608,11 +620,14 @@ public class MapleGuild { } } - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET allianceRank = ? WHERE guildid = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET allianceRank = ? WHERE guildid = ?")) { ps.setInt(1, 5); ps.setInt(2, id); ps.executeUpdate(); } + + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/net/server/handlers/login/ViewCharHandler.java b/src/net/server/handlers/login/ViewCharHandler.java index 62979fce5e..99ccfbf475 100644 --- a/src/net/server/handlers/login/ViewCharHandler.java +++ b/src/net/server/handlers/login/ViewCharHandler.java @@ -23,6 +23,7 @@ package net.server.handlers.login; import client.MapleCharacter; import client.MapleClient; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; @@ -40,7 +41,9 @@ public final class ViewCharHandler extends AbstractMaplePacketHandler { short charsNum; List worlds; List chars; - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT world, id FROM characters WHERE accountid = ?")) { + + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT world, id FROM characters WHERE accountid = ?")) { ps.setInt(1, c.getAccID()); charsNum = 0; worlds = new ArrayList<>(); @@ -75,6 +78,8 @@ public final class ViewCharHandler extends AbstractMaplePacketHandler { } c.announce(MaplePacketCreator.showAllCharacterInfo(w, chrsinworld)); } + + con.close(); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/net/server/world/World.java b/src/net/server/world/World.java index 812f63b028..81e7fef757 100644 --- a/src/net/server/world/World.java +++ b/src/net/server/world/World.java @@ -28,6 +28,7 @@ import client.BuddylistEntry; import client.MapleCharacter; import client.MapleFamily; import constants.ServerConstants; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -252,12 +253,15 @@ public class World { public void setOfflineGuildStatus(int guildid, int guildrank, int cid) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET guildid = ?, guildrank = ? WHERE id = ?")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET guildid = ?, guildrank = ? WHERE id = ?")) { ps.setInt(1, guildid); ps.setInt(2, guildrank); ps.setInt(3, cid); ps.execute(); } + + con.close(); } catch (SQLException se) { se.printStackTrace(); } diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index a0baf3143e..19cd7c2415 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -416,29 +416,31 @@ public class AbstractPlayerInteraction { Item item = null; MaplePet evolved = null; int petId = -1; - if (id >= 5000000 && id <= 5000100) { - petId = MaplePet.createPet(id); - - if(from != null) { - evolved = MaplePet.loadFromDb(id, (short) 0, petId); - - Point pos = getPlayer().getPosition(); - pos.y -= 12; - evolved.setPos(pos); - evolved.setFh(getPlayer().getMap().getFootholds().findBelow(evolved.getPos()).getId()); - evolved.setStance(0); - evolved.setSummoned(true); - - evolved.setName(from.getName()); - evolved.setCloseness(from.getCloseness()); - evolved.setFullness(from.getFullness()); - evolved.setLevel(from.getLevel()); - evolved.saveToDb(); - } - - //MapleInventoryManipulator.addById(c, id, (short) 1, null, petId, expires == -1 ? -1 : System.currentTimeMillis() + expires); - } + if (quantity >= 0) { + if (id >= 5000000 && id <= 5000100) { + petId = MaplePet.createPet(id); + + if(from != null) { + evolved = MaplePet.loadFromDb(id, (short) 0, petId); + + Point pos = getPlayer().getPosition(); + pos.y -= 12; + evolved.setPos(pos); + evolved.setFh(getPlayer().getMap().getFootholds().findBelow(evolved.getPos()).getId()); + evolved.setStance(0); + evolved.setSummoned(true); + + evolved.setName(from.getName()); + evolved.setCloseness(from.getCloseness()); + evolved.setFullness(from.getFullness()); + evolved.setLevel(from.getLevel()); + evolved.saveToDb(); + } + + //MapleInventoryManipulator.addById(c, id, (short) 1, null, petId, expires == -1 ? -1 : System.currentTimeMillis() + expires); + } + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); if (ii.getInventoryType(id).equals(MapleInventoryType.EQUIP)) { @@ -687,7 +689,7 @@ public class AbstractPlayerInteraction { } public void removeAll(int id, MapleClient cl) { - MapleInventoryType invType = MapleItemInformationProvider.getInstance().getInventoryType(id); + MapleInventoryType invType = MapleItemInformationProvider.getInstance().getInventoryType(id); int possessed = cl.getPlayer().getInventory(invType).countById(id); if (possessed > 0) { MapleInventoryManipulator.removeById(cl, MapleItemInformationProvider.getInstance().getInventoryType(id), id, possessed, true, false); diff --git a/src/scripting/event/EventInstanceManager.java b/src/scripting/event/EventInstanceManager.java index 5a0a265ed6..ec24c4e58e 100644 --- a/src/scripting/event/EventInstanceManager.java +++ b/src/scripting/event/EventInstanceManager.java @@ -57,6 +57,7 @@ import client.Skill; import constants.ItemConstants; import constants.ServerConstants; import java.awt.Point; +import java.sql.Connection; import java.util.concurrent.ScheduledFuture; import java.util.logging.Level; import java.util.logging.Logger; @@ -570,13 +571,16 @@ public class EventInstanceManager { public void saveWinner(MapleCharacter chr) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO eventstats (event, instance, characterid, channel) VALUES (?, ?, ?, ?)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("INSERT INTO eventstats (event, instance, characterid, channel) VALUES (?, ?, ?, ?)")) { ps.setString(1, em.getName()); ps.setString(2, getName()); ps.setInt(3, chr.getId()); ps.setInt(4, chr.getClient().getChannel()); ps.executeUpdate(); } + + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/scripting/portal/PortalPlayerInteraction.java b/src/scripting/portal/PortalPlayerInteraction.java index caa2dbcebd..c21f0fe03d 100644 --- a/src/scripting/portal/PortalPlayerInteraction.java +++ b/src/scripting/portal/PortalPlayerInteraction.java @@ -22,6 +22,7 @@ package scripting.portal; import client.MapleClient; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -46,14 +47,16 @@ public class PortalPlayerInteraction extends AbstractPlayerInteraction { public boolean hasLevel30Character() { PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT `level` FROM `characters` WHERE accountid = ?"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT `level` FROM `characters` WHERE accountid = ?"); ps.setInt(1, getPlayer().getAccountID()); rs = ps.executeQuery(); while (rs.next()) { if (rs.getInt("level") >= 30) { - ps.close(); - rs.close(); + ps.close(); + rs.close(); return true; } } @@ -67,11 +70,15 @@ public class PortalPlayerInteraction extends AbstractPlayerInteraction { if (rs != null && !rs.isClosed()) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException ex) { ex.printStackTrace(); } } - return false; + + return getPlayer().getLevel() >= 30; } public void blockPortal() { diff --git a/src/scripting/reactor/ReactorScriptManager.java b/src/scripting/reactor/ReactorScriptManager.java index 9ea6c59839..46074737e6 100644 --- a/src/scripting/reactor/ReactorScriptManager.java +++ b/src/scripting/reactor/ReactorScriptManager.java @@ -22,6 +22,7 @@ along with this program. If not, see . package scripting.reactor; import client.MapleClient; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.HashMap; @@ -82,7 +83,8 @@ public class ReactorScriptManager extends AbstractScriptManager { if (ret == null) { ret = new LinkedList<>(); try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT itemid, chance, questid FROM reactordrops WHERE reactorid = ? AND chance >= 0")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT itemid, chance, questid FROM reactordrops WHERE reactorid = ? AND chance >= 0")) { ps.setInt(1, rid); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { @@ -90,6 +92,8 @@ public class ReactorScriptManager extends AbstractScriptManager { } } } + + con.close(); } catch (Throwable e) { FilePrinter.printError(FilePrinter.REACTOR + rid + ".txt", e); } diff --git a/src/server/CashShop.java b/src/server/CashShop.java index 73edf5f985..2596b20249 100644 --- a/src/server/CashShop.java +++ b/src/server/CashShop.java @@ -162,8 +162,10 @@ public class CashShop { } PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM specialcashitems"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT * FROM specialcashitems"); rs = ps.executeQuery(); while (rs.next()) { specialcashitems.add(new SpecialCashItem(rs.getInt("sn"), rs.getInt("modifier"), rs.getByte("info"))); @@ -172,8 +174,9 @@ public class CashShop { ex.printStackTrace(); } finally { try { - if (rs != null) rs.close(); - if (ps != null) ps.close(); + if (rs != null && !rs.isClosed()) rs.close(); + if (ps != null && !ps.isClosed()) ps.close(); + if (con != null && !con.isClosed()) con.close(); } catch (SQLException ex) { ex.printStackTrace(); } @@ -206,8 +209,10 @@ public class CashShop { specialcashitems.clear(); PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM specialcashitems"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT * FROM specialcashitems"); rs = ps.executeQuery(); while (rs.next()) { specialcashitems.add(new SpecialCashItem(rs.getInt("sn"), rs.getInt("modifier"), rs.getByte("info"))); @@ -216,14 +221,16 @@ public class CashShop { ex.printStackTrace(); } finally { try { - if (rs != null) rs.close(); - if (ps != null) ps.close(); + if (rs != null && !rs.isClosed()) rs.close(); + if (ps != null && !ps.isClosed()) ps.close(); + if (con != null && !con.isClosed()) con.close(); } catch (SQLException ex) { ex.printStackTrace(); } } } } + private int accountId, characterId, nxCredit, maplePoint, nxPrepaid; private boolean opened; private ItemFactory factory; @@ -274,9 +281,11 @@ public class CashShop { rs.close(); ps.close(); + con.close(); } finally { - if (ps != null) ps.close(); - if (rs != null) rs.close(); + if (ps != null && !ps.isClosed()) ps.close(); + if (rs != null && !rs.isClosed()) rs.close(); + if (con != null && !con.isClosed()) con.close(); } } @@ -361,31 +370,35 @@ public class CashShop { public void gift(int recipient, String from, String message, int sn, int ringid) { PreparedStatement ps = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO `gifts` VALUES (DEFAULT, ?, ?, ?, ?, ?)"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("INSERT INTO `gifts` VALUES (DEFAULT, ?, ?, ?, ?, ?)"); ps.setInt(1, recipient); ps.setString(2, from); ps.setString(3, message); ps.setInt(4, sn); ps.setInt(5, ringid); ps.executeUpdate(); + con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } finally { try { - if (ps != null) ps.close(); + if (ps != null && !ps.isClosed()) ps.close(); + if (con != null && !con.isClosed()) con.close(); } catch (SQLException ex) { ex.printStackTrace(); } } } - public List> loadGifts() { List> gifts = new ArrayList<>(); - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM `gifts` WHERE `to` = ?"); ps.setInt(1, characterId); ResultSet rs = ps.executeQuery(); @@ -419,6 +432,7 @@ public class CashShop { ps.setInt(1, characterId); ps.executeUpdate(); ps.close(); + con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } diff --git a/src/server/MakerItemFactory.java b/src/server/MakerItemFactory.java index cc2f0ec3c4..0a5641bc0c 100644 --- a/src/server/MakerItemFactory.java +++ b/src/server/MakerItemFactory.java @@ -69,6 +69,7 @@ public class MakerItemFactory { } rs.close(); ps.close(); + con.close(); createCache.put(toCreate, ret); } catch (SQLException sqle) { sqle.printStackTrace(); diff --git a/src/server/MapleItemInformationProvider.java b/src/server/MapleItemInformationProvider.java index 98ae6ff64d..aba5e64875 100644 --- a/src/server/MapleItemInformationProvider.java +++ b/src/server/MapleItemInformationProvider.java @@ -65,6 +65,7 @@ import constants.ItemConstants; import constants.skills.Assassin; import constants.skills.Gunslinger; import constants.skills.NightWalker; +import java.sql.Connection; import server.life.MapleMonsterInformationProvider; /** @@ -533,10 +534,6 @@ public class MapleItemInformationProvider { return type[cat - 30]; } - private boolean isCleanSlate(int scrollId) { - return scrollId > 2048999 && scrollId < 2049004; - } - private static double testYourLuck() { double result = 100.0, rolled; int i, j = ServerConstants.SCROLL_CHANCE_RATE; @@ -554,6 +551,14 @@ public class MapleItemInformationProvider { return(testYourLuck() <= prop && prop > 0.0); } + private static short getMaximumShortMaxIfOverflow(int value1, int value2) { + return (short)Math.min(Short.MAX_VALUE, Math.max(value1, value2)); + } + + private static short getShortMaxIfOverflow(int value) { + return (short)Math.min(Short.MAX_VALUE, value); + } + public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, boolean isGM) { if (equip instanceof Equip) { Equip nEquip = (Equip) equip; @@ -561,7 +566,7 @@ public class MapleItemInformationProvider { Map stats = this.getEquipStats(scrollId); Map eqstats = this.getEquipStats(equip.getItemId()); - if (((nEquip.getUpgradeSlots() > 0 || isCleanSlate(scrollId))) || isGM) { + if (((nEquip.getUpgradeSlots() > 0 || ItemConstants.isCleanSlate(scrollId))) || isGM) { if(isGM || rollSuccessChance((double)stats.get("success"))) { short flag = nEquip.getFlag(); switch (scrollId) { @@ -600,7 +605,7 @@ public class MapleItemInformationProvider { for(i = 0; i < ServerConstants.SCROLL_CHANCE_RATE; i++) { if (nEquip.getStr() > 0) { temp = (nEquip.getStr() + Randomizer.nextInt(6) * inc); - nEquip.setStr((short) Math.max(mdStr, temp)); + nEquip.setStr(getMaximumShortMaxIfOverflow(mdStr, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdStr = nEquip.getStr(); @@ -612,7 +617,7 @@ public class MapleItemInformationProvider { } if (nEquip.getDex() > 0) { temp = (nEquip.getDex() + Randomizer.nextInt(6) * inc); - nEquip.setDex((short) Math.max(mdDex, temp)); + nEquip.setDex(getMaximumShortMaxIfOverflow(mdDex, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdDex = nEquip.getDex(); @@ -624,7 +629,7 @@ public class MapleItemInformationProvider { } if (nEquip.getInt() > 0) { temp = (nEquip.getInt() + Randomizer.nextInt(6) * inc); - nEquip.setInt((short) Math.max(mdInt, temp)); + nEquip.setInt(getMaximumShortMaxIfOverflow(mdInt, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdInt = nEquip.getInt(); @@ -636,7 +641,7 @@ public class MapleItemInformationProvider { } if (nEquip.getLuk() > 0) { temp = (nEquip.getLuk() + Randomizer.nextInt(6) * inc); - nEquip.setLuk((short) Math.max(mdLuk, temp)); + nEquip.setLuk(getMaximumShortMaxIfOverflow(mdLuk, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdLuk = nEquip.getLuk(); @@ -648,7 +653,7 @@ public class MapleItemInformationProvider { } if (nEquip.getWatk() > 0) { temp = (nEquip.getWatk() + Randomizer.nextInt(6) * inc); - nEquip.setWatk((short) Math.max(mdWatk, temp)); + nEquip.setWatk(getMaximumShortMaxIfOverflow(mdWatk, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdWatk = nEquip.getWatk(); @@ -660,7 +665,7 @@ public class MapleItemInformationProvider { } if (nEquip.getWdef() > 0) { temp = (nEquip.getWdef() + Randomizer.nextInt(6) * inc); - nEquip.setWdef((short) Math.max(mdWdef, temp)); + nEquip.setWdef(getMaximumShortMaxIfOverflow(mdWdef, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdWdef = nEquip.getWdef(); @@ -672,7 +677,7 @@ public class MapleItemInformationProvider { } if (nEquip.getMatk() > 0) { temp = (nEquip.getMatk() + Randomizer.nextInt(6) * inc); - nEquip.setMatk((short) Math.max(mdMatk, temp)); + nEquip.setMatk(getMaximumShortMaxIfOverflow(mdMatk, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdMatk = nEquip.getMatk(); @@ -684,7 +689,7 @@ public class MapleItemInformationProvider { } if (nEquip.getMdef() > 0) { temp = (nEquip.getMdef() + Randomizer.nextInt(6) * inc); - nEquip.setMdef((short) Math.max(mdMdef, temp)); + nEquip.setMdef(getMaximumShortMaxIfOverflow(mdMdef, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdMdef = nEquip.getMdef(); @@ -696,7 +701,7 @@ public class MapleItemInformationProvider { } if (nEquip.getAcc() > 0) { temp = (nEquip.getAcc() + Randomizer.nextInt(6) * inc); - nEquip.setAcc((short) Math.max(mdAcc, temp)); + nEquip.setAcc(getMaximumShortMaxIfOverflow(mdAcc, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdAcc = nEquip.getAcc(); @@ -708,7 +713,7 @@ public class MapleItemInformationProvider { } if (nEquip.getAvoid() > 0) { temp = (nEquip.getAvoid() + Randomizer.nextInt(6) * inc); - nEquip.setAvoid((short) Math.max(mdAvoid, temp)); + nEquip.setAvoid(getMaximumShortMaxIfOverflow(mdAvoid, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdAvoid = nEquip.getAvoid(); @@ -720,7 +725,7 @@ public class MapleItemInformationProvider { } if (nEquip.getSpeed() > 0) { temp = (nEquip.getSpeed() + Randomizer.nextInt(6) * inc); - nEquip.setSpeed((short) Math.max(mdSpeed, temp)); + nEquip.setSpeed(getMaximumShortMaxIfOverflow(mdSpeed, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdSpeed = nEquip.getSpeed(); @@ -732,7 +737,7 @@ public class MapleItemInformationProvider { } if (nEquip.getJump() > 0) { temp = (nEquip.getJump() + Randomizer.nextInt(6) * inc); - nEquip.setJump((short) Math.max(mdJump, temp)); + nEquip.setJump(getMaximumShortMaxIfOverflow(mdJump, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdJump = nEquip.getJump(); @@ -744,7 +749,7 @@ public class MapleItemInformationProvider { } if (nEquip.getHp() > 0) { temp = (nEquip.getHp() + Randomizer.nextInt(6) * inc); - nEquip.setHp((short) Math.max(mdHp, temp)); + nEquip.setHp(getMaximumShortMaxIfOverflow(mdHp, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdHp = nEquip.getHp(); @@ -756,7 +761,7 @@ public class MapleItemInformationProvider { } if (nEquip.getMp() > 0) { temp = (nEquip.getMp() + Randomizer.nextInt(6) * inc); - nEquip.setMp((short) Math.max(mdMp, temp)); + nEquip.setMp(getMaximumShortMaxIfOverflow(mdMp, temp)); if(ServerConstants.USE_ENHANCED_CHSCROLL == true) { mdMp = nEquip.getMp(); @@ -778,60 +783,60 @@ public class MapleItemInformationProvider { if(ServerConstants.USE_ENHANCED_CHSCROLL == true) inc = 1; if (nEquip.getStr() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setStr((short) Math.max(nEquip.getStr(), (nEquip.getStr() + Randomizer.nextInt(6) * inc))); - else nEquip.setStr((short) Math.max(0, (nEquip.getStr() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setStr(getMaximumShortMaxIfOverflow(nEquip.getStr(), (nEquip.getStr() + Randomizer.nextInt(6) * inc))); + else nEquip.setStr(getMaximumShortMaxIfOverflow(0, (nEquip.getStr() + Randomizer.nextInt(6) * inc))); } if (nEquip.getDex() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setDex((short) Math.max(nEquip.getDex(), (nEquip.getDex() + Randomizer.nextInt(6) * inc))); - else nEquip.setDex((short) Math.max(0, (nEquip.getDex() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setDex(getMaximumShortMaxIfOverflow(nEquip.getDex(), (nEquip.getDex() + Randomizer.nextInt(6) * inc))); + else nEquip.setDex(getMaximumShortMaxIfOverflow(0, (nEquip.getDex() + Randomizer.nextInt(6) * inc))); } if (nEquip.getInt() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setInt((short) Math.max(nEquip.getInt(), (nEquip.getInt() + Randomizer.nextInt(6) * inc))); - else nEquip.setInt((short) Math.max(0, (nEquip.getInt() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setInt(getMaximumShortMaxIfOverflow(nEquip.getInt(), (nEquip.getInt() + Randomizer.nextInt(6) * inc))); + else nEquip.setInt(getMaximumShortMaxIfOverflow(0, (nEquip.getInt() + Randomizer.nextInt(6) * inc))); } if (nEquip.getLuk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setLuk((short) Math.max(nEquip.getLuk(), (nEquip.getLuk() + Randomizer.nextInt(6) * inc))); - else nEquip.setLuk((short) Math.max(0, (nEquip.getLuk() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setLuk(getMaximumShortMaxIfOverflow(nEquip.getLuk(), (nEquip.getLuk() + Randomizer.nextInt(6) * inc))); + else nEquip.setLuk(getMaximumShortMaxIfOverflow(0, (nEquip.getLuk() + Randomizer.nextInt(6) * inc))); } if (nEquip.getWatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setWatk((short) Math.max(nEquip.getWatk(), (nEquip.getWatk() + Randomizer.nextInt(6) * inc))); - else nEquip.setWatk((short) Math.max(0, (nEquip.getWatk() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setWatk(getMaximumShortMaxIfOverflow(nEquip.getWatk(), (nEquip.getWatk() + Randomizer.nextInt(6) * inc))); + else nEquip.setWatk(getMaximumShortMaxIfOverflow(0, (nEquip.getWatk() + Randomizer.nextInt(6) * inc))); } if (nEquip.getWdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setWdef((short) Math.max(nEquip.getWdef(), (nEquip.getWdef() + Randomizer.nextInt(6) * inc))); - else nEquip.setWdef((short) Math.max(0, (nEquip.getWdef() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setWdef(getMaximumShortMaxIfOverflow(nEquip.getWdef(), (nEquip.getWdef() + Randomizer.nextInt(6) * inc))); + else nEquip.setWdef(getMaximumShortMaxIfOverflow(0, (nEquip.getWdef() + Randomizer.nextInt(6) * inc))); } if (nEquip.getMatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMatk((short) Math.max(nEquip.getMatk(), (nEquip.getMatk() + Randomizer.nextInt(6) * inc))); - else nEquip.setMatk((short) Math.max(0, (nEquip.getMatk() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMatk(getMaximumShortMaxIfOverflow(nEquip.getMatk(), (nEquip.getMatk() + Randomizer.nextInt(6) * inc))); + else nEquip.setMatk(getMaximumShortMaxIfOverflow(0, (nEquip.getMatk() + Randomizer.nextInt(6) * inc))); } if (nEquip.getMdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMdef((short) Math.max(nEquip.getMdef(), (nEquip.getMdef() + Randomizer.nextInt(6) * inc))); - else nEquip.setMdef((short) Math.max(0, (nEquip.getMdef() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMdef(getMaximumShortMaxIfOverflow(nEquip.getMdef(), (nEquip.getMdef() + Randomizer.nextInt(6) * inc))); + else nEquip.setMdef(getMaximumShortMaxIfOverflow(0, (nEquip.getMdef() + Randomizer.nextInt(6) * inc))); } if (nEquip.getAcc() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setAcc((short) Math.max(nEquip.getAcc(), (nEquip.getAcc() + Randomizer.nextInt(6) * inc))); - else nEquip.setAcc((short) Math.max(0, (nEquip.getAcc() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setAcc(getMaximumShortMaxIfOverflow(nEquip.getAcc(), (nEquip.getAcc() + Randomizer.nextInt(6) * inc))); + else nEquip.setAcc(getMaximumShortMaxIfOverflow(0, (nEquip.getAcc() + Randomizer.nextInt(6) * inc))); } if (nEquip.getAvoid() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setAvoid((short) Math.max(nEquip.getAvoid(), (nEquip.getAvoid() + Randomizer.nextInt(6) * inc))); - else nEquip.setAvoid((short) Math.max(0, (nEquip.getAvoid() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setAvoid(getMaximumShortMaxIfOverflow(nEquip.getAvoid(), (nEquip.getAvoid() + Randomizer.nextInt(6) * inc))); + else nEquip.setAvoid(getMaximumShortMaxIfOverflow(0, (nEquip.getAvoid() + Randomizer.nextInt(6) * inc))); } if (nEquip.getSpeed() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setSpeed((short) Math.max(nEquip.getSpeed(), (nEquip.getSpeed() + Randomizer.nextInt(6) * inc))); - else nEquip.setSpeed((short) Math.max(0, (nEquip.getSpeed() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setSpeed(getMaximumShortMaxIfOverflow(nEquip.getSpeed(), (nEquip.getSpeed() + Randomizer.nextInt(6) * inc))); + else nEquip.setSpeed(getMaximumShortMaxIfOverflow(0, (nEquip.getSpeed() + Randomizer.nextInt(6) * inc))); } if (nEquip.getJump() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setJump((short) Math.max(nEquip.getJump(), (nEquip.getJump() + Randomizer.nextInt(6) * inc))); - else nEquip.setJump((short) Math.max(0, (nEquip.getJump() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setJump(getMaximumShortMaxIfOverflow(nEquip.getJump(), (nEquip.getJump() + Randomizer.nextInt(6) * inc))); + else nEquip.setJump(getMaximumShortMaxIfOverflow(0, (nEquip.getJump() + Randomizer.nextInt(6) * inc))); } if (nEquip.getHp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setHp((short) Math.max(nEquip.getHp(), (nEquip.getHp() + Randomizer.nextInt(6) * inc))); - else nEquip.setHp((short) Math.max(0, (nEquip.getHp() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setHp(getMaximumShortMaxIfOverflow(nEquip.getHp(), (nEquip.getHp() + Randomizer.nextInt(6) * inc))); + else nEquip.setHp(getMaximumShortMaxIfOverflow(0, (nEquip.getHp() + Randomizer.nextInt(6) * inc))); } if (nEquip.getMp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMp((short) Math.max(nEquip.getMp(), (nEquip.getMp() + Randomizer.nextInt(6) * inc))); - else nEquip.setMp((short) Math.max(0, (nEquip.getMp() + Randomizer.nextInt(6) * inc))); + if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setMp(getMaximumShortMaxIfOverflow(nEquip.getMp(), (nEquip.getMp() + Randomizer.nextInt(6) * inc))); + else nEquip.setMp(getMaximumShortMaxIfOverflow(0, (nEquip.getMp() + Randomizer.nextInt(6) * inc))); } } break; @@ -840,46 +845,46 @@ public class MapleItemInformationProvider { for (Entry stat : stats.entrySet()) { switch (stat.getKey()) { case "STR": - nEquip.setStr((short) (nEquip.getStr() + stat.getValue().intValue())); + nEquip.setStr(getShortMaxIfOverflow(nEquip.getStr() + stat.getValue().intValue())); break; case "DEX": - nEquip.setDex((short) (nEquip.getDex() + stat.getValue().intValue())); + nEquip.setDex(getShortMaxIfOverflow(nEquip.getDex() + stat.getValue().intValue())); break; case "INT": - nEquip.setInt((short) (nEquip.getInt() + stat.getValue().intValue())); + nEquip.setInt(getShortMaxIfOverflow(nEquip.getInt() + stat.getValue().intValue())); break; case "LUK": - nEquip.setLuk((short) (nEquip.getLuk() + stat.getValue().intValue())); + nEquip.setLuk(getShortMaxIfOverflow(nEquip.getLuk() + stat.getValue().intValue())); break; case "PAD": - nEquip.setWatk((short) (nEquip.getWatk() + stat.getValue().intValue())); + nEquip.setWatk(getShortMaxIfOverflow(nEquip.getWatk() + stat.getValue().intValue())); break; case "PDD": - nEquip.setWdef((short) (nEquip.getWdef() + stat.getValue().intValue())); + nEquip.setWdef(getShortMaxIfOverflow(nEquip.getWdef() + stat.getValue().intValue())); break; case "MAD": - nEquip.setMatk((short) (nEquip.getMatk() + stat.getValue().intValue())); + nEquip.setMatk(getShortMaxIfOverflow(nEquip.getMatk() + stat.getValue().intValue())); break; case "MDD": - nEquip.setMdef((short) (nEquip.getMdef() + stat.getValue().intValue())); + nEquip.setMdef(getShortMaxIfOverflow(nEquip.getMdef() + stat.getValue().intValue())); break; case "ACC": - nEquip.setAcc((short) (nEquip.getAcc() + stat.getValue().intValue())); + nEquip.setAcc(getShortMaxIfOverflow(nEquip.getAcc() + stat.getValue().intValue())); break; case "EVA": - nEquip.setAvoid((short) (nEquip.getAvoid() + stat.getValue().intValue())); + nEquip.setAvoid(getShortMaxIfOverflow(nEquip.getAvoid() + stat.getValue().intValue())); break; case "Speed": - nEquip.setSpeed((short) (nEquip.getSpeed() + stat.getValue().intValue())); + nEquip.setSpeed(getShortMaxIfOverflow(nEquip.getSpeed() + stat.getValue().intValue())); break; case "Jump": - nEquip.setJump((short) (nEquip.getJump() + stat.getValue().intValue())); + nEquip.setJump(getShortMaxIfOverflow(nEquip.getJump() + stat.getValue().intValue())); break; case "MHP": - nEquip.setHp((short) (nEquip.getHp() + stat.getValue().intValue())); + nEquip.setHp(getShortMaxIfOverflow(nEquip.getHp() + stat.getValue().intValue())); break; case "MMP": - nEquip.setMp((short) (nEquip.getMp() + stat.getValue().intValue())); + nEquip.setMp(getShortMaxIfOverflow(nEquip.getMp() + stat.getValue().intValue())); break; case "afterImage": break; @@ -887,7 +892,7 @@ public class MapleItemInformationProvider { } break; } - if (!isCleanSlate(scrollId)) { + if (!ItemConstants.isCleanSlate(scrollId)) { if (ServerConstants.USE_PERFECT_SCROLLING == true && !isGM && !usingWhiteScroll) { nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1)); } @@ -895,14 +900,14 @@ public class MapleItemInformationProvider { } } - if (ServerConstants.USE_PERFECT_SCROLLING == false && !isCleanSlate(scrollId)) { + if (ServerConstants.USE_PERFECT_SCROLLING == false && !ItemConstants.isCleanSlate(scrollId)) { if (!isGM && !usingWhiteScroll) { nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1)); } //nEquip.setLevel((byte) (nEquip.getLevel() + 1)); } } else { - if (!usingWhiteScroll && !isCleanSlate(scrollId) && !isGM) { + if (!usingWhiteScroll && !ItemConstants.isCleanSlate(scrollId) && !isGM) { nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1)); } if (Randomizer.nextInt(101) < stats.get("cursed")) { @@ -1153,24 +1158,30 @@ public class MapleItemInformationProvider { private void loadCardIdData() { PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT cardid, mobid FROM monstercarddata"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT cardid, mobid FROM monstercarddata"); rs = ps.executeQuery(); while (rs.next()) { monsterBookID.put(rs.getInt(1), rs.getInt(2)); } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { - if (rs != null) { + if (rs != null && !rs.isClosed()) { rs.close(); } - if (ps != null) { + if (ps != null && !ps.isClosed()) { ps.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1307,20 +1318,6 @@ public class MapleItemInformationProvider { eq.getAvoid() > 0 || eq.getSpeed() > 0 || eq.getJump() > 0 || eq.getHp() > 0 || eq.getMp() > 0); } - - public boolean isRateCoupon(int itemId) { - int itemType = itemId / 1000; - return itemType == 5211 || itemType == 5360; - } - - public boolean isPartyItem(int itemId) { - return itemId >= 2022430 && itemId <= 2022433; - } - - public boolean isPartyAllcure(int itemId) { - return itemId == 2022433; - } - public Collection canWearEquipment(MapleCharacter chr, Collection items) { MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIPPED); if (inv.checked()) { @@ -1523,9 +1520,10 @@ public class MapleItemInformationProvider { public Set getWhoDrops(Integer itemId) { Set list = new HashSet<>(); - + Connection con = null; try { - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM drop_data WHERE itemid = ? LIMIT 50"); + con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM drop_data WHERE itemid = ? LIMIT 50"); ps.setInt(1, itemId); ResultSet rs = ps.executeQuery(); while(rs.next()) { @@ -1536,6 +1534,7 @@ public class MapleItemInformationProvider { } rs.close(); ps.close(); + con.close(); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/server/MapleShop.java b/src/server/MapleShop.java index fd1a89b7ef..f52bc93220 100644 --- a/src/server/MapleShop.java +++ b/src/server/MapleShop.java @@ -233,6 +233,7 @@ public class MapleShop { } else { rs.close(); ps.close(); + con.close(); return null; } ps = con.prepareStatement("SELECT * FROM shopitems WHERE shopid = ? ORDER BY position DESC"); @@ -255,6 +256,7 @@ public class MapleShop { } rs.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/server/MapleStorage.java b/src/server/MapleStorage.java index 6a00712600..47be5f5d19 100644 --- a/src/server/MapleStorage.java +++ b/src/server/MapleStorage.java @@ -61,11 +61,14 @@ public class MapleStorage { private static MapleStorage create(int id, int world) { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO storages (accountid, world, slots, meso) VALUES (?, ?, 4, 0)")) { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("INSERT INTO storages (accountid, world, slots, meso) VALUES (?, ?, 4, 0)")) { ps.setInt(1, id); ps.setInt(2, world); ps.executeUpdate(); } + + con.close(); } catch (Exception e) { e.printStackTrace(); } @@ -84,6 +87,7 @@ public class MapleStorage { if (!rs.next()) { rs.close(); ps.close(); + con.close(); return create(id, world); } else { storeId = rs.getInt("storageid"); @@ -94,6 +98,8 @@ public class MapleStorage { ret.items.add(item.getLeft()); } } + + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/server/life/MapleMonsterInformationProvider.java b/src/server/life/MapleMonsterInformationProvider.java index 630960b2cc..3e4e3c8d06 100644 --- a/src/server/life/MapleMonsterInformationProvider.java +++ b/src/server/life/MapleMonsterInformationProvider.java @@ -59,9 +59,10 @@ public class MapleMonsterInformationProvider { private void retrieveGlobal() { PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - final Connection con = DatabaseConnection.getConnection(); + con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM drop_data_global WHERE chance > 0"); rs = ps.executeQuery(); @@ -76,18 +77,23 @@ public class MapleMonsterInformationProvider { rs.getInt("maximum_quantity"), rs.getShort("questid"))); } + rs.close(); ps.close(); + con.close(); } catch (SQLException e) { System.err.println("Error retrieving drop" + e); } finally { try { - if (ps != null) { + if (ps != null && !ps.isClosed()) { ps.close(); } - if (rs != null) { + if (rs != null && !rs.isClosed()) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException ignore) { ignore.printStackTrace(); } @@ -102,8 +108,10 @@ public class MapleMonsterInformationProvider { PreparedStatement ps = null; ResultSet rs = null; + Connection con = null; try { - ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM drop_data WHERE dropperid = ?"); + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT * FROM drop_data WHERE dropperid = ?"); ps.setInt(1, monsterId); rs = ps.executeQuery(); @@ -116,17 +124,22 @@ public class MapleMonsterInformationProvider { rs.getInt("maximum_quantity"), rs.getShort("questid"))); } + + con.close(); } catch (SQLException e) { - e.printStackTrace(); + e.printStackTrace(); return ret; } finally { try { - if (ps != null) { + if (ps != null && !ps.isClosed()) { ps.close(); } - if (rs != null) { + if (rs != null && !rs.isClosed()) { rs.close(); } + if (con != null && !con.isClosed()) { + con.close(); + } } catch (SQLException ignore) { ignore.printStackTrace(); return ret; diff --git a/src/server/maps/HiredMerchant.java b/src/server/maps/HiredMerchant.java index e0f3bc554d..0f52e93c92 100644 --- a/src/server/maps/HiredMerchant.java +++ b/src/server/maps/HiredMerchant.java @@ -167,10 +167,14 @@ public class HiredMerchant extends AbstractMapleMapObject { owner.addMerchantMesos(price); } else { try { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET MerchantMesos = MerchantMesos + " + price + " WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { + Connection con = DatabaseConnection.getConnection(); + + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET MerchantMesos = MerchantMesos + " + price + " WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { ps.setInt(1, ownerId); ps.executeUpdate(); } + + con.close(); } catch (Exception e) { e.printStackTrace(); } @@ -204,57 +208,67 @@ public class HiredMerchant extends AbstractMapleMapObject { map.removeMapObject(this); - MapleCharacter player = Server.getInstance().getWorld(world).getPlayerStorage().getCharacterById(ownerId); - if(player != null) { - player.setHasMerchant(false); - } else { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET HasMerchant = 0 WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { - ps.setInt(1, ownerId); - ps.executeUpdate(); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } + MapleCharacter player = Server.getInstance().getWorld(world).getPlayerStorage().getCharacterById(ownerId); + if(player != null) { + player.setHasMerchant(false); + } else { + try { + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("UPDATE characters SET HasMerchant = 0 WHERE id = ?", Statement.RETURN_GENERATED_KEYS); + ps.setInt(1, ownerId); + ps.executeUpdate(); + + ps.close(); + con.close(); + } catch (SQLException ex) { + ex.printStackTrace(); + } + } map = null; schedule = null; } public void closeShop(MapleClient c, boolean timeout) { - map.removeMapObject(this); - map.broadcastMessage(MaplePacketCreator.destroyHiredMerchant(ownerId)); - c.getChannelServer().removeHiredMerchant(ownerId); - try { - MapleCharacter player = c.getWorldServer().getPlayerStorage().getCharacterById(ownerId); - if(player != null) { - player.setHasMerchant(false); - } else { - try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET HasMerchant = 0 WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { - ps.setInt(1, ownerId); - ps.executeUpdate(); - } - } - if (check(c.getPlayer(), getItems()) && !timeout) { - for (MaplePlayerShopItem mpsi : getItems()) { - if (mpsi.isExist() && (mpsi.getItem().getType() == MapleInventoryType.EQUIP.getType())) { - MapleInventoryManipulator.addFromDrop(c, mpsi.getItem(), false); - } else if (mpsi.isExist()) { - MapleInventoryManipulator.addById(c, mpsi.getItem().getItemId(), (short) (mpsi.getBundles() * mpsi.getItem().getQuantity()), null, -1, mpsi.getItem().getFlag(), mpsi.getItem().getExpiration()); - } - } - items.clear(); - } + map.removeMapObject(this); + map.broadcastMessage(MaplePacketCreator.destroyHiredMerchant(ownerId)); + c.getChannelServer().removeHiredMerchant(ownerId); + try { - this.saveItems(timeout); + MapleCharacter player = c.getWorldServer().getPlayerStorage().getCharacterById(ownerId); + if(player != null) { + player.setHasMerchant(false); + } else { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET HasMerchant = 0 WHERE id = ?", Statement.RETURN_GENERATED_KEYS)) { + ps.setInt(1, ownerId); + ps.executeUpdate(); + } + con.close(); + } + + if (check(c.getPlayer(), getItems()) && !timeout) { + for (MaplePlayerShopItem mpsi : getItems()) { + if (mpsi.isExist() && (mpsi.getItem().getType() == MapleInventoryType.EQUIP.getType())) { + MapleInventoryManipulator.addFromDrop(c, mpsi.getItem(), false); + } else if (mpsi.isExist()) { + MapleInventoryManipulator.addById(c, mpsi.getItem().getItemId(), (short) (mpsi.getBundles() * mpsi.getItem().getQuantity()), null, -1, mpsi.getItem().getFlag(), mpsi.getItem().getExpiration()); + } + } + items.clear(); + } + + try { + this.saveItems(timeout); + } catch (Exception e) { + e.printStackTrace(); + } + + items.clear(); } catch (Exception e) { e.printStackTrace(); } - items.clear(); - - } catch (Exception e) { - e.printStackTrace(); - } - schedule.cancel(false); + schedule.cancel(false); } public String getOwner() { @@ -343,8 +357,10 @@ public class HiredMerchant extends AbstractMapleMapObject { itemsWithType.add(new Pair<>(newItem, MapleInventoryType.getByType(newItem.getType()))); } } - - ItemFactory.MERCHANT.saveItems(itemsWithType, this.ownerId, DatabaseConnection.getConnection()); + + Connection con = DatabaseConnection.getConnection(); + ItemFactory.MERCHANT.saveItems(itemsWithType, this.ownerId, con); + con.close(); } private static boolean check(MapleCharacter chr, List items) { diff --git a/src/server/maps/MapleMapFactory.java b/src/server/maps/MapleMapFactory.java index 43d8178285..1e7de3181a 100644 --- a/src/server/maps/MapleMapFactory.java +++ b/src/server/maps/MapleMapFactory.java @@ -23,8 +23,10 @@ package server.maps; import java.awt.Point; import java.awt.Rectangle; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; @@ -168,7 +170,9 @@ public class MapleMapFactory { map.addMapleArea(new Rectangle(x1, y1, (x2 - x1), (y2 - y1))); } } - try { try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM playernpcs WHERE map = ?")) { + try { + Connection con = DatabaseConnection.getConnection(); + try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE map = ?")) { ps.setInt(1, omapid); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { @@ -176,7 +180,9 @@ public class MapleMapFactory { } } } - } catch (Exception e) { + + con.close(); + } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/server/maps/PlayerNPCs.java b/src/server/maps/PlayerNPCs.java index 47e6c7dae7..00bdbcc509 100644 --- a/src/server/maps/PlayerNPCs.java +++ b/src/server/maps/PlayerNPCs.java @@ -27,6 +27,7 @@ import java.sql.ResultSet; import java.util.HashMap; import java.util.Map; import client.MapleClient; +import java.sql.Connection; import java.sql.SQLException; import tools.DatabaseConnection; import tools.MaplePacketCreator; @@ -54,7 +55,9 @@ public class PlayerNPCs extends AbstractMapleMapObject { RX1 = rs.getInt("rx1"); npcId = rs.getInt("ScriptId"); setPosition(new Point(rs.getInt("x"), CY)); - PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT equippos, equipid FROM playernpcs_equip WHERE NpcId = ?"); + + Connection con = DatabaseConnection.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT equippos, equipid FROM playernpcs_equip WHERE NpcId = ?"); ps.setInt(1, rs.getInt("id")); ResultSet rs2 = ps.executeQuery(); while (rs2.next()) { @@ -62,6 +65,7 @@ public class PlayerNPCs extends AbstractMapleMapObject { } rs2.close(); ps.close(); + con.close(); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/server/partyquest/MonsterCarnival.java b/src/server/partyquest/MonsterCarnival.java index 9527dbeb0d..89945d7e82 100644 --- a/src/server/partyquest/MonsterCarnival.java +++ b/src/server/partyquest/MonsterCarnival.java @@ -147,8 +147,9 @@ public class MonsterCarnival { } public void saveResults() { - Connection con = DatabaseConnection.getConnection(); + Connection con = null; try { + con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO carnivalresults VALUES (?,?,?,?)"); for (MapleCharacter chr : red.getMembers()) { ps.setInt(1, chr.getId()); @@ -165,6 +166,7 @@ public class MonsterCarnival { ps.execute(); } ps.close(); + con.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/server/quest/MapleQuest.java b/src/server/quest/MapleQuest.java index fdb579f331..fd5c884168 100644 --- a/src/server/quest/MapleQuest.java +++ b/src/server/quest/MapleQuest.java @@ -36,7 +36,6 @@ import provider.MapleDataProviderFactory; import provider.MapleDataTool; import server.quest.actions.*; import server.quest.requirements.*; -import tools.FilePrinter; import tools.MaplePacketCreator; /** @@ -113,8 +112,9 @@ public class MapleQuest { for (MapleData completeReq : completeReqData.getChildren()) { MapleQuestRequirementType type = MapleQuestRequirementType.getByWZName(completeReq.getName()); MapleQuestRequirement req = this.getRequirement(type, completeReq); - if(req == null) - continue; + + if(req == null) + continue; if (type.equals(MapleQuestRequirementType.INFO_NUMBER)) { infoNumber = (short) MapleDataTool.getInt(completeReq, 0); @@ -230,6 +230,9 @@ public class MapleQuest { } for (MapleQuestRequirement r : completeReqs.values()) { if (r == null || !r.check(c, npcid)) { + if(r.getType() == MapleQuestRequirementType.MESO) { // TODO: find a way to tell the client about the new MESO requirement type. + c.dropMessage(5, "You don't have enough mesos to complete this quest."); + } return false; } } @@ -402,6 +405,9 @@ public class MapleQuest { case MAX_LEVEL: ret = new MaxLevelRequirement(this, data); break; + case MESO: + ret = new MesoRequirement(this, data); + break; case MIN_LEVEL: ret = new MinLevelRequirement(this, data); break; diff --git a/src/server/quest/MapleQuestRequirementType.java b/src/server/quest/MapleQuestRequirementType.java index 50e69da3d5..073fcab887 100644 --- a/src/server/quest/MapleQuestRequirementType.java +++ b/src/server/quest/MapleQuestRequirementType.java @@ -26,7 +26,7 @@ package server.quest; * @author Matze */ public enum MapleQuestRequirementType { - UNDEFINED(-1), JOB(0), ITEM(1), QUEST(2), MIN_LEVEL(3), MAX_LEVEL(4), END_DATE(5), MOB(6), NPC(7), FIELD_ENTER(8), INTERVAL(9), SCRIPT(10), PET(11), MIN_PET_TAMENESS(12), MONSTER_BOOK(13), NORMAL_AUTO_START(14), INFO_NUMBER(15), INFO_EX(16), COMPLETED_QUEST(17), START(18), END(19), DAY_BY_DAY(20); + UNDEFINED(-1), JOB(0), ITEM(1), QUEST(2), MIN_LEVEL(3), MAX_LEVEL(4), END_DATE(5), MOB(6), NPC(7), FIELD_ENTER(8), INTERVAL(9), SCRIPT(10), PET(11), MIN_PET_TAMENESS(12), MONSTER_BOOK(13), NORMAL_AUTO_START(14), INFO_NUMBER(15), INFO_EX(16), COMPLETED_QUEST(17), START(18), END(19), DAY_BY_DAY(20), MESO(21); final byte type; private MapleQuestRequirementType(int type) { @@ -82,6 +82,8 @@ public enum MapleQuestRequirementType { return END; } else if(name.equals("daybyday")) { return DAY_BY_DAY; + } else if (name.equals("money")) { + return MESO; } else { return UNDEFINED; } diff --git a/src/server/quest/requirements/MesoRequirement.java b/src/server/quest/requirements/MesoRequirement.java new file mode 100644 index 0000000000..f94822afc4 --- /dev/null +++ b/src/server/quest/requirements/MesoRequirement.java @@ -0,0 +1,52 @@ +/* + 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 server.quest.requirements; + +import provider.MapleData; +import provider.MapleDataTool; +import server.quest.MapleQuest; +import server.quest.MapleQuestRequirementType; +import client.MapleCharacter; + +/** + * + * @author Ronan + */ +public class MesoRequirement extends MapleQuestRequirement { + private int meso = 0; + + public MesoRequirement(MapleQuest quest, MapleData data) { + super(MapleQuestRequirementType.MESO); + processData(data); + } + + @Override + public void processData(MapleData data) { + meso = MapleDataTool.getInt(data); + } + + + @Override + public boolean check(MapleCharacter chr, Integer npcid) { + return chr.getMeso() >= meso; + } +} diff --git a/src/tools/DatabaseConnection.java b/src/tools/DatabaseConnection.java index a988477d48..3e3194dc6d 100644 --- a/src/tools/DatabaseConnection.java +++ b/src/tools/DatabaseConnection.java @@ -3,47 +3,89 @@ package tools; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; +import java.util.Properties; +import org.apache.commons.dbcp2.ConnectionFactory; +import org.apache.commons.dbcp2.DriverManagerConnectionFactory; +import org.apache.commons.dbcp2.PoolableConnectionFactory; +import org.apache.commons.dbcp2.PoolingDriver; +import org.apache.commons.pool2.impl.GenericObjectPool; import constants.ServerConstants; /** * @author Frz (Big Daddy) * @author The Real Spookster (some modifications to this beautiful code) + * @author Ronan (some connection pool to this beautiful code) */ public class DatabaseConnection { - - public static final int RETURN_GENERATED_KEYS = 1; - - private static ThreadLocal con = new ThreadLocalConnection(); - - public static Connection getConnection() { - Connection c = con.get(); - try { - c.getMetaData(); - } catch (SQLException e) { // connection is dead, therefore discard old object 5ever - con.remove(); - c = con.get(); + private static Properties prop; + + public static Connection getConnection() throws SQLException { + if(prop != null) { + Connection con = null; + while(con == null) { //oh yes, this will loop until success! + try { + con = DriverManager.getConnection(ServerConstants.DB_URL, prop); + } catch (SQLException sqle) {} + } + + return con; + } else { + return DriverManager.getConnection(ServerConstants.DB_URL, ServerConstants.DB_USER, ServerConstants.DB_PASS); } - return c; + } + + private static Properties getProperties() { + Properties connectionProperties = new Properties(); + connectionProperties.put("user", ServerConstants.DB_USER); + connectionProperties.put("password", ServerConstants.DB_PASS); + + connectionProperties.put("minIdle", "-1"); + connectionProperties.put("maxIdle", "-1"); + + connectionProperties.put("testOnBorrow", "true"); + connectionProperties.put("lifo", "false"); + + connectionProperties.put("maxTotal", "42"); //max allotted connections + connectionProperties.put("maxConnLifetimeMillis", "60000"); //connection remains valid for 1 min + connectionProperties.put("maxWaitMillis", "777"); //there are more pools, if this one is unavailable then pass to another already + connectionProperties.put("poolPreparedStatements", "true"); + connectionProperties.put("maxOpenPreparedStatements", "100"); //max allotted PS + + return connectionProperties; + } + + private PoolingDriver installDriver(short id) { + GenericObjectPool connectionPool = new GenericObjectPool(null); + ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(ServerConstants.DB_URL, prop); + PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool.getJmxName()); + PoolingDriver driver = new PoolingDriver(); + driver.registerPool("maplesolaxiapool" + id, connectionPool); + + return driver; } - private static class ThreadLocalConnection extends ThreadLocal { - - @Override - protected Connection initialValue() { + public DatabaseConnection() { + prop = null; + + try { + Class.forName("com.mysql.jdbc.Driver"); // touch the mysql driver + } catch (ClassNotFoundException e) { + System.out.println("[SEVERE] SQL Driver Not Found. Consider death by clams."); + e.printStackTrace(); + return; + } + + if(ServerConstants.DB_EXPERIMENTAL_POOLS > 0) { + // Connection Pool on database ftw! + + prop = getProperties(); try { - Class.forName("com.mysql.jdbc.Driver"); // touch the mysql driver - } catch (ClassNotFoundException e) { - System.out.println("[SEVERE] SQL Driver Not Found. Consider death by clams."); - e.printStackTrace(); - return null; - } - try { - return DriverManager.getConnection(ServerConstants.DB_URL, ServerConstants.DB_USER, ServerConstants.DB_PASS); - } catch (SQLException e) { - System.out.println("[SEVERE] Unable to make database connection."); - e.printStackTrace(); - return null; + for(short i = 0; i < ServerConstants.DB_EXPERIMENTAL_POOLS; i++) { + DriverManager.registerDriver(installDriver(i)); + } + } catch(SQLException sqle) { + sqle.printStackTrace(); } } } diff --git a/tools/MapleIdRetriever/build/built-jar.properties b/tools/MapleIdRetriever/build/built-jar.properties index 8a828d751e..f7282e5599 100644 --- a/tools/MapleIdRetriever/build/built-jar.properties +++ b/tools/MapleIdRetriever/build/built-jar.properties @@ -1,4 +1,4 @@ -#Sat, 05 Aug 2017 17:48:47 -0300 +#Tue, 22 Aug 2017 21:30:04 -0300 C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\tools\\MapleIdRetriever= diff --git a/tools/MapleIdRetriever/build/classes/mapleidretriever/MapleIdRetriever.class b/tools/MapleIdRetriever/build/classes/mapleidretriever/MapleIdRetriever.class index dc1f25100a..8a204beabc 100644 Binary files a/tools/MapleIdRetriever/build/classes/mapleidretriever/MapleIdRetriever.class and b/tools/MapleIdRetriever/build/classes/mapleidretriever/MapleIdRetriever.class differ diff --git a/tools/MapleIdRetriever/dist/MapleIdRetriever.jar b/tools/MapleIdRetriever/dist/MapleIdRetriever.jar index 6cdbbb069f..caa900c4bd 100644 Binary files a/tools/MapleIdRetriever/dist/MapleIdRetriever.jar and b/tools/MapleIdRetriever/dist/MapleIdRetriever.jar differ diff --git a/tools/MapleIdRetriever/lib/fetch.txt b/tools/MapleIdRetriever/lib/fetch.txt index ab02c7cbdf..7407ca14cb 100644 --- a/tools/MapleIdRetriever/lib/fetch.txt +++ b/tools/MapleIdRetriever/lib/fetch.txt @@ -1,26 +1,14 @@ -Dark Crystal Ore -DEX Crystal Ore -LUK Crystal Ore -Power Crystal Ore -Wisdom Crystal Ore -Dark Crystal -DEX Crystal -LUK Crystal -Power Crystal -Wisdom Crystal +Orihalcon Platine (M) +Helios -Mana Elixir -Elixir -Power Elixir +Green Neli Shoes +Kage -Reindeer Milk -Sunrise Dew -Sunset Dew +Green Pris (M) +Golden Raven -Silver Rover -Mithril Husk -Gold Eyes -Blue Lorin -Brown Lorin -Steel Pow -Black Bisk \ No newline at end of file +Brown Pireta Hat +Dragon's Tail + +Red Martier +White Fangz diff --git a/tools/MapleIdRetriever/lib/result.txt b/tools/MapleIdRetriever/lib/result.txt index 8cf519cca7..dc604699b3 100644 --- a/tools/MapleIdRetriever/lib/result.txt +++ b/tools/MapleIdRetriever/lib/result.txt @@ -1,26 +1,14 @@ -4004004 -4004002 -4004003 -4004000 -4004001 -4005004 -4005002 -4005003 -4005000 -4005001 -2000006 2000018 2022177 -2000004 2000012 2002012 2022175 2022456 -2000005 2000019 2002013 2022176 2022457 +1412009 1412016 1412020 1412025 -2020013 -2020014 -2020015 +1072207 +1382008 1382024 1382029 1382034 -1082096 -1082104 -1082107 -1082099 -1082098 -1082204 +1462012 + +1002327 +1332023 1332037 1332042 1332047 + +1082210 +1482011 diff --git a/tools/MapleIdRetriever/nbproject/private/private.xml b/tools/MapleIdRetriever/nbproject/private/private.xml index 6807a2ba19..bb8342ed61 100644 --- a/tools/MapleIdRetriever/nbproject/private/private.xml +++ b/tools/MapleIdRetriever/nbproject/private/private.xml @@ -2,6 +2,8 @@ - + + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/tools/MapleIdRetriever/src/mapleidretriever/MapleIdRetriever.java + diff --git a/tools/MapleIdRetriever/src/mapleidretriever/MapleIdRetriever.java b/tools/MapleIdRetriever/src/mapleidretriever/MapleIdRetriever.java index 3674b7b5a6..46a4085f6e 100644 --- a/tools/MapleIdRetriever/src/mapleidretriever/MapleIdRetriever.java +++ b/tools/MapleIdRetriever/src/mapleidretriever/MapleIdRetriever.java @@ -30,7 +30,7 @@ import java.util.ArrayList; * */ public class MapleIdRetriever { - private final static boolean INSTALL_SQLTABLE = true; + private final static boolean INSTALL_SQLTABLE = false; static String host = "jdbc:mysql://localhost:3306/maplesolaxia"; static String driver = "com.mysql.jdbc.Driver"; diff --git a/tools/MobBookUpdate/build/built-jar.properties b/tools/MobBookUpdate/build/built-jar.properties index 02a051abac..b828bcc5c1 100644 --- a/tools/MobBookUpdate/build/built-jar.properties +++ b/tools/MobBookUpdate/build/built-jar.properties @@ -1,4 +1,4 @@ -#Fri, 18 Aug 2017 18:00:41 -0300 +#Tue, 22 Aug 2017 22:50:37 -0300 C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\tools\\MobBookUpdate= diff --git a/tools/MobBookUpdate/build/classes/.netbeans_automatic_build b/tools/MobBookUpdate/build/classes/.netbeans_automatic_build deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/MobBookUpdate/build/classes/.netbeans_update_resources b/tools/MobBookUpdate/build/classes/.netbeans_update_resources deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/MobBookUpdate/build/classes/mobbookupdate/MobBookUpdate.class b/tools/MobBookUpdate/build/classes/mobbookupdate/MobBookUpdate.class index 45dc15e916..838ae80ead 100644 Binary files a/tools/MobBookUpdate/build/classes/mobbookupdate/MobBookUpdate.class and b/tools/MobBookUpdate/build/classes/mobbookupdate/MobBookUpdate.class differ diff --git a/tools/MobBookUpdate/dist/MobBookUpdate.jar b/tools/MobBookUpdate/dist/MobBookUpdate.jar index 5fa2280b66..4578874384 100644 Binary files a/tools/MobBookUpdate/dist/MobBookUpdate.jar and b/tools/MobBookUpdate/dist/MobBookUpdate.jar differ diff --git a/tools/MobBookUpdate/lib/MonsterBook.img.xml b/tools/MobBookUpdate/lib/MonsterBook.img.xml index 4275039b99..173d4e6180 100644 --- a/tools/MobBookUpdate/lib/MonsterBook.img.xml +++ b/tools/MobBookUpdate/lib/MonsterBook.img.xml @@ -166,33 +166,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -918,12 +917,13 @@ - - - - - - + + + + + + + @@ -1268,11 +1268,12 @@ - - - - - + + + + + + @@ -2090,13 +2091,14 @@ - - - - - - - + + + + + + + + @@ -2329,13 +2331,14 @@ - - - - - - - + + + + + + + + @@ -2460,18 +2463,19 @@ - - - - - - - - - - - - + + + + + + + + + + + + + @@ -2991,62 +2995,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3188,49 +3191,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -3383,13 +3344,14 @@ - - - - - - - + + + + + + + + @@ -4347,37 +4309,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -5338,15 +5270,16 @@ - - - - - - - - - + + + + + + + + + + @@ -5780,16 +5713,17 @@ - - - - - - - - - - + + + + + + + + + + + @@ -5899,8 +5833,13 @@ - - + + + + + + + @@ -5909,8 +5848,13 @@ - - + + + + + + + @@ -5923,42 +5867,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -6148,12 +6057,13 @@ - - - - - - + + + + + + + @@ -6181,14 +6091,15 @@ - - - - - - - - + + + + + + + + + @@ -6268,15 +6179,16 @@ - - - - - - - - - + + + + + + + + + + @@ -6437,26 +6349,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -6467,41 +6378,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -7509,68 +7386,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7897,8 +7773,13 @@ - - + + + + + + + @@ -7909,8 +7790,14 @@ - - + + + + + + + + @@ -7919,8 +7806,13 @@ - - + + + + + + + @@ -7931,8 +7823,13 @@ - - + + + + + + + @@ -8268,25 +8165,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -8307,31 +8203,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -8778,16 +8673,7 @@ - - - - - - - - - - + @@ -9275,14 +9161,15 @@ - - - - - - - - + + + + + + + + + @@ -9327,15 +9214,16 @@ - - - - - - - - - + + + + + + + + + + @@ -9412,27 +9300,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -10370,68 +10257,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -12011,47 +11896,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -12064,42 +11909,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -12112,53 +11922,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -13162,13 +12926,14 @@ - - - - - - - + + + + + + + + @@ -13229,10 +12994,9 @@ - - - - + + + @@ -13277,12 +13041,13 @@ - - - - - - + + + + + + + @@ -13477,28 +13242,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -13884,7 +13648,8 @@ - + + @@ -13893,7 +13658,102 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13903,6 +13763,8 @@ + + @@ -13911,7 +13773,8 @@ - + + @@ -13920,7 +13783,8 @@ - + + @@ -13929,7 +13793,8 @@ - + + @@ -13944,18 +13809,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -13970,18 +13839,19 @@ - - - - - - - - - - - - + + + + + + + + + + + + + @@ -13990,27 +13860,28 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -14028,6 +13899,7 @@ + @@ -14037,28 +13909,26 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -14068,23 +13938,27 @@ - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + @@ -14093,8 +13967,62 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14103,6 +14031,7 @@ + @@ -14111,80 +14040,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14193,20 +14123,21 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -14215,23 +14146,25 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -14240,23 +14173,24 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -14265,19 +14199,21 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -14286,16 +14222,17 @@ - - - - - - - - - - + + + + + + + + + + + @@ -14304,36 +14241,40 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -14342,31 +14283,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14378,37 +14323,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14419,29 +14367,29 @@ - - - - - - - + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -14454,35 +14402,35 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -14492,29 +14440,29 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -14527,31 +14475,31 @@ - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -14562,36 +14510,36 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + + + @@ -14600,45 +14548,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + @@ -14647,72 +14597,76 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + + + + + @@ -14721,80 +14675,86 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -14803,63 +14763,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/MobBookUpdate/lib/MonsterBookOrig.img.xml b/tools/MobBookUpdate/lib/MonsterBookOrig.img.xml new file mode 100644 index 0000000000..4275039b99 --- /dev/null +++ b/tools/MobBookUpdate/lib/MonsterBookOrig.img.xml @@ -0,0 +1,14866 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/MobBookUpdate/lib/MonsterBook_updated.img.xml b/tools/MobBookUpdate/lib/MonsterBook_updated.img.xml index 173d4e6180..3fabc2df24 100644 --- a/tools/MobBookUpdate/lib/MonsterBook_updated.img.xml +++ b/tools/MobBookUpdate/lib/MonsterBook_updated.img.xml @@ -3191,7 +3191,49 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4309,7 +4351,37 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5867,7 +5939,41 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6378,7 +6484,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7417,36 +7555,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8375,35 +8511,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8673,7 +8808,17 @@ - + + + + + + + + + + + @@ -9120,8 +9265,27 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -9982,21 +10146,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -10458,8 +10621,27 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -11896,7 +12078,47 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11909,7 +12131,42 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11922,7 +12179,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13438,44 +13741,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13752,8 +14054,7 @@ - - + @@ -13909,26 +14210,10 @@ - - - - - - - - - - - - - - - - - - - - + + + + @@ -14265,16 +14550,15 @@ - - - - - - - - - - + + + + + + + + + diff --git a/tools/SQL/test_mobcarddrop.sql b/tools/SQL/test_mobcarddrop.sql index 21f5f7643a..0b8db06717 100644 --- a/tools/SQL/test_mobcarddrop.sql +++ b/tools/SQL/test_mobcarddrop.sql @@ -36,4 +36,10 @@ SELECT cardid FROM monstercarddata LEFT JOIN drop_data ON monstercarddata.cardid # LENGTHY query that also recovers MISSING cards from mobs that drops card. SELECT id FROM handbook WHERE id NOT IN ( SELECT DISTINCT itemid FROM drop_data -) AND id>=2380000 AND id<2390000; \ No newline at end of file +) AND id>=2380000 AND id<2390000; + +# retrieves number of drops of each represented mob in the monster book +SELECT dropperid, count(*) FROM drop_data WHERE dropperid IN (SELECT mobid FROM monstercardwz) GROUP BY dropperid ORDER BY dropperid; + +# retrieves the rows where the number of drops of those mobs on monsterbook is lacking +SELECT dropperid, count(*) FROM drop_data WHERE dropperid IN (SELECT mobid FROM monstercardwz) GROUP BY dropperid HAVING count(*) < 5 ORDER BY dropperid; \ No newline at end of file diff --git a/wz/Map.wz/Map/Map1/103040000.img.xml b/wz/Map.wz/Map/Map1/103040000.img.xml index de03afb3b6..0aa12601a3 100644 --- a/wz/Map.wz/Map/Map1/103040000.img.xml +++ b/wz/Map.wz/Map/Map1/103040000.img.xml @@ -2369,5 +2369,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wz/Mob.wz/5120100.img.xml b/wz/Mob.wz/5120100.img.xml index 0303ca101e..548064b713 100644 --- a/wz/Mob.wz/5120100.img.xml +++ b/wz/Mob.wz/5120100.img.xml @@ -19,6 +19,9 @@ + + + diff --git a/wz/Mob.wz/7090000.img.xml b/wz/Mob.wz/7090000.img.xml index a0746acc50..4511090a79 100644 --- a/wz/Mob.wz/7090000.img.xml +++ b/wz/Mob.wz/7090000.img.xml @@ -4,7 +4,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -36,6 +36,9 @@ + + + diff --git a/wz/Mob.wz/8090000.img.xml b/wz/Mob.wz/8090000.img.xml index f3c90e3b33..fafd123777 100644 --- a/wz/Mob.wz/8090000.img.xml +++ b/wz/Mob.wz/8090000.img.xml @@ -4,7 +4,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -37,6 +37,9 @@ + + + diff --git a/wz/Quest.wz/Check.img.xml b/wz/Quest.wz/Check.img.xml index b3ee572f3f..2f69e293b8 100644 --- a/wz/Quest.wz/Check.img.xml +++ b/wz/Quest.wz/Check.img.xml @@ -57328,7 +57328,7 @@ - + @@ -62420,6 +62420,7 @@ + @@ -62851,8 +62852,7 @@ - - + @@ -63580,6 +63580,7 @@ + @@ -63661,6 +63662,7 @@ + diff --git a/wz/String.wz/MonsterBook.img.xml b/wz/String.wz/MonsterBook.img.xml index 173d4e6180..3fabc2df24 100644 --- a/wz/String.wz/MonsterBook.img.xml +++ b/wz/String.wz/MonsterBook.img.xml @@ -3191,7 +3191,49 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4309,7 +4351,37 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5867,7 +5939,41 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6378,7 +6484,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7417,36 +7555,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8375,35 +8511,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8673,7 +8808,17 @@ - + + + + + + + + + + + @@ -9120,8 +9265,27 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -9982,21 +10146,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -10458,8 +10621,27 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -11896,7 +12078,47 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11909,7 +12131,42 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11922,7 +12179,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13438,44 +13741,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13752,8 +14054,7 @@ - - + @@ -13909,26 +14210,10 @@ - - - - - - - - - - - - - - - - - - - - + + + + @@ -14265,16 +14550,15 @@ - - - - - - - - - - + + + + + + + + + diff --git a/wz/UI.wz/UIWindow.img.xml b/wz/UI.wz/UIWindow.img.xml index 476ef69dfc..cfabf4b85c 100644 --- a/wz/UI.wz/UIWindow.img.xml +++ b/wz/UI.wz/UIWindow.img.xml @@ -10178,6 +10178,18 @@ + + + + + + + + + + + +