Compare commits

..

846 Commits

Author SHA1 Message Date
FatBoy a7c3662463 fixed build error 2024-06-08 19:12:56 -05:00
FatBoy 909e04b8d1 update inventory after resource purchase 2024-06-08 19:07:55 -05:00
FatBoy a7d1dc5fd0 Merge branch 'lakebane-old' into lakebane-master
# Conflicts:
#	src/engine/gameManager/LootManager.java
2024-06-08 19:06:15 -05:00
FatBoy 2f87fd9812 r8 gains 25% resource mine production bonus 2024-06-08 19:04:42 -05:00
FatBoy c696bd368e gold amount no longer reduced for mine production 2024-06-08 19:04:42 -05:00
FatBoy 7716d82adb mines named correctly 2024-06-08 19:04:42 -05:00
FatBoy 66804d5704 resource purchasing 2024-06-08 19:04:40 -05:00
FatBoy 02aafc9274 resource purchasing 2024-06-08 19:04:39 -05:00
FatBoy 2ef0d4305c divide by 0 error 2024-06-08 19:04:39 -05:00
FatBoy 972c99a146 server to sell elans at correct costs 2024-06-08 19:04:39 -05:00
FatBoy ad9d27c6ee server to sell resources at correct costs 2024-06-08 19:04:39 -05:00
FatBoy e1d11d5d94 server to sell resources at correct costs 2024-06-08 19:04:39 -05:00
FatBoy ca78a3b581 resource merchant to price resources correctly 2024-06-08 19:04:39 -05:00
FatBoy bcaa5d42ff resource merchant to sell items correctly 2024-06-08 19:04:37 -05:00
FatBoy 6dad14ae57 reimplement resource merchant with 5mil stacks 2024-06-08 19:04:33 -05:00
FatBoy 6e465248b1 drop rates adjusted again again third time 2024-06-08 19:04:30 -05:00
FatBoy 7c106d5d34 drop rates adjusted again again third time 2024-06-08 19:04:30 -05:00
FatBoy 8135ef8e9c drop rates adjusted again again third time 2024-06-08 19:04:30 -05:00
FatBoy db2d6a4bf3 drop rates adjusted again again 2024-06-08 19:04:30 -05:00
FatBoy bb0a3b8b5b drop rates adjusted again 2024-06-08 19:04:30 -05:00
FatBoy 0145a7264d updated maintenance system 2024-06-08 19:04:28 -05:00
FatBoy 6eec56adb4 rune and contract drop rate 2024-06-08 19:04:27 -05:00
FatBoy 01662aae07 mine close crash bug 2024-06-08 19:04:27 -05:00
FatBoy 72d73883a4 catch process mine window logic 2024-06-08 19:04:27 -05:00
FatBoy 9c64dbb70c SIXTH AFTER ROLLBACK: mob rune and contract drop annouces local 2024-06-08 19:04:27 -05:00
FatBoy 9408602c9c FIFTH AFTER ROLLBACK: mob rune and contract work updated correctly 2024-06-08 19:04:27 -05:00
FatBoy 58cf778ce4 FOURTH AFTER ROLLBACK: error catching for attempt ot upgrade warehouses 2024-06-08 19:04:27 -05:00
FatBoy 885b612bd6 THIRD AFTER ROLLBACK: contract and rune and glass drop rates adjusted properly 2024-06-08 19:04:25 -05:00
FatBoy bf69045b0b SECOND AFTER ROLLBACK: serialize MineTimes correctly 2024-06-08 19:04:22 -05:00
FatBoy 8b03fbc15b FIRST AFTER ROLLBACK: reintroduce mines 2024-06-08 19:04:17 -05:00
FatBoy 3c23a070df glass repairable for 3x base repair costs 2024-06-08 19:03:11 -05:00
FatBoy c14cc98ca2 mines reset claimability at 3am CST 2024-06-08 18:58:46 -05:00
FatBoy c326008112 drop rates adjusted again again third time 2024-06-05 19:51:14 -05:00
FatBoy 90facabc7b drop rates adjusted again again third time 2024-06-05 19:45:59 -05:00
FatBoy 6e26a8cfcf drop rates adjusted again again third time 2024-06-05 19:20:03 -05:00
FatBoy 4b1ab35a36 drop rates adjusted again again 2024-06-05 19:02:28 -05:00
FatBoy d733afef58 drop rates adjusted again 2024-06-05 18:56:16 -05:00
FatBoy f30a02a6d5 updated maintenance system 2024-06-05 10:56:27 -05:00
FatBoy b255b1c9f4 rune and contract drop rate 2024-06-05 10:41:14 -05:00
FatBoy 6151a9e650 mine close crash bug 2024-06-04 08:56:06 -05:00
FatBoy 0f7ef9f56b city data msg catch 2024-06-03 19:51:06 -05:00
FatBoy 6d68d048b0 catch process mine window logic 2024-06-03 19:47:23 -05:00
FatBoy 8ccdbf8cc9 SIXTH AFTER ROLLBACK: mob rune and contract drop annouces local 2024-06-03 19:25:54 -05:00
FatBoy 1798a8f170 FIFTH AFTER ROLLBACK: mob rune and contract work updated correctly 2024-06-02 22:02:19 -05:00
FatBoy 737da1bf14 FOURTH AFTER ROLLBACK: error catching for attempt ot upgrade warehouses 2024-06-02 21:55:31 -05:00
FatBoy 45eb0776d6 THIRD AFTER ROLLBACK: contract and rune and glass drop rates adjusted properly 2024-06-02 16:24:55 -05:00
FatBoy f4346b97f7 SECOND AFTER ROLLBACK: serialize MineTimes correctly 2024-06-02 15:58:26 -05:00
FatBoy cf6f684f5e FIRST AFTER ROLLBACK: reintroduce mines 2024-06-02 15:50:21 -05:00
FatBoy a8e3cfa8f7 new mine handling system 2024-05-29 20:51:48 -05:00
FatBoy 0028b7be69 pet msg toggle handling 2024-05-29 20:31:53 -05:00
FatBoy 3f11996b40 box limits resolved 2024-05-29 19:48:35 -05:00
FatBoy 779f5bbb5b null resolution 2024-05-29 19:28:37 -05:00
FatBoy 37c89e6073 Box Tracker 2024-05-29 19:27:10 -05:00
FatBoy 83499816eb Box Tracker 2024-05-29 19:25:45 -05:00
FatBoy 0eb8da855d maintenance resolution 2024-05-29 19:16:03 -05:00
FatBoy 36fb3f12b1 30 second delay to zerg mechanic running 2024-05-29 18:53:06 -05:00
FatBoy ba642e049e null check fix 2024-05-28 23:52:59 -05:00
FatBoy 98835cad90 revert boxflag 2024-05-28 23:39:39 -05:00
FatBoy 4d9600a8bf box flag checker 2024-05-28 22:28:20 -05:00
FatBoy 4089f72d8f box flag checker 2024-05-28 22:23:40 -05:00
FatBoy ead86efcf6 box flag checker 2024-05-28 22:10:35 -05:00
FatBoy ae01a421de box flag checker 2024-05-28 21:52:59 -05:00
FatBoy 469662f732 box flag checker 2024-05-28 21:52:15 -05:00
FatBoy 8b9bc474b4 box flag checker 2024-05-28 21:37:03 -05:00
FatBoy 3815f9df8e box flag checker 2024-05-28 21:30:54 -05:00
FatBoy 6313182c4f mine window processing 2024-05-28 21:28:06 -05:00
FatBoy 40bff54838 box flag situation looked into 2024-05-28 21:24:53 -05:00
FatBoy 2b1299ec4a ZergMultiplier fix 2024-05-28 21:07:38 -05:00
FatBoy 0955dff7aa city map serialization fix 2024-05-28 21:01:47 -05:00
FatBoy 2b18765781 elan stones sell 10 for 1 mil from resource vendor 2024-05-28 20:39:08 -05:00
FatBoy c55f67a977 resource vendor now sells in stack sizes of 500k purchase 2024-05-28 20:24:59 -05:00
FatBoy 730467828c rune price ceiling adjustment 2024-05-28 20:02:02 -05:00
FatBoy ad05f0d7bc gold from mines no longer produces at half value 2024-05-28 19:41:38 -05:00
FatBoy c922d9c532 recall scroll set to 20 seconds 2024-05-28 19:39:16 -05:00
FatBoy ed4d186b10 can no longer PVE to level 76 2024-05-28 19:38:22 -05:00
FatBoy de1bc375ca forced hourly rune and contract drops 2024-05-27 22:22:08 -05:00
FatBoy 1c48b28d4e maintenance fix 2024-05-27 22:04:55 -05:00
FatBoy 0318459ff1 disc rune announcements 2024-05-27 21:45:06 -05:00
FatBoy 4bdc207c37 maintenance completed 2024-05-27 21:36:26 -05:00
FatBoy ba537d7b00 invisible cities on map logging 2024-05-27 21:25:11 -05:00
FatBoy a0164d5abb invisible cities on map logging 2024-05-27 21:23:28 -05:00
FatBoy eec5861944 invisible cities on map logging 2024-05-27 21:14:27 -05:00
FatBoy 094a7a9498 new maintenance completed 2024-05-27 21:00:53 -05:00
FatBoy d93892df6c new maintenance completed 2024-05-27 20:55:51 -05:00
FatBoy 81150642f0 new maintenance completed 2024-05-27 20:51:08 -05:00
FatBoy 7fb5ccf4f1 new maintenance completed 2024-05-27 20:48:40 -05:00
FatBoy ab1e69a6ef maintenance rewrite - needs completeing for r8 2024-05-27 19:16:00 -05:00
FatBoy 2d2832caf9 public variable 2024-05-27 18:36:50 -05:00
FatBoy 5dee08d3ce Merge branch 'lakebane-mines' into lakebane-master
# Conflicts:
#	src/engine/gameManager/CombatManager.java
#	src/engine/mobileAI/utilities/MovementUtilities.java
#	src/engine/net/client/ClientMessagePump.java
#	src/engine/net/client/msg/VendorDialogMsg.java
#	src/engine/objects/CharacterItemManager.java
#	src/engine/objects/Mine.java
#	src/engine/objects/PlayerCharacter.java
#	src/engine/objects/Warehouse.java
2024-05-27 18:36:07 -05:00
FatBoy 75b68c0a8c disc spawn timers corrected 2024-05-26 22:43:03 -05:00
FatBoy a9f006936b yet another attempt at mines 2024-05-26 20:05:28 -05:00
FatBoy 917fddceeb yet another attempt at mines 2024-05-26 20:01:06 -05:00
FatBoy a2da8f3861 yet another attempt at mines 2024-05-26 16:42:13 -05:00
FatBoy b1b2912092 yet another attempt at mines 2024-05-26 16:36:40 -05:00
FatBoy 3bcda38bb7 destroy and remove form cache and DB all buildinsg within city when its being destroyed 2024-05-25 22:29:31 -05:00
FatBoy 918a797f34 timezone updated 2024-05-25 22:13:14 -05:00
FatBoy ba9238a49a new mines system 2024-05-23 19:16:23 -05:00
FatBoy bd5061a7e8 new mines system 2024-05-23 18:14:17 -05:00
FatBoy 270301c35b new mines system 2024-05-23 18:07:39 -05:00
FatBoy ffcaf0e063 new mines system 2024-05-23 18:01:59 -05:00
FatBoy 6e7633828f new mines system 2024-05-23 18:01:02 -05:00
FatBoy 3aac2410b0 new mines system 2024-05-23 17:56:54 -05:00
FatBoy c90378e3f0 delay mine checks to 1 minute intervals 2024-05-22 20:33:03 -05:00
FatBoy 4734f23805 check if mines are active before spamming them to open 2024-05-22 20:27:27 -05:00
FatBoy 47503de748 system to open and close mines 2024-05-22 20:23:19 -05:00
FatBoy 8ab2805e39 xp and range fix 2024-05-22 06:45:32 -05:00
FatBoy 1d703b08a2 xp and range fix 2024-05-22 06:43:51 -05:00
FatBoy a660457883 cannot get XP from the same character in PVP more than once per reboot 2024-05-21 21:49:05 -05:00
FatBoy 4ca81b019b everyone gets an extra disc 2024-05-21 21:39:23 -05:00
FatBoy 5f16b40092 PVP experience only after level 75 2024-05-21 21:20:19 -05:00
FatBoy 0d7beb5a5a PVP experience only after level 75 2024-05-21 20:43:21 -05:00
FatBoy b66e1c1f93 setlevel command goes to 80 now 2024-05-21 20:20:35 -05:00
FatBoy f1e8384af0 mines will start again 2024-05-21 20:19:19 -05:00
FatBoy c9dcb82c45 removed leadership cap 2024-05-21 20:12:03 -05:00
FatBoy c2c946165c scaling XP gains for groups 2024-05-21 20:11:03 -05:00
FatBoy ffd65b3641 mob range min set to 6 2024-05-21 17:42:19 -05:00
FatBoy ba2084ceb0 level 80 characters get a 5th disc rune 2024-05-21 17:40:52 -05:00
FatBoy 34ec123702 level cap increased to 80 Experience altered 2024-05-21 17:28:57 -05:00
FatBoy 7c36325905 level cap increased to 80 Experience altered 2024-05-21 17:20:18 -05:00
FatBoy 915f182d79 level cap increased to 80 2024-05-21 17:12:35 -05:00
FatBoy fb1d6a3248 auto update NPC slot location and reload on mesh change for buildings 2024-05-21 17:01:23 -05:00
FatBoy 6d16eccc24 shrines can be looted once destroyed 2024-05-21 16:41:28 -05:00
FatBoy fa5cdae17e shrine delete button causes rubble pile 2024-05-21 16:11:35 -05:00
FatBoy b46eb8639d capturing city will cede all buildinsg to conquerer 2024-05-21 14:34:17 -05:00
FatBoy 58916c35c7 shrines can be destroyed 2024-05-21 14:26:57 -05:00
FatBoy f80d50f95e buildings cannot be deleted if the city is under siege 2024-05-21 14:23:59 -05:00
FatBoy 77f2e413c9 Mine time and cap changes 2024-05-21 14:20:33 -05:00
FatBoy 5e84ee8b11 pet run/walk determined by owner 2024-05-21 14:16:03 -05:00
FatBoy b6a9a0c813 detection of using /tar 2024-05-20 21:26:39 -05:00
FatBoy f7e6307d66 Mine optimization 2024-05-20 21:19:53 -05:00
FatBoy 1359417b40 databse update for stacked resources 2024-05-20 14:23:16 -05:00
FatBoy 85077a5e56 databse update for stacked resources 2024-05-20 14:22:06 -05:00
FatBoy 366815f1f9 databse update for stacked resources 2024-05-20 14:11:29 -05:00
FatBoy 2ca51d6a83 merchant resource stacking 2024-05-20 14:07:30 -05:00
FatBoy b7ebb728e2 attempted warehouse delay issue resolution 2024-05-20 13:35:49 -05:00
FatBoy 023057668a attempted warehouse delay issue resolution 2024-05-20 13:34:03 -05:00
FatBoy a11b590573 revert deposit change 2024-05-20 11:26:02 -05:00
FatBoy 353d211a04 PC cleanup 2024-05-20 11:15:38 -05:00
FatBoy c792e49fdc added 30 second delay to Enrollment Officer 2024-05-20 11:14:24 -05:00
FatBoy f8e99a84b1 optimized ManageCityAssetMsgHandler 2024-05-20 11:01:28 -05:00
FatBoy b28c157a5c Revert "optimized deleting items"
This reverts commit 0ac7a1a7fa.
2024-05-20 10:46:43 -05:00
FatBoy 85717a1880 Revert "optimized looting system"
This reverts commit 7745ef6949.
2024-05-20 10:46:37 -05:00
FatBoy 0ac7a1a7fa optimized deleting items 2024-05-20 10:30:37 -05:00
FatBoy 7745ef6949 optimized looting system 2024-05-20 10:07:04 -05:00
FatBoy 40078df067 optimized 2024-05-20 00:03:04 -05:00
FatBoy bb28d38735 mob AI aggro cleanup 2024-05-19 07:19:32 -05:00
FatBoy 7bd6e3a149 mob AI message cleanup 2024-05-19 07:13:56 -05:00
FatBoy 72faafedfe resource merchant 2024-05-19 06:40:20 -05:00
FatBoy e560c07aba track chaining for same nations 2024-05-19 06:39:59 -05:00
FatBoy 742232166e prospector cost reduced to 500k on disc merchant 2024-05-19 06:39:55 -05:00
FatBoy 910a5d9e3c prospector costs 500k 2024-05-19 06:39:51 -05:00
FatBoy a943a5a51d update saetor stats 2024-05-19 06:39:43 -05:00
FatBoy e3a278e090 moving in the air with movebuff will result in immediate ground 2024-05-19 06:39:20 -05:00
FatBoy 5959209081 fly work 2024-05-19 06:39:09 -05:00
FatBoy e222cb3543 zerg multiplier application work 2024-05-19 06:38:56 -05:00
FatBoy a4efe199c6 saetor starting runes added 2024-05-19 06:35:03 -05:00
FatBoy fa5ac4fea3 euro mines time changed up by 4 hours 2024-05-19 06:34:51 -05:00
FatBoy f28c887b92 inline method 2024-05-18 14:58:52 -05:00
FatBoy c1331efe38 add is alive check to box refresh 2024-05-18 12:26:17 -05:00
FatBoy b113b55703 optimisation 2024-05-18 11:50:06 -05:00
FatBoy 560466e3ef null check 2024-05-18 10:55:06 -05:00
FatBoy 0457287905 fixed ballad of beregund the bold 2024-05-18 10:25:55 -05:00
FatBoy db7e9276b1 fixed ballad of beregund the bold 2024-05-18 10:22:17 -05:00
FatBoy a14057b9df resource stacking optimized location 2024-05-18 08:44:04 -05:00
FatBoy 0a3624e503 5 second delay for switching boxes 2024-05-18 00:24:41 -05:00
FatBoy 45048b2b4e box check only every 10 seconds 2024-05-18 00:08:58 -05:00
FatBoy 27550293d6 box check only every 10 seconds 2024-05-17 23:57:03 -05:00
FatBoy 422cf10eea box check only every 10 seconds 2024-05-17 23:56:46 -05:00
FatBoy c412336257 box check only every 5 seconds 2024-05-17 23:38:53 -05:00
FatBoy c8bea0d1ce resource merchant 2024-05-17 23:14:15 -05:00
FatBoy e66a8459c0 flash message can be more than one word 2024-05-17 19:28:24 -05:00
FatBoy 817067d242 flash message can be more than one word 2024-05-17 19:03:50 -05:00
FatBoy 942288cee2 mob resists 2024-05-17 18:19:24 -05:00
FatBoy 8d633adbb3 disc dropper resists 2024-05-17 18:11:37 -05:00
FatBoy a821f7f7e4 r8 resists 2024-05-17 18:07:24 -05:00
FatBoy 0581cab5cb mob resists 2024-05-17 17:49:54 -05:00
FatBoy 6ee1c02e08 mob resists 2024-05-17 17:45:19 -05:00
FatBoy 8379b48332 mob resists 2024-05-17 17:34:42 -05:00
FatBoy e2ae758e36 bank refresh 2024-05-17 17:31:37 -05:00
FatBoy 8f1855fb3f bank refresh 2024-05-17 17:29:22 -05:00
FatBoy e15164bcb2 Boxed Flag 2024-05-17 17:23:49 -05:00
FatBoy 836fa4f8dc Boxed Flag 2024-05-17 17:22:06 -05:00
FatBoy fe7f4dc3ca stealth breaking when attacking 2024-05-17 17:07:58 -05:00
FatBoy 19402bf06f stealth breaking when attacking 2024-05-17 17:06:43 -05:00
FatBoy bed49c0230 stealth breaking when attacking 2024-05-17 17:05:21 -05:00
FatBoy 9c79dca2c5 weird range check issue resolved 2024-05-17 16:55:30 -05:00
FatBoy 3820d179c6 better protocol error tracking 2024-05-16 19:37:55 -05:00
FatBoy 6e1db9489a track chaining for same nations 2024-05-15 21:43:29 -05:00
FatBoy 8227db92c8 prospector cost reduced to 500k on disc merchant 2024-05-15 21:32:01 -05:00
FatBoy 06309daae6 prospector costs 500k 2024-05-15 21:21:35 -05:00
FatBoy 49e5be959f spells that target self now default to self target 2024-05-15 20:55:58 -05:00
FatBoy 74a22d4cf5 update saetor stats 2024-05-15 20:42:28 -05:00
FatBoy 3f827cebd8 boxed characters now get recurring travel stance effect 2024-05-15 20:23:39 -05:00
FatBoy ae734cbb0a mob AI work 2024-05-15 20:09:46 -05:00
FatBoy bde3e54fd4 mob AI work 2024-05-15 20:05:18 -05:00
FatBoy fa5144c932 mob AI work 2024-05-15 20:03:20 -05:00
FatBoy de08d0d210 mob AI work 2024-05-15 20:03:03 -05:00
FatBoy 79a9bfd606 fix banks 2024-05-15 19:55:42 -05:00
FatBoy 491519216c moving in the air with movebuff will result in immediate ground 2024-05-15 17:43:13 -05:00
FatBoy 048c4dfb1b fly work 2024-05-15 17:33:14 -05:00
FatBoy d14144cdf3 zerg multiplier application work 2024-05-15 17:00:16 -05:00
FatBoy d610bccdee 5 second delay forced between warehouse transactions 2024-05-15 16:46:00 -05:00
FatBoy 39f7be99b0 gold dupe prevention 2024-05-15 16:29:23 -05:00
FatBoy 01aa226c62 transfer item to vault fixed 2024-05-15 16:00:53 -05:00
FatBoy 87bd67b0f5 saetor starting runes added 2024-05-15 15:54:19 -05:00
FatBoy 70edd4c19c euro mines time changed up by 4 hours 2024-05-15 15:50:23 -05:00
FatBoy 6c86da0719 looting auto stacks resources 2024-05-14 22:11:53 -05:00
FatBoy 84cc435a2b trading auto stacks resources 2024-05-14 22:09:05 -05:00
FatBoy 5e61ef26e1 stack resources completed 2024-05-14 22:03:45 -05:00
FatBoy 9e85c1e361 stack resources 2024-05-14 21:55:20 -05:00
FatBoy 3d80a03e1e Resource Auto Stacking 2024-05-13 18:18:51 -05:00
FatBoy 15136518a3 Resource Auto Stacking 2024-05-13 18:12:30 -05:00
FatBoy b8abe94a8c Resource Auto Stacking 2024-05-13 17:47:00 -05:00
FatBoy f2e4e8062e cant inventory junk more than 10 mil 2024-05-13 16:29:10 -05:00
FatBoy feaa38ee98 mine caps 2024-05-12 21:51:00 -05:00
FatBoy 6f453ab5c4 discs junkable 2024-05-12 21:45:41 -05:00
FatBoy af839c108c runes and contracts drop rate increased by 3x 2024-05-12 21:07:42 -05:00
FatBoy 8bac27f0fc mine cap sizes 2024-05-12 20:47:26 -05:00
FatBoy bfb257c410 trainer buildings granted 3 slots at r1 2024-05-12 20:46:49 -05:00
FatBoy 3be694275d removed 20 man mines 2024-05-12 20:36:38 -05:00
FatBoy f885560e52 trainer upgrade cost reduced to 25% 2024-05-12 20:23:30 -05:00
FatBoy a8a9cdb0f1 mob resist issue 2024-05-12 17:03:29 -05:00
FatBoy 210cc94dac mob resist issue 2024-05-12 16:56:41 -05:00
FatBoy bf503c0be0 mob resist issue 2024-05-12 16:54:05 -05:00
FatBoy 24c16e6cf1 mob resist issue 2024-05-12 16:51:49 -05:00
FatBoy a6fb7ec0a0 mob resist issue 2024-05-12 16:49:10 -05:00
FatBoy cb9197013e mob resist issue 2024-05-12 16:45:45 -05:00
FatBoy e1584161c9 mob resist issue 2024-05-12 16:44:37 -05:00
FatBoy 0c85c1d289 mob resist issue 2024-05-12 16:44:19 -05:00
FatBoy ead9683b98 mob resist issue 2024-05-12 16:41:15 -05:00
FatBoy c29d6f548e mob resist issue 2024-05-12 16:40:55 -05:00
FatBoy 5822cb1ab4 mob resist issue 2024-05-12 16:40:00 -05:00
FatBoy 371d077320 mob resist issue 2024-05-12 16:38:32 -05:00
FatBoy 984c4d205a mob resist issue 2024-05-12 16:32:41 -05:00
FatBoy 8cc92e9792 mob resist issue 2024-05-12 16:31:29 -05:00
FatBoy c1ea68aa41 mob resist issue 2024-05-12 16:21:07 -05:00
FatBoy 324851a8ab mob resist issue 2024-05-12 16:20:17 -05:00
FatBoy cd512100a2 mob resist issue 2024-05-12 16:13:11 -05:00
FatBoy a0e78d8add mob resist issue 2024-05-12 16:12:26 -05:00
FatBoy f02d79c65e mob resist issue 2024-05-12 16:11:10 -05:00
FatBoy cfffb0c16a mob resist issue 2024-05-12 16:07:24 -05:00
FatBoy 8804a3ecd4 mob resist issue 2024-05-12 16:04:32 -05:00
FatBoy 16c84f2b30 mob resist issue 2024-05-12 15:57:44 -05:00
FatBoy 5858aabc83 mob resist issue 2024-05-11 20:30:00 -05:00
FatBoy 4b81a5c435 mob resist issue 2024-05-11 20:26:50 -05:00
FatBoy c1107ae98d mob resist issue 2024-05-11 20:26:02 -05:00
FatBoy c5f2464d55 mob resist issue 2024-05-11 20:21:10 -05:00
FatBoy e0beab2dc5 mob resist issue 2024-05-11 20:10:24 -05:00
FatBoy bcbeacd60e mob resist issue 2024-05-11 19:58:57 -05:00
FatBoy e39c7bebb5 mob resist issue 2024-05-11 19:13:51 -05:00
FatBoy 4e6e56350c mob resist issue 2024-05-11 18:57:20 -05:00
FatBoy a33d650738 mob resist issue 2024-05-11 18:53:06 -05:00
FatBoy 12b44e216c mob resist issue 2024-05-11 18:49:29 -05:00
FatBoy a202a0544e mob resist issue 2024-05-11 18:44:16 -05:00
FatBoy 8156f261fc mob aggro issue 2024-05-11 18:27:04 -05:00
FatBoy 283ae37919 mob aggro issue 2024-05-11 18:18:28 -05:00
FatBoy 3e30c7a01e no more dead or self track 2024-05-11 18:12:21 -05:00
FatBoy a5570e4bb5 no more dead or self track 2024-05-11 18:10:32 -05:00
FatBoy 290aec79ba pets kills are aded to kill spam 2024-05-11 18:06:03 -05:00
FatBoy 1378bc8030 attempting to fly with movement buff will ground you 2024-05-11 17:59:13 -05:00
FatBoy bd536961e2 removal group guil refreshes group windows 2024-05-11 17:43:34 -05:00
FatBoy 17aee68575 2x xp for solo players without a group 2024-05-11 17:38:49 -05:00
FatBoy a97f4e6da6 conc pots cant be deleted 2024-05-11 17:27:20 -05:00
FatBoy 2274a9e16e Hamlet Guards Immune To All 2024-05-11 17:22:34 -05:00
FatBoy 1caa704b6a removed BOXED text from flag 2024-05-11 17:14:39 -05:00
FatBoy 1bb4e17ead Boxed Title 2024-05-10 18:31:17 -05:00
FatBoy d84b214fd3 Boxed Title 2024-05-10 18:28:30 -05:00
FatBoy 4440ed1f0d Boxed Title 2024-05-10 18:23:35 -05:00
FatBoy f0ad1b730c Boxed Title 2024-05-10 18:18:22 -05:00
FatBoy d968c4eca4 Boxed Title 2024-05-10 18:12:51 -05:00
FatBoy 38816f25bb refiner? 2024-05-10 18:06:03 -05:00
FatBoy 58f5bf05e0 refiner? 2024-05-10 17:59:14 -05:00
FatBoy 78d9e3d6fc Blood rue dropper update 2024-05-10 17:13:44 -05:00
FatBoy d1c07e88fc CC staff dropper 2024-05-10 16:49:33 -05:00
FatBoy dcd108e3ac dropper resists 2024-05-10 16:41:47 -05:00
FatBoy 2c2a2464ee dropper resists 2024-05-09 21:26:19 -05:00
FatBoy ee5c254de4 box check 2024-05-09 21:00:27 -05:00
FatBoy efa4ce91fa adjusted rates properly 2024-05-09 20:19:05 -05:00
FatBoy cd45f49b07 cant delete disc runes 2024-05-09 20:02:21 -05:00
FatBoy 116c9bfdfb debugging 2024-05-09 19:36:55 -05:00
FatBoy 4ec7c3c4bd cleanup 2024-05-09 19:05:54 -05:00
FatBoy 281dde533a cleanup 2024-05-09 18:56:05 -05:00
FatBoy 55b6f95696 cleanup 2024-05-08 21:58:05 -05:00
FatBoy e120ae6e18 cleanup 2024-05-08 21:49:22 -05:00
FatBoy 9e44c9475a cleanup 2024-05-08 21:42:04 -05:00
FatBoy 4d8cb339c3 errant characters recall to SDR 2024-05-05 20:26:45 -05:00
FatBoy b1dfd9a40d shade sneak recast 2024-05-05 20:13:19 -05:00
FatBoy cff6714160 remove day fo week bane placement restriction 2024-05-05 19:59:29 -05:00
FatBoy 16a9d4e5c9 blood rune check work 2024-05-04 10:14:20 -05:00
FatBoy 3189d64031 blood rune check work 2024-05-04 10:11:08 -05:00
FatBoy 5cd94234e9 blood rune check work 2024-05-04 09:53:01 -05:00
FatBoy b45b325cad human blood runes cost 0 2024-05-03 21:44:35 -05:00
FatBoy b731291e6c human blood runes cost 0 2024-05-03 21:22:27 -05:00
FatBoy c207bd14b6 human blood runes cost 0 2024-05-03 21:04:22 -05:00
FatBoy 4924133416 humans can only apply 1 Blood Rune 2024-05-03 21:03:32 -05:00
FatBoy 6769286c4a Adjust Mine Times 2024-05-03 20:56:49 -05:00
FatBoy d21bf0185b catch exceptin for missing tokens 2024-05-03 19:36:07 -05:00
FatBoy 3312ea292f healer archmage fix and saetor ranger fix 2024-05-02 20:50:41 -05:00
FatBoy c7604d0f2c Allow Saetor Rangers 2024-05-02 20:44:06 -05:00
FatBoy 1206441ab3 assorted fixes 2024-05-02 19:42:12 -05:00
FatBoy 679346383a assorted fixes 2024-05-02 19:27:07 -05:00
FatBoy e8df9ef0ea terraform update 2024-05-01 21:20:04 -05:00
FatBoy 3d683fc9a3 dropper resists 2024-05-01 21:00:26 -05:00
FatBoy fbeda13a48 dropper resists 2024-05-01 20:51:10 -05:00
FatBoy d598887f61 enable minor version checks 2024-05-01 20:45:11 -05:00
FatBoy 40372e1b35 enable minor version checks 2024-05-01 20:33:46 -05:00
FatBoy 4476c3863d disable minor version checks 2024-05-01 20:18:03 -05:00
FatBoy 08f94226ba Disc Droppers get increased stats 2024-05-01 19:15:08 -05:00
FatBoy 7eb9eca7d0 Disc Droppers get 75% resist all 2024-05-01 18:55:16 -05:00
FatBoy c43c3de18a zone loading 2024-04-30 21:08:22 -05:00
FatBoy 9e0fa541a2 zone loading 2024-04-30 20:49:18 -05:00
FatBoy 58035d0f93 zone loading 2024-04-30 20:45:29 -05:00
FatBoy 92460d455b zone loading 2024-04-30 20:44:08 -05:00
FatBoy 3c5f510969 zone loading 2024-04-30 20:30:29 -05:00
FatBoy e3c8be6102 zone loading 2024-04-30 20:25:33 -05:00
FatBoy 5f0eb266c2 zone loading 2024-04-30 20:20:08 -05:00
FatBoy c721d6d4a8 zone loading 2024-04-30 20:12:50 -05:00
FatBoy d0b716eb41 zone loading 2024-04-30 20:03:22 -05:00
FatBoy a4a375e13b zone loading 2024-04-30 19:50:27 -05:00
FatBoy c56702bd75 promoting to active duty 2024-04-30 19:44:05 -05:00
FatBoy 5c023b4c4d log machine ID 2024-04-30 19:25:57 -05:00
FatBoy 4b67cbef38 realm date time console spam fix 2024-04-30 19:08:39 -05:00
FatBoy 6cf2705013 better DS application 2024-04-30 19:01:31 -05:00
FatBoy 66bc73a2b6 harmful spells break stealth 2024-04-29 18:55:04 -05:00
FatBoy 77cfa02bea players already flagged active cannot promote to active 2024-04-29 18:51:46 -05:00
FatBoy 93773a7784 Enrollment officer no longer strips buffs 2024-04-29 18:50:09 -05:00
FatBoy 42dd2b4e68 swap active character with NPC 2024-04-28 22:33:18 -05:00
FatBoy 2aed3ef922 no longer delete gold 2024-04-28 20:30:10 -05:00
FatBoy fb6a3706cd implement bane cap sizes based on trees in nation 2024-04-28 18:59:43 -05:00
FatBoy 48e126823f players dont show up on their own track
dead or inactive players dont show up on track
2024-04-28 11:11:24 -05:00
FatBoy b3de192f0b remove name override for vorg 2024-04-27 21:13:19 -05:00
FatBoy 58d5c1969c attack range sync 2024-04-27 19:37:51 -05:00
FatBoy 950108be87 Vorg Name Override 2024-04-27 19:27:49 -05:00
FatBoy a9746b9a2b add npc command 2024-04-26 20:07:26 -05:00
FatBoy eaa287e176 add npc command 2024-04-26 19:53:35 -05:00
FatBoy 67cdf0e98a add npc command 2024-04-26 19:50:41 -05:00
FatBoy 83e2b29635 added set profit dev command 2024-04-25 22:06:17 -05:00
FatBoy c99a361ca7 added set profit dev command 2024-04-25 22:04:32 -05:00
FatBoy f53c2c5cb0 vorg fix 2024-04-24 21:43:48 -05:00
FatBoy 6680651801 disc droppers are alive at server up 2024-04-24 19:03:08 -05:00
FatBoy 66fbbada48 mines close on time 2024-04-24 18:49:18 -05:00
FatBoy ba1cb22662 runegates always open 2024-04-24 17:55:52 -05:00
FatBoy bf9be1f7f9 runegates always open 2024-04-24 17:50:50 -05:00
FatBoy bb4c1d48a4 mob desync issue 2024-04-24 14:59:38 -05:00
FatBoy b33f451285 mob desync issue 2024-04-24 14:52:06 -05:00
FatBoy f865f94806 mob desync issue 2024-04-24 14:47:55 -05:00
FatBoy baf28519c2 mine fix dor delayed closing time 2024-04-23 21:16:00 -05:00
FatBoy 4a2ef92d33 4 hour disc spawns 100% 2024-04-23 20:57:27 -05:00
FatBoy c16ea8f3dd movement sync bug squashed 2024-04-23 20:51:22 -05:00
FatBoy 882ed17b3a Pet damage scales with zerg multiplier 2024-04-23 20:05:22 -05:00
FatBoy d06c298b09 revert power que 2024-04-23 19:39:38 -05:00
FatBoy e4bad5f418 zerg mechanic work 2024-04-23 19:18:30 -05:00
FatBoy 54c0b3d7ce mine work 2024-04-23 18:50:00 -05:00
FatBoy 9d59bde22e mine pulse 2024-04-23 18:38:14 -05:00
FatBoy 47243dd48d powers thread 2024-04-23 06:24:25 -05:00
FatBoy bb6828ec8e powers thread 2024-04-23 06:23:40 -05:00
FatBoy 5d0973c2bc mines thread 2024-04-23 06:10:48 -05:00
FatBoy 4f216364a9 general cleanup 2024-04-23 05:51:10 -05:00
FatBoy c1d193ee45 reduce runegate pulse from 3 seconds to half a second 2024-04-23 05:46:38 -05:00
FatBoy 9879c1b18f various cleanups 2024-04-23 05:44:32 -05:00
FatBoy 928845a220 disc fix 2024-04-22 21:49:15 -05:00
FatBoy 3378272a19 optimize 2024-04-22 19:58:46 -05:00
FatBoy e4c4643678 dieing resets ZergMultiplier 2024-04-22 19:27:07 -05:00
FatBoy 3c1a217ac6 top of the hour disc spawns 2024-04-22 19:25:50 -05:00
FatBoy 1567b22fe4 top of the hour disc spawns 2024-04-22 19:23:08 -05:00
FatBoy 2067bbc6e1 mine closing bug 2024-04-22 19:08:34 -05:00
FatBoy 9790423139 mine closing bug 2024-04-22 18:45:10 -05:00
FatBoy d8a8c1a9a0 mine closing bug 2024-04-22 18:38:14 -05:00
FatBoy 60ab4a846e update irekei move speed 2024-04-22 06:52:27 -05:00
FatBoy 58f250fa64 mob casting temporarily disabled 2024-04-21 21:53:41 -05:00
FatBoy a160df02c4 mines fix 2024-04-21 21:33:30 -05:00
FatBoy 1fa7cbed12 vorg drop ranges 2024-04-21 21:19:46 -05:00
FatBoy d16a56a582 vorg drop ranges 2024-04-21 21:16:25 -05:00
FatBoy 69aca2c728 disc resapwn attempt 2 2024-04-21 20:05:16 -05:00
FatBoy 159960d521 saetor can take born in the country 2024-04-21 19:55:55 -05:00
FatBoy b9871a2729 blood horn and thrall can be taken on all minotaurs and saetors 2024-04-21 19:36:09 -05:00
FatBoy 18f6822cb4 fix mines auto claim when rolle dover 2024-04-21 19:23:01 -05:00
FatBoy 18731839f7 update mine times 2024-04-21 19:19:05 -05:00
FatBoy 1d2e4d5608 desert r8 cant move 2024-04-21 19:15:35 -05:00
FatBoy ef49d0cbe0 apply human and elf runes in game 2024-04-21 19:14:35 -05:00
FatBoy 9604ee4399 sundancer given Find Weakness 2024-04-21 18:30:12 -05:00
FatBoy e708bb02f5 npc buildings dont accumulate gold 2024-04-21 16:42:08 -05:00
FatBoy 73c1f97051 mob cast fix 2024-04-21 16:33:35 -05:00
FatBoy 7a445db673 zerg multiplier fix 2024-04-21 16:19:44 -05:00
FatBoy b3d65ef700 mine lag fix 2024-04-21 16:18:10 -05:00
FatBoy 7a7559dee5 NPC buildings dont run out of gold space on buildings 2024-04-21 16:01:01 -05:00
FatBoy a902ff720a NPC buildings dont run out of gold space on buildings 2024-04-21 15:58:13 -05:00
FatBoy 98cb307e09 extended summon timer now uses extended accept time 2024-04-21 15:55:38 -05:00
FatBoy 0dca6c4662 universal mines round 2 2024-04-21 15:46:29 -05:00
FatBoy c8310ec5ba universal mines round 2 2024-04-21 15:06:03 -05:00
FatBoy 961258f67a reset mine production resources 2024-04-21 14:47:17 -05:00
FatBoy 2854472ae0 fixed bug with mob cast time frequency 2024-04-21 14:45:17 -05:00
FatBoy b81f088a3a disable mob changing target based on hate value 2024-04-21 14:42:57 -05:00
FatBoy be4cbd3f6f vorg baked in stats 2024-04-21 06:19:28 -05:00
FatBoy 7eb6deb1e9 fix cast bug for mob to PC 2024-04-21 06:17:06 -05:00
FatBoy d04cad0484 adjust mines 2024-04-21 06:01:27 -05:00
FatBoy a8a21e9e40 adjust mine times 2024-04-20 11:27:12 -05:00
FatBoy 0d5ff59cb7 Revert "adjust mine times"
This reverts commit cdeebda6f8.
2024-04-20 11:27:04 -05:00
FatBoy cdeebda6f8 adjust mine times 2024-04-20 10:58:32 -05:00
FatBoy 3065f9f7eb disc droppers no longer spawn at server up 2024-04-20 10:56:56 -05:00
FatBoy e2cca6201f summon fix 2024-04-20 10:49:52 -05:00
FatBoy 1f7ea89d66 starting conc issue resolved 2024-04-20 10:40:47 -05:00
FatBoy ce3eacda48 zerg mechanic work 2024-04-20 10:16:24 -05:00
FatBoy 8a3a4645af zerg mechanic work 2024-04-20 10:09:13 -05:00
FatBoy f074fe1825 zerg mechanic work 2024-04-20 10:04:05 -05:00
FatBoy e47430e61b zerg mechanic work 2024-04-20 10:02:41 -05:00
FatBoy b2718779f8 zerg mechanic work 2024-04-20 09:52:21 -05:00
FatBoy 189d0624e7 grouping restriction update 2024-04-20 00:44:30 -05:00
FatBoy a6cfe2fb76 disc droppers dont spawn at boot 2024-04-20 00:34:16 -05:00
FatBoy fa37e1bcca disc dropper time delay 2024-04-20 00:24:47 -05:00
FatBoy 7497526bd9 boons can be refreshed 2024-04-19 16:54:55 -05:00
FatBoy b9c38d9d2b fleet of foot allowed for saetor 2024-04-19 16:49:59 -05:00
FatBoy c8ec0fe191 sitting movement sync bug squashed 2024-04-19 16:43:24 -05:00
FatBoy 1378ddcaef disable clanwarden drop 2024-04-19 16:40:24 -05:00
FatBoy 78f8331582 potion cost bug 2024-04-18 21:46:11 -05:00
FatBoy c197a385c5 mob aggro issue 2024-04-18 21:25:27 -05:00
FatBoy 2c0899982c mine audit 2024-04-18 20:50:15 -05:00
FatBoy 72bc753724 mine audit 2024-04-18 20:44:23 -05:00
FatBoy c43f70128a mine audit 2024-04-18 20:40:07 -05:00
FatBoy 95b23a35fc mine audit 2024-04-18 20:32:29 -05:00
FatBoy 86d0254c2f mine audit 2024-04-18 20:28:57 -05:00
FatBoy d09240d11a only start thread for mine being set to active 2024-04-18 18:43:23 -05:00
FatBoy 5da4b66f81 prinstats will now show regen rates 2024-04-18 13:36:21 -05:00
FatBoy 5247bf77fe luauptime shows boxed and active players online 2024-04-18 13:32:47 -05:00
FatBoy f8a584d000 cannot summon outside of nation 2024-04-18 13:27:01 -05:00
FatBoy 7c2915928d being banished form guild will remove you from any groups 2024-04-18 13:24:06 -05:00
FatBoy 8308ac97e3 leaving guild will remove you from groups you are in 2024-04-18 13:22:07 -05:00
FatBoy 75ea9092e2 cannot group outside of nation 2024-04-18 13:19:21 -05:00
FatBoy d60532c23f cleanup 2024-04-18 13:11:34 -05:00
FatBoy d8f1cf2087 cleanup 2024-04-18 13:07:47 -05:00
FatBoy 379dbe668c nations can only have 1 bane placed on them at a time 2024-04-18 13:04:56 -05:00
FatBoy 52a0c95002 cannot be subbed if you have a bane placed
nations can only have 1 bane placed at a time
2024-04-18 12:58:18 -05:00
FatBoy 360a393a0f cannot invite guilds to sub if you are baned
cannot invite guilds to sub if any tree in your nation has a bane on it

cannot be subbed if you have a bane placed on you
2024-04-18 12:48:04 -05:00
FatBoy 345f4e799b mines get caps 3/5/10/20 2024-04-17 21:05:48 -05:00
FatBoy ef70d7b8ed 3 man mine value assigned 2024-04-17 20:52:56 -05:00
FatBoy f98f54139a Threads for Zerg Mechanics 2024-04-17 20:46:59 -05:00
FatBoy 7e3e337de0 Threads for Zerg Mechanics 2024-04-16 19:52:41 -05:00
FatBoy 74f8f0640f 60 second vamp summon 2024-04-15 22:05:42 -05:00
FatBoy 13babb630d all runes junk for 500k 2024-04-15 21:48:11 -05:00
FatBoy cd87927241 addressed mine bug 2024-04-15 21:46:27 -05:00
FatBoy e3377d26b1 mines only open at their correct times 2024-04-15 21:37:14 -05:00
FatBoy e02dbd3632 Universal Mines 2024-04-15 21:36:03 -05:00
FatBoy 0d7c2cd288 saetor cannot wear shoes 2024-04-15 21:24:49 -05:00
FatBoy 60ba6d5b28 disc rune changes for prospector and black mask 2024-04-15 21:04:32 -05:00
FatBoy 52c3f563a2 changed heal receptivity for vamps and elves 2024-04-14 10:18:59 -05:00
FatBoy 5655aef57a 5% movespeeed increase for IREKEI 2024-04-14 10:02:22 -05:00
FatBoy 487e557ef9 blood droppers 2024-04-13 21:09:28 -05:00
FatBoy f95dd7f6f2 translocate doesnt break on take damage 2024-04-13 21:05:45 -05:00
FatBoy 4f56cacaea unarmed mob damage addressed 2024-04-13 20:57:10 -05:00
FatBoy 36f42770c8 unarmed mob damage addressed 2024-04-13 20:25:39 -05:00
FatBoy 1dfac59b8c traveler and prospector droppers 1 hour spawn timers 2024-04-13 20:22:27 -05:00
FatBoy d22b10e9ef traveler and prospector droppers 1 hour spawn timers 2024-04-13 20:21:57 -05:00
FatBoy 5cdab459bc rogue/mage druids and saetor huntress/fury 2024-04-13 20:08:18 -05:00
FatBoy f62d44d631 rogue/mage druids and saetor huntress/fury 2024-04-13 19:49:10 -05:00
FatBoy 5ee3438e42 start with conc 2024-04-12 23:00:46 -05:00
FatBoy 6b07058dd4 start with conc 2024-04-12 22:55:18 -05:00
FatBoy 1f700cda4c start with conc 2024-04-12 22:52:01 -05:00
FatBoy c5f5c33329 rune merchant cleanup 2024-04-12 22:49:22 -05:00
FatBoy f3b00a6249 rune merchant cleanup 2024-04-12 22:44:26 -05:00
FatBoy 9da4b85dd1 realm cleanup 2024-04-12 21:33:51 -05:00
FatBoy 76da1d0cbf remove lizardman 2024-04-12 21:21:24 -05:00
FatBoy dc5b05e5b5 test 2024-04-12 21:17:42 -05:00
FatBoy 8414fb0039 test 2024-04-12 21:09:38 -05:00
FatBoy 8cdd4910ca NPC buy/sell use DB values 2024-04-12 20:01:01 -05:00
FatBoy ed7e7be3e8 extra summon time doesnt affect safezones 2024-04-10 19:05:55 -05:00
FatBoy 642103b5a2 shadow mantle increased to 15 second duration 2024-04-10 19:03:49 -05:00
FatBoy 1f95abf0b2 summon time takes +1 minute if non-nation players in load range 2024-04-05 21:43:58 -05:00
FatBoy 434e64d7ba 5 second cast time for wizard single teleport 2024-04-05 21:35:08 -05:00
FatBoy 665bc25126 5 second cast time for wizard single teleport 2024-04-05 21:33:40 -05:00
FatBoy 8b01f80231 new ATR vs DEF formula for spells 2024-04-05 21:27:26 -05:00
FatBoy 7fee52c861 cannot use movement speed buffs while flying 2024-04-05 21:25:49 -05:00
FatBoy f8cf531136 condemn list options removed from ToL 2024-04-05 21:17:38 -05:00
FatBoy 936f151a72 shadowmantle duration reduced to 10 seconds 2024-04-05 21:12:18 -05:00
FatBoy 4707bb11f0 recall scrolls take double the time to execute 2024-04-05 20:58:38 -05:00
FatBoy 4de40d054b BH eyes now see GM invis 2024-04-03 21:23:40 -05:00
FatBoy af3eb1d85f contagion castable on players 2024-04-03 20:56:26 -05:00
FatBoy 2990396778 bugfix - item pricing 2024-04-03 20:36:15 -05:00
FatBoy 7f8652b477 dev commands broadcast to server 2024-04-03 20:09:46 -05:00
FatBoy afae0e63ba saetor can now take "Chaos Boon" 2024-04-02 20:23:38 -05:00
FatBoy 850d2dfea0 Nephilim Shrine renames Chaos Shrine 2024-04-02 20:01:25 -05:00
FatBoy dcc92fd89d removed non-gold drops form safehold mobs 2024-04-02 19:53:16 -05:00
FatBoy 1346f490c9 players can now use ./prinstats and ./printresists on themselves 2024-04-02 19:33:09 -05:00
FatBoy 0c1b3d1460 Group translocate not allowed outside active banes and mines 2024-04-02 19:24:38 -05:00
FatBoy d96f10b41e vorg stats finalized 2024-03-31 20:03:20 -05:00
FatBoy 595d0ba9ba hit chance issue resolved 2024-03-31 12:00:56 -05:00
FatBoy 505f8fdd90 hit chance issue resolved 2024-03-31 11:33:44 -05:00
FatBoy bd098fcb24 hit chance work 2024-03-31 11:20:18 -05:00
FatBoy dae20d5591 create saetor shrine blueprint 2024-03-28 19:45:50 -05:00
FatBoy d33de60869 create saetor shrine object 2024-03-28 19:01:16 -05:00
FatBoy 38c9612eb6 saetor skills 2024-03-27 21:08:08 -05:00
FatBoy 4035f45c4f saetor skills 2024-03-27 21:03:43 -05:00
FatBoy 39b235963a saetor skills 2024-03-27 20:53:33 -05:00
FatBoy b142cded72 saetor skills 2024-03-27 20:16:13 -05:00
FatBoy 0e7281fe6a saetor skills 2024-03-27 20:14:44 -05:00
FatBoy fe39454113 saetor skills 2024-03-27 20:12:51 -05:00
FatBoy 74cf9d16c5 saetor skills 2024-03-27 16:44:53 -05:00
FatBoy 4b2563e4a1 saetor skills 2024-03-26 13:26:18 -05:00
FatBoy 1e19e10755 saetor granted skills 2024-03-26 13:23:27 -05:00
FatBoy 0c3e072e0e Backend Saetor work 2024-03-19 20:57:07 -05:00
FatBoy aa10a4c9ac Backend Saetor work 2024-03-19 20:33:34 -05:00
FatBoy 75947db6e5 Backend Saetor work 2024-03-19 20:28:37 -05:00
FatBoy 9d28601761 Backend Saetor work 2024-03-19 19:56:29 -05:00
FatBoy e8ca4863d5 Backend Saetor work 2024-03-19 19:34:54 -05:00
FatBoy a8bfcd08cc Backend Saetor work 2024-03-19 19:12:44 -05:00
FatBoy 8ae4ded83b safe guards dont aggro players 2024-03-17 17:10:07 -05:00
FatBoy 5023d6bb73 Merge branch 'lakebane-mines' into lakebane-custom-races 2024-03-17 16:59:21 -05:00
FatBoy ca47022d88 stats alteration for custom race 2024-03-17 16:59:02 -05:00
FatBoy c304a59d95 See Invis Bug Addressed 2024-03-17 16:17:33 -05:00
FatBoy 7dfc1dea0f fortitudes handled after resist calculations 2024-03-17 16:07:15 -05:00
FatBoy 77fda6a18c altered atr vs def formula 2024-03-17 16:04:30 -05:00
FatBoy b343f4d6d7 resource dupe 2024-03-14 22:05:21 -05:00
FatBoy 77e9a4d9bf resource dupe 2024-03-14 22:00:09 -05:00
FatBoy 512aba5cd9 resource dupe 2024-03-14 21:47:27 -05:00
FatBoy 2d93e408c3 resource dupe 2024-03-14 21:43:32 -05:00
FatBoy edd7be8734 resource dupe 2024-03-14 21:29:47 -05:00
FatBoy 8c6637663d resource dupe 2024-03-14 21:22:34 -05:00
FatBoy 4cb0f28e57 resource dupe 2024-03-14 21:06:26 -05:00
FatBoy 4d21fc0353 daily reboot removal 2024-03-14 20:56:34 -05:00
FatBoy 4d28cd2b25 daily reboot 2024-03-14 20:55:33 -05:00
FatBoy 1be6884ab0 conc removal 2024-03-14 20:53:12 -05:00
FatBoy 74eff825b0 daily auto reboot 2024-03-14 20:50:17 -05:00
FatBoy 1ae1deabdc daily auto reboot 2024-03-14 20:48:38 -05:00
FatBoy 54b7bcf907 pet buffs castable again 2024-03-14 19:40:07 -05:00
FatBoy a8c768931e 2am daily reboot 2024-03-14 19:21:21 -05:00
FatBoy 71687e39c8 2am daily reboot 2024-03-14 19:20:43 -05:00
FatBoy 678e45ce6b 2am daily reboot 2024-03-14 19:20:25 -05:00
FatBoy 5bfeafe8bf fixed scourge mother vorg drops 2024-03-14 19:13:58 -05:00
FatBoy a492e833e8 disc droppers spawn 6 hours apart 2024-03-14 19:04:57 -05:00
FatBoy 92436be3f9 vorg droppers increased difficulty 2024-03-14 18:59:49 -05:00
FatBoy 8890e02981 mobs attack pets 2024-03-14 18:55:23 -05:00
FatBoy 6fe8b80c87 remove resource drop server announcement 2024-03-14 18:54:03 -05:00
FatBoy c2e0979dc3 drop rate work 2024-03-13 21:51:55 -05:00
FatBoy 6023022077 drop rate work 2024-03-13 21:23:47 -05:00
FatBoy 9a570de54c contract and rune drop work 2024-03-13 20:03:32 -05:00
FatBoy d58d8ee67c Lizardman Race Added 2024-03-11 20:39:43 -05:00
FatBoy 132addc0a9 Lizardman Race Added 2024-03-11 20:26:26 -05:00
FatBoy 8bfba1b3a5 Saetor Race Added 2024-03-11 19:23:35 -05:00
FatBoy 0d45bb5bc1 Saetor Race Added 2024-03-10 19:12:12 -05:00
FatBoy 6ea4717263 custom races 2024-03-10 18:31:19 -05:00
FatBoy 7153216f09 custom races 2024-03-10 18:27:09 -05:00
FatBoy 114ccfee9d mob aggro 2024-03-10 16:37:21 -05:00
FatBoy 23e0a0dcc7 mob aggro 2024-03-10 16:34:10 -05:00
FatBoy b2a3eb3e6e uniform disc dropper respawns 2024-03-10 16:29:12 -05:00
FatBoy 13a4ba6e0e terraformsize 2024-03-10 15:52:58 -05:00
FatBoy eaa8828a24 terraformsize 2024-03-10 15:51:02 -05:00
FatBoy 6bbe9317ac terraformsize 2024-03-10 15:49:25 -05:00
FatBoy 0c56631b92 terraformsize 2024-03-10 15:45:25 -05:00
FatBoy a81810d751 terraformsize 2024-03-10 15:44:04 -05:00
FatBoy 9c75e7defe terraformsize 2024-03-10 15:37:40 -05:00
FatBoy 6aba5be67a login crash bug 2024-03-10 13:05:50 -05:00
FatBoy 9c867ee281 login crash bug 2024-03-10 13:00:46 -05:00
FatBoy afc91e22e5 login crash bug 2024-03-10 12:48:05 -05:00
FatBoy 6dac5c7ec8 login crash bug 2024-03-09 21:47:03 -06:00
FatBoy c6c4a128a2 login crash bug 2024-03-09 21:42:56 -06:00
FatBoy 28fa81962d login crash bug 2024-03-09 21:09:52 -06:00
FatBoy 0759c56b14 login crash bug 2024-03-09 21:08:58 -06:00
FatBoy 64e6e035c1 login crash bug 2024-03-09 21:03:32 -06:00
FatBoy 31bf62a678 login crash bug 2024-03-09 21:02:06 -06:00
FatBoy a924e4c876 login crash bug 2024-03-09 21:00:12 -06:00
FatBoy 38e6bdf92d login crash bug 2024-03-09 20:53:25 -06:00
FatBoy 69dd7bcc37 login crash bug 2024-03-09 20:46:15 -06:00
FatBoy f26e8e4559 login crash bug 2024-03-09 20:43:03 -06:00
FatBoy 16e8df3daf login crash bug 2024-03-09 20:35:00 -06:00
FatBoy c98c64262b resource stacking bug 2024-03-09 20:29:35 -06:00
FatBoy a6cf68ef07 resource stacking bug 2024-03-09 20:21:32 -06:00
FatBoy 3b179a5703 resource stacking bug 2024-03-09 20:09:05 -06:00
FatBoy 0638028a59 resource stacking bug 2024-03-09 20:06:02 -06:00
FatBoy 912ebd4742 resource stacking bug 2024-03-09 19:59:21 -06:00
FatBoy c1440f8f9e resource stacking bug 2024-03-09 19:52:52 -06:00
FatBoy 8d32927241 resource stacking bug 2024-03-09 19:41:17 -06:00
FatBoy d058e7506a resource stacking bug 2024-03-09 19:19:58 -06:00
FatBoy dd548acfe1 resource stacking bug 2024-03-09 19:01:52 -06:00
FatBoy acc0c1dc46 zerg test fixes 2024-03-08 22:09:25 -06:00
FatBoy d0c74e0641 30 minute mine windows 2024-03-07 21:45:00 -06:00
FatBoy 095a26e1d9 30 minute mine windows 2024-03-07 21:30:12 -06:00
FatBoy 1cb0848690 30 minute mine windows 2024-03-07 21:23:46 -06:00
FatBoy 60a7b395e5 30 minute mine windows 2024-03-07 21:11:28 -06:00
FatBoy 09e57852f4 30 minute mine windows 2024-03-07 20:25:56 -06:00
FatBoy c2fe156680 30 minute mine windows 2024-03-07 20:24:14 -06:00
FatBoy b9545dbf76 30 minute mine windows 2024-03-07 20:13:20 -06:00
FatBoy 8ce7c09000 30 minute mine windows 2024-03-07 20:09:58 -06:00
FatBoy 9107540212 30 minute mine windows 2024-03-07 20:04:58 -06:00
FatBoy 24bc0097be 30 minute mine windows 2024-03-07 19:45:12 -06:00
FatBoy 7175f79bfe mine HP set to custom value after rebuild 2024-03-07 19:27:28 -06:00
FatBoy 230a7460cd PC null catch 2024-03-06 21:35:04 -06:00
FatBoy e172d3f2d0 Modified Vorg Boots 2024-03-06 21:31:34 -06:00
FatBoy 2e78f44640 nation chat kill messages 2024-03-06 21:27:28 -06:00
FatBoy 5c46af3c52 Bounty Hunter Eyes Fix 2024-03-06 20:51:21 -06:00
FatBoy b9ec8fd540 vorg HA fix 2024-03-06 19:47:31 -06:00
FatBoy d3bf19426c vorg HA fix 2024-03-05 20:50:46 -06:00
FatBoy 734b46d816 vorg HA fix 2024-03-05 20:39:48 -06:00
FatBoy 11310a5b64 vorg HA fix 2024-03-05 20:33:58 -06:00
FatBoy 067f8f8d89 60 second default logout timer 2024-03-03 20:11:47 -06:00
FatBoy afa9ddf89e allow BH and huntsman on all but priest 2024-03-03 20:03:35 -06:00
FatBoy a6cee850a6 allow BH and huntsman on all but priest 2024-03-02 19:16:18 -06:00
FatBoy 5f5616fd2d guards 2024-03-02 19:01:54 -06:00
FatBoy dcd37bce13 guards 2024-03-02 18:55:14 -06:00
FatBoy d438440556 guards 2024-03-02 18:49:54 -06:00
FatBoy 9f58e211a8 guards 2024-03-02 17:41:07 -06:00
FatBoy f52e67e80c guards 2024-03-02 17:28:01 -06:00
FatBoy c520263179 combat bug fix 2024-03-02 17:21:16 -06:00
FatBoy c9f246afec combat bug fix 2024-03-02 17:00:55 -06:00
FatBoy cdf7fcc54d combat bug fix 2024-03-02 16:57:18 -06:00
FatBoy 3553291d1d combat bug fix 2024-03-02 16:56:40 -06:00
FatBoy 67ce60124f combat bug fix 2024-03-02 16:50:57 -06:00
FatBoy 0e6ee13926 combat bug fix 2024-03-02 16:48:19 -06:00
FatBoy 5b0ba790b3 combat bug fix 2024-03-02 16:44:21 -06:00
FatBoy b53f2c2824 combat bug fix 2024-03-02 16:35:00 -06:00
FatBoy b9a87ba407 combat bug fix 2024-03-02 16:17:57 -06:00
FatBoy e3ed34a04b combat bug fix 2024-03-02 16:11:36 -06:00
FatBoy 6915e30eb2 combat bug fix 2024-03-02 15:55:37 -06:00
FatBoy e9c7cc8e04 combat bug fix 2024-03-02 15:52:02 -06:00
FatBoy 90feaea89e combat bug fix 2024-03-02 15:50:44 -06:00
FatBoy 174bceb49e combat bug fix 2024-03-02 15:42:07 -06:00
FatBoy e3ec8d7737 combat bug fix 2024-03-02 15:28:12 -06:00
FatBoy c44a7eafab combat bug fix 2024-03-02 15:18:59 -06:00
FatBoy 879b52c7c7 combat bug fix 2024-03-02 15:14:34 -06:00
FatBoy 1fe3f7dfb1 combat bug fix 2024-03-02 15:11:43 -06:00
FatBoy 2c8517a1e4 combat bug fix 2024-03-02 14:59:27 -06:00
FatBoy 4eff71f288 combat bug fix 2024-03-02 14:54:17 -06:00
FatBoy 349b88f142 investigate vorg LA hood drop never occurring 2024-03-01 21:25:27 -06:00
FatBoy 6b8d1e6f71 chinese mines moved earlier by 1 hour 2024-03-01 21:01:21 -06:00
FatBoy 79022f0e3e enchant stripping bug 2024-03-01 19:58:24 -06:00
FatBoy 523eb8529f enchant stripping bug 2024-03-01 19:51:09 -06:00
FatBoy 5684fb6ce1 enchant stripping bug 2024-03-01 19:44:35 -06:00
FatBoy feb23e63fe zerg mechanic overhaul 2024-03-01 19:41:34 -06:00
FatBoy ab5943e4b2 zerg mechanic overhaul 2024-03-01 19:39:03 -06:00
FatBoy 02d22f0881 Mines no longer produce hourly resources 2024-03-01 19:17:27 -06:00
FatBoy 9b555c0259 Zerg multiplier reduction method 2024-03-01 19:15:27 -06:00
FatBoy 6a4e0e32cc hard set mine windows 2024-02-29 22:06:48 -06:00
FatBoy 5713dab8cf hard set mine windows 2024-02-29 21:59:45 -06:00
FatBoy 71b7fd5c1b hard set mine windows 2024-02-29 21:51:30 -06:00
FatBoy 39e6917ae8 hard set mine windows 2024-02-29 21:49:13 -06:00
FatBoy 86c33c195c hard set mine windows 2024-02-29 21:44:48 -06:00
FatBoy ad6fca61ed hard set mine windows 2024-02-29 21:42:26 -06:00
FatBoy f2b91f875f hard set mine windows 2024-02-29 21:37:02 -06:00
FatBoy ab2b7092fd hard set mine windows 2024-02-29 21:32:39 -06:00
FatBoy d39137d900 hard set mine windows 2024-02-29 21:27:26 -06:00
FatBoy d906d49e51 hard set mine windows 2024-02-29 21:07:36 -06:00
FatBoy 54c48d398b hard set mine windows 2024-02-29 20:58:38 -06:00
FatBoy 98fe77b148 hard set mine windows 2024-02-29 20:57:14 -06:00
FatBoy 9ee3b9d7bb hard set mine windows 2024-02-29 20:48:11 -06:00
FatBoy d6dd61e9c5 pet debugging 2024-02-29 20:06:03 -06:00
FatBoy d92e5d4a45 pet debugging 2024-02-29 20:01:28 -06:00
FatBoy d065e9ffc8 pet debugging 2024-02-29 19:52:08 -06:00
FatBoy 2b63ed08b8 pet debugging 2024-02-29 19:46:01 -06:00
FatBoy 50fb0d39c5 pet debugging 2024-02-29 19:38:21 -06:00
FatBoy bb91502cb4 pet debugging 2024-02-29 19:30:47 -06:00
FatBoy 8f6e13102d pet debugging 2024-02-29 19:20:17 -06:00
FatBoy 0679ffcaec pet debugging 2024-02-29 19:17:37 -06:00
FatBoy 9ab286166e zerg multiplier debug text 2024-02-29 19:11:35 -06:00
FatBoy 0d4e8f3c9a pet buff trouble shooting 2024-02-29 19:04:06 -06:00
FatBoy 02a78d538c pet buff trouble shooting 2024-02-28 21:24:57 -06:00
FatBoy 9e74954422 pet buff trouble shooting 2024-02-28 21:20:16 -06:00
FatBoy a267382481 pet buff trouble shooting 2024-02-28 21:14:56 -06:00
FatBoy 0910b7184c pet buff trouble shooting 2024-02-28 21:05:05 -06:00
FatBoy 297fe8c7a2 pet buff trouble shooting 2024-02-28 21:01:24 -06:00
FatBoy 76405cb968 pet buff trouble shooting 2024-02-28 20:59:52 -06:00
FatBoy a38e5b478a pet buff trouble shooting 2024-02-28 20:46:36 -06:00
FatBoy 4540e5c770 castable enchants removed when being traded or banked or vaulted 2024-02-28 20:32:14 -06:00
FatBoy aef12b2bb4 tree overlap reduction 2024-02-28 20:18:21 -06:00
FatBoy a562af57e9 boon level based on votary rank 2024-02-28 20:00:41 -06:00
FatBoy 03470c699d vorg stats 2024-02-28 19:43:51 -06:00
FatBoy f777f480ad vorg stats 2024-02-28 19:35:39 -06:00
FatBoy ce542ce319 combat problem chasing 2024-02-28 18:48:17 -06:00
FatBoy 7ff879ea64 perfect conc 2024-02-25 21:43:25 -06:00
FatBoy e4274994ff combat null fix 2024-02-25 20:40:37 -06:00
FatBoy 547d222a2d test 2024-02-24 12:51:48 -06:00
FatBoy 5159afc704 bugfix: null combat target 2024-02-24 12:28:46 -06:00
FatBoy 3a771ac585 bane cap sized persist through reboots 2024-02-23 20:56:08 -06:00
FatBoy 97fcbd8608 bane mechanic for zerg measures 2024-02-23 20:47:46 -06:00
FatBoy 39aec46220 bane mechanic for zerg measures 2024-02-23 20:41:31 -06:00
FatBoy 1db30e3c6b bane mechanic for zerg measures 2024-02-23 20:36:19 -06:00
FatBoy 34cb943595 Revert "randomized mine times"
This reverts commit de3f1cf004.
2024-02-23 20:07:20 -06:00
FatBoy bef49fc720 Revert "randomized mine times"
This reverts commit 802d46d66e.
2024-02-23 20:07:11 -06:00
FatBoy 2bbdeb89ff Revert "randomized mine times"
This reverts commit 2f4287783e.
2024-02-23 20:06:59 -06:00
FatBoy 2f4287783e randomized mine times 2024-02-23 20:03:37 -06:00
FatBoy 802d46d66e randomized mine times 2024-02-23 19:46:58 -06:00
FatBoy de3f1cf004 randomized mine times 2024-02-23 19:40:37 -06:00
FatBoy 90e85d3e46 taxing removed from r8 cities 2024-02-23 18:56:59 -06:00
FatBoy 2e104741ba bounty hunter eyes see invis 2024-02-22 21:44:12 -06:00
FatBoy 6461efa1a2 modified production values 2024-02-22 21:23:47 -06:00
FatBoy 320ea7e81c planting on OB and Mael 2024-02-22 21:19:35 -06:00
FatBoy 05eb8cd961 Mine Changes 2024-02-22 21:14:22 -06:00
FatBoy 9909216e27 Mine Changes 2024-02-22 20:51:20 -06:00
FatBoy 33a369821a Mine Changes 2024-02-22 20:49:08 -06:00
FatBoy 6e93e40454 Mine Changes 2024-02-22 20:45:10 -06:00
FatBoy c14fd84d96 Resource Merchant 2024-02-22 20:11:22 -06:00
FatBoy 56c16fc06e Resource Merchant 2024-02-22 20:00:54 -06:00
FatBoy 71274d25d0 Resource Merchant 2024-02-22 19:49:15 -06:00
FatBoy 9d75116790 Resource Merchant 2024-02-22 19:48:29 -06:00
FatBoy 629fce8cff Resource Merchant 2024-02-22 19:35:05 -06:00
FatBoy 7fefd53be2 Resource Merchant 2024-02-22 19:27:14 -06:00
FatBoy 8aab20caf4 Resource Merchant 2024-02-22 19:18:24 -06:00
FatBoy 14ad0b7599 Resource Merchant 2024-02-22 19:16:59 -06:00
FatBoy 267549ce15 Resource Merchant 2024-02-22 19:15:13 -06:00
FatBoy 6e14f723da Resource Merchant 2024-02-22 19:06:25 -06:00
FatBoy 46a9dad407 Resource Merchant 2024-02-22 18:58:02 -06:00
FatBoy e89e2f51b7 Merge branch 'lakebane-zerg' into lakebane-master
# Conflicts:
#	src/engine/InterestManagement/InterestManager.java
#	src/engine/gameManager/SimulationManager.java
#	src/engine/mobileAI/MobAI.java
#	src/engine/objects/CharacterItemManager.java
#	src/engine/objects/Mine.java
#	src/engine/objects/PlayerCharacter.java
2024-02-22 18:53:48 -06:00
FatBoy 40290bdf97 test rune vendor 2024-02-20 21:13:12 -06:00
FatBoy a37e30c550 test rune vendor 2024-02-20 21:06:32 -06:00
FatBoy 0440aabd1e test rune vendor 2024-02-20 21:03:05 -06:00
FatBoy fbc408f617 test rune vendor 2024-02-20 21:01:57 -06:00
FatBoy 0f7410f55f test rune vendor 2024-02-20 20:56:37 -06:00
FatBoy f82a19f243 test rune vendor 2024-02-20 20:50:58 -06:00
FatBoy c9428d2b56 test rune vendor 2024-02-20 20:39:38 -06:00
FatBoy c4bd766156 test rune vendor 2024-02-20 19:40:47 -06:00
FatBoy 44cd8d0013 resource stacking update 2024-02-19 18:41:47 -06:00
FatBoy 84a75f6b83 resource stacking update 2024-02-19 18:39:02 -06:00
FatBoy be902cf09c loot update 2024-02-19 18:30:09 -06:00
FatBoy 0289b5087d loot update 2024-02-19 18:27:56 -06:00
FatBoy b5f36b60f7 loot update 2024-02-19 18:01:19 -06:00
FatBoy 43409d2e4b booty sim 1000 iteration 2024-02-19 17:49:32 -06:00
FatBoy 547de5033b rune and contract rate update 2024-02-19 17:42:02 -06:00
FatBoy 2c7baaf2ac rune and contract rate update 2024-02-19 17:35:19 -06:00
FatBoy 351437b46b rune and contract rate update 2024-02-19 17:25:19 -06:00
FatBoy 1e9f1685da cannot delete gold 2024-02-19 17:19:34 -06:00
FatBoy d9a03ebf93 resources auto stack when entering inventory 2024-02-19 17:16:34 -06:00
FatBoy 666e3d5479 boons become nation friendly 2024-02-19 17:02:42 -06:00
FatBoy 7efd276d52 grant conc pot when level set to 10 2024-02-18 22:13:41 -06:00
FatBoy 46826163be test mechanics removed 2024-02-18 21:49:40 -06:00
FatBoy e70b52d88c test mechanics removed 2024-02-18 21:28:39 -06:00
FatBoy 106dd87216 zerg mechanic tweak 2024-02-18 20:25:11 -06:00
FatBoy c964115c1e resource merchant work 2024-02-18 18:34:46 -06:00
FatBoy 8c022596a7 resource merchant work 2024-02-18 18:31:55 -06:00
FatBoy 2de240dd60 resource merchant work 2024-02-18 18:28:36 -06:00
FatBoy 8e8876587c resource merchant work 2024-02-18 18:25:26 -06:00
FatBoy 8f0e19a10c resource merchant work 2024-02-18 18:17:38 -06:00
FatBoy 2222a335a1 resource merchant work 2024-02-18 18:12:09 -06:00
FatBoy a7bc1d5a6a resource merchant work 2024-02-18 18:04:31 -06:00
FatBoy 0e61f0e7b8 resource merchant work 2024-02-18 17:59:25 -06:00
FatBoy 0d256c17b5 resource merchant work 2024-02-18 17:57:17 -06:00
FatBoy 571ad4b466 resource merchant work 2024-02-18 17:49:13 -06:00
FatBoy 9e7a8bef4a resource merchant work 2024-02-18 17:38:57 -06:00
FatBoy 669db7f021 resource merchant work 2024-02-18 17:36:53 -06:00
FatBoy 13513bcf2a resource merchant work 2024-02-18 17:31:09 -06:00
FatBoy 149630ef5a resource merchant work 2024-02-18 17:20:49 -06:00
FatBoy 257d864132 resource merchant work 2024-02-18 16:58:45 -06:00
FatBoy 6247332f83 resource merchant work 2024-02-18 16:46:28 -06:00
FatBoy e5d606fe8a resource merchant work 2024-02-18 16:41:54 -06:00
FatBoy dc1720b38b resource merchant added 2024-02-18 16:29:40 -06:00
FatBoy 7b5de5f3f5 runey work > profit slider 2024-02-18 16:15:24 -06:00
FatBoy 7de9bdbbe4 runey work > profit slider 2024-02-18 16:14:42 -06:00
FatBoy 88123ad99a runey work > profit slider 2024-02-18 16:07:46 -06:00
FatBoy 0437f10bf9 runey work > profit slider 2024-02-18 16:06:09 -06:00
FatBoy e93f09c184 runey work > profit slider 2024-02-18 16:04:50 -06:00
FatBoy ee60f88e62 add UUID to slottest hireling list 2024-02-18 16:00:16 -06:00
FatBoy 2d4d0f79f8 add UUID to slottest hireling list 2024-02-18 15:58:33 -06:00
FatBoy 664eb04658 adjust "runey" location 2024-02-18 15:56:14 -06:00
FatBoy 1fc9e6251e adjust "runey" location 2024-02-18 15:52:10 -06:00
FatBoy 7eba9501a6 adjust "runey" location 2024-02-18 15:39:23 -06:00
FatBoy 0eb67c83a3 stat runes junk for 500k each 2024-02-18 15:33:08 -06:00
FatBoy 6668c01185 boxed characters to have pathfinding effect applied at all times 2024-02-18 15:27:46 -06:00
FatBoy 76b89d898a added rune merchant 2024-02-18 15:21:16 -06:00
FatBoy 6a28574471 adjusted and scaled mine hitpoints 2024-02-17 21:08:58 -06:00
FatBoy 11faa98503 reduced reources drops 2024-02-17 21:01:28 -06:00
FatBoy a32ba5e262 track range changes 2024-02-17 20:31:53 -06:00
FatBoy 558b645274 erro log fix and zerg mechanic manager 2024-02-17 19:40:26 -06:00
FatBoy a1115e728c custom rates for contracts runes and glass 2024-02-17 19:14:08 -06:00
FatBoy 409f8aa847 various console error fixes 2024-02-17 18:59:44 -06:00
FatBoy 78cf95d290 zerg mechanic work 2024-02-16 23:08:33 -06:00
FatBoy 2c78e0728a Revert "Enchantment Exploring"
This reverts commit c08a93e85d.
2024-02-16 23:07:55 -06:00
FatBoy 31e56b4da6 Revert "zerg mechanic work"
This reverts commit ba3fd7215b.
2024-02-16 23:07:45 -06:00
FatBoy ba3fd7215b zerg mechanic work 2024-02-16 22:55:50 -06:00
FatBoy c08a93e85d Enchantment Exploring 2024-02-16 22:21:40 -06:00
FatBoy b63a5fa1c1 Enchantment Exploring 2024-02-15 20:16:48 -06:00
FatBoy c7494e8a9d Lore Rules 2024-02-15 19:52:09 -06:00
FatBoy f69fde8a3a all items now AutoID 2024-02-14 22:02:04 -06:00
FatBoy 05dace9194 asset windows to display correct modified maintenance 2024-02-14 21:34:43 -06:00
FatBoy ae975b7591 asset windows to display correct modified maintenance 2024-02-14 20:57:48 -06:00
FatBoy 02f376f418 inventory junking 2024-02-14 20:31:19 -06:00
FatBoy 3c2d3782c2 inventory junking 2024-02-14 20:26:29 -06:00
FatBoy daaa1d9ece inventory junking 2024-02-14 20:21:47 -06:00
FatBoy 747056bc8c replace glass drop with HZ table drop 2024-02-14 20:14:34 -06:00
FatBoy b6760d0775 new NPC for ToL support 2024-02-14 20:05:14 -06:00
FatBoy ba4ab458a0 new NPC for ToL support 2024-02-14 19:58:39 -06:00
FatBoy c04fd62e71 new NPC for ToL support 2024-02-14 19:57:03 -06:00
FatBoy 97c063661a new NPC for ToL support 2024-02-14 19:52:29 -06:00
FatBoy 62205150a7 new NPC for ToL support 2024-02-14 19:46:23 -06:00
FatBoy 9f5bdce571 new NPC for ToL support 2024-02-14 19:36:28 -06:00
FatBoy 22a0cb2474 Tol can now support 4 max slost at r7/8 2024-02-14 19:28:11 -06:00
FatBoy 96c1e34a08 Tol can now support 4 max slost at r7/8 2024-02-14 19:11:09 -06:00
FatBoy 3dc7f7c9ed remove combat/nocombat requirement form powers 2024-02-14 18:19:42 -06:00
FatBoy cd1b15834a boxshroud fixes 2024-02-14 14:06:15 -06:00
FatBoy 8a0303e0f5 boxshroud fixes 2024-02-14 14:00:23 -06:00
FatBoy aa0e993038 boxshroud fixes 2024-02-14 13:51:50 -06:00
FatBoy 3ef3a0c37c boxshroud fixes 2024-02-14 13:48:34 -06:00
FatBoy a6a2629fd5 boxshroud fixes 2024-02-14 13:42:57 -06:00
FatBoy e414304e94 boxshroud fixes 2024-02-14 13:35:10 -06:00
FatBoy f5b08c1868 mines set to 5 cap, zerg mechanic buff/debuff introduced 2024-02-14 13:27:00 -06:00
FatBoy 0bdcfe7b51 mines set to 5 cap, zerg mechanic buff/debuff introduced 2024-02-14 09:53:00 -06:00
FatBoy c640caeb54 Zerg Mechanic Completed 2024-02-12 22:06:38 -06:00
FatBoy 3d33a16d06 multiplier display 2024-02-12 20:09:26 -06:00
FatBoy f4778d4f48 multiplier display 2024-02-12 19:55:56 -06:00
FatBoy c8246ff317 multiplier display 2024-02-12 19:54:25 -06:00
FatBoy 7a3a9c6254 multiplier display 2024-02-12 19:41:54 -06:00
FatBoy 545796e297 players removed when leaving mines 2024-02-12 19:21:41 -06:00
FatBoy 6b4eff4d4c players removed when leaving mines 2024-02-12 19:09:21 -06:00
FatBoy 457ed4f4e6 mine show in system chat updated numbers 2024-02-11 23:41:24 -06:00
FatBoy 8f2847a527 Mines calculate local players by guild 2024-02-11 23:18:09 -06:00
FatBoy 7f5df22a14 mines to set random cap size at server boot 5/10/20 2024-02-11 22:48:19 -06:00
FatBoy 4fd737e3ec mines to set random cap size at server boot 5/10/20 2024-02-11 22:47:22 -06:00
FatBoy e891d353ba Vorg mobs drop random piece of set and spawn randomly between 5 and 45 minutes after death 2024-02-11 22:36:48 -06:00
FatBoy c5376d24a5 NPC 5 minute upgrades 2024-02-11 22:03:15 -06:00
FatBoy 85bf30cbdd remove DS on login when no other boxes logged in 2024-02-11 21:26:00 -06:00
FatBoy 775410b00a Revert "5 minute upgrades for NPCs"
This reverts commit de772237c9.
2024-02-11 19:31:25 -06:00
FatBoy a8275c7cc7 Revert "5 minute upgrades for NPCs"
This reverts commit 1b7be0365a.
2024-02-11 19:31:17 -06:00
FatBoy 03025e7f00 5 minute upgrades for initial placement 2024-02-11 19:10:05 -06:00
FatBoy 1b7be0365a 5 minute upgrades for NPCs 2024-02-11 18:42:02 -06:00
FatBoy de772237c9 5 minute upgrades for NPCs 2024-02-11 18:39:31 -06:00
FatBoy e60c635c39 announce rates at login 2024-02-11 18:35:55 -06:00
FatBoy 6db9f115b1 announce rates at login 2024-02-11 17:40:11 -06:00
FatBoy 3f303e1c9e tweak 2024-02-11 17:37:01 -06:00
FatBoy c0ec747e43 any mob over level 30 has a small chance to drop glass 2024-02-11 17:12:43 -06:00
FatBoy b583034b4e hotzone removed from game 2024-02-11 17:01:42 -06:00
FatBoy 3360a034b2 maintenenace only ran for ToL, 3,000,000 cost, recycling daily when payment isnt received 2024-02-11 16:59:46 -06:00
FatBoy 668df83e33 boxed character fix, safezone equipment damage fix, trade fix, creation experience fix, sub guild limits removed 2024-02-11 09:36:10 -06:00
FatBoy fa3234d0f5 xp and conc granted for noob 2024-02-07 22:09:16 -06:00
FatBoy e8973ecb6d xp and conc granted for noob 2024-02-07 22:03:12 -06:00
FatBoy 134aecf4d7 xp and conc granted for noob 2024-02-07 21:53:48 -06:00
FatBoy 08cb49f641 xp and conc granted for noob 2024-02-07 21:41:25 -06:00
FatBoy 2a06015a0e xp and conc granted for noob 2024-02-07 21:38:02 -06:00
FatBoy 4559519512 xp and conc granted for noob 2024-02-07 21:30:16 -06:00
FatBoy 42b2f886d5 xp and conc granted for noob 2024-02-07 21:26:33 -06:00
FatBoy 0ce7f64d94 xp and conc granted for noob 2024-02-07 21:21:04 -06:00
FatBoy 5fbd5ebb5c xp and conc granted for noob 2024-02-07 21:20:41 -06:00
FatBoy 8fed2d3506 xp and conc granted for noob 2024-02-07 21:11:27 -06:00
FatBoy e119f62049 xp and conc granted for noob 2024-02-07 21:10:24 -06:00
FatBoy 228b0c74a9 xp and conc granted for noob 2024-02-07 21:01:53 -06:00
FatBoy c73688de4d xp and conc granted for noob 2024-02-07 20:52:00 -06:00
FatBoy 71288d0203 death in safe zone no longer causes item damage 2024-02-07 16:30:19 -06:00
FatBoy db229dcf74 1000 unit missed spot 2024-02-07 16:04:41 -06:00
FatBoy 2e4bf0823c standard 1000 inventory weight && fixed XP rates 5x/10x 2024-02-07 15:52:42 -06:00
FatBoy d70f9f6dc3 box tweaking 2024-02-05 20:36:21 -06:00
FatBoy a9ecf76585 deathshroud application 2024-02-05 20:25:12 -06:00
FatBoy ea3c571485 deathshroud application 2024-02-05 20:20:54 -06:00
FatBoy 5840de216d deathshroud application 2024-02-05 20:19:41 -06:00
FatBoy c7d26f9dcc box limit adjustment 2024-02-05 20:10:15 -06:00
FatBoy 5287b993fa collection of players for cities and mines 2024-02-05 20:08:39 -06:00
FatBoy 33bd1a0906 characters logged in exceeding max:1 will be given PR999 death shroud 2024-02-05 19:21:25 -06:00
FatBoy 5cd86bc033 characters logged in exceeding max:1 will be given PR999 death shroud 2024-02-05 19:20:27 -06:00
MagicBot bff41967db Revert "Out of combat mode when patrolling."
This reverts commit d3692d0fb7.
2023-09-08 13:07:15 -04:00
MagicBot d3692d0fb7 Out of combat mode when patrolling. 2023-09-08 13:04:29 -04:00
FatBoy 074a799d01 added health recovery to mobs 2023-08-22 20:58:52 -05:00
FatBoy 36ffd08a72 guard minions logic work 2023-08-22 20:52:45 -05:00
FatBoy 58f828b3cd items removed properly from inventory, NPCs nop longer stock base items 2023-08-22 20:52:26 -05:00
702 changed files with 31614 additions and 20429 deletions
+4 -4
View File
@@ -9,8 +9,8 @@
package discord;
import engine.Enum;
import engine.gameManager.ConfigManager;
import engine.mbEnums;
import org.pmw.tinylog.Logger;
import java.sql.*;
@@ -70,7 +70,7 @@ public class Database {
}
}
public boolean updateAccountStatus(String discordAccountID, mbEnums.AccountStatus accountStatus) {
public boolean updateAccountStatus(String discordAccountID, Enum.AccountStatus accountStatus) {
try (Connection connection = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
ConfigManager.MB_DATABASE_PASS.getValue());
@@ -131,7 +131,7 @@ public class Database {
discordAccount = new DiscordAccount();
discordAccount.discordAccount = rs.getString("discordAccount");
discordAccount.gameAccountName = rs.getString("acct_uname");
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
discordAccount.isDiscordAdmin = rs.getByte("discordAdmin"); // Registration date cannot be null
Timestamp registrationDate = rs.getTimestamp("registrationDate");
@@ -328,7 +328,7 @@ public class Database {
discordAccount = new DiscordAccount();
discordAccount.discordAccount = rs.getString("discordAccount");
discordAccount.gameAccountName = rs.getString("acct_uname");
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
// Registration date cannot be null
+2 -2
View File
@@ -8,14 +8,14 @@
package discord;
import engine.mbEnums;
import engine.Enum;
import java.time.LocalDateTime;
public class DiscordAccount {
public String discordAccount;
public String gameAccountName;
public mbEnums.AccountStatus status;
public Enum.AccountStatus status;
public LocalDateTime registrationDate;
public LocalDateTime lastUpdateRequest;
public byte isDiscordAdmin;
+2 -2
View File
@@ -11,7 +11,7 @@ package discord.handlers;
import discord.Database;
import discord.DiscordAccount;
import discord.MagicBot;
import engine.mbEnums;
import engine.Enum;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.List;
@@ -21,7 +21,7 @@ public class AccountInfoRequest {
public static void handleRequest(MessageReceivedEvent event) {
String discordAccountID = event.getAuthor().getId();
mbEnums.AccountStatus accountStatus;
Enum.AccountStatus accountStatus;
if (Database.online == false) {
+6 -6
View File
@@ -11,7 +11,7 @@ package discord.handlers;
import discord.DiscordAccount;
import discord.MagicBot;
import discord.RobotSpeak;
import engine.mbEnums;
import engine.Enum;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.pmw.tinylog.Logger;
@@ -23,7 +23,7 @@ public class BanToggleHandler {
public static void handleRequest(MessageReceivedEvent event, String[] args) {
String discordAccountID;
mbEnums.AccountStatus accountStatus;
Enum.AccountStatus accountStatus;
// Early exit if database unavailable or is not an admin
@@ -55,10 +55,10 @@ public class BanToggleHandler {
// toggle ban status
if (discordAccounts.get(0).status.equals(mbEnums.AccountStatus.BANNED))
accountStatus = mbEnums.AccountStatus.ACTIVE;
if (discordAccounts.get(0).status.equals(Enum.AccountStatus.BANNED))
accountStatus = Enum.AccountStatus.ACTIVE;
else
accountStatus = mbEnums.AccountStatus.BANNED;
accountStatus = Enum.AccountStatus.BANNED;
// We have a valid discord ID at this point. Banstick?
@@ -82,7 +82,7 @@ public class BanToggleHandler {
// If we're toggling status to active we're done here.
if (accountStatus.equals(mbEnums.AccountStatus.ACTIVE))
if (accountStatus.equals(Enum.AccountStatus.ACTIVE))
return;
// Set users role to noob
@@ -11,7 +11,7 @@ package discord.handlers;
import discord.Database;
import discord.DiscordAccount;
import discord.MagicBot;
import engine.mbEnums;
import engine.Enum;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.pmw.tinylog.Logger;
@@ -53,7 +53,7 @@ public class PasswordChangeHandler {
// Banned or suspended user's get no love.
if (discordAccount.status.equals(mbEnums.AccountStatus.BANNED)) {
if (discordAccount.status.equals(Enum.AccountStatus.BANNED)) {
MagicBot.sendResponse(event,
"Sorry but that is too much work. \n" +
"Your account detailings cannot for to log into game!");
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,706 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.InterestManagement;
import engine.Enum;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractWorldObject;
import engine.objects.Zone;
import engine.util.MapLoader;
import org.pmw.tinylog.Logger;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
public class HeightMap {
// Class variables
// Heightmap data for all zones.
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
// Bootstrap Tracking
public static int heightMapsCreated = 0;
public static HeightMap PlayerCityHeightMap;
// Heightmap data for this heightmap
public BufferedImage heightmapImage;
private int heightMapID;
private int maxHeight;
private int fullExtentsX;
private int fullExtentsY;
private float bucketWidthX;
private float bucketWidthY;
private int zoneLoadID;
private float seaLevel = 0;
private float outsetX;
private float outsetZ;
private int[][] pixelColorValues;
public HeightMap(ResultSet rs) throws SQLException {
this.heightMapID = rs.getInt("heightMapID");
this.maxHeight = rs.getInt("maxHeight");
int halfExtentsX = rs.getInt("xRadius");
int halfExtentsY = rs.getInt("zRadius");
this.zoneLoadID = rs.getInt("zoneLoadID");
this.seaLevel = rs.getFloat("seaLevel");
this.outsetX = rs.getFloat("outsetX");
this.outsetZ = rs.getFloat("outsetZ");
// Cache the full extents to avoid the calculation
this.fullExtentsX = halfExtentsX * 2;
this.fullExtentsY = halfExtentsY * 2;
this.heightmapImage = null;
File imageFile = new File(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/" + this.heightMapID + ".bmp");
// early exit if no image file was found. Will log in caller.
if (!imageFile.exists())
return;
// load the heightmap image.
try {
this.heightmapImage = ImageIO.read(imageFile);
} catch (IOException e) {
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
}
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
// Calculate the data we do not load from table
float numOfBuckets = this.heightmapImage.getWidth() - 1;
float calculatedWidth = this.fullExtentsX / numOfBuckets;
this.bucketWidthX = calculatedWidth;
this.bucketWidthY = this.bucketWidthX; // This makes no sense.
// Generate pixel array from image data
generatePixelData();
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
heightMapsCreated++;
}
//Created for PlayerCities
public HeightMap() {
this.heightMapID = 999999;
this.maxHeight = 5; // for real...
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents;
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents;
this.zoneLoadID = 0;
this.seaLevel = 0;
this.outsetX = 128;
this.outsetZ = 128;
// Cache the full extents to avoid the calculation
this.fullExtentsX = halfExtentsX * 2;
this.fullExtentsY = halfExtentsY * 2;
// load the heightmap image.
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = null;
// Calculate the data we do not load from table
this.bucketWidthX = 1;
this.bucketWidthY = 1;
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
for (int y = 0; y <= this.fullExtentsY; y++) {
for (int x = 0; x <= this.fullExtentsX; x++) {
pixelColorValues[x][y] = 255;
}
}
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
}
public HeightMap(Zone zone) {
this.heightMapID = 999999;
this.maxHeight = 0;
int halfExtentsX = (int) zone.getBounds().getHalfExtents().x;
int halfExtentsY = (int) zone.getBounds().getHalfExtents().y;
this.zoneLoadID = 0;
this.seaLevel = 0;
this.outsetX = 0;
this.outsetZ = 0;
// Cache the full extents to avoid the calculation
this.fullExtentsX = halfExtentsX * 2;
this.fullExtentsY = halfExtentsY * 2;
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = null;
// Calculate the data we do not load from table
this.bucketWidthX = 1;
this.bucketWidthY = 1;
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
for (int y = 0; y <= this.fullExtentsY; y++) {
for (int x = 0; x <= this.fullExtentsX; x++) {
pixelColorValues[x][y] = 255;
}
}
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
}
public static void GeneratePlayerCityHeightMap() {
HeightMap.PlayerCityHeightMap = new HeightMap();
}
public static void GenerateCustomHeightMap(Zone zone) {
HeightMap heightMap = new HeightMap(zone);
HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), heightMap);
}
public static Zone getNextZoneWithTerrain(Zone zone) {
Zone nextZone = zone;
if (zone.getHeightMap() != null)
return zone;
if (zone.equals(ZoneManager.getSeaFloor()))
return zone;
while (nextZone.getHeightMap() == null)
nextZone = nextZone.getParent();
return nextZone;
}
public static float getWorldHeight(AbstractWorldObject worldObject) {
Vector2f parentLoc = new Vector2f(-1, -1);
Zone currentZone = ZoneManager.findSmallestZone(worldObject.getLoc());
if (currentZone == null)
return worldObject.getAltitude();
currentZone = getNextZoneWithTerrain(currentZone);
if (currentZone == ZoneManager.getSeaFloor())
return currentZone.getAbsY() + worldObject.getAltitude();
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
HeightMap heightMap = currentZone.getHeightMap();
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), currentZone);
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldObject.getLoc(), currentZone);
if ((parentZone != null) && (parentZone.getHeightMap() != null))
parentLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), parentZone);
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
float worldAltitude = currentZone.getWorldAltitude();
float realWorldAltitude = interaltitude + worldAltitude;
//OUTSET
if (parentZone != null) {
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
float bucketScaleX = heightMap.outsetX / parentXRadius;
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
if (bucketScaleX <= 0.40000001)
bucketScaleX = heightMap.outsetZ / parentXRadius;
if (bucketScaleX > 0.40000001)
bucketScaleX = 0.40000001f;
if (bucketScaleZ <= 0.40000001)
bucketScaleZ = heightMap.outsetX / parentZRadius;
if (bucketScaleZ > 0.40000001)
bucketScaleZ = 0.40000001f;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
float weight;
double scale;
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getWorldAltitude();
realWorldAltitude = outsetALt;
} else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getWorldAltitude();
realWorldAltitude = outsetALt;
}
}
return realWorldAltitude;
}
public static float getWorldHeight(Vector3fImmutable worldLoc) {
Vector2f parentLoc = new Vector2f(-1, -1);
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
if (currentZone == null)
return 0;
currentZone = getNextZoneWithTerrain(currentZone);
if (currentZone == ZoneManager.getSeaFloor())
return currentZone.getAbsY();
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
HeightMap heightMap = currentZone.getHeightMap();
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
return currentZone.getAbsY();
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
if ((parentZone != null) && (parentZone.getHeightMap() != null))
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
float worldAltitude = currentZone.getWorldAltitude();
float realWorldAltitude = interaltitude + worldAltitude;
//OUTSET
if (parentZone != null) {
// if (currentZone.getHeightMap() != null && parentZone.getHeightMap() != null && parentZone.getParent() != null && parentZone.getParent().getHeightMap() != null)
// return realWorldAltitude;
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
float bucketScaleX = heightMap.outsetX / parentXRadius;
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
float weight;
double scale;
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getWorldAltitude();
realWorldAltitude = outsetALt;
} else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getWorldAltitude();
realWorldAltitude = outsetALt;
}
}
return realWorldAltitude;
}
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
Vector2f parentLoc;
float outsetALt = 0;
if (zone.getParent() == null || zone.getParent().getHeightMap() == null)
return interpolatedAltitude + zone.getWorldAltitude();
if (zone.getParent() != null && zone.getParent().getHeightMap() != null) {
parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent());
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone);
float parentXRadius = zone.getBounds().getHalfExtents().x;
float parentZRadius = zone.getBounds().getHalfExtents().y;
float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius;
float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
float weight;
double scale;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent()));
parentCenterAltitude += zone.getYCoord();
parentCenterAltitude += interpolatedAltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
outsetALt = firstScale + secondScale;
outsetALt += zone.getParent().getAbsY();
} else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone));
parentCenterAltitude += zone.getYCoord();
parentCenterAltitude += interpolatedAltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
outsetALt = firstScale + secondScale;
outsetALt += zone.getParent().getAbsY();
}
}
return outsetALt;
}
public static Vector2f getGridOffset(Vector2f gridSquare) {
int floorX = (int) gridSquare.x;
int floorY = (int) gridSquare.y;
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
}
public static void loadAlHeightMaps() {
// Load the heightmaps into staging hashmap keyed by HashMapID
DbManager.HeightMapQueries.LOAD_ALL_HEIGHTMAPS();
//generate static player city heightmap.
HeightMap.GeneratePlayerCityHeightMap();
// Clear all heightmap image data as it's no longer needed.
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
heightMap.heightmapImage = null;
}
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
}
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
float localAltitude = HeightMap.getWorldHeight(currentLoc);
Zone zone = ZoneManager.findSmallestZone(currentLoc);
if (localAltitude < zone.getSeaLevel())
return true;
return false;
}
public Vector2f getGridSquare(Vector2f zoneLoc) {
if (zoneLoc.x < 0)
zoneLoc.setX(0);
if (zoneLoc.x > this.fullExtentsX - 1)
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
if (zoneLoc.y < 0)
zoneLoc.setY(0);
if (zoneLoc.y > this.fullExtentsY - 1)
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
float xBucket = (zoneLoc.x / this.bucketWidthX);
float yBucket = (zoneLoc.y / this.bucketWidthY);
return new Vector2f(xBucket, yBucket);
}
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
Vector2f gridSquare;
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
return -1;
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
return -1;
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
//flip the Y so it grabs from the bottom left instead of top left.
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
gridSquare = getGridSquare(zoneLoc);
int gridX = (int) gridSquare.x;
int gridY = (int) (gridSquare.y);
if (gridX > maxX)
gridX = maxX;
if (gridY > maxY)
gridY = maxY;
float offsetX = (gridSquare.x - gridX);
float offsetY = gridSquare.y - gridY;
//get height of the 4 vertices.
float topLeftHeight = 0;
float topRightHeight = 0;
float bottomLeftHeight = 0;
float bottomRightHeight = 0;
int nextY = gridY + 1;
int nextX = gridX + 1;
if (nextY > maxY)
nextY = gridY;
if (nextX > maxX)
nextX = gridX;
topLeftHeight = pixelColorValues[gridX][gridY];
topRightHeight = pixelColorValues[nextX][gridY];
bottomLeftHeight = pixelColorValues[gridX][nextY];
bottomRightHeight = pixelColorValues[nextX][nextY];
float interpolatedHeight;
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
return interpolatedHeight;
}
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
Vector2f gridSquare;
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
return -1;
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
return -1;
//flip the Y so it grabs from the bottom left instead of top left.
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
gridSquare = getGridSquare(zoneLoc);
int gridX = (int) gridSquare.x;
int gridY = (int) (gridSquare.y);
float offsetX = (gridSquare.x - gridX);
float offsetY = gridSquare.y - gridY;
//get height of the 4 vertices.
float topLeftHeight = pixelColorValues[gridX][gridY];
float topRightHeight = pixelColorValues[gridX + 1][gridY];
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
float interpolatedHeight;
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
return interpolatedHeight;
}
private void generatePixelData() {
Color color;
// Generate altitude lookup table for this heightmap
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
color = new Color(this.heightmapImage.getRGB(x, y));
pixelColorValues[x][y] = color.getRed();
}
}
}
public float getScaledHeightForColor(float color) {
return (color / 256) * this.maxHeight;
}
public float getBucketWidthX() {
return bucketWidthX;
}
public float getBucketWidthY() {
return bucketWidthY;
}
public int getHeightMapID() {
return heightMapID;
}
public BufferedImage getHeightmapImage() {
return heightmapImage;
}
public float getSeaLevel() {
return seaLevel;
}
}
@@ -8,16 +8,16 @@
package engine.InterestManagement;
import engine.gameManager.DispatchManager;
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType;
import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager;
import engine.job.JobScheduler;
import engine.jobs.RefreshGroupJob;
import engine.mbEnums;
import engine.mbEnums.DispatchChannel;
import engine.mbEnums.GameObjectType;
import engine.net.AbstractNetMsg;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg;
@@ -25,6 +25,7 @@ import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg;
import engine.objects.*;
import engine.server.MBServerStatics;
import engine.util.BoxTracker;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@@ -88,7 +89,7 @@ public enum InterestManager implements Runnable {
if (send) {
Dispatch dispatch = Dispatch.borrow(player, msg);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
}
}
@@ -109,7 +110,7 @@ public enum InterestManager implements Runnable {
origin.sendMsg(moveMsg);
}
public static void reloadCharacter(AbstractCharacter absChar) {
public static void reloadCharacter(AbstractCharacter absChar, boolean sendToSelf) {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(absChar);
@@ -140,7 +141,7 @@ public enum InterestManager implements Runnable {
else {
if (pc != null)
if (pcc.getSeeInvis() < pc.hidden)
if (pcc.getSeeInvis() < pc.getHidden())
continue;
if (!cc.sendMsg(uom)) {
@@ -210,7 +211,7 @@ public enum InterestManager implements Runnable {
if (origin == null)
continue;
if (!playerCharacter.isEnteredWorld())
if (!playerCharacter.enteredWorld)
continue;
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
@@ -270,7 +271,7 @@ public enum InterestManager implements Runnable {
}
Dispatch dispatch = Dispatch.borrow(player, uom);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
loadedStaticObjects.removeAll(toRemove);
@@ -292,7 +293,7 @@ public enum InterestManager implements Runnable {
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
Dispatch dispatch = Dispatch.borrow(player, lcm);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
NPC npc = (NPC) awo;
@@ -304,13 +305,13 @@ public enum InterestManager implements Runnable {
if (lsm.getStructureList().size() > 0) {
Dispatch dispatch = Dispatch.borrow(player, lsm);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
for (LoadCharacterMsg lc : lcmList) {
Dispatch dispatch = Dispatch.borrow(player, lc);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
loadedStaticObjects.addAll(toLoad);
@@ -340,7 +341,7 @@ public enum InterestManager implements Runnable {
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
continue;
if (player.getSeeInvis() < loadedPlayer.hidden)
if (player.getSeeInvis() < loadedPlayer.getHidden())
continue;
if (loadedPlayer.safemodeInvis())
@@ -372,7 +373,7 @@ public enum InterestManager implements Runnable {
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
if (player.getSeeInvis() < loadedPlayer.hidden)
if (player.getSeeInvis() < loadedPlayer.getHidden())
toRemove.add(playerLoadedObject);
else if (loadedPlayer.safemodeInvis())
toRemove.add(playerLoadedObject);
@@ -414,7 +415,7 @@ public enum InterestManager implements Runnable {
if (!uom.getObjectList().isEmpty()) {
Dispatch dispatch = Dispatch.borrow(player, uom);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
}
@@ -437,7 +438,7 @@ public enum InterestManager implements Runnable {
// dont load if invis
if (player.getSeeInvis() < awopc.hidden)
if (player.getSeeInvis() < awopc.getHidden())
continue;
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
@@ -482,7 +483,7 @@ public enum InterestManager implements Runnable {
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
if ((awonpc.agentType.equals(mbEnums.AIAgentType.MOBILE)))
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -492,7 +493,7 @@ public enum InterestManager implements Runnable {
if (lcm != null) {
Dispatch dispatch = Dispatch.borrow(player, lcm);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
@@ -524,6 +525,7 @@ public enum InterestManager implements Runnable {
player.setDirtyLoad(true);
updateStaticList(player, origin);
updateMobileList(player, origin);
BoxTracker.addPlayer(origin.machineID,player);
}
+13 -16
View File
@@ -8,10 +8,14 @@
package engine.InterestManagement;
import engine.gameManager.DispatchManager;
/* This class is the main interface for Magicbane's
* Interest management facilities.
*/
import engine.Enum;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.msg.TerritoryChangeMessage;
import engine.objects.City;
import engine.objects.PlayerCharacter;
@@ -27,18 +31,11 @@ import static engine.objects.Realm.getRealm;
public enum RealmMap {
// MB Dev Notes:
// This class loads and caches realm maps used by each
// map set for its realm overlay. The RealmMap loaded is
// controlled by config entry MB_WORLD_REALMMAP
//
// Unlike a Heightmap this is a just color lookup; identical to
// the old image maps used in 90s web technology.
//
// Realm Map images are stored on disk in /mb.data/realmmaps/
REALM_MAP;
// Spatial hashmap. Used for determining which Realm
// a player is currently located within.
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
public static int[][] _realmImageMap;
@@ -68,7 +65,7 @@ public enum RealmMap {
public static Realm getRealmForCity(City city) {
Realm outRealm = null;
outRealm = city.realm;
outRealm = city.getRealm();
return outRealm;
}
@@ -91,17 +88,17 @@ public enum RealmMap {
if (city != null) {
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
} else {
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
}
} else {
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
}
}
-238
View File
@@ -1,238 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.InterestManagement;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.Zone;
import org.pmw.tinylog.Logger;
import java.util.HashMap;
import static java.lang.Math.PI;
// MB Dev Notes:
// The Terrain class handles lookups into the Heightmap data.
// It supports all current maps along with the differences in
// their parenting configuration.
//
// Heightmap images are stored on disk in /mb.data/heightmaps/
public class Terrain {
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
public short[][] terrain_pixel_data;
public Vector2f terrain_size = new Vector2f();
public Vector2f cell_size = new Vector2f();
public Vector2f cell_count = new Vector2f();
public float terrain_scale;
public Vector2f blend_values = new Vector2f();
public Vector2f blend_ratio = new Vector2f();
public int heightmap;
Zone zone;
public Terrain(Zone zone) {
this.zone = zone;
this.heightmap = this.zone.template.terrain_image;
// Configure PLANAR zones to use the same 16x16 pixel image
// that all similar terrains share. (See JSON)
if (this.zone.template.terrain_type.equals("PLANAR"))
this.heightmap = 1006300; // all 0
// Load pixel data for this terrain from cache
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap);
if (terrain_pixel_data == null)
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName);
// Configure terrain based on zone properties
this.terrain_size.x = this.zone.major_radius * 2;
this.terrain_size.y = this.zone.minor_radius * 2;
this.cell_count.x = this.terrain_pixel_data.length - 1;
this.cell_count.y = this.terrain_pixel_data[0].length - 1;
this.cell_size.x = terrain_size.x / this.cell_count.x;
this.cell_size.y = terrain_size.y / this.cell_count.y;
// Blending configuration. These ratios are used to calculate
// the blending area between child and parent terrains when
// they are stitched together.
this.blend_values.x = this.zone.template.max_blend;
this.blend_values.y = this.zone.template.min_blend;
Vector2f major_blend = new Vector2f(this.blend_values.x / this.zone.major_radius,
this.blend_values.y / this.zone.major_radius);
Vector2f minor_blend = new Vector2f(this.blend_values.x / this.zone.minor_radius,
this.blend_values.y / this.zone.minor_radius);
if (major_blend.y > 0.4f)
blend_ratio.x = major_blend.y;
else
blend_ratio.x = Math.min(major_blend.x, 0.4f);
if (minor_blend.y > 0.4f)
blend_ratio.y = minor_blend.y;
else
blend_ratio.y = Math.min(minor_blend.x, 0.4f);
// Scale coefficient for this terrain
this.terrain_scale = this.zone.template.terrain_max_y / 255f;
}
public static Zone getNextZoneWithTerrain(Zone zone) {
// Not all zones have a terrain. Some are for display only
// and heights returned are from the parent heightmap. This
// is controlled in the JSON via the has_terrain_gen field.
Zone terrain_zone = zone;
if (zone == null)
return ZoneManager.seaFloor;
if (zone.terrain != null)
return zone;
if (zone.equals(ZoneManager.seaFloor))
return zone;
while (terrain_zone.terrain == null)
terrain_zone = terrain_zone.parent;
return terrain_zone;
}
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
// Retrieve the next zone up in the tree with a terrain defined.
Zone terrainZone = getNextZoneWithTerrain(zone);
Zone parentZone = getNextZoneWithTerrain(zone.parent);
// Transform world loc into zone space coordinate system
Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone);
Vector2f parentLoc = ZoneManager.worldToTerrainSpace(world_loc, parentZone);
// Offset from origin needed for blending function
Vector2f terrainOffset = ZoneManager.worldToZoneOffset(world_loc, terrainZone);
// Interpolate height for this position in both terrains
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc);
interpolatedChildHeight += terrainZone.global_height;
float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc);
interpolatedParentTerrainHeight += parentZone.global_height;
// Blend between terrains
float blendCoefficient = terrainZone.terrain.getTerrainBlendCoefficient(terrainOffset);
float terrainHeight = interpolatedChildHeight * blendCoefficient;
terrainHeight += interpolatedParentTerrainHeight * (1 - blendCoefficient);
return terrainHeight;
}
public static float getWorldHeight(Vector3fImmutable world_loc) {
Zone currentZone = ZoneManager.findSmallestZone(world_loc);
return getWorldHeight(currentZone, world_loc);
}
public Vector2f getTerrainCell(Vector2f terrain_loc) {
// Calculate terrain cell with offset
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.y);
// Clamp values when standing directly on pole
terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x));
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
return terrain_cell;
}
public float getInterpolatedTerrainHeight(Vector2f terrain_loc) {
float interpolatedHeight;
// Early exit for guild zones
if (this.zone.guild_zone)
return 5.0f;
// Determine terrain and offset from top left vertex
Vector2f terrain_cell = getTerrainCell(terrain_loc);
int pixel_x = (int) Math.floor(terrain_cell.x);
int pixel_y = (int) Math.floor(terrain_cell.y);
Vector2f pixel_offset = new Vector2f(terrain_cell.x % 1, terrain_cell.y % 1);
// 4 surrounding vertices from the pixel array.
short top_left_pixel = terrain_pixel_data[pixel_x][pixel_y];
short top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y];
short bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1];
short bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1];
// Interpolate between the 4 vertices
interpolatedHeight = top_left_pixel * (1 - pixel_offset.x) * (1 - pixel_offset.y);
interpolatedHeight += top_right_pixel * (1 - pixel_offset.y) * (pixel_offset.x);
interpolatedHeight += (bottom_left_pixel * (1 - pixel_offset.x) * pixel_offset.y);
interpolatedHeight += (bottom_right_pixel * pixel_offset.y * pixel_offset.x);
interpolatedHeight *= this.terrain_scale; // Scale height
return interpolatedHeight;
}
public float getTerrainBlendCoefficient(Vector2f zone_offset) {
// Normalize terrain offset
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.template.major_radius,
Math.abs(zone_offset.y) / this.zone.template.minor_radius);
float blendCoefficient;
if (normalizedOffset.x <= 1 - blend_ratio.x || normalizedOffset.x <= normalizedOffset.y) {
if (normalizedOffset.y < 1 - blend_ratio.y)
return 1;
blendCoefficient = (normalizedOffset.y - (1 - blend_ratio.y)) / blend_ratio.y;
} else
blendCoefficient = (normalizedOffset.x - (1 - blend_ratio.x)) / blend_ratio.x;
blendCoefficient = (float) Math.atan((0.5f - blendCoefficient) * PI);
return (blendCoefficient + 1) * 0.5f;
}
}
+11 -11
View File
@@ -8,11 +8,11 @@
package engine.InterestManagement;
import engine.gameManager.DispatchManager;
import engine.Enum.GridObjectType;
import engine.math.FastMath;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.mbEnums.GridObjectType;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg;
@@ -201,7 +201,7 @@ public class WorldGrid {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(awo);
DispatchManager.sendToAllInRange(awo, uom);
DispatchMessage.sendToAllInRange(awo, uom);
}
public static void loadObject(AbstractWorldObject awo) {
@@ -213,15 +213,15 @@ public class WorldGrid {
case Building:
lsm = new LoadStructureMsg();
lsm.addObject((Building) awo);
DispatchManager.sendToAllInRange(awo, lsm);
DispatchMessage.sendToAllInRange(awo, lsm);
break;
case NPC:
lcm = new LoadCharacterMsg((NPC) awo, false);
DispatchManager.sendToAllInRange(awo, lcm);
DispatchMessage.sendToAllInRange(awo, lcm);
break;
case Mob:
lcm = new LoadCharacterMsg((Mob) awo, false);
DispatchManager.sendToAllInRange(awo, lcm);
DispatchMessage.sendToAllInRange(awo, lcm);
break;
default:
// *** Refactor: Log error?
@@ -239,19 +239,19 @@ public class WorldGrid {
case Building:
lsm = new LoadStructureMsg();
lsm.addObject((Building) awo);
DispatchManager.sendToAllInRange(awo, lsm);
DispatchMessage.sendToAllInRange(awo, lsm);
break;
case NPC:
lcm = new LoadCharacterMsg((NPC) awo, false);
DispatchManager.sendToAllInRange(awo, lcm);
DispatchMessage.sendToAllInRange(awo, lcm);
break;
case Mob:
lcm = new LoadCharacterMsg((Mob) awo, false);
DispatchManager.sendToAllInRange(awo, lcm);
DispatchMessage.sendToAllInRange(awo, lcm);
break;
case PlayerCharacter:
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
DispatchManager.sendToAllInRange(awo, lcm);
DispatchMessage.sendToAllInRange(awo, lcm);
break;
default:
// *** Refactor: Log error?
@@ -263,7 +263,7 @@ public class WorldGrid {
ClientConnection origin) {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(awo);
DispatchManager.sendToAllInRange(awo, uom);
DispatchMessage.sendToAllInRange(awo, uom);
}
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
+4 -4
View File
@@ -9,8 +9,8 @@
package engine.db.archive;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Bane;
import engine.objects.City;
import engine.workthreads.WarehousePushThread;
@@ -21,7 +21,7 @@ import java.sql.*;
import java.time.LocalDateTime;
import java.util.concurrent.LinkedBlockingQueue;
import static engine.mbEnums.RecordEventType;
import static engine.Enum.RecordEventType;
public class BaneRecord extends DataRecord {
@@ -38,7 +38,7 @@ public class BaneRecord extends DataRecord {
private DateTime baneDropTime;
private BaneRecord(Bane bane) {
this.recordType = mbEnums.DataRecordType.BANE;
this.recordType = Enum.DataRecordType.BANE;
this.eventType = RecordEventType.PENDING;
}
@@ -51,7 +51,7 @@ public class BaneRecord extends DataRecord {
baneRecord = new BaneRecord(bane);
baneRecord.eventType = eventType;
} else {
baneRecord.recordType = mbEnums.DataRecordType.BANE;
baneRecord.recordType = Enum.DataRecordType.BANE;
baneRecord.eventType = eventType;
}
+3 -3
View File
@@ -9,8 +9,8 @@
package engine.db.archive;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Guild;
import engine.objects.PlayerCharacter;
import engine.workthreads.WarehousePushThread;
@@ -33,7 +33,7 @@ public class CharacterRecord extends DataRecord {
private PlayerCharacter player;
private CharacterRecord(PlayerCharacter player) {
this.recordType = mbEnums.DataRecordType.CHARACTER;
this.recordType = Enum.DataRecordType.CHARACTER;
this.player = player;
}
@@ -45,7 +45,7 @@ public class CharacterRecord extends DataRecord {
if (characterRecord == null) {
characterRecord = new CharacterRecord(player);
} else {
characterRecord.recordType = mbEnums.DataRecordType.CHARACTER;
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
characterRecord.player = player;
}
+8 -8
View File
@@ -9,8 +9,8 @@
package engine.db.archive;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.City;
import engine.workthreads.WarehousePushThread;
@@ -20,7 +20,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class CityRecord extends DataRecord {
private static final LinkedBlockingQueue<CityRecord> recordPool = new LinkedBlockingQueue<>();
private mbEnums.RecordEventType eventType;
private Enum.RecordEventType eventType;
private City city;
private String cityHash;
private String cityGuildHash;
@@ -32,13 +32,13 @@ public class CityRecord extends DataRecord {
private java.time.LocalDateTime establishedDatetime;
private CityRecord(City city) {
this.recordType = mbEnums.DataRecordType.CITY;
this.recordType = Enum.DataRecordType.CITY;
this.city = city;
this.eventType = mbEnums.RecordEventType.CREATE;
this.eventType = Enum.RecordEventType.CREATE;
}
public static CityRecord borrow(City city, mbEnums.RecordEventType eventType) {
public static CityRecord borrow(City city, Enum.RecordEventType eventType) {
CityRecord cityRecord;
cityRecord = recordPool.poll();
@@ -47,7 +47,7 @@ public class CityRecord extends DataRecord {
cityRecord = new CityRecord(city);
cityRecord.eventType = eventType;
} else {
cityRecord.recordType = mbEnums.DataRecordType.CITY;
cityRecord.recordType = Enum.DataRecordType.CITY;
cityRecord.eventType = eventType;
cityRecord.city = city;
@@ -67,9 +67,9 @@ public class CityRecord extends DataRecord {
cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
cityRecord.zoneHash = cityRecord.city.getParent().hash;
cityRecord.zoneHash = cityRecord.city.getParent().getHash();
if (cityRecord.eventType.equals(mbEnums.RecordEventType.CREATE))
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
cityRecord.establishedDatetime = cityRecord.city.established;
else
cityRecord.establishedDatetime = java.time.LocalDateTime.now();
+2 -2
View File
@@ -9,11 +9,11 @@
package engine.db.archive;
import engine.mbEnums;
import engine.Enum;
class DataRecord {
public mbEnums.DataRecordType recordType;
public Enum.DataRecordType recordType;
DataRecord() {
+1 -1
View File
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.LinkedBlockingQueue;
import static engine.mbEnums.DataRecordType;
import static engine.Enum.DataRecordType;
public class DataWarehouse implements Runnable {
+8 -9
View File
@@ -9,9 +9,9 @@
package engine.db.archive;
import engine.Enum;
import engine.Enum.RecordEventType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.RecordEventType;
import engine.objects.Guild;
import engine.workthreads.WarehousePushThread;
@@ -30,7 +30,7 @@ public class GuildRecord extends DataRecord {
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
public String guildHash;
public int guildID;
private mbEnums.RecordEventType eventType;
private Enum.RecordEventType eventType;
private Guild guild;
private String guildName;
private String charterName;
@@ -44,9 +44,9 @@ public class GuildRecord extends DataRecord {
private java.time.LocalDateTime eventDatetime;
private GuildRecord(Guild guild) {
this.recordType = mbEnums.DataRecordType.GUILD;
this.recordType = Enum.DataRecordType.GUILD;
this.guild = guild;
this.eventType = mbEnums.RecordEventType.CREATE;
this.eventType = Enum.RecordEventType.CREATE;
}
@@ -71,7 +71,7 @@ public class GuildRecord extends DataRecord {
}
public static GuildRecord borrow(Guild guild, mbEnums.RecordEventType eventType) {
public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
GuildRecord guildRecord;
//add
guildRecord = recordPool.poll();
@@ -81,7 +81,7 @@ public class GuildRecord extends DataRecord {
guildRecord.eventType = eventType;
} else {
guildRecord.guild = guild;
guildRecord.recordType = mbEnums.DataRecordType.GUILD;
guildRecord.recordType = Enum.DataRecordType.GUILD;
guildRecord.eventType = eventType;
}
@@ -89,8 +89,7 @@ public class GuildRecord extends DataRecord {
guildRecord.guildHash = guildRecord.guild.getHash();
guildRecord.guildID = guildRecord.guild.getObjectUUID();
guildRecord.guildName = guildRecord.guild.getName();
mbEnums.GuildCharterType guildCharterType = guild.charter;
guildRecord.charterName = guildCharterType.name;
guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
+8 -8
View File
@@ -9,8 +9,8 @@
package engine.db.archive;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractCharacter;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
@@ -23,7 +23,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class MineRecord extends DataRecord {
private static final LinkedBlockingQueue<MineRecord> recordPool = new LinkedBlockingQueue<>();
private mbEnums.RecordEventType eventType;
private Enum.RecordEventType eventType;
private String zoneHash;
private String charHash;
private String mineGuildHash;
@@ -33,12 +33,12 @@ public class MineRecord extends DataRecord {
private float locY;
private MineRecord() {
this.recordType = mbEnums.DataRecordType.MINE;
this.eventType = mbEnums.RecordEventType.CAPTURE;
this.recordType = Enum.DataRecordType.MINE;
this.eventType = Enum.RecordEventType.CAPTURE;
}
public static MineRecord borrow(Mine mine, AbstractCharacter character, mbEnums.RecordEventType eventType) {
public static MineRecord borrow(Mine mine, AbstractCharacter character, Enum.RecordEventType eventType) {
MineRecord mineRecord;
mineRecord = recordPool.poll();
@@ -48,13 +48,13 @@ public class MineRecord extends DataRecord {
mineRecord = new MineRecord();
mineRecord.eventType = eventType;
} else {
mineRecord.recordType = mbEnums.DataRecordType.MINE;
mineRecord.recordType = Enum.DataRecordType.MINE;
mineRecord.eventType = eventType;
}
mineRecord.zoneHash = mine.getParentZone().hash;
mineRecord.zoneHash = mine.getParentZone().getHash();
if (character.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
player = (PlayerCharacter) character;
mineRecord.charHash = player.getHash();
} else
+3 -3
View File
@@ -23,8 +23,8 @@ import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import static engine.mbEnums.DataRecordType;
import static engine.mbEnums.PvpHistoryType;
import static engine.Enum.DataRecordType;
import static engine.Enum.PvpHistoryType;
public class PvpRecord extends DataRecord {
@@ -281,7 +281,7 @@ public class PvpRecord extends DataRecord {
outStatement.setInt(8, this.victim.getLevel());
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
outStatement.setString(10, zone.zoneName);
outStatement.setString(10, zone.getName());
outStatement.setFloat(11, this.location.getX());
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
outStatement.setBoolean(13, this.pvpExp);
+8 -8
View File
@@ -9,8 +9,8 @@
package engine.db.archive;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Realm;
import engine.workthreads.WarehousePushThread;
@@ -23,20 +23,20 @@ public class RealmRecord extends DataRecord {
private static final LinkedBlockingQueue<RealmRecord> recordPool = new LinkedBlockingQueue<>();
private Realm realm;
private mbEnums.RecordEventType eventType;
private Enum.RecordEventType eventType;
private String cityHash;
private String guildHash;
private String charterType;
private LocalDateTime eventDateTime;
private RealmRecord(Realm realm) {
this.recordType = mbEnums.DataRecordType.REALM;
this.recordType = Enum.DataRecordType.REALM;
this.realm = realm;
this.eventType = mbEnums.RecordEventType.CAPTURE;
this.eventType = Enum.RecordEventType.CAPTURE;
}
public static RealmRecord borrow(Realm realm, mbEnums.RecordEventType eventType) {
public static RealmRecord borrow(Realm realm, Enum.RecordEventType eventType) {
RealmRecord realmRecord;
realmRecord = recordPool.poll();
@@ -45,7 +45,7 @@ public class RealmRecord extends DataRecord {
realmRecord = new RealmRecord(realm);
realmRecord.eventType = eventType;
} else {
realmRecord.recordType = mbEnums.DataRecordType.REALM;
realmRecord.recordType = Enum.DataRecordType.REALM;
realmRecord.eventType = eventType;
realmRecord.realm = realm;
@@ -53,9 +53,9 @@ public class RealmRecord extends DataRecord {
realmRecord.cityHash = realm.getRulingCity().getHash();
realmRecord.guildHash = realm.getRulingCity().getGuild().getHash();
realmRecord.charterType = mbEnums.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
realmRecord.charterType = Enum.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
if (realmRecord.eventType.equals(mbEnums.RecordEventType.CAPTURE))
if (realmRecord.eventType.equals(Enum.RecordEventType.CAPTURE))
realmRecord.eventDateTime = realm.ruledSince;
else
realmRecord.eventDateTime = LocalDateTime.now();
+4 -4
View File
@@ -9,10 +9,10 @@
package engine.db.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.Account;
import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
@@ -27,7 +27,7 @@ public class dbAccountHandler extends dbHandlerBase {
public dbAccountHandler() {
this.localClass = Account.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Account GET_ACCOUNT(int accountID) {
@@ -204,7 +204,7 @@ public class dbAccountHandler extends dbHandlerBase {
if (account != null) {
account.runAfterLoad();
if (ConfigManager.serverType.equals(mbEnums.ServerType.LOGINSERVER))
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER))
Account.AccountsMap.put(uname, account.getObjectUUID());
}
@@ -9,9 +9,9 @@
package engine.db.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.BaseClass;
import org.pmw.tinylog.Logger;
@@ -25,7 +25,7 @@ public class dbBaseClassHandler extends dbHandlerBase {
public dbBaseClassHandler() {
this.localClass = BaseClass.class;
this.localObjectType = mbEnums.GameObjectType.BaseClass;
this.localObjectType = Enum.GameObjectType.BaseClass;
}
public BaseClass GET_BASE_CLASS(final int id) {
@@ -73,6 +73,14 @@ public class dbBlueprintHandler extends dbHandlerBase {
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(3), thisBlueprint);
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(7), thisBlueprint);
if(thisBlueprint.getName().contains("Vampire Shrine")){
Blueprint saetorShrine = new Blueprint(rs);
saetorShrine.setBlueprintUUID(1720000);
saetorShrine.rank1UUID = 1720000;
saetorShrine.rank3UUID = 1720000;
saetorShrine.rank7UUID = 1720000;
}
}
} catch (SQLException e) {
+51
View File
@@ -0,0 +1,51 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.objects.Boon;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class dbBoonHandler extends dbHandlerBase {
public dbBoonHandler() {
}
public ArrayList<Boon> GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) {
ArrayList<Boon> boons = new ArrayList<>();
Boon thisBoon;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) {
preparedStatement.setInt(1, itemBaseUUID);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
thisBoon = new Boon(rs);
boons.add(thisBoon);
}
} catch (SQLException e) {
Logger.error(e);
}
return boons;
}
}
+50 -47
View File
@@ -9,13 +9,12 @@
package engine.db.handlers;
import engine.gameManager.BuildingManager;
import engine.Enum;
import engine.Enum.DbObjectType;
import engine.Enum.ProtectionState;
import engine.Enum.TaxType;
import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.DbObjectType;
import engine.mbEnums.ProtectionState;
import engine.mbEnums.TaxType;
import engine.objects.*;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
@@ -28,13 +27,12 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public class dbBuildingHandler extends dbHandlerBase {
public dbBuildingHandler() {
this.localClass = Building.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
@@ -90,12 +88,14 @@ public class dbBuildingHandler extends dbHandlerBase {
return removeFromBuildings(b);
}
public ArrayList<Building> GET_ALL_BUILDINGS() {
public ArrayList<Building> GET_ALL_BUILDINGS_FOR_ZONE(Zone zone) {
ArrayList<Building> buildings = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
preparedStatement.setLong(1, zone.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
buildings = getObjectsFromRs(rs, 1000);
@@ -112,7 +112,7 @@ public class dbBuildingHandler extends dbHandlerBase {
if (uuid == 0)
return null;
Building building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, uuid);
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
if (building != null)
return building;
@@ -425,28 +425,26 @@ public class dbBuildingHandler extends dbHandlerBase {
return false;
}
public void LOAD_BUILDING_FRIENDS() {
public void LOAD_ALL_FRIENDS_FOR_BUILDING(Building building) {
if (building == null)
return;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends`")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends` WHERE `buildingUID` = ?")) {
preparedStatement.setInt(1, building.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
BuildingFriends friend = new BuildingFriends(rs);
// Create map if it does not yet exist
if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID))
BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>());
switch (friend.friendType) {
switch (friend.getFriendType()) {
case 7:
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);
building.getFriends().put(friend.getPlayerUID(), friend);
break;
case 8:
case 9:
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.guildUID, friend);
building.getFriends().put(friend.getGuildUID(), friend);
break;
}
}
@@ -457,29 +455,26 @@ public class dbBuildingHandler extends dbHandlerBase {
}
public void LOAD_BUILDING_CONDEMNED() {
public void LOAD_ALL_CONDEMNED_FOR_BUILDING(Building building) {
if (building == null)
return;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned`")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned` WHERE `buildingUID` = ?")) {
preparedStatement.setInt(1, building.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
Condemned condemned = new Condemned(rs);
// Create map if it does not yet exist
if (!BuildingManager._buildingCondemned.containsKey(condemned.buildingUUID))
BuildingManager._buildingCondemned.put(condemned.buildingUUID, new ConcurrentHashMap<>());
switch (condemned.friendType) {
switch (condemned.getFriendType()) {
case 2:
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.playerUID, condemned);
building.getCondemned().put(condemned.getPlayerUID(), condemned);
break;
case 4:
case 5:
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.guildUID, condemned);
building.getCondemned().put(condemned.getGuildUID(), condemned);
break;
}
}
@@ -489,27 +484,35 @@ public class dbBuildingHandler extends dbHandlerBase {
}
}
public void LOAD_BARRACKS_PATROL_POINTS() {
public ArrayList<Vector3fImmutable> LOAD_PATROL_POINTS(Building building) {
if (building == null)
return null;
ArrayList<Vector3fImmutable> patrolPoints = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points`")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points` WHERE `buildingUID` = ?")) {
preparedStatement.setInt(1, building.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int buildingUUID = rs.getInt("buildingUID");
if (!BuildingManager._buildingPatrolPoints.containsKey(buildingUUID))
BuildingManager._buildingPatrolPoints.put(buildingUUID, new ArrayList<>());
Vector3fImmutable patrolPoint = new Vector3fImmutable(rs.getFloat("patrolX"), rs.getFloat("patrolY"), rs.getFloat("patrolZ"));
BuildingManager._buildingPatrolPoints.get(buildingUUID).add(patrolPoint);
float x1 = rs.getFloat("patrolX");
float y1 = rs.getFloat("patrolY");
float z1 = rs.getFloat("patrolZ");
Vector3fImmutable patrolPoint = new Vector3fImmutable(x1, y1, z1);
patrolPoints.add(patrolPoint);
}
} catch (SQLException e) {
Logger.error(e);
}
return patrolPoints;
}
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) {
@@ -719,10 +722,10 @@ public class dbBuildingHandler extends dbHandlerBase {
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
preparedStatement.setBoolean(1, active);
preparedStatement.setInt(2, condemn.buildingUUID);
preparedStatement.setInt(3, condemn.playerUID);
preparedStatement.setInt(4, condemn.guildUID);
preparedStatement.setInt(5, condemn.friendType);
preparedStatement.setInt(2, condemn.getParent());
preparedStatement.setInt(3, condemn.getPlayerUID());
preparedStatement.setInt(4, condemn.getGuildUID());
preparedStatement.setInt(5, condemn.getFriendType());
return (preparedStatement.executeUpdate() > 0);
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.BuildingLocation;
import org.pmw.tinylog.Logger;
@@ -24,7 +23,7 @@ public class dbBuildingLocationHandler extends dbHandlerBase {
public dbBuildingLocationHandler() {
this.localClass = BuildingLocation.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<BuildingLocation> LOAD_BUILDING_LOCATIONS() {
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Account;
import engine.objects.PlayerCharacter;
import engine.session.CSSession;
@@ -27,7 +26,7 @@ public class dbCSSessionHandler extends dbHandlerBase {
public dbCSSessionHandler() {
this.localClass = CSSession.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.CharacterPower;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
@@ -23,7 +23,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
public dbCharacterPowerHandler() {
this.localClass = CharacterPower.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public CharacterPower ADD_CHARACTER_POWER(CharacterPower toAdd) {
@@ -74,7 +74,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
public CharacterPower GET_CHARACTER_POWER(int objectUUID) {
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(mbEnums.GameObjectType.CharacterPower, objectUUID);
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(Enum.GameObjectType.CharacterPower, objectUUID);
if (characterPower != null)
return characterPower;
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.CharacterRune;
import org.pmw.tinylog.Logger;
@@ -21,7 +21,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
public dbCharacterRuneHandler() {
this.localClass = CharacterRune.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public CharacterRune ADD_CHARACTER_RUNE(final CharacterRune toAdd) {
@@ -49,7 +49,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
public CharacterRune GET_CHARACTER_RUNE(int runeID) {
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(mbEnums.GameObjectType.CharacterRune, runeID);
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(Enum.GameObjectType.CharacterRune, runeID);
if (characterRune != null)
return characterRune;
@@ -9,11 +9,12 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractCharacter;
import engine.objects.CharacterSkill;
import engine.objects.PlayerCharacter;
import engine.objects.SkillsBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
@@ -24,7 +25,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
public dbCharacterSkillHandler() {
this.localClass = CharacterSkill.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
@@ -72,7 +73,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
public CharacterSkill GET_SKILL(final int objectUUID) {
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(mbEnums.GameObjectType.CharacterSkill, objectUUID);
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(Enum.GameObjectType.CharacterSkill, objectUUID);
if (characterSkill != null)
return characterSkill;
@@ -95,7 +96,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
ConcurrentHashMap<String, CharacterSkill> characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
if (ac == null || (!(ac.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))))
if (ac == null || (!(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
return characterSkills;
PlayerCharacter playerCharacter = (PlayerCharacter) ac;
+18 -18
View File
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.City;
@@ -25,7 +25,7 @@ public class dbCityHandler extends dbHandlerBase {
public dbCityHandler() {
this.localClass = City.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
@@ -34,42 +34,40 @@ public class dbCityHandler extends dbHandlerBase {
case "zone":
Zone zone = new Zone(rs);
DbManager.addToCache(zone);
zone.runAfterLoad();
list.add(zone);
break;
case "building":
Building building = new Building(rs);
DbManager.addToCache(building);
building.runAfterLoad();
list.add(building);
break;
case "city":
City city = new City(rs);
DbManager.addToCache(city);
city.runAfterLoad();
list.add(city);
break;
}
}
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, int realmID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
preparedStatement.setFloat(3, xCoord); //xOffset from parentZone center
preparedStatement.setFloat(4, yCoord); //yOffset from parentZone center
preparedStatement.setFloat(5, zCoord); //zOffset from parentZone center
preparedStatement.setString(6, name); //city name
preparedStatement.setTimestamp(7, Timestamp.valueOf(established));
preparedStatement.setFloat(8, rotation);
preparedStatement.setFloat(9, W);
preparedStatement.setTimestamp(10, Timestamp.valueOf(upgradeTime));
preparedStatement.setLong(3, realmID); //objectUUID of realm city belongs in
preparedStatement.setFloat(4, xCoord); //xOffset from parentZone center
preparedStatement.setFloat(5, yCoord); //yOffset from parentZone center
preparedStatement.setFloat(6, zCoord); //zOffset from parentZone center
preparedStatement.setString(7, name); //city name
preparedStatement.setTimestamp(8, Timestamp.valueOf(established));
preparedStatement.setFloat(9, rotation);
preparedStatement.setFloat(10, W);
preparedStatement.setTimestamp(11, Timestamp.valueOf(upgradeTime));
boolean work = preparedStatement.execute();
@@ -98,12 +96,14 @@ public class dbCityHandler extends dbHandlerBase {
return objectList;
}
public ArrayList<City> GET_ALL_CITIES() {
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
ArrayList<City> cityList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` ORDER BY `object`.`UID` ASC;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`parent`=?;")) {
preparedStatement.setLong(1, objectUUID);
ResultSet rs = preparedStatement.executeQuery();
cityList = getObjectsFromRs(rs, 100);
@@ -117,7 +117,7 @@ public class dbCityHandler extends dbHandlerBase {
public City GET_CITY(final int cityId) {
City city = (City) DbManager.getFromCache(mbEnums.GameObjectType.City, cityId);
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, cityId);
if (city != null)
return city;
+35 -14
View File
@@ -9,11 +9,11 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.gameManager.ItemManager;
import engine.mbEnums;
import engine.objects.Contract;
import engine.objects.Item;
import engine.objects.ItemBase;
import engine.objects.MobEquipment;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -25,12 +25,12 @@ public class dbContractHandler extends dbHandlerBase {
public dbContractHandler() {
this.localClass = Contract.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Contract GET_CONTRACT(final int objectUUID) {
Contract contract = (Contract) DbManager.getFromCache(mbEnums.GameObjectType.Contract, objectUUID);
Contract contract = (Contract) DbManager.getFromCache(Enum.GameObjectType.Contract, objectUUID);
if (contract != null)
return contract;
@@ -63,12 +63,33 @@ public class dbContractHandler extends dbHandlerBase {
while (rs.next()) {
int templateID = rs.getInt("templateID");
//handle item base
int itemBaseID = rs.getInt("itembaseID");
Item item = new Item(templateID);
item.objectUUID = ItemManager.lastNegativeID.decrementAndGet();
contract.getSellInventory().add(item);
ItemBase ib = ItemBase.getItemBase(itemBaseID);
if (ib != null) {
MobEquipment me = new MobEquipment(ib, 0, 0);
contract.getSellInventory().add(me);
//handle magic effects
String prefix = rs.getString("prefix");
int pRank = rs.getInt("pRank");
String suffix = rs.getString("suffix");
int sRank = rs.getInt("sRank");
if (prefix != null) {
me.setPrefix(prefix, pRank);
me.setIsID(true);
}
if (suffix != null) {
me.setSuffix(suffix, sRank);
me.setIsID(true);
}
}
}
} catch (SQLException e) {
Logger.error(e);
@@ -106,12 +127,12 @@ public class dbContractHandler extends dbHandlerBase {
}
}
public boolean updateAllowedBuildings(final Contract con) {
public boolean updateAllowedBuildings(final Contract con, final long slotbitvalue) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `slotInBuildings`=? WHERE `contractID`=?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?")) {
preparedStatement.setString(1, mbEnums.asString(con.allowedBuildings));
preparedStatement.setLong(1, slotbitvalue);
preparedStatement.setInt(2, con.getContractID());
return (preparedStatement.executeUpdate() > 0);
@@ -126,7 +147,7 @@ public class dbContractHandler extends dbHandlerBase {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, slotInBuildings=? WHERE `ID`=?")) {
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?")) {
preparedStatement.setInt(1, con.getContractID());
preparedStatement.setString(2, con.getName());
@@ -135,7 +156,7 @@ public class dbContractHandler extends dbHandlerBase {
preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
preparedStatement.setInt(6, con.getIconID());
preparedStatement.setInt(8, con.getObjectUUID());
preparedStatement.setString(7, mbEnums.asString(con.allowedBuildings));
preparedStatement.setLong(7, con.getAllowedBuildings().toLong());
return (preparedStatement.executeUpdate() > 0);
@@ -9,9 +9,9 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.gameManager.PowersManager;
import engine.mbEnums;
import engine.powers.EffectsBase;
import engine.powers.effectmodifiers.*;
import org.pmw.tinylog.Logger;
@@ -63,7 +63,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
IDString = rs.getString("IDString");
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
mbEnums.ModType modifier = mbEnums.ModType.GetModType(rs.getString("modType"));
Enum.ModType modifier = Enum.ModType.GetModType(rs.getString("modType"));
//combine item prefix and suffix effect modifiers
@@ -86,7 +86,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
}
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, mbEnums.ModType modifier) throws SQLException {
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, Enum.ModType modifier) throws SQLException {
switch (modifier) {
case AdjustAboveDmgCap:
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
@@ -10,49 +10,38 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.gameManager.PowersManager;
import engine.mbEnums;
import engine.objects.EffectsResourceCosts;
import org.json.JSONObject;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.ArrayList;
public class dbEffectsResourceCostHandler extends dbHandlerBase {
public dbEffectsResourceCostHandler() {
this.localClass = EffectsResourceCosts.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public void LOAD_ALL_COSTMAPS() {
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_effect_costmaps`")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
preparedStatement.setString(1, idString);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String effectID = rs.getString("effectID");
String costString = rs.getString("costmap");
JSONObject costJSON = new JSONObject(costString);
HashMap<mbEnums.ResourceType, Integer> costmap = new HashMap<>();
for (String key : costJSON.keySet()) {
int value = costJSON.getInt(key);
costmap.put(mbEnums.ResourceType.valueOf(key), value);
}
PowersManager._effect_costMaps.put(effectID, costmap);
}
effectsResourceCosts = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
}
return effectsResourceCosts;
}
}
+26 -6
View File
@@ -9,9 +9,9 @@
package engine.db.handlers;
import engine.Enum;
import engine.Enum.GuildHistoryType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GuildHistoryType;
import engine.objects.*;
import engine.server.world.WorldServer;
import org.joda.time.DateTime;
@@ -24,7 +24,7 @@ public class dbGuildHandler extends dbHandlerBase {
public dbGuildHandler() {
this.localClass = Guild.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static ArrayList<PlayerCharacter> GET_GUILD_BANISHED(final int id) {
@@ -276,7 +276,7 @@ public class dbGuildHandler extends dbHandlerBase {
public Guild GET_GUILD(int id) {
Guild guild = (Guild) DbManager.getFromCache(mbEnums.GameObjectType.Guild, id);
Guild guild = (Guild) DbManager.getFromCache(Enum.GameObjectType.Guild, id);
if (guild != null)
return guild;
@@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
preparedStatement.setInt(6, guildTag.symbolColor);
preparedStatement.setInt(7, guildTag.backgroundDesign);
preparedStatement.setInt(8, guildTag.symbol);
preparedStatement.setInt(9, g.charter.templateID);
preparedStatement.setInt(9, g.getCharter());
preparedStatement.setString(10, g.getLeadershipType());
preparedStatement.setString(11, g.getMotto());
@@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
preparedStatement.setInt(6, g.getGuildTag().symbol);
preparedStatement.setInt(7, g.charter.templateID);
preparedStatement.setInt(7, g.getCharter());
preparedStatement.setString(8, g.getMOTD());
preparedStatement.setString(9, g.getICMOTD());
preparedStatement.setString(10, "");
@@ -695,4 +695,24 @@ public class dbGuildHandler extends dbHandlerBase {
}
}
//TODO uncomment this when finished with guild history warehouse integration
// public HashMap<Integer, GuildRecord> GET_WAREHOUSE_GUILD_HISTORY(){
//
// HashMap<Integer, GuildRecord> tempMap = new HashMap<>();
// prepareCallable("SELECT * FROM `warehouse_guildhistory` WHERE `eventType` = 'CREATE'");
// try {
// ResultSet rs = executeQuery();
//
// while (rs.next()) {
// GuildRecord guildRecord = new GuildRecord(rs);
// tempMap.put(guildRecord.guildID, guildRecord);
// }
// }catch (Exception e){
// Logger.error(e);
// }
// return tempMap;
//
// }
}
+6 -3
View File
@@ -9,10 +9,10 @@
package engine.db.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.AbstractGameObject;
import engine.objects.AbstractWorldObject;
import org.pmw.tinylog.Logger;
@@ -42,7 +42,7 @@ public abstract class dbHandlerBase {
// Only call runAfterLoad() for objects instanced on the world server
if ((abstractGameObject != null && abstractGameObject instanceof AbstractWorldObject) &&
(ConfigManager.serverType.equals(mbEnums.ServerType.WORLDSERVER) ||
(ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER) ||
(abstractGameObject.getObjectType() == GameObjectType.Guild)))
((AbstractWorldObject) abstractGameObject).runAfterLoad();
@@ -63,6 +63,9 @@ public abstract class dbHandlerBase {
} else {
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(toAdd);
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
continue;
}
objectList.add((T) toAdd);
if (toAdd != null && toAdd instanceof AbstractWorldObject)
@@ -0,0 +1,43 @@
package engine.db.handlers;
import engine.InterestManagement.HeightMap;
import engine.gameManager.DbManager;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class dbHeightMapHandler extends dbHandlerBase {
public dbHeightMapHandler() {
}
public void LOAD_ALL_HEIGHTMAPS() {
HeightMap thisHeightmap;
HeightMap.heightMapsCreated = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_heightmap INNER JOIN static_zone_size ON static_zone_size.loadNum = static_zone_heightmap.zoneLoadID")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
thisHeightmap = new HeightMap(rs);
if (thisHeightmap.getHeightmapImage() == null) {
Logger.info("Imagemap for " + thisHeightmap.getHeightMapID() + " was null");
continue;
}
}
} catch (SQLException e) {
Logger.error(e);
}
}
}
@@ -0,0 +1,202 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.objects.ItemBase;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class dbItemBaseHandler extends dbHandlerBase {
public dbItemBaseHandler() {
}
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
int itemBaseID = itemBase.getUUID();
switch(itemBaseID){
case 27550://bow
case 27560://dagger
case 27570://hammer
case 27580://axe
case 27590://sword
//return new String[]{"PRE-010","SUF-260"};
itemBaseID = 8000000;
break;
case 27600://staff
//return new String[]{"PRE-334","PRE-315"};
itemBaseID = 8000010;
break;
case 188500://HA chest
case 188510://HA arms
case 188520://HA legs
case 188530://HA gloves
case 188550://HA helm
case 188720://CC hood
case 188900://MA chest
case 188910://MA Sleeves
case 188920://MA Legs
case 188930://MA gloves
case 188950://MA helm
case 189100://la chest
case 189110://la arms
case 189120://la legs
case 189130://la gloves
case 189150://la helm
case 189550://CC gloves
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
itemBaseID = 8000020;
break;
case 188540://HA boots
case 188940://MA boots
case 189140://LA boots
case 189560://CC boots
//return new String[]{"PRE-133", "PRE-230", "PRE-210", "PRE-220", "SUF-003","SUF-150"};
itemBaseID = 8000030;
break;
case 188700://CC robe
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222","SUF-317","SUF-317","SUF-317"};
itemBaseID = 8000040;
break;
case 189500://MA shield
case 189510://HA shield
//return new String[]{"PRE-125","PRE-125","PRE-125", "PRE-230", "PRE-210", "PRE-220"};
itemBaseID = 8000050;
}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
preparedStatement.setInt(1, itemBaseID);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
if (rs.getBoolean("fromUse"))
itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains"));
else
itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains"));
}
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_ANIMATIONS(ItemBase itemBase) {
ArrayList<Integer> tempList = new ArrayList<>();
ArrayList<Integer> tempListOff = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) {
preparedStatement.setInt(1, itemBase.getUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int animation = rs.getInt("animation");
boolean rightHand = rs.getBoolean("rightHand");
if (rightHand)
tempList.add(animation);
else
tempListOff.add(animation);
}
} catch (SQLException e) {
Logger.error(e);
}
itemBase.setAnimations(tempList);
itemBase.setOffHandAnimations(tempListOff);
}
public void LOAD_ALL_ITEMBASES() {
ItemBase itemBase;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
itemBase = new ItemBase(rs);
ItemBase.addToCache(itemBase);
//copy the vampire shrine for saetor and change uuid and name
if(itemBase.getName().contains("Vampire Shrine")){
ItemBase saetorShrine = new ItemBase(rs);
saetorShrine.setUUID(1035);
saetorShrine.setName(saetorShrine.getName().replace("Vampire","Saetor"));
ItemBase.addToCache(saetorShrine);
}
}
} catch (SQLException e) {
Logger.error(e);
}
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
}
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
int runeSetID;
int runeBaseID;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
runeSetID = rs.getInt("runeSet");
runeBaseID = rs.getInt("runeBase");
if (runeSets.get(runeSetID) == null) {
ArrayList<Integer> runeList = new ArrayList<>();
runeList.add(runeBaseID);
runeSets.put(runeSetID, runeList);
} else {
ArrayList<Integer> runeList = runeSets.get(runeSetID);
runeList.add(runeSetID);
runeSets.put(runeSetID, runeList);
}
}
} catch (SQLException e) {
Logger.error(e);
return runeSets;
}
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
return runeSets;
}
}
+56 -129
View File
@@ -9,15 +9,12 @@
package engine.db.handlers;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.ItemContainerType;
import engine.mbEnums.ItemType;
import engine.objects.AbstractCharacter;
import engine.objects.CharacterItemManager;
import engine.objects.Item;
import engine.objects.ItemTemplate;
import org.json.JSONObject;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -25,7 +22,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -33,7 +29,7 @@ public class dbItemHandler extends dbHandlerBase {
public dbItemHandler() {
this.localClass = Item.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
private static String formatTradeString(HashSet<Integer> list) {
@@ -56,56 +52,46 @@ public class dbItemHandler extends dbHandlerBase {
return ret;
}
public Item PERSIST(Item toAdd) {
public Item ADD_ITEM(Item toAdd) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) {
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) {
preparedStatement.setInt(1, toAdd.ownerID);
preparedStatement.setInt(2, toAdd.templateID);
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining);
preparedStatement.setInt(4, (short) toAdd.combat_health_current);
preparedStatement.setInt(1, toAdd.getOwnerID());
preparedStatement.setInt(2, toAdd.getItemBaseID());
preparedStatement.setInt(3, toAdd.getChargesRemaining());
preparedStatement.setInt(4, toAdd.getDurabilityCurrent());
preparedStatement.setInt(5, toAdd.getDurabilityMax());
if (toAdd.getNumOfItems() < 1)
preparedStatement.setInt(5, 1);
preparedStatement.setInt(6, 1);
else
preparedStatement.setInt(5, toAdd.getNumOfItems());
preparedStatement.setInt(6, toAdd.getNumOfItems());
switch (toAdd.containerType) {
case INVENTORY:
preparedStatement.setString(6, "inventory");
preparedStatement.setString(7, "inventory");
break;
case EQUIPPED:
preparedStatement.setString(6, "equip");
preparedStatement.setString(7, "equip");
break;
case BANK:
preparedStatement.setString(6, "bank");
preparedStatement.setString(7, "bank");
break;
case VAULT:
preparedStatement.setString(6, "vault");
preparedStatement.setString(7, "vault");
break;
case FORGE:
preparedStatement.setString(6, "forge");
preparedStatement.setString(7, "forge");
break;
default:
preparedStatement.setString(6, "none"); //Shouldn't be here
preparedStatement.setString(7, "none"); //Shouldn't be here
break;
}
if (toAdd.equipSlot.equals(mbEnums.EquipSlotType.NONE))
preparedStatement.setString(7, "");
else
preparedStatement.setString(7, toAdd.equipSlot.name());
String flagString = "";
for (mbEnums.ItemFlags itemflag : toAdd.flags)
flagString += itemflag.toString() + ";";
flagString = flagString.replaceAll(";$", "");
preparedStatement.setString(8, flagString);
preparedStatement.setString(9, toAdd.name);
preparedStatement.setByte(8, toAdd.getEquipSlot());
preparedStatement.setInt(9, toAdd.getFlags());
preparedStatement.setString(10, toAdd.getCustomName());
ResultSet rs = preparedStatement.executeQuery();
@@ -149,7 +135,11 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
worked = rs.getBoolean("result");
try {
worked = rs.getBoolean("result");
}catch(Exception e){
return true;
}
} catch (SQLException e) {
Logger.error(e);
@@ -162,7 +152,7 @@ public class dbItemHandler extends dbHandlerBase {
ArrayList<Item> itemList;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`container`='equip';")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`item_container`='equip';")) {
preparedStatement.setLong(1, targetId);
ResultSet rs = preparedStatement.executeQuery();
@@ -177,49 +167,6 @@ public class dbItemHandler extends dbHandlerBase {
return itemList;
}
public void LOAD_ITEM_TEMPLATES() {
HashMap<ItemType, Integer> templateTCountMap = new HashMap<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;");
ResultSet rs = preparedStatement.executeQuery()) {
while (rs.next()) {
int templateID = rs.getInt("id");
JSONObject jsonObject = new JSONObject(rs.getString("template"));
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
itemTemplate.template_id = templateID;
ItemTemplate.templates.put(templateID, itemTemplate);
templateTCountMap.merge(itemTemplate.item_type, 1, Integer::sum);
}
Logger.info(templateTCountMap.toString());
} catch (Exception e) {
Logger.error(e);
}
}
public void LOAD_TEMPLATE_MODTABLES() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_vendor_items`;");
ResultSet rs = preparedStatement.executeQuery()) {
while (rs.next()) {
int templateID = rs.getInt("templateID");
int modTable = rs.getInt("modTable");
ItemTemplate template = ItemTemplate.templates.get(templateID);
template.modTable = modTable;
}
} catch (Exception e) {
Logger.error(e);
}
}
public Item GET_ITEM(final int itemUUID) {
Item item;
@@ -299,7 +246,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean MOVE_GOLD(final Item from, final Item to, final int amt) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
int newFromAmt = from.getNumOfItems() - amt;
int newToAmt = to.getNumOfItems() + amt;
@@ -325,11 +272,11 @@ public class dbItemHandler extends dbHandlerBase {
for (Item item : inventory) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.getItemBase().getType().equals(ItemType.GOLD))
continue;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`container`='none' WHERE `object`.`UID`=?;")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`item_container`='none' WHERE `object`.`UID`=?;")) {
preparedStatement.setLong(1, item.getObjectUUID());
worked = (preparedStatement.executeUpdate() > 0);
@@ -345,12 +292,12 @@ public class dbItemHandler extends dbHandlerBase {
return worked;
}
public HashSet<Integer> GET_VENDOR_CAN_ROLL_LIST(final int vendorID) {
public HashSet<Integer> GET_ITEMS_FOR_VENDOR(final int vendorID) {
HashSet<Integer> itemSet = new HashSet<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT templateID FROM static_vendor_items WHERE vendorType = ?")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT ID FROM static_itembase WHERE vendorType = ?")) {
preparedStatement.setInt(1, vendorID);
@@ -368,8 +315,8 @@ public class dbItemHandler extends dbHandlerBase {
}
//Used to transfer a single item between owners or equip or vault or bank or inventory
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
ItemContainerType containerType, mbEnums.EquipSlotType slot) {
public boolean UPDATE_OWNER(final Item item, int newOwnerID, boolean ownerNPC, boolean ownerPlayer,
boolean ownerAccount, ItemContainerType containerType, int slot) {
boolean worked = false;
@@ -403,16 +350,15 @@ public class dbItemHandler extends dbHandlerBase {
preparedStatement.setString(3, "none"); //Shouldn't be here
break;
}
if (slot.equals(mbEnums.EquipSlotType.NONE))
preparedStatement.setString(4, "");
else
preparedStatement.setString(4, slot.name());
preparedStatement.setInt(4, slot);
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
worked = rs.getBoolean("result");
try {
worked = rs.getBoolean("result");
} catch(Exception e){
worked = true;
}
} catch (SQLException e) {
Logger.error(e);
@@ -424,11 +370,11 @@ public class dbItemHandler extends dbHandlerBase {
public boolean SET_DURABILITY(final Item item, int value) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `combat_health_current`=? WHERE `UID`=? AND `combat_health_current`=?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityCurrent`=?")) {
preparedStatement.setInt(1, value);
preparedStatement.setLong(2, item.getObjectUUID());
preparedStatement.setInt(3, (short) item.combat_health_current);
preparedStatement.setInt(3, item.getDurabilityCurrent());
return (preparedStatement.executeUpdate() > 0);
@@ -441,7 +387,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_FORGE_TO_INVENTORY(final Item item) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `container` = ? WHERE `UID` = ? AND `container` = 'forge';")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_container` = ? WHERE `UID` = ? AND `item_container` = 'forge';")) {
preparedStatement.setString(1, "inventory");
preparedStatement.setLong(2, item.getObjectUUID());
@@ -474,11 +420,11 @@ public class dbItemHandler extends dbHandlerBase {
*/
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
if (!item.template.item_type.equals(ItemType.GOLD))
if (!item.getItemBase().getType().equals(ItemType.GOLD))
return false;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=? WHERE `UID`=?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
preparedStatement.setInt(1, newValue);
preparedStatement.setLong(2, item.getObjectUUID());
@@ -495,9 +441,9 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_REMAINING_CHARGES(final Item item) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `chargesRemaining` = ? WHERE `UID` = ?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_chargesRemaining` = ? WHERE `UID` = ?")) {
preparedStatement.setInt(1, (byte) item.chargesRemaining);
preparedStatement.setInt(1, item.getChargesRemaining());
preparedStatement.setLong(2, item.getObjectUUID());
return (preparedStatement.executeUpdate() > 0);
@@ -515,7 +461,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean ZERO_ITEM_STACK(Item item) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=0 WHERE `UID` = ?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=0 WHERE `UID` = ?")) {
preparedStatement.setLong(1, item.getObjectUUID());
@@ -530,16 +476,9 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_FLAGS(Item item) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `flags`=? WHERE `UID` = ?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_flags`=? WHERE `UID` = ?")) {
String flagString = "";
for (mbEnums.ItemFlags itemflag : item.flags)
flagString += itemflag.toString() + ";";
flagString = flagString.replaceAll(";$", "");
preparedStatement.setString(1, flagString);
preparedStatement.setInt(1, item.getFlags());
preparedStatement.setLong(2, item.getObjectUUID());
return (preparedStatement.executeUpdate() > 0);
@@ -552,13 +491,8 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_VALUE(Item item, int value) {
// Write 0 if we will not modify the value from template
if (value == item.template.item_value)
value = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `value`=? WHERE `UID` = ?")) {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_value`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, value);
preparedStatement.setLong(2, item.getObjectUUID());
@@ -571,24 +505,17 @@ public class dbItemHandler extends dbHandlerBase {
}
}
public boolean UPDATE_EQUIP_SLOT(Item item) {
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
if (item.getItemBase().getType().equals(ItemType.GOLD))
return false;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `equipSlot`=? WHERE `UID` = ?")) {
if (item.equipSlot.equals(mbEnums.EquipSlotType.NONE))
preparedStatement.setString(1, "");
else
preparedStatement.setString(1, item.equipSlot.name());
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
preparedStatement.setInt(1, newValue);
preparedStatement.setLong(2, item.getObjectUUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Kit;
import org.pmw.tinylog.Logger;
@@ -24,7 +23,7 @@ public class dbKitHandler extends dbHandlerBase {
public dbKitHandler() {
this.localClass = Kit.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<Kit> GET_ALL_KITS() {
+1 -2
View File
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.MenuOption;
import org.pmw.tinylog.Logger;
@@ -24,7 +23,7 @@ public class dbMenuHandler extends dbHandlerBase {
public dbMenuHandler() {
this.localClass = MenuOption.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
+40 -7
View File
@@ -8,12 +8,15 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Mine;
import engine.objects.MineProduction;
import engine.objects.Resource;
import org.pmw.tinylog.Logger;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -24,15 +27,31 @@ public class dbMineHandler extends dbHandlerBase {
public dbMineHandler() {
this.localClass = Mine.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Mine GET_MINE(int id) {
if (id == 0)
return null;
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
Mine mine = (Mine) DbManager.getFromCache(mbEnums.GameObjectType.Mine, id);
//preparedStatement.setInt(1, id);
ResultSet rs = preparedStatement.executeQuery();
while(rs.next()){
if(rs.getInt("UID") == id){
int towerUID = rs.getInt("mine_buildingUID");
mine = Mine.getMineFromTower(towerUID);
}
}
} catch (SQLException e) {
Logger.error(e);
}
if (mine != null)
return mine;
@@ -55,13 +74,27 @@ public class dbMineHandler extends dbHandlerBase {
ArrayList<Mine> mines = new ArrayList<>();
//try (Connection connection = DbManager.getConnection();
// PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
// ResultSet rs = preparedStatement.executeQuery();
// mines = getObjectsFromRs(rs, 1000);
// } catch (SQLException e) {
// Logger.error(e);
//}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
ResultSet rs = preparedStatement.executeQuery();
mines = getObjectsFromRs(rs, 1000);
while(rs.next()){
if(BuildingManager.getBuildingFromCache(rs.getInt("mine_buildingUID")) == null)
continue;
} catch (SQLException e) {
mines.add(new Mine(rs));
}
} catch (SQLException | UnknownHostException e) {
Logger.error(e);
}
return mines;
@@ -83,7 +116,7 @@ public class dbMineHandler extends dbHandlerBase {
return false;
}
public boolean CHANGE_RESOURCE(Mine mine, mbEnums.ResourceType resource) {
public boolean CHANGE_RESOURCE(Mine mine, Resource resource) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
+22 -3
View File
@@ -9,9 +9,8 @@
package engine.db.handlers;
import engine.Enum.GameObjectType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.MobBase;
import engine.objects.MobBaseEffects;
import engine.objects.MobBaseStats;
@@ -22,12 +21,13 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class dbMobBaseHandler extends dbHandlerBase {
public dbMobBaseHandler() {
this.localClass = MobBase.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public MobBase GET_MOBBASE(int id) {
@@ -113,6 +113,25 @@ public class dbMobBaseHandler extends dbHandlerBase {
return mobBaseStats;
}
public void LOAD_ALL_MOBBASE_RACES() {
MobBase.mobbase_race_types = new HashMap<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase`;")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int id = rs.getInt("loadID");
if(MobBase.mobbase_race_types.containsKey(id) == false){
MobBase.mobbase_race_types.put(id,rs.getString("raceType"));
}
}
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_ALL_MOBBASE_SPEEDS(MobBase mobBase) {
if (mobBase.getLoadID() == 0)
+24 -34
View File
@@ -10,8 +10,8 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Mob;
import engine.objects.Zone;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
@@ -25,7 +25,7 @@ public class dbMobHandler extends dbHandlerBase {
public dbMobHandler() {
this.localClass = Mob.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Mob PERSIST(Mob toAdd) {
@@ -33,7 +33,7 @@ public class dbMobHandler extends dbHandlerBase {
Mob mobile = null;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
preparedStatement.setLong(1, toAdd.parentZoneUUID);
preparedStatement.setInt(2, toAdd.loadID);
@@ -43,12 +43,11 @@ public class dbMobHandler extends dbHandlerBase {
preparedStatement.setFloat(6, toAdd.bindLoc.z);
preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius);
preparedStatement.setInt(9, toAdd.spawnDelay);
preparedStatement.setInt(9, toAdd.spawnTime);
preparedStatement.setInt(10, toAdd.contractUUID);
preparedStatement.setInt(11, toAdd.buildingUUID);
preparedStatement.setInt(12, toAdd.level);
preparedStatement.setString(13, toAdd.firstName);
preparedStatement.setString(14, toAdd.behaviourType.toString());
ResultSet rs = preparedStatement.executeQuery();
@@ -65,23 +64,6 @@ public class dbMobHandler extends dbHandlerBase {
return mobile;
}
public ArrayList<Mob> GET_ALL_MOBS() {
ArrayList<Mob> mobileList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
mobileList = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
return mobileList;
}
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
try (Connection connection = DbManager.getConnection();
@@ -128,7 +110,7 @@ public class dbMobHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String minionName = rs.getString("minionName");
String minionName = rs.getString("name");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
if (toCreate == null)
@@ -144,13 +126,15 @@ public class dbMobHandler extends dbHandlerBase {
}
}
public boolean ADD_GUARD_MINION(final long captainUID, final String minionName) {
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
preparedStatement.setLong(1, captainUID);
preparedStatement.setString(2, minionName);
preparedStatement.setInt(2, mobBaseID);
preparedStatement.setString(3, name);
preparedStatement.setInt(4, slot);
return (preparedStatement.executeUpdate() > 0);
@@ -160,13 +144,14 @@ public class dbMobHandler extends dbHandlerBase {
}
}
public boolean REMOVE_GUARD_MINION(final long captainUID, final String minionName) {
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
preparedStatement.setLong(1, captainUID);
preparedStatement.setString(2, minionName);
preparedStatement.setInt(2, mobBaseID);
preparedStatement.setInt(3, slot);
return (preparedStatement.executeUpdate() > 0);
@@ -176,19 +161,24 @@ public class dbMobHandler extends dbHandlerBase {
}
}
public boolean REMOVE_ALL_MINIONS(final long captainUID) {
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
ArrayList<Mob> mobileList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=?;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
preparedStatement.setLong(1, captainUID);
preparedStatement.setLong(1, zone.getObjectUUID());
return (preparedStatement.executeUpdate() > 0);
ResultSet rs = preparedStatement.executeQuery();
mobileList = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
return false;
}
return mobileList;
}
public Mob GET_MOB(final int objectUUID) {
+119 -61
View File
@@ -9,12 +9,13 @@
package engine.db.handlers;
import engine.Enum.ProfitType;
import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.ProfitType;
import engine.objects.NPC;
import engine.objects.NPCProfits;
import engine.objects.ProducedItem;
import engine.objects.Zone;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
@@ -23,52 +24,12 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class dbNPCHandler extends dbHandlerBase {
public dbNPCHandler() {
this.localClass = NPC.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
int runeSetID;
int runeBaseID;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
runeSetID = rs.getInt("runeSet");
runeBaseID = rs.getInt("runeBase");
if (runeSets.get(runeSetID) == null) {
ArrayList<Integer> runeList = new ArrayList<>();
runeList.add(runeBaseID);
runeSets.put(runeSetID, runeList);
} else {
ArrayList<Integer> runeList = runeSets.get(runeSetID);
runeList.add(runeSetID);
runeSets.put(runeSetID, runeList);
}
}
} catch (SQLException e) {
Logger.error(e);
return runeSets;
}
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
return runeSets;
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public NPC PERSIST(NPC toAdd) {
@@ -133,12 +94,14 @@ public class dbNPCHandler extends dbHandlerBase {
return row_count;
}
public ArrayList<NPC> GET_ALL_NPCS() {
public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) {
ArrayList<NPC> npcList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
preparedStatement.setLong(1, zone.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
npcList = getObjectsFromRs(rs, 1000);
@@ -310,22 +273,6 @@ public class dbNPCHandler extends dbHandlerBase {
}
}
public boolean UPDATE_RACE(NPC npc, int value) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `npc_raceID`=? WHERE `UID`=?")) {
preparedStatement.setInt(1, value);
preparedStatement.setLong(2, npc.getObjectUUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public void LOAD_PIRATE_NAMES() {
String pirateName;
@@ -361,6 +308,117 @@ public class dbNPCHandler extends dbHandlerBase {
+ NPC._pirateNames.size() + " mobBases");
}
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
preparedStatement.setLong(1, ID);
preparedStatement.setLong(2, npcUID);
preparedStatement.setLong(3, itemBaseID);
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
preparedStatement.setBoolean(5, isRandom);
preparedStatement.setString(6, prefix);
preparedStatement.setString(7, suffix);
preparedStatement.setString(8, name);
preparedStatement.setInt(9, playerID);
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public boolean REMOVE_FROM_PRODUCTION_LIST(final long ID, final long npcUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_npc_production` WHERE `ID`=? AND `npcUID`=?;")) {
preparedStatement.setLong(1, ID);
preparedStatement.setLong(2, npcUID);
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public boolean UPDATE_ITEM_TO_INVENTORY(final long ID, final long npcUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `inForge`=? WHERE `ID`=? AND `npcUID`=?;")) {
preparedStatement.setByte(1, (byte) 0);
preparedStatement.setLong(2, ID);
preparedStatement.setLong(3, npcUID);
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public boolean UPDATE_ITEM_PRICE(final long ID, final long npcUID, int value) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `value`=? WHERE `ID`=? AND `npcUID`=?;")) {
preparedStatement.setInt(1, value);
preparedStatement.setLong(2, ID);
preparedStatement.setLong(3, npcUID);
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public boolean UPDATE_ITEM_ID(final long ID, final long npcUID, final long value) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `ID`=? WHERE `ID`=? AND `npcUID`=? LIMIT 1;")) {
preparedStatement.setLong(1, value);
preparedStatement.setLong(2, ID);
preparedStatement.setLong(3, npcUID);
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
return false;
}
}
public void LOAD_ALL_ITEMS_TO_PRODUCE(NPC npc) {
if (npc == null)
return;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_npc_production` WHERE `npcUID` = ?")) {
preparedStatement.setInt(1, npc.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
ProducedItem producedItem = new ProducedItem(rs);
npc.forgedItems.add(producedItem);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public boolean UPDATE_PROFITS(NPC npc, ProfitType profitType, float value) {
try (Connection connection = DbManager.getConnection();
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Petition;
import org.pmw.tinylog.Logger;
@@ -58,8 +58,8 @@ public class dbPetitionHandler extends dbHandlerBase {
" VALUES (?,?,?,?,?,?,?,?,?);")) {
preparedStatement.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis()));
preparedStatement.setString(2, mbEnums.PetitionType.values()[petition.primaryType].name());
preparedStatement.setString(3, mbEnums.PetitionSubType.values()[petition.subType].name());
preparedStatement.setString(2, Enum.PetitionType.values()[petition.primaryType].name());
preparedStatement.setString(3, Enum.PetitionSubType.values()[petition.subType].name());
preparedStatement.setInt(4, petition.reportAccount.getObjectUUID());
preparedStatement.setString(5, petition.reportAccount.getUname());
preparedStatement.setInt(6, petition.reportPlayer.getObjectUUID());
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractWorldObject;
import engine.objects.Heraldry;
import engine.objects.PlayerCharacter;
@@ -29,7 +29,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
public dbPlayerCharacterHandler() {
this.localClass = PlayerCharacter.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public PlayerCharacter ADD_PLAYER_CHARACTER(final PlayerCharacter toAdd) {
@@ -45,8 +45,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
preparedStatement.setLong(1, toAdd.getAccount().getObjectUUID());
preparedStatement.setString(2, toAdd.getFirstName());
preparedStatement.setString(3, toAdd.getLastName());
preparedStatement.setInt(4, toAdd.race.getRaceRuneID());
preparedStatement.setInt(5, toAdd.baseClass.getObjectUUID());
preparedStatement.setInt(4, toAdd.getRace().getRaceRuneID());
preparedStatement.setInt(5, toAdd.getBaseClass().getObjectUUID());
preparedStatement.setInt(6, toAdd.getStrMod());
preparedStatement.setInt(7, toAdd.getDexMod());
preparedStatement.setInt(8, toAdd.getConMod());
@@ -176,7 +176,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
if (objectUUID == 0)
return null;
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(mbEnums.GameObjectType.PlayerCharacter, objectUUID);
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, objectUUID);
if (playerCharacter != null)
return playerCharacter;
+61 -15
View File
@@ -9,57 +9,62 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.gameManager.PowersManager;
import engine.mbEnums;
import engine.objects.Mob;
import engine.objects.PreparedStatementShared;
import engine.powers.EffectsBase;
import engine.powers.MobPowerEntry;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class dbPowerHandler extends dbHandlerBase {
public dbPowerHandler() {
this.localClass = Mob.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static void addAllSourceTypes() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) {
ResultSet rs = preparedStatement.executeQuery();
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_sourcetype");
ResultSet rs = ps.executeQuery();
String IDString, source;
while (rs.next()) {
IDString = rs.getString("IDString");
int token = DbManager.hasher.SBStringHash(IDString);
source = rs.getString("source").replace("-", "").trim();
mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source);
Enum.EffectSourceType effectSourceType = Enum.EffectSourceType.GetEffectSourceType(source);
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
}
rs.close();
} catch (Exception e) {
Logger.error(e);
} finally {
ps.release();
}
}
public static void addAllAnimationOverrides() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_animation_override")) {
ResultSet rs = preparedStatement.executeQuery();
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_animation_override");
ResultSet rs = ps.executeQuery();
String IDString;
int animation;
while (rs.next()) {
@@ -73,10 +78,51 @@ public class dbPowerHandler extends dbHandlerBase {
PowersManager.AnimationOverrides.put(IDString, animation);
}
rs.close();
} catch (Exception e) {
Logger.error(e);
} finally {
ps.release();
}
}
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
MobPowerEntry mobPowerEntry;
int mobbaseID;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
mobbaseID = rs.getInt("mobbaseUUID");
mobPowerEntry = new MobPowerEntry(rs);
if (mobPowers.get(mobbaseID) == null) {
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
powerList.add(mobPowerEntry);
mobPowers.put(mobbaseID, powerList);
} else {
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
powerList.add(mobPowerEntry);
mobPowers.put(mobbaseID, powerList);
}
}
} catch (SQLException e) {
Logger.error(e);
return mobPowers;
}
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
return mobPowers;
}
}
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.PromotionClass;
import org.pmw.tinylog.Logger;
@@ -24,7 +23,7 @@ public class dbPromotionClassHandler extends dbHandlerBase {
public dbPromotionClassHandler() {
this.localClass = PromotionClass.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<Integer> GET_ALLOWED_RUNES(final PromotionClass pc) {
@@ -23,7 +23,25 @@ public class dbResistHandler extends dbHandlerBase {
public dbResistHandler() {
}
public void LOAD_RESISTS_FOR_MOBS() {
Resists resists = null;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists`;")) {
ResultSet rs = preparedStatement.executeQuery();
while(rs.next()){
resists = new Resists(rs);
if(!Resists.mobResists.containsKey(rs.getInt("ID")))
Resists.mobResists.put(rs.getInt("ID"),resists);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public Resists GET_RESISTS_FOR_MOB(int resistID) {
Resists resists = null;
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.RuneBaseAttribute;
import org.pmw.tinylog.Logger;
@@ -24,7 +23,7 @@ public class dbRuneBaseAttributeHandler extends dbHandlerBase {
public dbRuneBaseAttributeHandler() {
this.localClass = RuneBaseAttribute.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
@@ -9,9 +9,8 @@
package engine.db.handlers;
import engine.Enum.GameObjectType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.AbstractGameObject;
import engine.objects.RuneBaseEffect;
import org.pmw.tinylog.Logger;
@@ -27,7 +26,7 @@ public class dbRuneBaseEffectHandler extends dbHandlerBase {
public dbRuneBaseEffectHandler() {
this.localClass = RuneBaseEffect.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) {
+38 -82
View File
@@ -10,10 +10,7 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.RuneBase;
import engine.powers.RunePowerEntry;
import engine.powers.RuneSkillAdjustEntry;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -27,85 +24,7 @@ public class dbRuneBaseHandler extends dbHandlerBase {
public dbRuneBaseHandler() {
this.localClass = RuneBase.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
RunePowerEntry runePowerEntry;
int rune_id;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
rune_id = rs.getInt("rune_id");
runePowerEntry = new RunePowerEntry(rs);
if (mobPowers.get(rune_id) == null) {
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
runePowerList.add(runePowerEntry);
mobPowers.put(rune_id, runePowerList);
} else {
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
powerList.add(runePowerEntry);
mobPowers.put(rune_id, powerList);
}
}
} catch (SQLException e) {
Logger.error(e);
return mobPowers;
}
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
return mobPowers;
}
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
RuneSkillAdjustEntry runeSkillAdjustEntry;
int rune_id;
int recordsRead = 0;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
recordsRead++;
rune_id = rs.getInt("rune_id");
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
if (runeSkillAdjusts.get(rune_id) == null) {
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
skillAdjustList.add(runeSkillAdjustEntry);
runeSkillAdjusts.put(rune_id, skillAdjustList);
} else {
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
powerList.add(runeSkillAdjustEntry);
runeSkillAdjusts.put(rune_id, powerList);
}
}
} catch (SQLException e) {
Logger.error(e);
return runeSkillAdjusts;
}
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
return runeSkillAdjusts;
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public void GET_RUNE_REQS(final RuneBase rb) {
@@ -140,6 +59,43 @@ public class dbRuneBaseHandler extends dbHandlerBase {
rb.setLevelRequired(rs.getInt("requiredRuneID"));
break;
}
int id = rs.getInt("runeID");
switch(id) {
case 3001:
case 3002:
case 3003:
case 3004:
case 3007:
case 3008:
case 3009:
case 3013:
case 3014:
case 3016:
case 3017:
case 3018:
case 3019:
case 3020:
case 3021:
case 3026:
case 3030:
case 3031:
case 3033:
case 3037:
case 3040:
case 3045:
case 3046:
case 3047:
case 3048:
case 2514:
rb.getRace().put(1999, true);
break;
case 3035:
rb.getBaseClass().put(2501,true);
break;
case 3049:
rb.getRace().clear();
}
}
} catch (SQLException e) {
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.Building;
import engine.objects.Portal;
import org.pmw.tinylog.Logger;
@@ -49,7 +49,7 @@ public class dbRunegateHandler extends dbHandlerBase {
public ArrayList<Portal> GET_PORTAL_LIST(int gateUID) {
ArrayList<Portal> portalList = new ArrayList<>();
Building sourceBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, gateUID);
Building sourceBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, gateUID);
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_runegate_portals` WHERE `sourceBuilding` = ?;")) {
@@ -60,8 +60,8 @@ public class dbRunegateHandler extends dbHandlerBase {
while (rs.next()) {
int targetBuildingID = rs.getInt("targetBuilding");
Building targetBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, targetBuildingID);
mbEnums.PortalType portalType = mbEnums.PortalType.valueOf(rs.getString("portalType"));
Building targetBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, targetBuildingID);
Enum.PortalType portalType = Enum.PortalType.valueOf(rs.getString("portalType"));
Portal portal = new Portal(sourceBuilding, portalType, targetBuilding);
portalList.add(portal);
}
+2 -3
View File
@@ -9,10 +9,9 @@
package engine.db.handlers;
import engine.Enum.ProtectionState;
import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.ProtectionState;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.Shrine;
@@ -29,7 +28,7 @@ public class dbShrineHandler extends dbHandlerBase {
public dbShrineHandler() {
this.localClass = Shrine.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
+10 -3
View File
@@ -9,9 +9,9 @@
package engine.db.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.objects.MaxSkills;
import engine.objects.SkillsBase;
import org.pmw.tinylog.Logger;
@@ -27,7 +27,7 @@ public class dbSkillBaseHandler extends dbHandlerBase {
public dbSkillBaseHandler() {
this.localClass = SkillsBase.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public SkillsBase GET_BASE(final int objectUUID) {
@@ -143,6 +143,13 @@ public class dbSkillBaseHandler extends dbHandlerBase {
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
}
//add saetor skills
HashMap<Integer, Integer> skills = new HashMap<>();
skills.put(71438003,15); // staff
skills.put(-61022283,10); // staff mastery
skills.put(95961104,10); // parry
SkillsBase.runeSkillsCache.put(1999,skills);
} catch (SQLException e) {
Logger.error(e);
@@ -10,7 +10,6 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.SkillReq;
import engine.powers.PowersBase;
import org.pmw.tinylog.Logger;
@@ -26,7 +25,7 @@ public class dbSkillReqHandler extends dbHandlerBase {
public dbSkillReqHandler() {
this.localClass = SkillReq.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public static ArrayList<PowersBase> getAllPowersBase() {
@@ -9,8 +9,8 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.VendorDialog;
import org.pmw.tinylog.Logger;
@@ -23,12 +23,12 @@ public class dbVendorDialogHandler extends dbHandlerBase {
public dbVendorDialogHandler() {
this.localClass = VendorDialog.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(mbEnums.GameObjectType.VendorDialog, objectUUID);
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(Enum.GameObjectType.VendorDialog, objectUUID);
if (vendorDialog != null)
return vendorDialog;
+466 -145
View File
@@ -9,20 +9,14 @@
package engine.db.handlers;
import engine.Enum.GameObjectType;
import engine.Enum.ProtectionState;
import engine.Enum.TransactionType;
import engine.gameManager.DbManager;
import engine.gameManager.ForgeManager;
import engine.loot.WorkOrder;
import engine.mbEnums;
import engine.mbEnums.GameObjectType;
import engine.mbEnums.TransactionType;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.Transaction;
import engine.objects.Warehouse;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.joda.time.DateTime;
import org.json.JSONArray;
import org.json.JSONObject;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -37,10 +31,463 @@ public class dbWarehouseHandler extends dbHandlerBase {
private static final ConcurrentHashMap<Integer, String> columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public dbWarehouseHandler() {
this.localClass = Warehouse.class;
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, mbEnums.ResourceType resource, int amount, DateTime date) {
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
String type = rs.getString("type");
switch (type) {
case "building":
Building building = new Building(rs);
DbManager.addToCache(building);
list.add(building);
break;
case "warehouse":
Warehouse warehouse = new Warehouse(rs);
DbManager.addToCache(warehouse);
list.add(warehouse);
break;
}
}
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
Vector3fImmutable location, float meshScale, int currentHP,
ProtectionState protectionState, int currentGold, int rank,
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `WAREHOUSE_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,? ,?, ?);")) {
preparedStatement.setInt(1, parentZoneID);
preparedStatement.setInt(2, OwnerUUID);
preparedStatement.setString(3, name);
preparedStatement.setInt(4, meshUUID);
preparedStatement.setFloat(5, location.x);
preparedStatement.setFloat(6, location.y);
preparedStatement.setFloat(7, location.z);
preparedStatement.setFloat(8, meshScale);
preparedStatement.setInt(9, currentHP);
preparedStatement.setString(10, protectionState.name());
preparedStatement.setInt(11, currentGold);
preparedStatement.setInt(12, rank);
if (upgradeDate != null)
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
else
preparedStatement.setNull(13, java.sql.Types.DATE);
preparedStatement.setInt(14, blueprintUUID);
preparedStatement.setFloat(15, w);
preparedStatement.setFloat(16, rotY);
preparedStatement.execute();
ResultSet rs = preparedStatement.getResultSet();
while (rs.next())
addObject(warehouseList, rs);
while (preparedStatement.getMoreResults()) {
rs = preparedStatement.getResultSet();
while (rs.next())
addObject(warehouseList, rs);
}
} catch (SQLException e) {
Logger.error(e);
}
return warehouseList;
}
public boolean updateLocks(final Warehouse wh, long locks) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
preparedStatement.setLong(1, locks);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateGold(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateStone(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateTruesteel(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateIron(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateAdamant(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateLumber(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateOak(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateBronzewood(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateMandrake(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateCoal(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateAgate(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateDiamond(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateOnyx(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateAzoth(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateOrichalk(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateAntimony(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateSulfur(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateQuicksilver(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateGalvor(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateWormwood(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateObsidian(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateBloodstone(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean updateMithril(final Warehouse wh, int amount) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
@@ -85,150 +532,24 @@ public class dbWarehouseHandler extends dbHandlerBase {
return transactionsList;
}
public void DELETE_WAREHOUSE(Warehouse warehouse) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_warehouse` WHERE `cityUUID` = ?;")) {
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
preparedStatement.executeUpdate();
public void LOAD_ALL_WAREHOUSES() {
} catch (SQLException e) {
Logger.error(e);
}
}
public boolean UPDATE_WAREHOUSE(Warehouse warehouse) {
JSONObject warehouseJSON = new JSONObject();
JSONObject resources = new JSONObject(warehouse.resources);
warehouseJSON.put("resources", resources);
JSONArray locks = new JSONArray();
for (mbEnums.ResourceType resource : warehouse.locked)
locks.put(resource.name());
warehouseJSON.put("locked", locks);
Warehouse warehouse;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse` (`cityUUID`, `warehouse`) VALUES (?, ?) " +
"ON DUPLICATE KEY UPDATE `warehouse` = VALUES(`warehouse`)")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")) {
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
preparedStatement.setString(2, warehouseJSON.toString());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public void LOAD_WAREHOUSES() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_warehouse`;");
ResultSet rs = preparedStatement.executeQuery()) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int cityUID = rs.getInt("cityUUID");
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
City city = City.getCity(cityUID);
if (city == null) {
Logger.error("No city " + cityUID + " for warehouse");
continue;
}
city.warehouse = new Warehouse(jsonObject);
city.warehouse.city = city;
// Locate warehouse building
for (Building building : city.parentZone.zoneBuildingSet) {
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.WAREHOUSE)) {
city.warehouse.building = building;
break;
}
}
warehouse = new Warehouse(rs);
warehouse.runAfterLoad();
warehouse.loadAllTransactions();
}
} catch (Exception e) {
Logger.error(e);
}
}
public boolean WRITE_WORKORDER(WorkOrder workOrder) {
JSONObject warehouseJSON = WorkOrder.toJson(workOrder);
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_workorders` (`workorderID`, `workorder`) VALUES (?, ?) " +
"ON DUPLICATE KEY UPDATE `workorder` = VALUES(`workorder`)")) {
preparedStatement.setInt(1, workOrder.workOrderID);
preparedStatement.setString(2, warehouseJSON.toString());
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public void DELETE_WORKORDER(WorkOrder workOrder) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_workorders` WHERE `workorderID` = ?;")) {
preparedStatement.setInt(1, workOrder.workOrderID);
preparedStatement.executeUpdate();
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_WORKORDERS() {
// Method loads NPC workOrders from disk at bootstrap.
// A workOrder will persist until completed or junked
// via the client interface.
ArrayList<WorkOrder> submitList = new ArrayList<>();
ArrayList<WorkOrder> orphanList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
ResultSet rs = preparedStatement.executeQuery()) {
while (rs.next()) {
JSONObject jsonObject = new JSONObject(rs.getString("workorder"));
WorkOrder workOrder = new WorkOrder(jsonObject);
submitList.add(workOrder);
}
} catch (Exception e) {
Logger.error(e);
}
// Submit new workOrders to the ForgeManager
for (WorkOrder workOrder : submitList) {
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
// Delete but do not reconstitute orphan workOrders
if (workOrder.vendor == null)
continue;
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
ForgeManager.forge.add(workOrder);
}
}
}
+50 -41
View File
@@ -9,11 +9,11 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.mbEnums;
import engine.math.Vector2f;
import engine.objects.Zone;
import engine.objects.ZoneTemplate;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -26,29 +26,33 @@ public class dbZoneHandler extends dbHandlerBase {
public dbZoneHandler() {
this.localClass = Zone.class;
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<Zone> GET_ALL_ZONES() {
ArrayList<Zone> zoneList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
zoneList = getObjectsFromRs(rs, 2000);
} catch (SQLException e) {
Logger.error(e);
public ArrayList<Zone> GET_ALL_NODES(Zone zone) {
ArrayList<Zone> wsmList = new ArrayList<>();
wsmList.addAll(zone.getNodes());
if (zone.absX == 0.0f) {
zone.absX = zone.getXCoord();
}
return zoneList;
if (zone.absY == 0.0f) {
zone.absY = zone.getYCoord();
}
if (zone.absZ == 0.0f) {
zone.absZ = zone.getZCoord();
}
for (Zone child : zone.getNodes()) {
child.absX = child.getXCoord() + zone.absX;
child.absY = child.getYCoord() + zone.absY;
child.absZ = child.getZCoord() + zone.absZ;
wsmList.addAll(this.GET_ALL_NODES(child));
}
return wsmList;
}
public Zone GET_BY_UID(long ID) {
Zone zone = (Zone) DbManager.getFromCache(mbEnums.GameObjectType.Zone, (int) ID);
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, (int) ID);
if (zone != null)
return zone;
@@ -68,38 +72,43 @@ public class dbZoneHandler extends dbHandlerBase {
return zone;
}
public void LOAD_ALL_ZONE_TEMPLATES() {
public ArrayList<Zone> GET_MAP_NODES(final int objectUUID) {
ArrayList<Zone> zoneList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_templates")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
preparedStatement.setLong(1, objectUUID);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
ZoneTemplate zoneTemplate = new ZoneTemplate(rs);
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
}
// Add player city
ZoneTemplate zoneTemplate = new ZoneTemplate();
zoneTemplate.templateID = 0;
zoneTemplate.sea_level_type = "PARENT";
zoneTemplate.sea_level = 0;
zoneTemplate.max_blend = 128;
zoneTemplate.min_blend = 128;
zoneTemplate.terrain_max_y = 5;
zoneTemplate.major_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
zoneTemplate.minor_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
zoneTemplate.terrain_type = "PLANAR";
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
zoneList = getObjectsFromRs(rs, 2000);
} catch (SQLException e) {
Logger.error(e);
}
return zoneList;
}
public void LOAD_ZONE_EXTENTS() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_zone_size`;")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
Vector2f zoneSize = new Vector2f();
int loadNum = rs.getInt("loadNum");
zoneSize.x = rs.getFloat("xRadius");
zoneSize.y = rs.getFloat("zRadius");
ZoneManager._zone_size_data.put(loadNum, zoneSize);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public boolean DELETE_ZONE(final Zone zone) {
+1 -1
View File
@@ -9,9 +9,9 @@
package engine.devcmd;
import engine.Enum.GameObjectType;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.mbEnums.GameObjectType;
import engine.objects.*;
import java.util.ArrayList;
+1 -1
View File
@@ -9,6 +9,7 @@
package engine.devcmd.cmds;
import engine.Enum.ProtectionState;
import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
@@ -16,7 +17,6 @@ import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.mbEnums.ProtectionState;
import engine.objects.*;
import engine.server.MBServerStatics;
+3 -3
View File
@@ -32,7 +32,7 @@ public class AddGoldCmd extends AbstractDevCmd {
return;
}
Item gold = pc.charItemManager.getGoldInventory();
Item gold = pc.getCharItemManager().getGoldInventory();
int curAmt;
if (gold == null)
curAmt = 0;
@@ -54,13 +54,13 @@ public class AddGoldCmd extends AbstractDevCmd {
return;
}
if (!pc.charItemManager.addGoldToInventory(amt, true)) {
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
pc.charItemManager.updateInventory();
pc.getCharItemManager().updateInventory();
}
@Override
+31 -9
View File
@@ -9,16 +9,18 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.mbEnums;
import engine.objects.AbstractGameObject;
import engine.objects.Mob;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class AddMobCmd extends AbstractDevCmd {
public AddMobCmd() {
@@ -35,8 +37,27 @@ public class AddMobCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
int loadID;
if (words[0].equals("all")) {
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
return;
}
int loadID;
try {
loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
@@ -50,19 +71,20 @@ public class AddMobCmd extends AbstractDevCmd {
return; // NaN
}
if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in.");
return;
}
if (zone.guild_zone) {
if (zone.isPlayerCity()) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return;
}
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1, mbEnums.AIAgentType.MOBILE);
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
+22 -19
View File
@@ -9,10 +9,11 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*;
import engine.mbEnums.GameObjectType;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
@@ -70,28 +71,30 @@ public class AddNPCCmd extends AbstractDevCmd {
throwbackError(pc, "Failed to find zone to place npc in.");
return;
}
Building building = null;
if (target != null)
if (target.getObjectType() == GameObjectType.Building) {
Building parentBuilding = (Building) target;
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
return;
building = (Building)target;
}
NPC npc = NPC.createNPC(name, contractID,
pc.getLoc(), null, zone, (short) level, null);
if (npc != null) {
WorldGrid.addObject(npc, pc);
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getDBID() + " added");
this.setResult(String.valueOf(npc.getDBID()));
} else {
throwbackError(pc, "Failed to create npc of contract type "
+ contractID);
Logger.error(
"Failed to create npc of contract type " + contractID);
NPC created;
Guild guild = null;
Vector3fImmutable loc;
if(building != null){
guild = building.getGuild();
loc = building.loc;
} else{
loc = pc.loc;
}
created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
created.bindLoc = loc;
if(building != null) {
created.buildingUUID = building.getObjectUUID();
created.building = building;
NPCManager.slotCharacterInBuilding(created);
}
created.setLoc(created.bindLoc);
created.updateDatabase();
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
}
@Override
+1 -1
View File
@@ -9,10 +9,10 @@
package engine.devcmd.cmds;
import engine.Enum.PowerActionType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.PowersManager;
import engine.mbEnums.PowerActionType;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.powers.ActionsBase;
@@ -0,0 +1,127 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.ModType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.net.ItemProductionManager;
import engine.objects.*;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.powers.poweractions.AbstractPowerAction;
import org.pmw.tinylog.Logger;
public class AuditFailedItemsCmd extends AbstractDevCmd {
public AuditFailedItemsCmd() {
super("faileditems");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (ItemProductionManager.FailedItems.isEmpty())
return;
Logger.info("Auditing Item production Failed Items");
String newLine = "\r\n";
String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
for (ProducedItem failedItem : ItemProductionManager.FailedItems) {
String npcName = "";
String playerName = "";
String contractName = "";
String prefix = "";
String suffix = "";
String itemName = "";
NPC npc = NPC.getFromCache(failedItem.getNpcUID());
if (npc == null) {
npcName = "null";
contractName = "null";
} else {
npcName = npc.getName();
if (npc.getContract() != null)
contractName = npc.getContract().getName();
}
PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
if (roller == null)
playerName = "null";
else
playerName = roller.getName();
ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
if (ib != null) {
itemName = ib.getName();
}
if (failedItem.isRandom() == false) {
if (failedItem.getPrefix().isEmpty() == false) {
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
if (pa != null) {
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
if (aem.modType.equals(ModType.ItemName)) {
prefix = aem.getString1();
break;
}
}
}
}
if (failedItem.getSuffix().isEmpty() == false) {
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
if (pa != null) {
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
if (aem.modType.equals(ModType.ItemName)) {
suffix = aem.getString1();
break;
}
}
}
}
} else {
prefix = "random";
}
auditFailedItem += newLine;
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
}
Logger.info(auditFailedItem);
ItemProductionManager.FailedItems.clear();
}
@Override
protected String _getUsageString() {
return "' /bounds'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
@@ -0,0 +1,70 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.InterestManagement.HeightMap;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
public class AuditHeightMapCmd extends AbstractDevCmd {
public AuditHeightMapCmd() {
super("auditheightmap");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
int count = Integer.parseInt(words[0]);
long start = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
if (currentZone != null && currentZone.getHeightMap() != null) {
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
}
}
long end = System.currentTimeMillis();
long delta = end - start;
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
+105
View File
@@ -0,0 +1,105 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
public class AuditMobsCmd extends AbstractDevCmd {
public AuditMobsCmd() {
super("auditmobs");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
//get Zone to check mobs against
Zone zone;
if (words.length == 2) {
if (words[0].equals("all")) {
int plusplus = 0;
int count = Integer.parseInt(words[1]);
for (Zone zoneMicro : ZoneManager.getAllZones()) {
int size = zoneMicro.zoneMobSet.size();
if (size >= count) {
plusplus++;
throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
}
}
throwbackInfo(pcSender, " there are " + plusplus + " zones with at least " + count + " mobs in each.");
}
return;
}
if (words.length > 1) {
this.sendUsage(pcSender);
return;
} else if (words.length == 1) {
int uuid;
try {
uuid = Integer.parseInt(words[0]);
zone = ZoneManager.getZoneByUUID(uuid);
} catch (NumberFormatException e) {
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
} else
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
if (zone == null) {
throwbackError(pcSender, "Unable to find the zone");
return;
}
//get list of mobs for zone
if (zone.zoneMobSet.isEmpty()) {
throwbackError(pcSender, "No mobs found for this zone.");
return;
}
// ConcurrentHashMap<Integer, Mob> spawnMap = Mob.getSpawnMap();
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
//mob not found in spawn map, check respawn
boolean inRespawn = false;
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
+1 -1
View File
@@ -9,8 +9,8 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.mbEnums.GameObjectType;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.PlayerCharacter;
+114
View File
@@ -0,0 +1,114 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.util.MiscUtils;
public class ChangeNameCmd extends AbstractDevCmd {
public ChangeNameCmd() {
super("changename");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Vector3fImmutable loc = null;
// Arg Count Check
if (words.length < 2) {
this.sendUsage(pc);
return;
}
String oldFirst = words[0];
String newFirst = words[1];
String newLast = "";
if (words.length > 2) {
newLast = words[2];
for (int i = 3; i < words.length; i++)
newLast += ' ' + words[i];
}
//verify new name length
if (newFirst.length() < 3) {
this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
return;
}
//verify old name length
if (newLast.length() > 50) {
this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
return;
}
// Check if firstname is valid
if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
this.throwbackError(pc, "Error: First name is not allowed");
return;
}
//get the world ID we're modifying for
//test if first name is unique, unless new and old first name are equal.
if (!(oldFirst.equals(newFirst))) {
if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
this.throwbackError(pc, "Error: First name is not unique.");
return;
}
}
//tests passed, update name in database
if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
this.throwbackError(pc, "Error: Database failed to update the name.");
return;
}
//Finally update player ingame
PlayerCharacter pcTar = null;
try {
pcTar = SessionManager
.getPlayerCharacterByLowerCaseName(words[0]);
pcTar.setFirstName(newFirst);
pcTar.setLastName(newLast);
this.setTarget(pcTar); //for logging
//specify if last name is ascii characters only
String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
pcTar.setAsciiLastName(lastAscii.equals(newLast));
} catch (Exception e) {
this.throwbackError(pc, "Database was updated but ingame character failed to update.");
return;
}
String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
this.throwbackInfo(pc, out);
}
@Override
protected String _getHelpString() {
return "Changes the name of a player";
}
@Override
protected String _getUsageString() {
return "'./changename oldFirstName newFirstName newLastName'";
}
}
@@ -0,0 +1,56 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.net.client.msg.TargetedActionMsg;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
* @author Eighty
*/
public class CombatMessageCmd extends AbstractDevCmd {
public CombatMessageCmd() {
super("cm");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null)
return;
if (args.length != 1) {
this.sendUsage(pcSender);
return;
}
int num = 0;
try {
num = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
return;
}
TargetedActionMsg.un2cnt = num;
throwbackInfo(pcSender, "CombatMessage set to " + num);
}
@Override
protected String _getUsageString() {
return "' /cm [cmNumber]'";
}
@Override
protected String _getHelpString() {
return "Sets the combat message to the supplied integer value";
}
}
+18 -38
View File
@@ -10,14 +10,10 @@
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractGameObject;
import engine.objects.Item;
import engine.objects.ItemTemplate;
import engine.objects.ItemBase;
import engine.objects.ItemFactory;
import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
/**
* @author Eighty
@@ -29,46 +25,30 @@ public class CreateItemCmd extends AbstractDevCmd {
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(playerCharacter);
this.sendUsage(pc);
return;
}
int id;
id = ItemBase.getIDByName(words[0]);
if (id == 0)
id = Integer.parseInt(words[0]);
if (id == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.....");
return;
}
int templateID = Integer.parseInt(words[0]);
ItemTemplate template = ItemTemplate.templates.get(templateID);
if (template == null) {
ChatManager.chatSystemInfo(playerCharacter, "No such template found.");
return;
}
int size = 1;
if (words.length == 2)
if (words.length < 3) {
size = Integer.parseInt(words[1]);
for (int i = 0; i < size; i++) {
if (!playerCharacter.charItemManager.hasRoomInventory(template.item_wt)) {
ChatManager.chatSystemInfo(playerCharacter, "You are encumbered!.");
break;
}
Item item = new Item(templateID);
item.ownerID = playerCharacter.getObjectUUID();
item.ownerType = mbEnums.OwnerType.PlayerCharacter;
item.containerType = mbEnums.ItemContainerType.INVENTORY;
try {
item = DbManager.ItemQueries.PERSIST(item);
playerCharacter.charItemManager.addItemToInventory(item);
} catch (Exception e) {
Logger.error(e);
}
}
playerCharacter.charItemManager.updateInventory();
ItemFactory.fillInventory(pc, id, size);
}
@Override
@@ -78,7 +58,7 @@ public class CreateItemCmd extends AbstractDevCmd {
@Override
protected String _getUsageString() {
return "' /createitem <templateID> <quantity>'";
return "' /createitem <ItembaseID> <quantity>'";
}
}
+122
View File
@@ -0,0 +1,122 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.jobs.DebugTimerJob;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class DebugCmd extends AbstractDevCmd {
public DebugCmd() {
super("debug");
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
}
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
if (toggle) {
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
pc.renewTimer(name, dtj, duration);
} else
pc.cancelTimer(name);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
if (pc == null)
return;
//pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
String command = words[0].toLowerCase();
boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
switch (command) {
case "magictrek":
pc.RUN_MAGICTREK = toggle;
break;
case "combat":
pc.setDebug(64, toggle);
break;
case "health":
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
break;
case "mana":
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
break;
case "stamina":
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
break;
case "spells":
pc.setDebug(16, toggle);
break;
case "damageabsorber":
pc.setDebug(2, toggle);
break;
case "recast":
case "recycle":
pc.setDebug(4, toggle);
break;
case "seeinvis":
pc.setDebug(8, toggle);
break;
case "movement":
pc.setDebug(1, toggle);
break;
case "noaggro":
pc.setDebug(32, toggle);
break;
// case "loot":
// MBServerStatics.debugLoot = toggle;
// break;
default:
String output = "Debug for " + command + " not found.";
throwbackError(pc, output);
return;
}
setTarget(pc); //for logging
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
throwbackInfo(pc, output);
}
@Override
protected String _getHelpString() {
return "Runs debug commands";
}
@Override
protected String _getUsageString() {
return "'./Debug command on/off'";
}
}
@@ -10,49 +10,48 @@
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractCharacter;
import engine.gameManager.ChatManager;
import engine.objects.AbstractGameObject;
import engine.objects.CharacterRune;
import engine.objects.PlayerCharacter;
/**
*
*/
public class DebugMeleeSyncCmd extends AbstractDevCmd {
public class PrintRunesCmd extends AbstractDevCmd {
public PrintRunesCmd() {
super("printrunes");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
public DebugMeleeSyncCmd() {
super("debugmeleesync");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
AbstractCharacter tar;
String s = words[0].toLowerCase();
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
String newline = "\r\n ";
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
for (CharacterRune rune : ((AbstractCharacter) target).runes) {
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
}
throwbackInfo(pc, output);
if (s.equals("on")) {
pc.setDebug(64, true);
ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
} else if (s.equals("off")) {
pc.setDebug(64, false);
ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
} else {
this.sendUsage(pc);
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current stats";
return "Turns on/off melee sync debugging.";
}
@Override
protected String _getUsageString() {
return "' /printstats'";
return "'./debugmeleesync on|off'";
}
}
@@ -9,49 +9,46 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractCharacter;
import engine.gameManager.DbManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
*
*/
public class DecachePlayerCmd extends AbstractDevCmd {
public class PrintEffectsCmd extends AbstractDevCmd {
public PrintEffectsCmd() {
super("printeffects");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
public DecachePlayerCmd() {
super("decacheplayer");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 1) {
this.sendUsage(pc);
}
AbstractCharacter tar;
int objectUUID = Integer.parseInt(words[0]);
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
String newline = "\r\n ";
String output = "Effects For Character: " + tar.getName() + newline;
for (String effect : tar.effects.keySet()) {
output += effect + newline;
}
throwbackInfo(pc, output);
if (DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
PlayerCharacter.getFromCache(objectUUID).removeFromCache();
} else {
this.sendHelp(pc);
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current stats";
return "No player found. Please make sure the table ID is correct.";
}
@Override
protected String _getUsageString() {
return "' /printstats'";
return "' /decacheplayer <UUID>'";
}
}
+66
View File
@@ -0,0 +1,66 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.Mob;
import engine.objects.PlayerCharacter;
public class DespawnCmd extends AbstractDevCmd {
public DespawnCmd() {
super("debugmob");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (pc == null) {
return;
}
Mob mob = null;
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
mob = (Mob) target;
if (mob == null)
mob = Mob.getFromCache(Integer.parseInt(words[1]));
if (mob == null)
return;
if (words[0].equalsIgnoreCase("respawn")) {
mob.respawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
} else if (words[0].equalsIgnoreCase("despawn")) {
mob.despawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
}
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
}
@Override
protected String _getUsageString() {
return "' /distance'";
}
}
+65
View File
@@ -0,0 +1,65 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject;
import engine.objects.AbstractWorldObject;
import engine.objects.PlayerCharacter;
public class DistanceCmd extends AbstractDevCmd {
public DistanceCmd() {
super("distance");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
if (target == null || !(target instanceof AbstractWorldObject)) {
throwbackError(pc, "No target found.");
return;
}
AbstractWorldObject awoTarget = (AbstractWorldObject) target;
Vector3fImmutable pcLoc = pc.getLoc();
Vector3fImmutable tarLoc = awoTarget.getLoc();
String out = "Distance: " + pcLoc.distance(tarLoc) +
"\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
"\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
throwbackInfo(pc, out);
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
}
@Override
protected String _getUsageString() {
return "' /distance'";
}
}
+61
View File
@@ -0,0 +1,61 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.PowersManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.powers.EffectsBase;
/**
* @author Eighty
*/
public class EffectCmd extends AbstractDevCmd {
public EffectCmd() {
super("effect");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int ID = 0;
int token = 0;
if (args.length != 2) {
this.sendUsage(pcSender);
return;
}
ID = Integer.parseInt(args[0]);
token = Integer.parseInt(args[1]);
EffectsBase eb = PowersManager.setEffectToken(ID, token);
if (eb == null) {
throwbackError(pcSender, "Unable to find EffectsBase " + ID
+ " to modify.");
return;
}
ChatManager.chatSayInfo(pcSender,
"EffectsBase with ID " + ID + " changed token to " + token);
}
@Override
protected String _getUsageString() {
return "' /effect EffectsBaseID Token'";
}
@Override
protected String _getHelpString() {
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
}
}
+76
View File
@@ -0,0 +1,76 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.*;
import engine.powers.EffectsBase;
public class EnchantCmd extends AbstractDevCmd {
public EnchantCmd() {
super("enchant");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int rank = 0;
if (words.length < 1) {
this.sendUsage(pc);
return;
}
try {
rank = Integer.parseInt(words[0]);
} catch (Exception e) {
}
Item item;
if (target == null || target instanceof Item)
item = (Item) target;
else {
throwbackError(pc, "Must have an item targeted");
return;
}
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
if (words[0].equals("clear")) {
item.clearEnchantments();
cim.updateInventory();
this.setResult(String.valueOf(item.getObjectUUID()));
} else {
int cnt = words.length;
String enchant = words[1];
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase());
item.addPermanentEnchantmentForDev(enchant, 0);
cim.updateInventory();
}
}
@Override
protected String _getHelpString() {
return "Enchants an item with a prefix and suffix";
}
@Override
protected String _getUsageString() {
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ public class FlashMsgCmd extends AbstractDevCmd {
this.sendUsage(pcSender);
return;
}
ChatManager.chatSystemFlash(args[0]);
ChatManager.chatSystemFlash(String.join(" ", args));
}
/**
+84
View File
@@ -0,0 +1,84 @@
package engine.devcmd.cmds;
import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.math.Vector3fImmutable;
import engine.objects.*;
public class GateInfoCmd extends AbstractDevCmd {
public GateInfoCmd() {
super("gateinfo");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter player, String[] args,
AbstractGameObject target) {
Building targetBuilding;
String outString;
Runegate runeGate;
Blueprint blueprint;
String newline = "\r\n ";
targetBuilding = (Building) target;
if (targetBuilding.getObjectType() != GameObjectType.Building) {
throwbackInfo(player, "GateInfo: target must be a Building");
throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
return;
}
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
if (blueprint == null ||
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)) {
throwbackInfo(player, "showgate: target must be a Runegate");
return;
}
runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
outString = "RungateType: " + runeGate.gateBuilding.getName();
outString += newline;
outString += "Portal State:";
outString += newline;
for (Portal portal : runeGate.getPortals()) {
outString += "Portal: " + portal.portalType.name();
outString += " Active: " + portal.isActive();
outString += " Dest: " + portal.targetGate.getName();
outString += newline;
outString += " Origin: " + portal.getPortalLocation().x + 'x';
outString += " " + portal.getPortalLocation().y + 'y';
outString += newline;
Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
outString += " Offset: " + offset.x + "x " + offset.z + 'y';
outString += newline;
outString += newline;
}
outString += newline;
throwbackInfo(player, outString);
}
@Override
protected String _getHelpString() {
return "Displays a runegate's gate status";
}
@Override
protected String _getUsageString() {
return "/gateinfo <target runegate> \n";
}
}
@@ -6,39 +6,47 @@
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.handlers;
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.SessionManager;
import engine.mbEnums;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.TargetObjectMsg;
import engine.net.client.msg.VendorDialogMsg;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class TargetObjectMsgHandler extends AbstractClientMsgHandler {
/**
* @author Eighty
*/
public class GetBankCmd extends AbstractDevCmd {
public TargetObjectMsgHandler() {
super();
public GetBankCmd() {
super("getbank");
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null)
return;
TargetObjectMsg msg = (TargetObjectMsg) baseMsg;
ClientConnection cc = SessionManager.getClientConnection(pcSender);
if (cc == null)
return;
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
if (player == null)
return true;
// TODO improve this later. hacky way to make sure player ingame is
// active.
if (!player.isActive())
player.setActive(true);
player.setLastTarget(mbEnums.GameObjectType.values()[msg.getTargetType()], msg.getTargetID());
return true;
VendorDialogMsg.getBank(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
}
@Override
protected String _getUsageString() {
return "' /getbank'";
}
@Override
protected String _getHelpString() {
return "Opens bank window";
}
}
@@ -9,44 +9,32 @@
package engine.devcmd.cmds;
import engine.InterestManagement.InterestManager;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractGameObject;
import engine.objects.NPC;
import engine.objects.PlayerCharacter;
public class SetRaceCmd extends AbstractDevCmd {
public class GetCacheCountCmd extends AbstractDevCmd {
public SetRaceCmd() {
super("setRace");
public GetCacheCountCmd() {
super("getcachecount");
this.addCmdString("getcachecount");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int newRace = Integer.parseInt(words[0]);
if (target.getObjectType().equals(mbEnums.GameObjectType.NPC) == false) {
throwbackError(player, "You Must Target An NPC");
}
NPC npc = (NPC) target;
npc.loadID = newRace;
DbManager.NPCQueries.UPDATE_RACE(npc, newRace);
InterestManager.reloadCharacter(npc);
}
@Override
protected String _getHelpString() {
return "Sets NPC race";
DbManager.printCacheCount(pcSender);
}
@Override
protected String _getUsageString() {
return "' /setrace ID'";
return "' /getcachecount'";
}
@Override
protected String _getHelpString() {
return "Get a count of the objects in the cache";
}
}
+172 -45
View File
@@ -9,10 +9,11 @@
package engine.devcmd.cmds;
import engine.InterestManagement.Terrain;
import engine.InterestManagement.HeightMap;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
@@ -21,79 +22,205 @@ public class GetHeightCmd extends AbstractDevCmd {
public GetHeightCmd() {
super("getHeight");
this.addCmdString("height");
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Zone currentZone;
Zone parentZone;
Zone heightmapZone;
boolean end = true;
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
heightmapZone = Terrain.getNextZoneWithTerrain(currentZone);
parentZone = Terrain.getNextZoneWithTerrain(currentZone.parent);
float height = HeightMap.getWorldHeight(pc);
Vector2f childZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
Vector2f childZoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
Vector2f normalizedOffset = new Vector2f(Math.abs(childZoneOffset.x) / heightmapZone.template.major_radius,
Math.abs(childZoneOffset.y) / heightmapZone.template.minor_radius);
Vector2f parentZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), parentZone);
this.throwbackInfo(pc, "Altitude : " + height);
float childHeight = heightmapZone.terrain.getInterpolatedTerrainHeight(childZoneLoc);
childHeight = childHeight + heightmapZone.global_height;
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
float parentHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentZoneLoc);
parentHeight += parentZone.global_height;
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
if (end)
return;
Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc);
Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1);
Vector2f gridSquare;
Vector2f gridOffset;
Vector2f parentGrid;
Vector2f parentLoc = new Vector2f(-1, -1);
terrainCell.x = (float) Math.floor(terrainCell.x);
terrainCell.y = (float) Math.floor(terrainCell.y);
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
if (currentZone == null)
return;
Zone parentZone = currentZone.getParent();
HeightMap heightMap = currentZone.getHeightMap();
short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y];
short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y];
short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y + 1];
short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y + 1];
//find the next parents heightmap if the currentzone heightmap is null.
while (heightMap == null) {
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName);
if (currentZone == ZoneManager.getSeaFloor()) {
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
break;
}
this.throwbackInfo(playerCharacter, "Player loc: " + "[" + playerCharacter.loc.x + "]" + "[" + playerCharacter.loc.y + "]" + "[" + playerCharacter.loc.z + "]");
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
this.throwbackInfo(pc, "Using parent zone instead: ");
currentZone = currentZone.getParent();
heightMap = currentZone.getHeightMap();
}
this.throwbackInfo(playerCharacter, "Terrain Cell : " + "[" + terrainCell.x + "]" + "[" + terrainCell.y + "]");
this.throwbackInfo(playerCharacter, "Cell Offset : " + "[" + cell_offset.x + "]" + "[" + cell_offset.y + "]");
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]");
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]");
this.throwbackInfo(playerCharacter, "Child Zone Offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]");
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend);
this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y);
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset));
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
return;
}
this.throwbackInfo(playerCharacter, "------------");
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
} else
parentGrid = new Vector2f(-1, -1);
gridSquare = heightMap.getGridSquare(zoneLoc);
gridOffset = HeightMap.getGridOffset(gridSquare);
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
this.throwbackInfo(pc, currentZone.getName());
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
if (parentGrid.x != -1) {
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
}
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
//OUTSET
if (parentZone != null) {
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
float bucketScaleX = 100 / parentXRadius;
float bucketScaleZ = 200 / parentZRadius;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
float weight;
double scale;
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getAbsY();
realWorldAltitude = outsetALt;
} else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
float scaleChild = (float) ((scale + 1) * .5);
float scaleParent = 1 - scaleChild;
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
parentCenterAltitude += currentZone.getYCoord();
parentCenterAltitude += interaltitude;
float firstScale = parentAltitude * scaleParent;
float secondScale = parentCenterAltitude * scaleChild;
float outsetALt = firstScale + secondScale;
outsetALt += currentZone.getParent().getAbsY();
realWorldAltitude = outsetALt;
}
}
float strMod = pc.statStrBase - 40;
strMod *= .00999999998f;
strMod += 1f;
float radius = 0;
switch (pc.getRaceID()) {
case 2017:
radius = 3.1415927f;
case 2000:
}
strMod *= 1.5707964f;
strMod += 3.1415927f;
strMod -= .5f;
realWorldAltitude += strMod;
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
this.throwbackInfo(playerCharacter, "Child Height at loc: " + Math.ceil(childHeight));
this.throwbackInfo(playerCharacter, "Parent Height at loc: " + Math.ceil(parentHeight));
this.throwbackInfo(playerCharacter, "Blended Height (Ceil): " + blendedHeight + " (" + Math.ceil(blendedHeight) + ")");
}
@Override
protected String _getHelpString() {
return "Queries heightmap engine";
return "Temporarily Changes SubRace";
}
@Override
protected String _getUsageString() {
return "' /getheight";
return "' /subrace mobBaseID";
}
}
+58
View File
@@ -0,0 +1,58 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class GetMemoryCmd extends AbstractDevCmd {
public GetMemoryCmd() {
super("getmemory");
}
public static String getMemoryOutput(long memory) {
String out = "";
if (memory > 1073741824)
return (memory / 1073741824) + "GB";
else if (memory > 1048576)
return (memory / 1048576) + "MB";
else if (memory > 1024)
return (memory / 1048576) + "KB";
else
return memory + "B";
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
throwbackInfo(pcSender, out);
}
@Override
protected String _getUsageString() {
return "' /getmemory'";
}
@Override
protected String _getHelpString() {
return "lists memory usage";
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ public class GetOffsetCmd extends AbstractDevCmd {
float difY = pcSender.getLoc().y - zone.absY;
float difZ = pcSender.getLoc().z - zone.absZ;
throwbackInfo(pcSender, zone.zoneName + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
}
@Override
@@ -6,37 +6,38 @@
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.handlers;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.GoldToVaultMsg;
import engine.objects.Account;
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class GoldToVaultMsgHandler extends AbstractClientMsgHandler {
public GoldToVaultMsgHandler() {
super();
public class GetRuneDropRateCmd extends AbstractDevCmd {
public GetRuneDropRateCmd() {
super("getrunedroprate");
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
PlayerCharacter player = origin.getPlayerCharacter();
GoldToVaultMsg msg = (GoldToVaultMsg) baseMsg;
if (player == null)
return true;
Account account = player.getAccount();
if (account == null)
return true;
account.transferGoldFromInventoryToVault(msg, origin);
return true;
String out = "Depracated";
throwbackInfo(pcSender, out);
}
}
@Override
protected String _getUsageString() {
return "' /getrunedroprate'";
}
@Override
protected String _getHelpString() {
return "lists drop rates for runes and contracts in non-hotzone.";
}
}
+2 -2
View File
@@ -12,7 +12,7 @@ package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.SessionManager;
import engine.net.client.ClientConnection;
import engine.net.client.handlers.VendorDialogMsgHandler;
import engine.net.client.msg.VendorDialogMsg;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
@@ -32,7 +32,7 @@ public class GetVaultCmd extends AbstractDevCmd {
if (cc == null)
return;
VendorDialogMsgHandler.getVault(pcSender, null, cc);
VendorDialogMsg.getVault(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
+67
View File
@@ -0,0 +1,67 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
import java.util.ArrayList;
public class GetZoneCmd extends AbstractDevCmd {
public GetZoneCmd() {
super("getzone");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
if (words.length != 1) {
this.sendUsage(pcSender);
return;
}
ArrayList<Zone> allIn = new ArrayList<>();
switch (words[0].toLowerCase()) {
case "all":
throwbackInfo(pcSender, "All zones currently in");
allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
break;
case "smallest":
throwbackInfo(pcSender, "Smallest zone currently in");
Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
allIn.add(zone);
break;
default:
this.sendUsage(pcSender);
return;
}
for (Zone zone : allIn)
throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
}
@Override
protected String _getUsageString() {
return "' /getzone smallest/all'";
}
@Override
protected String _getHelpString() {
return "lists what zones a player is in";
}
}
+107
View File
@@ -0,0 +1,107 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.PlayerCharacter;
public class GotoBoundsCmd extends AbstractDevCmd {
public GotoBoundsCmd() {
super("gotobounds");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
String corner = words[0];
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
this.throwbackError(player, "No Building Selected");
return;
}
Building building = (Building) target;
if (building.getBounds() == null) {
this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
return;
}
float x = building.getBounds().getHalfExtents().x;
float z = building.getBounds().getHalfExtents().y;
if (building.getBlueprint() != null) {
x = building.getBlueprint().getExtents().x;
z = building.getBlueprint().getExtents().y;
}
float topLeftX = building.getLoc().x - x;
float topLeftY = building.getLoc().z - z;
float topRightX = building.getLoc().x + x;
float topRightY = building.getLoc().z - z;
float bottomLeftX = building.getLoc().x - x;
float bottomLeftY = building.getLoc().z + z;
float bottomRightX = building.getLoc().x + x;
float bottomRightY = building.getLoc().z + z;
switch (corner) {
case "topleft":
targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
break;
case "topright":
targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
break;
case "bottomleft":
targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
break;
case "bottomright":
targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
break;
default:
this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
return;
}
targetLoc = Vector3fImmutable.transform(building.getLoc(), targetLoc, building.getBounds().getRotationDegrees());
// Teleport player
if (targetLoc == Vector3fImmutable.ZERO) {
this.throwbackError(player, "Failed to locate UUID");
return;
}
player.teleport(targetLoc);
}
@Override
protected String _getHelpString() {
return "Teleports player to a UUID";
}
@Override
protected String _getUsageString() {
return "' /gotoobj <UID>'";
}
}
+4 -4
View File
@@ -9,11 +9,11 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums.GameObjectType;
import engine.objects.*;
import engine.server.MBServerStatics;
@@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd {
continue;
Zone zone = city.getParent();
if (zone != null) {
if (zone.isNPCCity || zone.guild_zone)
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
@@ -97,10 +97,10 @@ public class GotoCmd extends AbstractDevCmd {
Zone zone = (Zone) zoneAgo;
if (zone == null)
continue;
if (!zone.zoneName.equalsIgnoreCase(cityName))
if (!zone.getName().equalsIgnoreCase(cityName))
continue;
if (zone != null) {
if (zone.isNPCCity || zone.guild_zone)
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
+8 -8
View File
@@ -9,10 +9,10 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.objects.*;
public class GotoObj extends AbstractDevCmd {
@@ -27,7 +27,7 @@ public class GotoObj extends AbstractDevCmd {
int uuid;
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
mbEnums.DbObjectType objectType;
Enum.DbObjectType objectType;
try {
uuid = Integer.parseInt(words[0]);
@@ -41,37 +41,37 @@ public class GotoObj extends AbstractDevCmd {
switch (objectType) {
case NPC:
NPC npc = (NPC) DbManager.getFromCache(mbEnums.GameObjectType.NPC, uuid);
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
if (npc != null)
targetLoc = npc.getLoc();
break;
case MOB:
Mob mob = (Mob) DbManager.getFromCache(mbEnums.GameObjectType.Mob, uuid);
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
if (mob != null)
targetLoc = mob.getLoc();
break;
case CHARACTER:
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(mbEnums.GameObjectType.PlayerCharacter, uuid);
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
if (playerCharacter != null)
targetLoc = playerCharacter.getLoc();
break;
case BUILDING:
Building building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, uuid);
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
if (building != null)
targetLoc = building.getLoc();
break;
case ZONE:
Zone zone = (Zone) DbManager.getFromCache(mbEnums.GameObjectType.Zone, uuid);
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
if (zone != null)
targetLoc = zone.getLoc();
break;
case CITY:
City city = (City) DbManager.getFromCache(mbEnums.GameObjectType.City, uuid);
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
if (city != null)
targetLoc = city.getLoc();
+2 -2
View File
@@ -40,7 +40,7 @@ public class HotzoneCmd extends AbstractDevCmd {
String input = data.toString().trim();
if (input.length() == 0) {
outString = "Current hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
@@ -48,7 +48,7 @@ public class HotzoneCmd extends AbstractDevCmd {
if (input.equalsIgnoreCase("random")) {
ZoneManager.generateAndSetRandomHotzone();
outString = "New hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
+28 -29
View File
@@ -9,14 +9,14 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
import engine.Enum.TargetColor;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.BuildingGroup;
import engine.mbEnums.GameObjectType;
import engine.mbEnums.TargetColor;
import engine.objects.*;
import engine.util.StringUtils;
@@ -253,9 +253,9 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
output += newline;
output += "RaceType: " + targetPC.race.getRaceType().name();
output += "RaceType: " + targetPC.getRace().getRaceType().name();
output += newline;
output += "Race: " + targetPC.race.getName();
output += "Race: " + targetPC.getRace().getName();
output += newline;
output += "Safe:" + targetPC.inSafeZone();
output += newline;
@@ -278,9 +278,9 @@ public class InfoCmd extends AbstractDevCmd {
output += "Account ID: UNKNOWN";
output += newline;
output += "Inventory Weight:" + (targetPC.charItemManager.getInventoryWeight() + targetPC.charItemManager.getEquipWeight());
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
output += newline;
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
output += "Max Inventory Weight:" + targetPC.getInventoryCapacity();
output += newline;
output += "ALTITUDE :" + targetPC.getAltitude();
output += newline;
@@ -291,7 +291,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "inFloor :" + targetPC.getInFloorID();
output += newline;
BaseClass baseClass = targetPC.baseClass;
BaseClass baseClass = targetPC.getBaseClass();
if (baseClass != null)
output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
@@ -336,8 +336,9 @@ public class InfoCmd extends AbstractDevCmd {
output += "Swimming : " + targetPC.isSwimming();
output += newline;
output += "isMoving : " + targetPC.isMoving();
output += "isMoving : " + targetPC.isMoving() + newline;
output += "Zerg Multiplier: " + targetPC.ZergMultiplier + newline;
output += "isBoxed: " + targetPC.isBoxed + newline;
break;
case NPC:
@@ -369,8 +370,7 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "InventorySet: " + targetNPC.getContract().inventorySet;
output += newline;
Contract contract1 = targetNPC.getContract();
output += contract1.allowedBuildings.toString();
output += targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
@@ -384,12 +384,11 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
if (mobBase != null) {
output += newline;
Contract contract = targetNPC.getContract();
output += "Slottable: " + contract.allowedBuildings.toString();
output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "EquipSet: " + targetNPC.getEquipmentSetID();
output += newline;
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().templateID;
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
}
@@ -438,7 +437,7 @@ public class InfoCmd extends AbstractDevCmd {
if (targetMob.isPet()) {
output += "isPet: true";
output += newline;
if ((targetMob.agentType.equals(mbEnums.AIAgentType.PET)))
if ((targetMob.agentType.equals(Enum.AIAgentType.PET)))
output += "isSummonedPet: true";
else
output += "isSummonedPet: false";
@@ -458,7 +457,7 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
}
if ((targetMob.agentType.equals(mbEnums.AIAgentType.MOBILE))) {
if ((targetMob.agentType.equals(Enum.AIAgentType.MOBILE))) {
output += "SpawnRadius: " + targetMob.getSpawnRadius();
output += newline;
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
@@ -475,7 +474,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "EquipSet: " + targetMob.equipmentSetID;
output += newline;
try {
output += "Parent Zone LoadNum : " + targetMob.parentZone.templateID;
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
} catch (Exception ex) {
//who cares
}
@@ -496,28 +495,28 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "No building found." + newline;
}
int max = (int) (4.882 * targetMob.level + 121.0);
if (max > 321) {
int max = (int)(4.882 * targetMob.level + 121.0);
if(max > 321){
max = 321;
}
int min = (int) (4.469 * targetMob.level - 3.469);
int min = (int)(4.469 * targetMob.level - 3.469);
output += "Min Loot Roll = " + min;
output += "Max Loot Roll = " + max;
break;
case Item: //intentional passthrough
case MobLoot:
Item item = (Item) target;
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
output += StringUtils.addWS("Template: " + template.template_id, 20);
output += "Weight: " + template.item_wt;
ItemBase itemBase = item.getItemBase();
output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
output += "Weight: " + itemBase.getWeight();
output += newline;
DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
output += StringUtils.addWS("Qty: "
+ df.format(item.getNumOfItems()), 20);
output += "Charges: " + (byte) item.chargesRemaining
+ '/' + item.template.item_initial_charges;
output += "Charges: " + item.getChargesRemaining()
+ '/' + item.getChargesMax();
output += newline;
output += "Name: " + template.item_base_name;
output += "Name: " + itemBase.getName();
output += newline;
output += item.getContainerInfo();
@@ -527,7 +526,7 @@ public class InfoCmd extends AbstractDevCmd {
ConcurrentHashMap<String, Effect> effects = item.getEffects();
for (String name : effects.keySet()) {
Effect eff = effects.get(name);
output += eff.getEffectsBase().getIDString();
output += eff.getEffectsBase().getIDString() + " Static:" + eff.isStatic();
output += newline;
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
}
+212
View File
@@ -0,0 +1,212 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.ProtectionState;
import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class MakeBaneCmd extends AbstractDevCmd {
public MakeBaneCmd() {
super("makebane");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 1 || words.length > 2) {
this.sendUsage(pc);
return;
}
int attackerID = 0;
int rank = 8;
if (words.length == 2) {
try {
attackerID = Integer.parseInt(words[0]);
rank = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
return;
}
} else if (words.length == 1) {
if (target == null) {
throwbackError(pc, "No target specified");
return;
}
if (!(target instanceof PlayerCharacter)) {
throwbackError(pc, "Target is not a player");
return;
}
attackerID = target.getObjectUUID();
try {
rank = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Rank must be specified, 1 through 8");
return;
}
}
if (rank < 1 || rank > 8) {
throwbackError(pc, "Rank must be 1 through 8");
return;
}
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
if (player.getGuild().isEmptyGuild()) {
throwbackError(pc, "Errant's can not place banes");
return;
}
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
if (attackerAGL == null) {
throwbackError(pc, "No guild leader found for attacking guild.");
return;
}
if (!(attackerAGL instanceof PlayerCharacter)) {
throwbackError(pc, "Attacking guild leader is an NPC.");
return;
}
if (player.getGuild().isNPCGuild()) {
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
return;
}
// if (player.getGuild().getOwnedCity() != null) {
// throwbackError(pc, "The attacking guild already has a city.");
// return;
// }
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
if (city.getTOL() == null) {
throwbackError(pc, "Unable to find the tree of life for this city.");
return;
}
if (city.getBane() != null) {
throwbackError(pc, "This city is already baned.");
return;
}
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
throwbackError(pc, "This guild is already baning someone.");
return;
}
Blueprint blueprint = Blueprint.getBlueprint(24300);
if (blueprint == null) {
throwbackError(pc, "Unable to find building set for banestone.");
return;
}
Vector3f rot = new Vector3f(0, 0, 0);
// *** Refactor : Overlap test goes here
//Let's drop a banestone!
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
if (localLocation == null) {
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
Logger.info("Failed to Convert World coordinates to local zone coordinates");
return;
}
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
null, blueprint.getBlueprintUUID(), 1, 0.0f);
if (stone == null) {
ChatManager.chatSystemError(pc, "Failed to create banestone.");
return;
}
stone.addEffectBit((1 << 19));
stone.setRank((byte) rank);
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
stone.setCurrentHitPoints(stone.getMaxHitPoints());
BuildingManager.setUpgradeDateTime(stone, null, 0);
//Make the bane
Bane bane = Bane.makeBane(player, city, stone);
if (bane == null) {
//delete bane stone, failed to make bane object
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
throwbackError(pc, "Failed to create bane.");
return;
}
WorldGrid.addObject(stone, pc);
//Add baned effect to TOL
city.getTOL().addEffectBit((1 << 16));
city.getTOL().updateEffects();
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
player.teleport(movePlayerOutsideStone);
throwbackInfo(pc, "The city has been succesfully baned.");
}
@Override
protected String _getHelpString() {
return "Creates an bane.";
}
@Override
protected String _getUsageString() {
return "'./makebane playerUUID baneRank'";
}
}
+88 -35
View File
@@ -9,13 +9,16 @@
package engine.devcmd.cmds;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.mbEnums.ItemType;
import engine.mbEnums.OwnerType;
import engine.objects.*;
import engine.powers.EffectsBase;
import java.util.ArrayList;
/**
* @author Eighty
*/
@@ -29,6 +32,52 @@ public class MakeItemCmd extends AbstractDevCmd {
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words[0].equals("resources")) {
for (int ibID : Warehouse.getMaxResources().keySet()) {
if (ibID == 7)
continue;
ItemBase ib = ItemBase.getItemBase(ibID);
short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item");
pc.getCharItemManager().updateInventory();
return;
}
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
if(item == null)
throwbackError(pc, "Item Null");
else
throwbackError(pc, "Worked = false");
return;
}
//add item to inventory
pc.getCharItemManager().addItemToInventory(item);
}
return;
}
if (words.length < 3 || words.length > 5) {
this.sendUsage(pc);
return;
@@ -58,23 +107,16 @@ public class MakeItemCmd extends AbstractDevCmd {
numItems = (numItems > 5000) ? 5000 : numItems;
}
int templateID;
ItemTemplate template;
int itembaseID;
try {
templateID = Integer.parseInt(words[0]);
template = ItemTemplate.templates.get(words[0].toLowerCase());
if (template == null) {
itembaseID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
if (itembaseID == 0) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
}
if (template.item_type == ItemType.GOLD) {
this.throwbackInfo(pc, "use /addgold to add gold.");
return;
}
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use createitem command for type "
@@ -82,6 +124,10 @@ public class MakeItemCmd extends AbstractDevCmd {
return; // NaN
}
if (itembaseID == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.");
return;
}
String prefix = "";
String suffix = "";
@@ -132,54 +178,61 @@ public class MakeItemCmd extends AbstractDevCmd {
return;
}
}
template = ItemTemplate.templates.get(templateID);
if (template == null) {
throwbackError(pc, "Unable to find template " + templateID);
ItemBase ib = ItemBase.getItemBase(itembaseID);
if (ib == null) {
throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
return;
}
if ((numItems > 1)
&& (template.item_type.equals(ItemType.RESOURCE) == false)
&& (template.item_type.equals(ItemType.OFFERING)) == false)
&& (ib.getType().equals(ItemType.RESOURCE) == false)
&& (ib.getType().equals(ItemType.OFFERING)) == false)
numItems = 1;
CharacterItemManager cim = pc.charItemManager;
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
byte charges = (byte) ib.getNumCharges();
short dur = (short) ib.getDurability();
String result = "";
for (int i = 0; i < quantity; i++) {
int weight = template.item_wt;
short weight = ib.getWeight();
if (!cim.hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
if (i > 0)
cim.updateInventory();
return;
}
Item item = new Item(templateID);
item.ownerID = pc.getObjectUUID();
item.ownerType = OwnerType.PlayerCharacter;
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, charges, charges, dur, dur,
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
if (numItems > 1)
item.setNumOfItems(numItems);
try {
item = DbManager.ItemQueries.PERSIST(item);
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
if(item == null)
throwbackError(pc, "Item Null");
else
throwbackError(pc, "Worked = false");
return;
}
//create prefix
if (!prefix.isEmpty())
item.addPermanentEnchantmentForDev(prefix, 0);
@@ -198,12 +251,12 @@ public class MakeItemCmd extends AbstractDevCmd {
@Override
protected String _getHelpString() {
return "Creates an item of type templateID with a prefix and suffix";
return "Creates an item of type 'itembaseID' with a prefix and suffix";
}
@Override
protected String _getUsageString() {
return "'./makeitem templateID PrefixID SuffixID [quantity] [numResources]'";
return "'./makeitem itembaseID PrefixID SuffixID [quantity] [numResources]'";
}
}
+2 -3
View File
@@ -16,7 +16,6 @@ import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
import engine.workthreads.HourlyJobThread;
/**
*
@@ -41,10 +40,10 @@ public class MineActiveCmd extends AbstractDevCmd {
String trigger = args[0];
switch (trigger) {
case "true":
HourlyJobThread.mineWindowOpen(mine);
Mine.mineWindowOpen(mine);
break;
case "false":
HourlyJobThread.mineWindowClose(mine);
Mine.mineWindowClose(mine);
break;
default:
this.sendUsage(pcSender);
+2 -6
View File
@@ -47,17 +47,13 @@ public class PrintBankCmd extends AbstractDevCmd {
}
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
ArrayList<Item> list = cim.getBank();
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems());
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldBank();
if (gold != null)
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
else
+2 -3
View File
@@ -9,9 +9,9 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.mbEnums.GameObjectType;
import engine.objects.*;
import engine.powers.effectmodifiers.AbstractEffectModifier;
@@ -33,8 +33,7 @@ public class PrintBonusesCmd extends AbstractDevCmd {
if (target instanceof Item) {
type = "Item";
tar = (Item) target;
ItemTemplate template = ItemTemplate.templates.get(((Item) tar).templateID);
name = template.item_base_name;
name = ((Item) tar).getItemBase().getName();
} else if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();

Some files were not shown because too many files have changed in this diff Show More