Compare commits

..

953 Commits

Author SHA1 Message Date
FatBoy aad305a499 dungeon to teleport to is visable with safeholds 2025-03-02 22:56:16 -06:00
FatBoy 88ce07df13 enable dungeon teleport 2025-03-02 22:49:26 -06:00
FatBoy 251210d166 remove dungeon teleport from base game 2025-03-02 22:48:37 -06:00
FatBoy 5841db2a0d serialize dungeon for teleport 2025-03-02 22:30:24 -06:00
FatBoy 6127bbadb4 dungeon work 2025-03-02 22:08:47 -06:00
FatBoy 8e5584f413 admin building creation 2025-03-02 21:52:02 -06:00
FatBoy d5e69446c7 admin building creation 2025-03-02 21:29:01 -06:00
FatBoy b3247160d7 fix join heavens host 2025-03-02 18:20:53 -06:00
FatBoy 06e31c1243 update stat and mastery pricing 2025-03-02 18:18:04 -06:00
FatBoy ac5528382c new combat manager first draft 2025-03-01 18:17:12 -06:00
FatBoy 9d8467613a new combat manager first draft 2025-03-01 18:04:43 -06:00
FatBoy 8ff0594333 announce XP rate on login 2025-02-28 17:51:57 -06:00
FatBoy 2e7707fcbe remove mob ai spam logging 2025-02-28 17:44:05 -06:00
FatBoy 78131ed6f2 attempt to stop second box crash 2025-02-28 17:31:40 -06:00
FatBoy 9b2a1a271e attempt to stop second box crash 2025-02-28 17:31:11 -06:00
FatBoy 846d720c2f attempt to stop second box crash 2025-02-28 17:30:34 -06:00
FatBoy 9ba2f375cf hamlet guards don't aggro 2025-02-28 17:27:14 -06:00
FatBoy 22c975d251 dungeon generation 2025-02-28 14:35:00 -06:00
FatBoy 601687133f dungeon generation 2025-02-28 14:22:40 -06:00
FatBoy 2c47f593f3 dungeon generation 2025-02-28 14:10:48 -06:00
FatBoy 6d004d631c add XP config multiplier 2025-02-28 13:17:38 -06:00
FatBoy 2b4a87777c rune merchant price adjustments 2025-02-27 20:02:42 -06:00
FatBoy b795db7fbd fix casting form mob hates 2025-02-27 19:55:30 -06:00
FatBoy af684c6968 fix casting form mob hates 2025-02-27 19:44:48 -06:00
FatBoy 80b1ab709d relog crash bug 2025-02-27 19:16:37 -06:00
FatBoy 140ba6ae75 new mob aggro system 2025-02-27 15:43:43 -06:00
FatBoy c24d779d08 clear recycle timer for reveal thyself 2025-02-27 15:04:55 -06:00
FatBoy 5f169fcfae disconnect caught cheaters after trashing account 2025-02-27 05:51:50 -06:00
FatBoy a5e0396dc6 Dungeon System draft 2025-02-27 05:15:29 -06:00
FatBoy c5b2db051b run ban cleanup hourly 2025-02-26 21:21:54 -06:00
FatBoy b94f8e4b03 build cleanup 2025-02-26 21:20:34 -06:00
FatBoy dbfc33563c add stored procedure call 2025-02-26 21:13:09 -06:00
FatBoy 57e7c3285f remove multibox checks for banned 2025-02-26 20:59:31 -06:00
FatBoy c01d47fe21 perma root and perma stun 2025-02-26 19:46:51 -06:00
FatBoy d5eb423db8 damage effect modifier 2025-02-26 19:37:12 -06:00
FatBoy 69113ee3c4 catch failure in combat stats to prevent deadlock 2025-02-26 19:31:01 -06:00
FatBoy c1aa6e2434 cannot sacrifice on self 2025-02-26 19:19:03 -06:00
FatBoy 7820743222 catch null checks in calculate defense 2025-02-26 19:08:56 -06:00
FatBoy e6762ef9b5 mele attack null checks 2025-02-26 07:43:27 -06:00
FatBoy 81b60cd269 mele attack null checks 2025-02-26 07:28:27 -06:00
FatBoy 755d89ebe0 mele attack null checks 2025-02-26 07:22:53 -06:00
FatBoy aab28cd68c mele attack null checks 2025-02-26 06:57:33 -06:00
FatBoy 97b2af52b9 mele attack null checks 2025-02-26 06:54:46 -06:00
FatBoy 16a0b9c0e3 defense calc null checks 2025-02-25 21:11:49 -06:00
FatBoy bfd89036b2 healer def stance ATR removed again 2025-02-25 20:55:49 -06:00
FatBoy 9cad140836 saetors no longer parry incoming ranged damage 2025-02-25 20:11:02 -06:00
FatBoy a9ca96bf96 glass items can only ever take 1 point of damage 2025-02-25 20:07:53 -06:00
FatBoy 1ef18490b5 allow deleting shrines by players 2025-02-25 20:05:52 -06:00
FatBoy 8d739c3dae detect multibox launcher 2025-02-25 19:52:59 -06:00
FatBoy 44f5fb02a3 detect multibox launcher 2025-02-25 19:49:55 -06:00
FatBoy 240198eec6 ring bonuses calculated specifically 2025-02-23 20:06:36 -06:00
FatBoy dfe300ba4b ring bonuses calculated specifically 2025-02-23 20:05:04 -06:00
FatBoy b48d294eca update XP scale 2025-02-23 16:40:41 -06:00
FatBoy be27262e47 add strigoi fort to exception list 2025-02-23 16:12:21 -06:00
FatBoy d1d51ef791 flat defense from rings calculated 2025-02-23 16:08:04 -06:00
FatBoy e380c4dddb armor piercing fix 2025-02-23 15:09:22 -06:00
FatBoy f9a7b91868 new XP system 2025-02-23 14:12:00 -06:00
FatBoy cb73a81e33 fixed breathing 2025-02-23 10:30:07 -06:00
FatBoy 47f1aa8a89 better random rolls 2025-02-23 00:15:50 -06:00
FatBoy ca0738b6ed region heights issue resolved 2025-02-22 23:07:40 -06:00
FatBoy 5fabd31495 region heights issue 2025-02-22 22:38:40 -06:00
FatBoy e90465ee8f armorpiercing pierces armor instea dof reducing damage 2025-02-22 21:24:46 -06:00
FatBoy 1b1c636628 fat coding fail 2025-02-22 21:06:41 -06:00
FatBoy 5f28d3ae10 revert addition of new XP system for production 2025-02-22 20:50:16 -06:00
FatBoy d0e93773ad revert addition of new XP system for production 2025-02-22 20:43:37 -06:00
FatBoy 2160719126 player update cleanup 2025-02-22 20:40:35 -06:00
FatBoy 0449465af9 update location for player update 2025-02-22 20:40:00 -06:00
FatBoy 891e350362 cancel casting of powers player does not have 2025-02-22 19:51:03 -06:00
FatBoy 942c37442e mines run at 1:00 am CST 2025-02-22 19:03:47 -06:00
FatBoy 0571d5ded3 race type cleanup for saetor 2025-02-22 18:58:49 -06:00
FatBoy 1f63df4f08 new experience 2025-02-22 18:55:06 -06:00
FatBoy eec07f3a28 new experience 2025-02-22 18:38:59 -06:00
FatBoy a199014a98 potential mele range sync fix 2025-02-22 17:48:37 -06:00
FatBoy 48f8cf32b7 mine anti-zerg 2025-02-22 17:40:26 -06:00
FatBoy f28b15b95e disable force DC 2025-02-21 22:49:30 -06:00
FatBoy 8e5aec841d characters count at mines for 3 minutes 2025-02-21 20:41:48 -06:00
FatBoy 9b7bcdc043 ZergMultiplier scales correctly 2025-02-21 20:10:10 -06:00
FatBoy 2dbaac5bcf null combat stats error 2025-02-21 19:54:40 -06:00
FatBoy 2f201151df keyclone audit 2025-02-21 18:02:22 -06:00
FatBoy 3d48951184 saetor parry all the time 2025-02-21 12:10:32 -06:00
FatBoy 3d199a9362 new spell ATR 2025-02-21 11:53:32 -06:00
FatBoy c8a95cab41 new spell ATR 2025-02-21 11:27:35 -06:00
FatBoy 43631af53b cheat logging 2025-02-21 10:20:57 -06:00
FatBoy 89e31fd159 cheat logging 2025-02-21 09:54:26 -06:00
FatBoy ffecdbb06b new Fate Peddler 2025-02-20 21:58:30 -06:00
FatBoy 7331c870c2 new Fate Peddler 2025-02-20 21:37:45 -06:00
FatBoy 4b760baae4 new Fate Peddler 2025-02-20 21:13:53 -06:00
FatBoy 8106b100ec all footwear has equal chance to drop movespeed suffixes 2025-02-20 10:39:06 -06:00
FatBoy 53285ca898 all footwear has equal chance to drop movespeed suffixes 2025-02-20 10:36:18 -06:00
FatBoy 9db7411ee6 calc OnTakeDamage in combat loop 2025-02-20 10:06:06 -06:00
FatBoy a12687913e printstats showing spells and their ATR 2025-02-20 09:53:33 -06:00
FatBoy 937656a91d sub race rune application check 2025-02-20 09:42:09 -06:00
FatBoy 5f2034a35b atr calculation fix 2025-02-20 09:33:34 -06:00
FatBoy 87d39ae29d target software identification 2025-02-20 09:27:02 -06:00
FatBoy bd95a8d7af target software identification 2025-02-20 09:24:32 -06:00
FatBoy 1fa9a88ae3 combat stats cleanup 2025-02-20 09:02:01 -06:00
FatBoy 34e3ae20d7 zerg mechanic applications 2025-02-19 20:37:43 -06:00
FatBoy 55b6d60141 zerg mechanic applications 2025-02-19 20:15:19 -06:00
FatBoy 92d0aec77d zerg mechanic applications 2025-02-19 20:09:11 -06:00
FatBoy 1282f58a3c players coutn towards mine cap for 3 minutes after leaving 2025-02-19 19:56:19 -06:00
FatBoy 1070d61251 zerg mechanic for mines adjusted to 3x load range 2025-02-19 19:40:35 -06:00
FatBoy f7ab5347ab new application of zerg multiplier 2025-02-19 19:37:32 -06:00
FatBoy 517e64d613 global rune drops 2025-02-19 07:07:33 -06:00
FatBoy 5ed31c5e2e revert cancel on take damage 2025-02-19 06:58:03 -06:00
FatBoy c50bcb0a32 bug fix 2025-02-18 21:46:40 -06:00
FatBoy 09a6e18d4f bug fix 2025-02-18 21:40:59 -06:00
FatBoy b0dd7e9b59 bug fix 2025-02-18 21:37:43 -06:00
FatBoy 92d685c3e3 bug fix 2025-02-18 21:34:18 -06:00
FatBoy 84a1db1e09 log cheaters 2025-02-18 20:51:15 -06:00
FatBoy d0e3cac4c3 log selected object UUID 2025-02-18 20:47:10 -06:00
FatBoy 9a5fd53271 log trash disconnect for cheater 2025-02-18 20:37:30 -06:00
FatBoy 8d4fb261b5 cancel on take damage everytime you take damage 2025-02-18 19:51:36 -06:00
FatBoy 4a7a999ed1 pets to use owners ZergMultiplier 2025-02-18 19:43:45 -06:00
FatBoy e69c0f2799 cannot repldeg to any non-open ToL 2025-02-18 18:05:48 -06:00
FatBoy 9e36d558bf state zone name in PVP message 2025-02-18 17:51:23 -06:00
FatBoy df2271fe2c universal rune drops 2025-02-18 17:46:26 -06:00
FatBoy 1f7d2a14bf death no longer releases mine claims 2025-02-18 09:53:53 -06:00
FatBoy a99047aee8 ranged based tracking 2025-02-18 09:47:38 -06:00
FatBoy 5dc9e127bb undo 2025-02-17 20:11:48 -06:00
FatBoy bb05bdd87c handle trainer inventories 2025-02-17 19:30:58 -06:00
FatBoy 4c0b480aeb trainer merchants 2025-02-17 19:06:28 -06:00
FatBoy 3cf38da567 no stam drain while TS 2025-02-17 17:09:11 -06:00
FatBoy 96731bd9bb saetor inherit racetype 2025-02-17 17:00:34 -06:00
FatBoy 9d79afa395 player update optimized 2025-02-16 18:07:56 -06:00
FatBoy 944290f958 audit chat messages for target ID 2025-02-16 18:03:15 -06:00
FatBoy e6eb753666 audit chat messages for target ID 2025-02-16 18:03:13 -06:00
FatBoy 4ad7e0f021 fix track power range 2025-02-16 18:03:07 -06:00
FatBoy 8d587538e0 uptime to show boxed and active players 2025-02-16 18:03:04 -06:00
FatBoy 4ae64ab94c pet aggro fix 2025-02-16 18:03:02 -06:00
FatBoy c5e6205801 invis mob solution 2025-02-16 18:02:58 -06:00
FatBoy 5a3f4e690f mobs will attack player pets 2025-02-16 18:02:54 -06:00
FatBoy 048474b014 must be in safezone to switch boxes 2025-02-16 18:02:50 -06:00
FatBoy 24e01acff4 pet assistance 2025-02-16 18:02:04 -06:00
FatBoy a75670bf0e retaliate handled properly 2025-02-16 18:02:02 -06:00
FatBoy d56d58492a huntress pets properly granted modifiers 2025-02-16 18:01:59 -06:00
FatBoy 7b33c1392a set mob level earlier in routine 2025-02-16 18:01:54 -06:00
FatBoy 86c95f0eb5 disable gimme command 2025-02-16 18:01:47 -06:00
FatBoy 6ed648d6d4 catch weird city null error 2025-02-16 18:01:45 -06:00
FatBoy c722450f65 proper XP group scaling 2025-02-16 18:01:38 -06:00
FatBoy c3a7262a7f logging for failed to move item to vault or bank 2025-02-11 20:03:30 -06:00
FatBoy d1c6d9edec reveal thyself castable by all 2025-02-11 19:53:07 -06:00
FatBoy 1e865eecbc increase starting gold to 1500 2025-02-11 07:57:55 -06:00
FatBoy 5f735a49c1 mobs no longer double multiply for sitting target 2025-02-11 07:52:24 -06:00
FatBoy e609c015b9 Dwarvish Wrath added to exception list 2025-02-11 07:51:34 -06:00
FatBoy 5a198669b9 quick targeting check cleanup 2025-02-11 07:49:19 -06:00
FatBoy fe399664f3 targeting object checks only count when targeting players 2025-02-11 07:44:28 -06:00
FatBoy 3bc62e9baa 10 seconds for 7 stamina ticks in travel stance 2025-02-10 20:31:25 -06:00
FatBoy cf23266f31 10 seconds for 7 stamina ticks in travel stance 2025-02-10 20:13:19 -06:00
FatBoy b097472402 delete AI Players 2025-02-10 20:06:00 -06:00
FatBoy 57b18c2d15 AI Players as mobs 2025-02-10 19:59:45 -06:00
FatBoy 040eef576e disable AI Players 2025-02-10 19:50:55 -06:00
FatBoy d76403a0c8 Ai Players 2025-02-10 19:34:26 -06:00
FatBoy 8ce1054599 Ai Players 2025-02-10 19:25:45 -06:00
FatBoy 0daf8cfe4c Ai Players 2025-02-10 19:20:39 -06:00
FatBoy 898c4c2fa0 Ai Players 2025-02-10 19:19:55 -06:00
FatBoy ecba693105 Ai Players 2025-02-10 19:16:00 -06:00
FatBoy dbc0da20df pets issues fixed 2025-02-09 20:42:00 -06:00
FatBoy 354d0ab283 pets issues 2025-02-09 20:30:24 -06:00
FatBoy c1b66269bb new regen system 2025-02-09 20:23:57 -06:00
FatBoy 7981acb582 new regen system 2025-02-09 19:38:16 -06:00
FatBoy 03448397ee strike counter trash logging 2025-02-09 15:35:18 -06:00
FatBoy 685dc572e8 strike counter 2025-02-09 15:23:52 -06:00
FatBoy 5a161a0808 strike counter 2025-02-09 14:47:08 -06:00
FatBoy 3e4aad9db9 aimbot detection 2025-02-09 14:37:44 -06:00
FatBoy 47981872be network message validation 2025-02-09 14:13:28 -06:00
FatBoy daea835613 network message validation 2025-02-09 14:08:17 -06:00
FatBoy 55923559cd group tele allowe don all city zones 2025-02-08 09:50:48 -06:00
FatBoy 9efde874f3 remove level difference form passive chance 2025-02-08 09:48:35 -06:00
FatBoy 9b2b0073a5 gambler NPC 2025-02-07 20:00:53 -06:00
FatBoy 33328f74db gambler NPC 2025-02-07 19:42:20 -06:00
FatBoy 41023fb890 gambler NPC 2025-02-07 19:27:27 -06:00
FatBoy 54a279c3e6 track threads being used 2025-02-07 12:16:52 -06:00
FatBoy 29aea83217 track threads being used 2025-02-07 12:08:06 -06:00
FatBoy 30d27f8a68 job worker thread to prevent deadlocks 2025-02-07 11:50:43 -06:00
FatBoy 17e54ea4aa job worker thread 2025-02-07 11:38:12 -06:00
FatBoy 86c0bbb065 passives 2025-02-06 20:23:24 -06:00
FatBoy ec4cad5e19 added 250L wait to network selector 2025-02-06 17:48:29 -06:00
FatBoy b674625f7b reduced admin command spam 2025-02-06 17:29:11 -06:00
FatBoy d57b45ef9c fix event processing in network code 2025-02-06 17:27:41 -06:00
FatBoy 2a38c60a67 Revert "fix event processing in network code"
This reverts commit cd1e38b184.
2025-02-06 17:25:34 -06:00
FatBoy cd1e38b184 fix event processing in network code 2025-02-06 17:16:56 -06:00
FatBoy 69457d5f7e new curved map for hit chances 2025-02-05 20:23:15 -06:00
FatBoy 7728a800d9 new hit chance scaling 2025-02-05 20:02:45 -06:00
FatBoy 8b2c018103 mana can be recovered while casting - to match client 2025-02-05 19:04:35 -06:00
FatBoy 76d39f5cc3 mana can be recovered while casting - to match client 2025-02-05 18:55:41 -06:00
FatBoy 826457fb25 mana and stamina regen resynced 2025-02-05 18:11:21 -06:00
FatBoy 0681d3d116 tears of saedron remove stat runes 2025-02-05 17:59:07 -06:00
FatBoy ccdea6f970 players can teleport to their own cities 2025-02-04 20:17:09 -06:00
FatBoy ab00fd7a85 limit dev commands 2025-02-04 20:02:09 -06:00
FatBoy 70d67a2b7f update thread optimized 2025-02-04 19:57:40 -06:00
FatBoy f5b27e0c5b no reverse KoS 2025-02-04 19:50:43 -06:00
FatBoy 3c26df5f86 last tick on over time applies 2025-02-04 19:13:22 -06:00
FatBoy 9ed43b5891 combatstats cleanup 2025-02-04 18:58:05 -06:00
FatBoy 4814404f1c combatstats cleanup 2025-02-04 18:37:47 -06:00
FatBoy b1d41e8e85 update delay removed 2025-02-04 18:31:23 -06:00
FatBoy cc5aa4c140 ATR completed 2025-02-04 18:27:55 -06:00
FatBoy 934c0a98f8 atr buff/debuffs 2025-02-04 18:19:12 -06:00
FatBoy 91c2cd47fb def buff/debuffs 2025-02-04 18:00:59 -06:00
FatBoy 22f14fb8f1 treb spam 2025-02-04 17:07:15 -06:00
FatBoy 93a975dd42 optimized run time 2025-02-04 17:03:46 -06:00
FatBoy 7d1570fdca group tele limit recyle power properly 2025-02-03 20:25:39 -06:00
FatBoy 76db3e1f96 disable mob casting 2025-02-03 20:21:50 -06:00
FatBoy afbe23fc03 use calculated value son PC for combat stats 2025-02-03 20:20:01 -06:00
FatBoy 4e417c8810 audit hit/miss chances 2025-02-03 20:05:04 -06:00
FatBoy d79c69658a parry chance removed 10x 2025-02-03 19:04:04 -06:00
FatBoy 0d125e2640 hit chance 2025-02-03 19:03:26 -06:00
FatBoy e4a3405032 location sync and def formula 2025-02-03 19:02:34 -06:00
FatBoy c391272e5b can block spells 2025-02-02 21:02:21 -06:00
FatBoy 0d3423d51b can block spells 2025-02-02 19:24:10 -06:00
FatBoy 549ca25483 can block spells 2025-02-02 19:21:25 -06:00
FatBoy 603d4ca3a8 reconstructed passive chance formulas 2025-02-02 19:16:31 -06:00
FatBoy fababd3e42 reconstructed passive chance formulas 2025-02-02 18:39:15 -06:00
FatBoy bec6230a06 box limiter 2025-02-02 14:31:55 -06:00
FatBoy 773b6253b9 def formula 2025-02-02 14:29:26 -06:00
FatBoy 1ffcc1086b def formula 2025-02-02 14:25:36 -06:00
FatBoy 992d52a389 always allow parry on saetor 2025-02-02 09:59:54 -06:00
FatBoy 61088d0b59 box limiter 2025-02-02 09:05:22 -06:00
FatBoy 601e97eaca Revert "box limited config entry"
This reverts commit eae4675f85.
2025-02-02 08:57:58 -06:00
FatBoy eae4675f85 box limited config entry 2025-02-02 08:52:09 -06:00
FatBoy 84410114e7 mob casting time fixed 2025-02-01 19:48:41 -06:00
FatBoy 70855acbcf mob casting time 2025-02-01 19:44:05 -06:00
FatBoy 2a8e0dea73 mob casting time 2025-02-01 19:41:06 -06:00
FatBoy 6c4f18218c atr calculations 2025-02-01 19:03:18 -06:00
FatBoy 0b5f469b13 no footwear on saetors 2025-02-01 16:36:01 -06:00
FatBoy 68a43388ff saetor can only parry naturally 2025-02-01 16:26:27 -06:00
FatBoy 5fe12df436 mobs cannot cast debuffs 2025-02-01 16:24:29 -06:00
FatBoy caa0aa5172 AI cast frequency 2025-02-01 16:15:38 -06:00
FatBoy 37a81ed53e ATR system 2025-02-01 16:07:34 -06:00
FatBoy 39afb33186 old regen system 2025-02-01 15:57:19 -06:00
FatBoy 228152596c spell dodge chance resolved 2025-02-01 11:36:33 -06:00
FatBoy d75a052bd3 non siege pets can always roam as a flag 2025-02-01 11:22:51 -06:00
FatBoy 81d6a55096 stop bonus calc spam 2025-02-01 11:19:42 -06:00
FatBoy 55d9cf6d26 calculate base skill 2025-02-01 11:04:49 -06:00
FatBoy 9cf69ec73f calculate base skill 2025-02-01 10:59:28 -06:00
FatBoy 4595582def calculate base skill 2025-02-01 10:01:29 -06:00
FatBoy 0b2d598261 print new skill calculations to client 2025-01-31 21:06:31 -06:00
FatBoy cf342cd1a6 print new skill calculations to client 2025-01-31 21:05:11 -06:00
FatBoy 05bb323c0c print new skill calculations to client 2025-01-31 19:55:24 -06:00
FatBoy c415bb15e2 use new skill level calculations 2025-01-31 19:47:02 -06:00
FatBoy eac58b086b limiter for client syncing 2025-01-31 18:15:40 -06:00
FatBoy fea39ffa85 calculate modified and base skill values 2025-01-31 17:45:42 -06:00
FatBoy fb8971ce86 calculate modified and base skill values 2025-01-31 17:41:37 -06:00
FatBoy e44dd5e2cc properly sync client for regen 2025-01-31 17:09:26 -06:00
FatBoy 3ed303bec4 calculate combat stats spam fix 2025-01-30 19:53:34 -06:00
FatBoy f4267c3c92 calculate combat stats spam fix 2025-01-30 19:49:37 -06:00
FatBoy c5f678ea0e join heavens host allowed for prelates 2025-01-30 19:14:00 -06:00
FatBoy 4fe3d92b3f optimize PlayerCombatStats calling 2025-01-30 18:20:22 -06:00
FatBoy 284fc7e37e remove error logging spam 2025-01-30 18:16:35 -06:00
FatBoy 402d69312c use new regen calculations 2025-01-29 20:09:42 -06:00
FatBoy 198648d3db use new regen calculations 2025-01-29 20:02:02 -06:00
FatBoy 3a01dbf5f6 shade hide power block 2025-01-29 19:23:18 -06:00
FatBoy 0ec505e37f player lock fix 2025-01-29 19:15:20 -06:00
FatBoy 1e26d7f38c player lock fix 2025-01-29 17:44:43 -06:00
FatBoy 64f9f4d4b9 player lock fix 2025-01-29 17:38:00 -06:00
FatBoy 89c06f714f player lock fix 2025-01-29 17:36:56 -06:00
FatBoy 157d116626 player lock fix 2025-01-29 17:29:57 -06:00
FatBoy de229ddde5 dont load cities without ToL 2025-01-29 06:48:40 -06:00
FatBoy 8b456f66ef healers dont get ATR from def stance 2025-01-28 19:10:36 -06:00
FatBoy 2e35e35a6e fury no longer grounded at end of flight chant 2025-01-28 18:58:15 -06:00
FatBoy cca078f017 strip castable enchanst when moving to vault 2025-01-28 18:06:05 -06:00
FatBoy f658a30132 atr % bonus accounted for 2025-01-28 18:04:25 -06:00
FatBoy 0a827d2404 proper duel wield attack speed calc 2025-01-28 17:52:08 -06:00
FatBoy 806adee3de fortitude fix 2025-01-28 17:47:44 -06:00
FatBoy bdd108065b apply powerBlock on shade hide 2025-01-28 17:43:42 -06:00
FatBoy 8d41c5475c unfuck fortitude 2025-01-27 21:50:06 -06:00
FatBoy 99ad461a82 skin the beast work son all but templar 2025-01-27 17:35:39 -06:00
FatBoy 9da56b4226 3 second power block for hide 2025-01-27 16:07:04 -06:00
FatBoy beeca529cd fortitudes handled last 2025-01-27 15:55:40 -06:00
FatBoy ebb765ae82 use total skill percent when calculating ATR 2025-01-27 13:28:31 -06:00
FatBoy 65e391f6f7 Revert "use total skill instea dof modified for ATR"
This reverts commit ab45d92bd1.
2025-01-27 13:18:28 -06:00
FatBoy ab45d92bd1 use total skill instea dof modified for ATR 2025-01-27 13:17:55 -06:00
FatBoy a366c95941 can't TP to errant mines 2025-01-27 13:15:42 -06:00
FatBoy f2d9eb003c temporary enchant timers 2025-01-27 13:02:50 -06:00
FatBoy bb1a99912c temporary enchant stripping 2025-01-27 12:46:10 -06:00
FatBoy fd30e52741 temporary enchant stripping 2025-01-27 12:08:01 -06:00
FatBoy 58a0b6150f aI delay 2025-01-27 10:03:57 -06:00
FatBoy 9aa053beb6 aI delay 2025-01-27 10:00:53 -06:00
FatBoy 7eb084efaa aI delay 2025-01-27 09:46:48 -06:00
FatBoy 1568377725 dex reductions 2025-01-26 19:28:59 -06:00
FatBoy 7b32cfe235 shade backstabs 2025-01-26 19:06:48 -06:00
FatBoy 7ef3efafd3 shade backstabs 2025-01-26 18:55:50 -06:00
FatBoy ffdd79c497 blood mage fix 2025-01-26 18:25:13 -06:00
FatBoy b156da7ded AP applies only to mele damage 2025-01-26 17:39:06 -06:00
FatBoy 9278954f2f saetor can parry 2025-01-26 17:35:13 -06:00
FatBoy 4324ebe855 Phaedra's Fury added to exception list for form break 2025-01-26 17:14:35 -06:00
FatBoy 4a69dca5cc allow gimme 2025-01-26 08:58:52 -06:00
FatBoy 2cc54b4002 100 ms delay between mob spawns 2025-01-26 08:49:20 -06:00
FatBoy eac0aebd59 defense calc completed 2025-01-25 19:03:12 -06:00
FatBoy 172dcfb6d8 defense calc completed 2025-01-25 18:55:18 -06:00
FatBoy d320d83c22 defense calc completed 2025-01-25 18:51:28 -06:00
FatBoy af2dd004e4 defense calc 2025-01-25 18:01:59 -06:00
FatBoy dfbace76db defense calc 2025-01-25 17:49:04 -06:00
FatBoy 119f762492 defense calc 2025-01-25 17:39:44 -06:00
FatBoy e586c442c1 PlayerCombatStats dex penalty applied correctly 2025-01-25 16:39:27 -06:00
FatBoy c01e87ee8b PlayerCombatStats dex penalty applied correctly 2025-01-25 16:31:56 -06:00
FatBoy af4025d948 PlayerCombatStats dex penalty applied correctly 2025-01-25 14:48:51 -06:00
FatBoy b7c2b7a0d5 PlayerCombatStats dex penalty applied correctly 2025-01-25 14:27:25 -06:00
FatBoy f073a93d47 PlayerCombatStats dex penalty applied correctly 2025-01-25 14:23:18 -06:00
FatBoy 47914838f5 PlayerCombatStats dex penalty applied correctly 2025-01-25 14:20:04 -06:00
FatBoy 69e2630d77 PlayerCombatStats dex penalty applied correctly 2025-01-25 14:15:27 -06:00
FatBoy 08148c058c PlayerCombatStats defense formula 2025-01-25 07:53:54 -06:00
FatBoy a7ee8f553b PlayerCombatStats proc chances 2025-01-24 06:29:35 -06:00
FatBoy 8395bb80f1 PlayerCombatStats use in combat 2025-01-24 06:22:44 -06:00
FatBoy becd3cbf65 PlayerCombatStats use in combat 2025-01-24 06:21:11 -06:00
FatBoy 80ec681a2c PlayerCombatStats 30% damage reduction for duel wielding 2025-01-24 06:08:08 -06:00
FatBoy 96a80ce1b6 PlayerCombatStats attack delay 2025-01-24 06:06:04 -06:00
FatBoy f18cf5c8a6 PlayerCombatStats modified skills 2025-01-23 21:36:50 -06:00
FatBoy 4c21159553 PlayerCombatStats modified skills 2025-01-23 21:00:27 -06:00
FatBoy 475c0a9b09 PlayerCombatStats modified skills 2025-01-23 20:59:43 -06:00
FatBoy f80ad61179 PlayerCombatStats weapon speed enchants applied separately 2025-01-23 16:39:21 -06:00
FatBoy 10ccfb1086 PlayerCombatStats weapon speed enchants applied separately 2025-01-23 16:38:27 -06:00
FatBoy 44197fd83c PlayerCombatStats revision 2025-01-22 21:28:51 -06:00
FatBoy 0d9e03f848 PlayerCombatStats weapon speed calculations complete 2025-01-22 21:08:38 -06:00
FatBoy 810812d06b PlayerCombatStats weapon speed calculations 2025-01-22 20:53:07 -06:00
FatBoy 539d7f6e79 PlayerCombatStats def calculations completed 2025-01-22 20:44:33 -06:00
FatBoy 3358d9e943 PlayerCombatStats def calculations 2025-01-22 19:53:24 -06:00
FatBoy eeffd9b357 PlayerCombatStats atr calculations completed 2025-01-22 19:18:31 -06:00
FatBoy b33f41200e PlayerCombatStats atr 2025-01-22 16:56:25 -06:00
FatBoy 030d1110b9 PlayerCombatStats proper delays 2025-01-22 16:05:01 -06:00
FatBoy 09af8084b9 PlayerCombatStats final 2025-01-21 21:08:46 -06:00
FatBoy 0cff9524c2 PlayerCombatStats final 2025-01-21 21:07:17 -06:00
FatBoy f6299f5b97 PlayerCombatStats final 2025-01-21 20:37:17 -06:00
FatBoy b1250ae4e4 PlayerCombatStats proper stance calculations 2025-01-21 20:26:20 -06:00
FatBoy a9144471b1 PlayerCombatStats defense proper rounding 2025-01-21 20:24:15 -06:00
FatBoy 9f924da18b PlayerCombatStats min/max rounding final 2025-01-21 20:18:19 -06:00
FatBoy aac92f1760 PlayerCombatStats defense final 2025-01-21 20:08:50 -06:00
FatBoy fdf42bd913 PlayerCombatStats defense 2025-01-21 20:01:20 -06:00
FatBoy ecee2f2e8c PlayerCombatStats damage calc final 2025-01-21 19:55:32 -06:00
FatBoy 1b487fdbb6 PlayerCombatStats damage calc 2025-01-21 19:51:59 -06:00
FatBoy bb7bd6d71b PlayerCombatStats atr final 2025-01-21 19:43:16 -06:00
FatBoy 34178906a3 PlayerCombatStats attack speed final 2025-01-21 19:40:49 -06:00
FatBoy c689722459 PlayerCombatStats object 2025-01-21 18:43:56 -06:00
FatBoy 8e4ff8c67f PlayerCombatStats object 2025-01-21 18:43:27 -06:00
FatBoy 4ff22d1d20 PlayerCombatStats object 2025-01-21 13:33:49 -06:00
FatBoy 5ed7712aed PlayerCombatStats object 2025-01-21 13:23:04 -06:00
FatBoy a6fcb5ea00 weapon speed 2025-01-20 21:00:44 -06:00
FatBoy 8f402c8c03 weapon speed 2025-01-20 20:46:32 -06:00
FatBoy 5761e313fd weapon speed 2025-01-20 20:28:04 -06:00
FatBoy 441771839a new stat calculations 2025-01-20 20:02:47 -06:00
FatBoy ad6700974f new stat calculations 2025-01-20 19:56:10 -06:00
FatBoy 499aec2c61 new stat calculations 2025-01-20 18:55:41 -06:00
FatBoy ceed4c641a new stat calculations 2025-01-20 18:53:13 -06:00
FatBoy 669c0b4cd7 attack speed 2025-01-20 17:52:44 -06:00
FatBoy 7964de1045 attack speed 2025-01-20 17:52:08 -06:00
FatBoy 961e2915b4 attack speed 2025-01-20 17:43:06 -06:00
FatBoy 6c6a64fa98 mobs dont chase invisible players 2025-01-20 16:34:45 -06:00
FatBoy 7a8a751bca stealing/peeking fix 2025-01-20 16:30:48 -06:00
FatBoy 69bf6ef8cd combat formula and steal 2025-01-20 16:08:54 -06:00
FatBoy 05e542215d allow 5th disc at 70 2025-01-20 15:33:01 -06:00
FatBoy 868eaab5ed mantle of stone added to form break exception list 2025-01-20 15:30:36 -06:00
FatBoy e7d22717cd attack speed calculations 2025-01-20 15:24:48 -06:00
FatBoy bbabf814e1 attack speed calculations 2025-01-20 13:44:32 -06:00
FatBoy 938fcb1352 allow print bonuses 2025-01-19 19:51:54 -06:00
FatBoy 42a71396cd persist print commands for non-testmode 2025-01-19 19:50:50 -06:00
FatBoy 9ec95b974f mob work 2025-01-18 16:06:38 -06:00
FatBoy 49ea9e50cf mob work 2025-01-18 15:57:20 -06:00
FatBoy 456edce9fc mob work 2025-01-18 15:50:14 -06:00
FatBoy 537512ed5d mob work 2025-01-18 15:36:18 -06:00
FatBoy d0efd08a84 mobbase effect info command 2025-01-18 15:16:16 -06:00
FatBoy bb7ba9a6df mobbase effect info command 2025-01-18 15:07:35 -06:00
FatBoy 09695d97db mobbase effect info command 2025-01-18 15:04:27 -06:00
FatBoy 4fe4835c29 mobbase effects 2025-01-18 14:53:07 -06:00
FatBoy 86435a3563 respawn thread optimized 2025-01-18 03:35:35 -06:00
FatBoy bc84c7537b optimized regen client sync 2025-01-18 03:24:36 -06:00
FatBoy 29736f9c8f optimized regen client sync 2025-01-18 03:24:16 -06:00
FatBoy 99a9cd297c optimized mob ai thread 2025-01-18 03:19:08 -06:00
FatBoy e86749febd optimized bane thread 2025-01-18 03:15:48 -06:00
FatBoy 4b86fbb12c optimized regen 2025-01-18 03:11:45 -06:00
FatBoy 4c342c9b9a bard uses pathfinding 2025-01-15 19:39:15 -06:00
FatBoy d2e0b7b95c bard uses pathfinding 2025-01-15 19:25:37 -06:00
FatBoy 53fe763764 boxed characters dont get ding gold 2025-01-15 16:39:22 -06:00
FatBoy 86d7233aa4 remove console spam 2025-01-15 16:23:10 -06:00
FatBoy d19ea0968a allowed casts in form 2025-01-15 13:42:46 -06:00
FatBoy 7eb49446c1 correct use of proper stat for ATR calculation 2025-01-14 18:47:05 -06:00
FatBoy 01a88c85a6 correct use of proper stat for ATR calculation 2025-01-14 18:11:20 -06:00
FatBoy 5492374f2c saetor in who window, skin the beast double point value 2025-01-14 17:56:52 -06:00
FatBoy 9ca00be694 saetor in who window, skin the beast double point value 2025-01-14 16:19:46 -06:00
FatBoy 23d9807fe3 infastructure for exclusion to breaking form from powers 2025-01-14 15:50:54 -06:00
FatBoy 8a3e3ae866 special case weapon powers requiring hit rolls 2025-01-14 15:22:58 -06:00
FatBoy 117646cda4 limit spamming messages ot client for stat sync 2025-01-13 16:27:10 -06:00
FatBoy 6cf502c4bb mob drop aggro check 2025-01-13 16:06:36 -06:00
FatBoy 1bb99127c4 mob drop aggro check 2025-01-13 15:58:44 -06:00
FatBoy 8aeccd35c9 mob drop aggro check 2025-01-13 15:57:01 -06:00
FatBoy c90b94d1ec endless player guard combat cycle 2025-01-13 15:46:08 -06:00
FatBoy 031fd24842 PLayerCharacter.java Cleanup 2025-01-13 09:21:01 -06:00
FatBoy e1c07deb52 remove debug logs from stam/health consumption 2025-01-13 09:09:38 -06:00
FatBoy 5f10c24f03 health degregation for swimming 2025-01-12 20:08:07 -06:00
FatBoy f643caacbe health degregation for swimming 2025-01-12 19:45:30 -06:00
FatBoy cb5ab26924 recovery system fully synced to client 2025-01-12 19:37:24 -06:00
FatBoy 94c9e92553 mob loot system addressed 2025-01-12 17:09:27 -06:00
FatBoy 507638594d updated regen system 2025-01-12 16:56:13 -06:00
FatBoy e72c4886e8 updated regen system 2025-01-12 16:18:47 -06:00
FatBoy 5ba11a6238 updated regen system 2025-01-12 09:34:44 -06:00
FatBoy 2fc7671051 updated regen system 2025-01-12 00:59:02 -06:00
FatBoy d142097b0f updated regen system 2025-01-12 00:58:31 -06:00
FatBoy 4330bb3ecd updated regen system 2025-01-12 00:18:30 -06:00
FatBoy 2e1dd27332 updated regen system 2025-01-12 00:13:21 -06:00
FatBoy 4f08d7286e mob respawn issue resolved 2025-01-11 23:56:04 -06:00
FatBoy 7f8fb13552 mana regen change 2025-01-10 22:10:04 -06:00
FatBoy 93e0d119b0 mana regen change 2025-01-10 22:09:29 -06:00
FatBoy a9bc44f19b fifth disc for level 80 2025-01-10 21:18:17 -06:00
FatBoy 83bc09f34b fifth disc for level 80 2025-01-10 21:16:05 -06:00
FatBoy 4386e1c828 throttled xp for killing same person 2025-01-10 21:11:11 -06:00
FatBoy 72b2e54331 banes to set default times 2025-01-10 21:06:29 -06:00
FatBoy e912c24025 5th hireling in r8 ToL 2025-01-10 12:34:32 -06:00
FatBoy c9c1f6ba1c wall bonus HP 2025-01-10 09:52:34 -06:00
FatBoy abda30fc25 wall bonus HP 2025-01-10 09:47:39 -06:00
FatBoy 62c188c5c7 wall bonus HP 2025-01-10 09:45:51 -06:00
FatBoy 67f7b6f3f8 wall bonus HP 2025-01-10 09:40:15 -06:00
FatBoy f04ccb9403 wall bonus HP 2025-01-10 09:36:01 -06:00
FatBoy b71bb60669 allow 5th slot in r8 TOL + wall health upgrade for r8 trees 2025-01-10 09:28:08 -06:00
FatBoy 5eab1ad1c0 allow 5th slot in r8 TOL + wall health upgrade 2025-01-10 09:17:58 -06:00
FatBoy f96d0caf3c stun grounds 1 tier per 1.5 seconds of stunned 2025-01-09 18:22:57 -06:00
FatBoy 3e6655a199 cant change altitude while stunned 2025-01-09 18:02:04 -06:00
FatBoy 386cdc8c18 cant change altitude while stunned 2025-01-09 17:58:27 -06:00
FatBoy 63b40c27a5 fall slowly while stunned 2025-01-09 17:53:13 -06:00
FatBoy 6985dffda4 no more spamming console 2025-01-09 08:17:56 -06:00
FatBoy 88e16448a8 gold and conc on promotion 2025-01-07 19:11:41 -06:00
FatBoy 4cb428e993 noob island progression changes 2025-01-07 19:05:11 -06:00
FatBoy af9945f9db added null check for endEffect 2025-01-06 21:28:54 -06:00
FatBoy f0594fb1b2 sitting only toggle when casting spells not skills 2025-01-06 12:45:20 -06:00
FatBoy a155bc0308 modified ht chance 2025-01-06 07:14:40 -06:00
FatBoy dce7444483 modified ht chance 2025-01-06 06:54:26 -06:00
FatBoy 76eed79b0a repair cost formula fixed 2025-01-05 20:05:41 -06:00
FatBoy f73ed17c05 repair cost formula 2025-01-05 19:24:05 -06:00
FatBoy b049d21aff corpse timer 2025-01-05 18:53:00 -06:00
FatBoy f6cce5ee1f corpse timer 2025-01-05 18:52:53 -06:00
FatBoy 8038c2ebe2 arena que messages 2025-01-05 18:52:10 -06:00
FatBoy 9f51b9af57 arena que messages 2025-01-05 18:42:06 -06:00
FatBoy cbc75bf9d7 irekei healer blood prophet 2025-01-05 17:40:55 -06:00
FatBoy 0ecfa546cd SDR bind loc for errants 2025-01-05 16:43:38 -06:00
FatBoy b89fb0803d SDR bind loc for errants 2025-01-05 15:41:10 -06:00
FatBoy 11005d58a7 SDR bind loc for errants 2025-01-05 15:39:41 -06:00
FatBoy b0c6239314 SDR bind loc for errants 2025-01-05 15:36:30 -06:00
FatBoy 67f66155e9 SDR bind loc for errants 2025-01-05 15:28:51 -06:00
FatBoy 7fbae12e99 mob update 2025-01-05 14:53:05 -06:00
FatBoy 65580c0a47 mob update 2025-01-05 14:51:43 -06:00
FatBoy 236afe4cc6 mob update 2025-01-05 14:48:51 -06:00
FatBoy c23a6af28f mob update 2025-01-05 14:45:45 -06:00
FatBoy 2535106d2c player update sync 2025-01-05 14:38:07 -06:00
FatBoy d8379ae5a9 shades dont break hide when moving 2025-01-05 11:18:39 -06:00
FatBoy 9f13f5fc5d add sprint to shade stealth 2025-01-05 10:56:14 -06:00
FatBoy 884cb30ebd trade bug 2025-01-05 09:26:42 -06:00
FatBoy 30488e5da6 maintenance bug 2025-01-04 18:47:50 -06:00
FatBoy b7e798a950 spire effect extension 2025-01-04 18:37:16 -06:00
FatBoy e999ca3f68 spire effect extension 2025-01-04 18:36:56 -06:00
FatBoy 039638c0d8 stackable enum types 2025-01-04 15:20:46 -06:00
FatBoy f282504896 irekei movepseed 2025-01-04 15:06:31 -06:00
FatBoy 0062936ac6 irekei movepseed 2025-01-04 14:57:07 -06:00
FatBoy 19c41daa86 irekei movepseed 2025-01-04 14:52:49 -06:00
FatBoy d860b16cfd irekei movepseed 2025-01-04 14:44:43 -06:00
FatBoy e3b42a8ad9 irekei movepseed 2025-01-04 13:33:34 -06:00
FatBoy 20bd7a82af proper flying check for speed calculation 2025-01-04 13:12:44 -06:00
FatBoy e607eb8220 irekei movespeed sync 2025-01-04 13:02:17 -06:00
FatBoy 38ca49d1a5 errants bind loc to tree in SDR 2025-01-04 12:53:36 -06:00
FatBoy a21bdfe031 blood prophet for all irekei mage/healers 2025-01-04 12:39:14 -06:00
FatBoy f95832b87c xp modifiers 2025-01-04 12:36:37 -06:00
FatBoy feff9b3540 cant get XP for suicide 2025-01-04 12:32:22 -06:00
FatBoy 78118aa08c update inventory when getting conc and gold at start 2025-01-04 12:31:22 -06:00
FatBoy 3539372437 powers manager fixes 2025-01-04 12:30:17 -06:00
FatBoy 7c498625bd bounds error 2025-01-03 21:09:53 -06:00
FatBoy e379016123 bane mechanic complete - working 2025-01-03 20:59:35 -06:00
FatBoy afa68b840c bane mechanic complete - working 2025-01-03 20:53:08 -06:00
FatBoy 1926deb7f9 bane mechanic complete - working 2025-01-03 20:41:11 -06:00
FatBoy 25c1f34c23 bane mechanic 2025-01-03 20:12:47 -06:00
FatBoy d0e04e53ad bane mechanic 2025-01-03 20:09:48 -06:00
FatBoy e475fb5cc9 wildkins chase removes snare 2025-01-03 19:22:57 -06:00
FatBoy f72f632cd8 login crash bug 2025-01-03 19:19:19 -06:00
FatBoy 02ea27fc6f login crash bug 2025-01-03 19:17:26 -06:00
FatBoy 5d338bb87c login crash bug 2025-01-03 19:11:09 -06:00
FatBoy f9f08c2886 login crash bug 2025-01-03 19:07:35 -06:00
FatBoy dcc139043d stop movement on cast 2025-01-03 18:57:56 -06:00
FatBoy 520219404c NPC special price option 2025-01-03 18:56:41 -06:00
FatBoy f97991f00d NPC special price option 2025-01-03 07:55:01 -06:00
FatBoy 7b7e1c5337 NPC special price option 2025-01-03 07:48:05 -06:00
FatBoy 6e66659940 NPC special price option 2025-01-03 07:47:16 -06:00
FatBoy 3d83baed78 all sages can repair everything 2025-01-02 21:07:34 -06:00
FatBoy 049b27da96 all sages can repair everything 2025-01-02 21:04:03 -06:00
FatBoy 6bcbe0f633 all sages can repair everything 2025-01-02 20:56:52 -06:00
FatBoy 8c44e39275 all sages can repair everything 2025-01-02 20:52:14 -06:00
FatBoy e36ab1f5d2 corspe timer reduced to 10 minutes(from 15) 2025-01-02 19:55:17 -06:00
FatBoy 865c775f41 Arena death message 2025-01-01 21:50:03 -06:00
FatBoy 198778ba2d arena circle addition 2025-01-01 21:41:48 -06:00
FatBoy 215aabdc5f arena circle addition 2025-01-01 21:38:48 -06:00
FatBoy 8d92c8be37 Arena System complete feature 2025-01-01 21:26:51 -06:00
FatBoy 93b3ce07f0 Arena System prize 2025-01-01 21:11:26 -06:00
FatBoy f9b7c8b851 Arena System 2025-01-01 20:37:13 -06:00
FatBoy b3cf72abdc Arena System 2025-01-01 20:35:21 -06:00
FatBoy 65fddd06a9 Arena System 2025-01-01 20:04:16 -06:00
FatBoy 41f4a8ff58 Arena System 2025-01-01 19:32:11 -06:00
FatBoy a13d5018b9 Arena System 2025-01-01 19:26:02 -06:00
FatBoy 2ac3ce5bc8 Arena System 2025-01-01 19:18:31 -06:00
FatBoy 85514987e7 Arena Manager NPC 2025-01-01 18:43:32 -06:00
FatBoy c9eb07b5ba Enrollment officer dialog option added 2025-01-01 18:32:00 -06:00
FatBoy 7201b61498 Enrollment officer dialog option added 2025-01-01 18:28:33 -06:00
FatBoy 55b3161900 Enrollment officer dialog 2025-01-01 18:15:22 -06:00
FatBoy 9d5c4424a1 Arena Infrastructure 2025-01-01 17:44:34 -06:00
FatBoy d507ba2339 force to stand when casting 2025-01-01 11:13:04 -06:00
FatBoy 4ec5103454 saetor doomsayers 2025-01-01 10:59:49 -06:00
FatBoy 3e09cd415e thread count on boot 2025-01-01 10:45:51 -06:00
FatBoy 1098265145 player update handled in new thread 2025-01-01 10:31:46 -06:00
FatBoy df7a106237 bane commander dialog reset options 2025-01-01 09:07:33 -06:00
FatBoy 00b38970a1 bane commander dialog reset options 2025-01-01 09:00:55 -06:00
FatBoy c1004e5817 bane commander dialog options 2024-12-31 21:18:11 -06:00
FatBoy 13e9738345 bane commander dialog options 2024-12-31 20:55:47 -06:00
FatBoy 1a7c1e2544 mine load error 2024-12-31 20:21:51 -06:00
FatBoy ff082487b5 mine load error 2024-12-31 20:14:48 -06:00
FatBoy 14cac0d892 mine load error 2024-12-31 20:09:28 -06:00
FatBoy a8347e0b53 npc manager error spam 2024-12-31 20:06:31 -06:00
FatBoy a73c3453ea npc manager error spam 2024-12-31 20:04:54 -06:00
FatBoy a64932b2c9 Revert "npc manager error spam"
This reverts commit 685297171c.
2024-12-31 20:04:17 -06:00
FatBoy 685297171c npc manager error spam 2024-12-31 20:01:47 -06:00
FatBoy 2e3e403165 trouble shooting mine bug 2024-12-31 19:57:18 -06:00
FatBoy fbd910ef50 fix for flying bug 2024-12-31 19:13:10 -06:00
FatBoy 30129d161f force respawn of dead players throwing error 2024-12-31 18:56:20 -06:00
FatBoy a6510af56d force respawn of dead players throwing error 2024-12-31 18:55:17 -06:00
FatBoy 9830920635 bane mechanic thread finalized 2024-12-31 18:46:54 -06:00
FatBoy 93025b72cd bane mechanic thread finalized 2024-12-31 18:23:03 -06:00
FatBoy 22639baa4c bane mechanic thread 2024-12-31 17:54:53 -06:00
FatBoy 1aba8dfb11 bane mechanic thread 2024-12-31 17:44:27 -06:00
FatBoy 8b4eb96262 bane mechanic thread 2024-12-31 17:39:28 -06:00
FatBoy cafe6cd2fe bane mechanic thread 2024-12-31 17:38:21 -06:00
FatBoy da6140f6f4 bane mechanic thread 2024-12-31 17:35:38 -06:00
FatBoy 3fc68ce2ff bane mechanic thread 2024-12-31 17:34:51 -06:00
FatBoy 5e8927245b bane mechanic thread 2024-12-31 17:33:26 -06:00
FatBoy 75de1b3ae8 initiate baneAtendees 2024-12-31 17:18:05 -06:00
FatBoy 6743114d19 update bane time first try 2024-12-31 16:25:34 -06:00
FatBoy 28cca67cb3 Revert "update bane time first try"
This reverts commit bad7c6e798.
2024-12-31 16:21:42 -06:00
FatBoy bad7c6e798 update bane time first try 2024-12-31 16:13:54 -06:00
FatBoy ecd3b38d3a update map when bane set 2024-12-31 14:48:11 -06:00
FatBoy 8f09f16603 update map when bane set 2024-12-31 14:37:16 -06:00
FatBoy 80812cb402 update map when bane set 2024-12-31 14:36:36 -06:00
FatBoy 66fbf7aee6 update map when bane set 2024-12-31 14:32:48 -06:00
FatBoy a92c603ab2 update map when bane set 2024-12-31 14:28:42 -06:00
FatBoy 365438370d update map when bane set 2024-12-31 14:26:37 -06:00
FatBoy a40b8fc915 update map when bane set 2024-12-31 14:21:20 -06:00
FatBoy 5d92c1c86d bane system work 2024-12-31 14:09:11 -06:00
FatBoy c526fd8847 bane system work 2024-12-31 14:03:29 -06:00
FatBoy cd767dc68c bane system work 2024-12-31 13:59:23 -06:00
FatBoy e21ebc75ee pets dont get sent home 2024-12-31 13:32:30 -06:00
FatBoy 931eaaae4a city bane status update fix 2024-12-31 13:30:19 -06:00
FatBoy 4d487e6bf0 city bane status update fix 2024-12-31 13:29:18 -06:00
FatBoy 6c45a6573a null checks 2024-12-30 20:09:02 -06:00
FatBoy 45b0dda7d9 remove duplicated gold and conc grants at character creation 2024-12-30 17:55:48 -06:00
FatBoy caf3bc7470 remove option for 10 and 20 man banes based on trees in nation 2024-12-30 17:49:19 -06:00
FatBoy 5259b801f7 bane ZergMultiplier value sfor 20-unlimited banes 2024-12-30 17:41:54 -06:00
FatBoy 77e6d0db75 player guards to drop aggro once player leaves city 2024-12-30 17:24:46 -06:00
FatBoy b2d7e5ec1e bane commander NPC work 2024-12-30 17:06:07 -06:00
FatBoy 15bc99d216 bane commander NPC work 2024-12-30 16:29:16 -06:00
FatBoy 63c6e2abd7 bane zerg mechanics enabled 2024-12-29 21:19:50 -06:00
FatBoy 8ab97a1b36 bane zerg mechanics enabled 2024-12-29 21:19:20 -06:00
FatBoy d1aa581879 players coutn towards Siege Cap at banes for 3 minutes after leaving bane area 2024-12-29 21:05:25 -06:00
FatBoy 5f56143c5e fixed bug with negative xp when setting level to 10 2024-12-29 20:49:12 -06:00
FatBoy 1a2b558ac3 fixed bug with negative xp when setting level to 10 2024-12-29 20:20:12 -06:00
FatBoy 4f4ff74bf1 fixed bug with negative xp when setting level to 10 2024-12-29 19:32:01 -06:00
FatBoy ded3b08080 fixed random rune drop chance 2024-12-29 19:22:41 -06:00
FatBoy 14a29c8612 fixed NPC interaction 2024-12-29 18:37:42 -06:00
FatBoy e66e430d30 fixed NPC interaction 2024-12-29 16:19:08 -06:00
FatBoy c833f560c1 guard minion retaliation 2024-12-29 15:57:52 -06:00
FatBoy 454c721842 zerg mechanic values adjusted 2024-12-29 15:51:01 -06:00
FatBoy 26eda324dc adjusted global drop rates 2024-12-29 15:38:59 -06:00
FatBoy 16951d36a2 bane commander NPC 2024-12-28 08:16:20 -06:00
FatBoy e1d36125d2 bane commander NPC 2024-12-28 08:11:14 -06:00
FatBoy 7a3c259d2f bane commander NPC 2024-12-28 08:03:38 -06:00
FatBoy aa5fb2a2c5 bane commander NPC 2024-12-28 07:57:51 -06:00
FatBoy a92cc6506c bane commander NPC 2024-12-28 07:53:49 -06:00
FatBoy 3971548142 bane commander NPC 2024-12-28 07:49:41 -06:00
FatBoy d94de771bf bane commander NPC 2024-12-28 07:45:43 -06:00
FatBoy c5f47ffcd4 bane commander NPC 2024-12-28 07:39:15 -06:00
FatBoy b336235ad7 bane commander NPC 2024-12-28 07:17:23 -06:00
FatBoy eea07309aa bane commander NPC 2024-12-28 07:14:56 -06:00
FatBoy 5529170036 bane commander NPC 2024-12-28 06:48:43 -06:00
FatBoy 3d745e93b6 bane commander NPC 2024-12-28 06:37:44 -06:00
FatBoy 019082bec7 bane commander NPC 2024-12-28 06:27:31 -06:00
FatBoy 855cceea70 bane commander NPC 2024-12-28 06:14:06 -06:00
FatBoy 487eae85e1 bane commander NPC 2024-12-28 06:12:15 -06:00
FatBoy 5d188e61c0 bane commander NPC 2024-12-28 06:09:29 -06:00
FatBoy 546c335198 bane commander NPC 2024-12-28 06:07:54 -06:00
FatBoy aaecc5eda2 bane commander NPC 2024-12-28 06:05:19 -06:00
FatBoy d13e939ddd bane commander NPC 2024-12-28 06:00:21 -06:00
FatBoy afea79474e bane commander NPC 2024-12-28 05:56:04 -06:00
FatBoy 05f555b5b5 bane commander NPC 2024-12-28 05:53:38 -06:00
FatBoy 85931b6dc2 bane commander NPC 2024-12-28 05:50:15 -06:00
FatBoy 9f0c7f6a76 bane commander NPC 2024-12-28 05:49:09 -06:00
FatBoy 022c06c803 bane commander NPC 2024-12-28 05:41:33 -06:00
FatBoy 1b72e7d6b7 bane commander NPC 2024-12-28 05:28:27 -06:00
FatBoy 666ac6df5b bane commander NPC 2024-12-28 05:21:10 -06:00
FatBoy 36481a53d9 bane commander NPC 2024-12-28 05:18:24 -06:00
FatBoy 5a9901d775 bane commander NPC 2024-12-28 05:09:51 -06:00
FatBoy b3a24d0158 fixed bug with trebs spamming console 2024-12-28 04:42:23 -06:00
FatBoy 8890826070 fixed bug with trebs spamming console 2024-12-28 04:37:36 -06:00
FatBoy daa84a1fef added MB_WORLD_TESTMODE to config manager and file 2024-12-28 04:27:26 -06:00
FatBoy a4bd47f001 audit command for drop rates 2024-12-27 20:26:56 -06:00
FatBoy d031f1be01 audit command for drop rates 2024-12-27 20:24:12 -06:00
FatBoy a48abc59ce audit command for drop rates 2024-12-27 20:16:31 -06:00
FatBoy 878f05c323 audit command for drop rates 2024-12-27 20:10:39 -06:00
FatBoy d462711d25 audit command for drop rates 2024-12-27 20:08:07 -06:00
FatBoy 40a0120a28 +1% drop disp[arity for mobs unde rlevel 50 AND introduce guard drops 2024-12-27 19:59:28 -06:00
FatBoy ac812eaeae allow goto and teleportmode for players 2024-12-26 16:43:32 -06:00
FatBoy 9965223d9b revert steward and builder sell inventory 2024-09-14 23:03:04 -05:00
FatBoy 08b99d0d3a revert steward and builder sell inventory 2024-09-14 22:50:31 -05:00
FatBoy 519a6a2b1e revert steward and builder sell inventory 2024-09-14 22:49:18 -05:00
FatBoy 524f5d470b protocol error logging 2024-09-14 22:47:24 -05:00
FatBoy 6631c6a5d7 protocol error logging 2024-09-14 22:44:26 -05:00
FatBoy 10f95fb0d9 fixed banestone roll times 2024-09-14 13:04:31 -05:00
FatBoy a315366026 disconnect after 10 minutes dead 2024-09-13 19:46:01 -05:00
FatBoy 1901c9a679 disconnect after 10 minutes dead 2024-09-13 19:44:56 -05:00
FatBoy 415ad5402f disconnect after 10 minutes dead 2024-09-13 19:44:13 -05:00
FatBoy 9a40e12dbc castable enchants removed when item leaves players immediate posession 2024-09-13 19:33:58 -05:00
FatBoy a1af663796 irekei healers get blood prophet 2024-09-13 19:21:35 -05:00
FatBoy 78b7ddb32a saetor trains undone 2024-09-13 18:22:45 -05:00
FatBoy 5e5ee4fed1 saetor trains 2024-09-13 17:57:58 -05:00
FatBoy 84c022a39b saetor trains 2024-09-13 17:54:50 -05:00
FatBoy 300741b05a saetor trains 2024-09-13 17:51:38 -05:00
FatBoy dc685a01c6 remove roots form wildkins chase 2024-09-12 21:31:12 -05:00
FatBoy 752f897a34 juiced up droppers 2024-09-12 21:26:42 -05:00
FatBoy 722cb6b1fd Revert "high str NPCs"
This reverts commit 50c095cd09.
2024-09-12 21:08:36 -05:00
FatBoy 50c095cd09 high str NPCs 2024-09-12 20:55:38 -05:00
FatBoy c23546eb46 10% cost for magical random rolls removed 2024-09-12 20:49:21 -05:00
FatBoy 36340c4e52 fixed production bug for mines 2024-09-12 20:21:11 -05:00
FatBoy a7ab38f40c can teleport to owned mines 2024-09-12 19:54:48 -05:00
FatBoy 0901c03b74 can teleport to owned mines 2024-09-12 19:47:42 -05:00
FatBoy 50817352c1 teleport to mines 2024-09-12 19:16:38 -05:00
FatBoy ee4a7447bc teleport to mines 2024-09-12 19:08:57 -05:00
FatBoy a6d3c827ad teleport to mines 2024-09-12 19:08:08 -05:00
FatBoy d4ea31b91f teleport to mines 2024-09-11 19:51:48 -05:00
FatBoy 210faaec6d refund gold for cancelled rolled items 2024-09-11 19:33:18 -05:00
FatBoy 16be9b9dae refund gold for cancelled rolled items 2024-09-11 19:21:13 -05:00
FatBoy 2b8f709182 stun grounds 2024-09-11 15:42:10 -05:00
FatBoy aec22d8563 disable keyclone audit 2024-09-11 15:33:10 -05:00
FatBoy 1996d042f0 fly speed changes finished 2024-09-10 20:26:42 -05:00
FatBoy 27b6665717 fly speed changes 2024-09-10 20:18:59 -05:00
FatBoy ce20045611 Merge remote-tracking branch 'origin/lakebane-strongholds' into lakebane-strongholds
# Conflicts:
#	src/engine/objects/PlayerCharacter.java
2024-09-10 20:17:33 -05:00
FatBoy 277f8bfd69 fly speed changes 2024-09-10 20:17:00 -05:00
FatBoy 1da2db856f fly speed completed 2024-09-10 19:23:39 -05:00
FatBoy 33dfe1389c move buff grounding 2024-09-10 17:58:41 -05:00
FatBoy 013b69405a move buff grounding 2024-09-10 17:46:35 -05:00
FatBoy ca07a53835 cast while flying 2024-09-10 17:02:21 -05:00
FatBoy bbdb6ae1f6 cast while flying 2024-09-10 17:00:28 -05:00
FatBoy 4a63222318 cast while flying 2024-09-10 16:54:57 -05:00
FatBoy 1a1c552964 cast while flying 2024-09-10 16:54:36 -05:00
FatBoy 3587dc2d75 builders sell things at proper ranks 2024-09-09 21:09:12 -05:00
FatBoy 96eb9a3ad0 builders sell things at proper ranks 2024-09-09 21:06:03 -05:00
FatBoy eaa70f43c0 stewards sell things at proper ranks 2024-09-09 20:59:56 -05:00
FatBoy a426b773d3 sage on TOL 2024-09-09 20:26:04 -05:00
FatBoy 84841edda9 r8 gets extra hireling slot 2024-09-09 20:24:36 -05:00
FatBoy d416dbe47b shade hide 2024-09-09 20:17:31 -05:00
FatBoy 7052da7e54 shade hide 2024-09-09 20:13:07 -05:00
FatBoy 8f2a2f0ba6 Rogue Druids 2024-09-08 19:17:16 -05:00
FatBoy d575ba663d displayed maintenance for r8 tree no longer shows resource required 2024-09-08 18:57:14 -05:00
FatBoy 964fe7f335 city serilizing bug 2024-09-08 18:43:47 -05:00
FatBoy d3e92d6576 city serilizing bug 2024-09-08 18:35:53 -05:00
FatBoy 9dbd6069f1 force respawn after 10 minutes dead 2024-09-08 18:23:12 -05:00
FatBoy 7ae25c9a1b can now summon in combat 2024-09-08 18:21:16 -05:00
FatBoy 689969a005 r* tree buildings acquire 10% more HP 2024-09-08 17:18:45 -05:00
FatBoy b270e1ac8d r8 maintenance flat 3 mil 2024-09-08 17:13:31 -05:00
FatBoy 95d38cea44 rogue can promote to druid 2024-09-08 17:10:57 -05:00
FatBoy 3ed0765fe5 flying while having move buff fix 2024-09-08 17:04:25 -05:00
FatBoy 0c90164c24 shade invis bug 2024-09-08 16:59:19 -05:00
FatBoy a45fa39afc random roll magic extra cost removed 2024-09-08 16:45:50 -05:00
FatBoy 8959f5e1c5 r7 votary grants PR40 boon 2024-09-08 16:41:17 -05:00
FatBoy df338ab00e fix resource vendor pricing 2024-09-07 18:34:33 -05:00
FatBoy ac7a2452d6 disable strongholds 2024-09-07 18:31:08 -05:00
FatBoy 80104e6d07 fixed login bug 2024-09-07 18:04:59 -05:00
FatBoy 8f394cd01d fixed login bug 2024-09-07 18:01:23 -05:00
FatBoy e5a32c83c5 Revert "mine production values adjusted"
This reverts commit 177f9a1ff6.
2024-09-07 17:45:32 -05:00
FatBoy 8dce20e69f Revert "adjusted hit chance formula"
This reverts commit 3428a06bb8.
2024-09-07 17:45:25 -05:00
FatBoy 3428a06bb8 adjusted hit chance formula 2024-09-07 17:38:26 -05:00
FatBoy 177f9a1ff6 mine production values adjusted 2024-09-07 17:35:50 -05:00
FatBoy 9d93944dd1 mob roll levels 2024-09-06 20:54:58 -05:00
FatBoy a4cba1a352 better roll chance for high level vendors 2024-09-06 20:28:32 -05:00
FatBoy 17b4232d80 better roll chance for high level vendors 2024-09-06 20:14:27 -05:00
FatBoy 2eb58eb719 custom hit chance formula 2024-09-05 21:30:01 -05:00
FatBoy db5a4195ad custom hit chance formula 2024-09-05 21:26:21 -05:00
FatBoy 3fb29f8e2b custom hit chance formula 2024-09-05 21:24:23 -05:00
FatBoy dacdb2cf35 stronghold mobs 2024-09-05 21:13:57 -05:00
FatBoy c8473cbe03 stronghold mobs 2024-09-05 21:12:39 -05:00
FatBoy e9edf8a7ea increase number of strongholds 2024-09-05 20:48:01 -05:00
FatBoy 5a73aa3d90 increase number of strongholds 2024-09-05 20:47:20 -05:00
FatBoy 04101c1c3e additional 60 second logout timer for players who have enemies nearby and aren't in safezone 2024-09-05 20:29:37 -05:00
FatBoy 0c9343f24d additional 60 second logout timer for players who have enemies nearby and aren't in safezone 2024-09-05 20:09:27 -05:00
FatBoy b71710871c track list construction 2024-09-05 19:57:34 -05:00
FatBoy f6df6db17b level cap increased to 80 2024-09-05 19:41:30 -05:00
FatBoy 3f8b3bc6cb PVP xp enabled 2024-09-05 19:40:25 -05:00
FatBoy 383ef27128 can use abilities while flying 2024-09-05 19:30:15 -05:00
FatBoy d8189768ae mine production cut in half 2024-09-05 19:26:22 -05:00
FatBoy a5eb2fce75 mine management to show correct production amount 2024-09-05 19:24:46 -05:00
FatBoy 1fe242a284 strip temporary item enchants when transfered 2024-09-05 19:19:34 -05:00
FatBoy a4b83ca9a0 increase resists of the droppers 2024-09-04 19:05:19 -05:00
FatBoy 2365b26c1c trainer buildinsg capped at r1 with 3 slots 2024-09-04 10:05:48 -05:00
FatBoy 8fb044f71b trainer buildinsg capped at r1 with 3 slots 2024-09-04 09:45:42 -05:00
FatBoy 5ce42475c4 force respawn after 10 minutes of unreleased corpse 2024-09-04 09:35:44 -05:00
FatBoy 57b9d31fff dropper resists 2024-09-04 09:21:07 -05:00
FatBoy 7671586cb0 terraform issue 2024-09-03 21:13:25 -05:00
FatBoy a1997e31a8 terraform issue 2024-09-03 21:11:44 -05:00
FatBoy f5478e9f64 terraform issue 2024-09-03 21:08:46 -05:00
FatBoy 06abea3576 terraform issue 2024-09-03 21:05:19 -05:00
FatBoy ae6b584a5f DS immunity fixed 2024-09-03 18:56:57 -05:00
FatBoy 9e27c69906 trainer buildings get 3 slots at r1 2024-09-01 20:20:37 -05:00
FatBoy 00afe27900 stealing from mobs works again 2024-09-01 20:13:01 -05:00
FatBoy 4e5c1a32d3 stronghold mob equipsets 2024-09-01 18:52:32 -05:00
FatBoy d4f5043a25 toughness sync issue 2024-09-01 15:20:33 -05:00
FatBoy 03a5a55974 remove NPC slot error spam onboot 2024-09-01 09:57:51 -05:00
FatBoy dbab4c1212 baked in stats null check 2024-09-01 09:51:03 -05:00
FatBoy d186a96796 non vorg droppers cannot drop vorg items 2024-09-01 09:46:25 -05:00
FatBoy 6880d014c3 elan vendor price increased to 1,000,000 2024-09-01 09:42:54 -05:00
FatBoy 6542dec358 saetors can take disc runes 2024-08-31 20:39:58 -05:00
FatBoy 1a2738c3a9 saetors can take disc runes 2024-08-31 20:37:27 -05:00
FatBoy 12118ff125 fixed saetor promotions 2024-08-31 20:30:55 -05:00
FatBoy c3a00186ff saetors allowed to take creation runes 2024-08-31 20:21:35 -05:00
FatBoy fafa777e98 saetor creation fixed 2024-08-31 20:08:19 -05:00
FatBoy d4da99f61c NPC sell% in safezone = 0 2024-08-31 19:39:19 -05:00
FatBoy bb293c0c02 BH eyes get double value for points in skill (20 points = PR40) 2024-08-31 19:35:47 -05:00
FatBoy 1e29971b3c safe NPC profits 2024-08-31 19:29:03 -05:00
FatBoy 25d70cca4f error message for flying with movement buff 2024-08-31 19:17:52 -05:00
FatBoy 362832a196 NPC safezone sell% = 0 2024-08-31 19:12:22 -05:00
FatBoy ed150a5ccd gimme command bumps level to 75 2024-08-31 19:04:52 -05:00
FatBoy d2247b66f1 safezone NPCs have 0% profit 2024-08-31 19:03:30 -05:00
FatBoy 3b58ea716c custom range for booty sim command 2024-08-31 16:28:34 -05:00
FatBoy 368e548e46 special case rolls for contracts, glass, resources and runes 2024-08-31 16:26:08 -05:00
FatBoy 6f3612d196 Elf Blood Runes Free 2024-08-31 16:01:19 -05:00
FatBoy 0f38146fcc extra stats on printstats 2024-08-30 20:48:47 -05:00
FatBoy 1a13f3f096 hit roll formula fixed 2024-08-30 20:44:22 -05:00
FatBoy 9cc102ca2a scrolls removed from form breaking 2024-08-30 20:11:30 -05:00
FatBoy 50ff4b89bf granted concnc pot fixed 2024-08-30 20:07:34 -05:00
FatBoy 9b898825ab no move buff while flying 2024-08-30 19:34:10 -05:00
FatBoy 5be9033c40 no move buff while flying 2024-08-30 19:27:19 -05:00
FatBoy 67e55ab0a0 no move buff while flying 2024-08-30 19:00:50 -05:00
FatBoy 227549bf22 no move buff while flying 2024-08-30 18:51:56 -05:00
FatBoy 19707d10a3 no move buff while flying 2024-08-30 18:50:42 -05:00
FatBoy 91565ced89 no move buff while flying 2024-08-30 18:46:05 -05:00
FatBoy 2383b00c8c mobs recall when out of range of their bind loc 2024-08-30 18:38:44 -05:00
FatBoy 405063f036 guilds MOTD now persist 2024-08-30 18:34:07 -05:00
FatBoy d2f3c6a879 potions and scrolls no longer count as casting a spell 2024-08-29 20:49:42 -05:00
FatBoy 4f759c1bd2 shade sneak 2024-08-29 20:43:10 -05:00
FatBoy 9d7f9ce7b3 no movement buffs while flying, cannot fly if you have a movement buff applied 2024-08-29 20:36:41 -05:00
FatBoy 56f3dfce92 no movement buffs while flying, cannot fly if you have a movement buff applied 2024-08-29 20:36:22 -05:00
FatBoy 9a66f18edb extra 60 seconds added to summon if enemies near and not in safezone 2024-08-29 20:21:26 -05:00
FatBoy d7270ffb84 group teleport restricted to active banes and active mines 2024-08-29 20:12:48 -05:00
FatBoy dd834a3104 cant delete buildings when baned 2024-08-29 19:44:51 -05:00
FatBoy e28ed1b882 fortitude handled after resists 2024-08-29 19:38:06 -05:00
FatBoy 2370123c72 hit roll formula added 2024-08-29 19:36:33 -05:00
FatBoy 8a5133f04b character starts with 1000 gold and a conc pot 2024-08-29 19:27:24 -05:00
FatBoy a0f874b319 cannot tax cities in realm 2024-08-27 20:58:41 -05:00
FatBoy 415d11ae33 Vorg droppers increased level and resists 2024-08-27 20:40:00 -05:00
FatBoy f93b1ce30e teleport to runegate power action fix for closest gate 2024-08-27 19:43:31 -05:00
FatBoy 9fb2e4ff1b apply rune message work 2024-08-27 19:35:25 -05:00
FatBoy 601d0f4324 special case drop rate for contracts runes and resources completed 2024-08-27 19:30:02 -05:00
FatBoy cbf7db3347 mine production issue resolved 2024-08-27 19:13:31 -05:00
FatBoy 217be1d234 Special Case rune contract and resource drops 2024-08-26 21:29:41 -05:00
FatBoy 7fabd6554d glass chance is 10/100,000 2024-08-26 21:10:25 -05:00
FatBoy d673819796 gimme command 2024-08-26 20:14:23 -05:00
FatBoy a963a331a2 mobs that spawn with no loot respawn again 2024-08-26 20:10:16 -05:00
FatBoy eda5b8995f stronghold mobs power sets 2024-08-24 20:36:04 -05:00
FatBoy d5e95eedf3 stronghold loot adjustment 2024-08-24 20:13:11 -05:00
FatBoy 032e703704 gimme command for testing 2024-08-24 19:35:17 -05:00
FatBoy ad1444f5ba level 70+ is allowed to apply a fifth disc rune 2024-08-24 19:25:31 -05:00
FatBoy a4b30b8620 level cap increased to 80 2024-08-24 19:20:12 -05:00
FatBoy 9c002c7bff updated stronghold mobs 2024-07-18 20:20:15 -05:00
FatBoy 90495a27d9 blood rune dropper issue resolved 2024-07-18 19:42:23 -05:00
FatBoy 1246fa699a blood rune boot issue 2024-07-18 19:18:51 -05:00
FatBoy 511d37f5e0 blood rune droppers moved to DB with client patch 2024-07-18 19:11:27 -05:00
FatBoy 7a03a0eaa9 noob conc pots 2024-07-17 19:43:43 -05:00
FatBoy 2f57cb613e noob conc pots 2024-07-17 19:39:38 -05:00
FatBoy e386c3078a noob conc pots 2024-07-17 19:34:42 -05:00
FatBoy 3802889834 allow applying blood runes 2024-07-17 19:12:43 -05:00
FatBoy f825b2baba negate stronghold mobs from dropping equipment 2024-07-15 20:05:36 -05:00
FatBoy 6c92abd083 present drops restricted to strongholds 2024-07-15 19:13:40 -05:00
FatBoy c652379a5f mob region lookup 2024-07-15 19:08:40 -05:00
FatBoy 61d34ab4ad hotfixes 2024-07-15 18:45:32 -05:00
FatBoy d511641410 hotfixes 2024-07-15 18:42:41 -05:00
FatBoy c8430625bf mob resists fix 2024-07-11 19:53:22 -05:00
FatBoy a418224bbb start random roll at 0 to avoid illegal argument 2024-07-11 19:41:32 -05:00
FatBoy 9e3c13dea3 generic resists added for mobs to stop crashing AI 2024-07-11 19:34:50 -05:00
FatBoy 335850f7ff stronghold epics target playe rnot self 2024-07-10 21:21:08 -05:00
FatBoy f6baf8fe83 resistance modifiers for mobs 2024-07-10 20:48:55 -05:00
FatBoy 4c9b82b649 def and ATR cuts for stronghold mobs 2024-07-10 20:40:28 -05:00
FatBoy f2570992e5 completed custom strongholds 2024-07-09 21:19:08 -05:00
FatBoy 6911d6314d epic encounter naming convention 2024-07-09 20:48:12 -05:00
FatBoy eaeea9730c epic encounter naming convention 2024-07-09 20:39:59 -05:00
FatBoy fb0790a733 epic encounter after clearing a stronghold 2024-07-09 20:28:56 -05:00
FatBoy 3230cd53e1 epic encounter after clearing a stronghold 2024-07-09 20:10:58 -05:00
FatBoy edbce067b8 epic encounter after clearing a stronghold 2024-07-09 19:48:02 -05:00
FatBoy 83877e5107 epic encounter after clearing a stronghold 2024-07-09 19:47:14 -05:00
FatBoy 3a67540212 stronghold attack messages 2024-07-09 19:31:49 -05:00
FatBoy 1a5db96023 stronghold mobs spawn 2x mines cap size 2024-07-09 19:25:52 -05:00
FatBoy ef82f9ab5b stronghold mobs no longer lose bonuses from weapon powers 2024-07-09 19:25:02 -05:00
FatBoy bf7e5c6333 stronghold guardian fix 2024-07-08 22:08:50 -05:00
FatBoy 443f0f5450 stronghold guardian fix 2024-07-08 21:58:17 -05:00
FatBoy cb1dccd630 stronghold guardian fix 2024-07-08 21:53:03 -05:00
FatBoy 2e558acbee stronghold guardian fix 2024-07-08 21:52:19 -05:00
FatBoy 74162ea54c stronghold guardian fix 2024-07-08 21:49:29 -05:00
FatBoy ccbe4fba04 stronghold guardian fix 2024-07-08 21:42:39 -05:00
FatBoy 5aeddb6166 stronghold guardian fix 2024-07-08 21:41:05 -05:00
FatBoy 49df5203ae stronghold guardian fix 2024-07-08 21:38:43 -05:00
FatBoy 0cfe801d18 stronghold guardian fix 2024-07-08 21:26:13 -05:00
FatBoy 89c01e8244 random item generation fix 2024-07-08 21:20:31 -05:00
FatBoy 6605e4dd61 update regions when changing mesh 2024-07-08 21:17:38 -05:00
FatBoy d6239de6fd delete stronghold mobs form DB when finished 2024-07-08 21:09:21 -05:00
FatBoy 99ad6f3712 delete stronghold mobs form DB when finished 2024-07-08 21:03:08 -05:00
FatBoy f3041e7549 SetLoc for stronghold mobs 2024-07-08 20:53:23 -05:00
FatBoy 1269031be3 SetLoc for stronghold mobs 2024-07-08 20:52:23 -05:00
FatBoy ce96274f28 SetLoc for stronghold mobs 2024-07-08 20:51:06 -05:00
FatBoy a9a9bd0a3d Stronghold variations 2024-07-08 20:41:16 -05:00
FatBoy 33789adadc final strongholds update 2024-07-07 21:44:20 -05:00
FatBoy 15b50a75c4 commander stats update 2024-07-07 21:42:26 -05:00
FatBoy ead34dbb1f commander powers 2024-07-07 21:32:04 -05:00
FatBoy a9b1356efa new stronghold mesh 2024-07-07 21:29:14 -05:00
FatBoy 33e105bc7b naming convention 2024-07-07 21:27:42 -05:00
FatBoy e5041147f4 added disc and rune to commander drops 2024-07-07 21:26:37 -05:00
FatBoy 576e627ad1 fixed loot generation array size bug 2024-07-07 21:16:41 -05:00
FatBoy 4059664354 stronghold loot 2024-07-07 21:14:09 -05:00
FatBoy 974c0ca7e8 force load changes meshes 2024-07-07 21:05:34 -05:00
FatBoy 8e7a7b8b6d stronghold scale set 2024-07-07 21:04:40 -05:00
FatBoy 1e3b1db905 commander location set 2024-07-07 21:04:00 -05:00
FatBoy 51c98746c4 make stronghold mobs aggro 2024-07-07 21:00:32 -05:00
FatBoy 4c21439847 serialize the stronghold mine 2024-07-07 20:53:52 -05:00
FatBoy 31385ee533 SCALING DOWN THE STRONGHOLD BUILDING 2024-07-07 20:51:01 -05:00
FatBoy bd4e34e0e1 SCALING DOWN THE STRONGHOLD BUILDING 2024-07-07 20:50:01 -05:00
FatBoy 9f591b166b Initial Stronghold Push 2024-07-07 20:44:24 -05:00
FatBoy 7e457fa17b all items form "Noob Helper" cost 2 gold 2024-07-07 18:41:44 -05:00
FatBoy 926b9d2bae R8 ToL can have 4 shrines 2024-07-07 18:39:38 -05:00
FatBoy c5822b5acf dropper resists and level increase 2024-07-06 20:43:03 -05:00
FatBoy 516b66a50a reintroduce blood rune droppers on 3 hour disc cycle 2024-07-06 20:35:17 -05:00
FatBoy 39305d63c7 noob island gear 2024-07-06 20:08:09 -05:00
FatBoy c0cb856961 noob island gear 2024-07-06 20:06:18 -05:00
FatBoy 2fb97a676f allow some dev commands for players (print) 2024-07-05 21:10:26 -05:00
FatBoy cbff151dc3 allow some dev commands for players (print) 2024-07-05 21:08:47 -05:00
FatBoy eed75fd2fd repair costs calculated properly 2024-07-05 20:57:45 -05:00
FatBoy 6374390b34 repair cost synced with server values 2024-07-05 19:58:42 -05:00
FatBoy 2185d3ef7c rune merchants pricing adjusts 2024-07-05 19:54:49 -05:00
FatBoy 4aaa96e36c resourc emerchant pricing adjust 2024-07-05 19:34:12 -05:00
FatBoy bf86680547 higher present drop chance 2024-07-05 19:28:05 -05:00
FatBoy 960307e262 rune pricing fix 2024-07-05 19:26:19 -05:00
FatBoy eedf96cc31 resource pricing fix 2024-07-05 19:23:23 -05:00
FatBoy 6fb5fce4d3 fixed profit error for NPCs 2024-07-05 19:15:43 -05:00
FatBoy 7688d21fe6 boons refreshable, boon level determined by votary rank, shrines should work for all, boons nation friendly again 2024-07-05 19:06:02 -05:00
FatBoy 23e60b36b4 General Cleanup and drop rates 2024-07-04 20:06:15 -05:00
FatBoy ab8fc8e0a0 random vorg droppers, max durability repairable 2024-07-04 19:49:24 -05:00
FatBoy b30f04046d uniform disc dropper times 2024-07-04 19:14:00 -05:00
FatBoy 9bd03c7d43 pricing corrected for rune vendors 2024-07-03 20:35:33 -05:00
FatBoy 78118a1ac1 fix for rune application 2024-07-03 20:22:03 -05:00
FatBoy 1f863d0cce resource pricing fix 2024-07-03 20:20:04 -05:00
FatBoy c49204aeeb NPC have 0 maint, fix for resource merchant 2024-07-03 20:15:41 -05:00
FatBoy b1de3755fd display correct maintenance costs 2024-07-03 20:07:27 -05:00
FatBoy 83a1cc5aba maintenance display on buildings 2024-07-03 19:56:50 -05:00
FatBoy 9b0b15c31e remove refund for deranked building due to maintenance 2024-06-26 21:09:32 -05:00
FatBoy 802651d2d4 rune application error fixed 2024-06-26 21:01:23 -05:00
FatBoy 52a48e5618 rune application checks 2024-06-26 20:51:04 -05:00
FatBoy 14fe248e19 mine serializing 2024-06-25 21:36:26 -05:00
FatBoy 5b81be371e mine serializing 2024-06-25 21:26:39 -05:00
FatBoy 82d67f2850 mine serializing 2024-06-25 21:24:48 -05:00
FatBoy 1c342bd566 server pop on creation displays amount of realms captured 2024-06-25 21:07:47 -05:00
FatBoy bb8ad3c971 character creation population message 2024-06-25 21:00:36 -05:00
FatBoy e9fef85b72 set maintenance dates correctly 2024-06-25 20:21:12 -05:00
FatBoy c0d1a4f274 mines produce once a day, maintenance system for TOL only 2024-06-25 20:17:16 -05:00
FatBoy 94be3335a0 mine production change error tracking 2024-06-25 19:55:30 -05:00
FatBoy 7d03f78546 rune application require/restrict actually use values 2024-06-25 19:44:17 -05:00
FatBoy 023f933d0b rune application require/restrict actually use values 2024-06-25 19:31:05 -05:00
FatBoy 9995cc01b7 rune application require/restrict actually use values 2024-06-25 19:24:15 -05:00
FatBoy fd03b263d1 pets follow owners through teleporting 2024-06-23 20:14:51 -05:00
FatBoy 6a09a3fd44 pets follow owners through teleporting 2024-06-23 20:08:46 -05:00
FatBoy 1322f8610c safe guards dont kill pets anymore 2024-06-23 20:03:41 -05:00
FatBoy 90ab6175b5 extra ToL slots 2024-06-23 19:55:26 -05:00
FatBoy 2e3e9ee882 extra ToL slots 2024-06-23 19:50:20 -05:00
FatBoy 5158329785 Saetor can take Chaos Shrine boon 2024-06-23 19:47:14 -05:00
FatBoy b8e0165da2 allowed siege engineer alchemist and banker on ToL 2024-06-23 19:44:10 -05:00
FatBoy 0fa6ebc136 fix pets 2024-06-23 19:33:06 -05:00
FatBoy 4e5e362197 attempt to fix mine serialization 2024-06-16 09:30:14 -05:00
FatBoy 61514fef2b attempt to fix mine serialization 2024-06-16 09:29:18 -05:00
FatBoy 59e593ab0d attempt to fix mine serialization 2024-06-16 09:24:15 -05:00
FatBoy 2c6ea98ef9 revert instant respawns 2024-06-15 21:37:14 -05:00
FatBoy bd3ea16b57 faster respawns 2024-06-15 21:35:05 -05:00
FatBoy 45165332f6 faster respawns 2024-06-15 21:33:56 -05:00
FatBoy d764a66e55 logging 2024-06-15 20:08:20 -05:00
FatBoy ac41e64429 logging 2024-06-15 20:03:45 -05:00
FatBoy 462beb30b3 logging 2024-06-15 20:03:09 -05:00
FatBoy 3a89e9c087 logging 2024-06-15 19:59:31 -05:00
FatBoy e71863cbd2 logging 2024-06-15 19:54:45 -05:00
FatBoy 5ec0ff0598 logging 2024-06-15 19:52:12 -05:00
FatBoy 2ca9b77cfb logging 2024-06-15 19:50:05 -05:00
FatBoy 4f535ef5fe loot manager for glass runes and contracts 2024-06-15 19:44:37 -05:00
FatBoy a46ad71bb0 loot manager for glass runes and contracts 2024-06-15 19:36:13 -05:00
FatBoy 90d6911d41 loot manager for glass runes and contracts 2024-06-15 19:26:49 -05:00
FatBoy e13ebae0df loot manager for glass runes and contracts 2024-06-15 19:18:40 -05:00
FatBoy 3e15fc8206 bootysim command work 2024-06-15 19:11:49 -05:00
FatBoy 6a400467dd drop rate work 2024-06-15 19:10:29 -05:00
FatBoy 488188e9c3 glass chance work 2024-06-15 19:03:08 -05:00
FatBoy 0d31bc4280 contract and rune drop work 2024-06-15 19:00:58 -05:00
FatBoy 6375b4431c box check 2024-06-15 18:50:40 -05:00
FatBoy 683422f8a4 auto identify all items 2024-06-15 18:42:49 -05:00
FatBoy e4dbad2669 generic loot system in place 2024-06-15 16:54:20 -05:00
FatBoy 34721fdee8 generic loot system in place 2024-06-15 16:51:46 -05:00
FatBoy f27668552c corrected pricing for +10 runes 2024-06-15 16:20:39 -05:00
FatBoy 306fdf4235 permanent open runegates 2024-06-15 16:18:24 -05:00
FatBoy 553b09d827 rune pricing corrected 2024-06-15 16:16:18 -05:00
FatBoy 8ee17f0c64 fix resource merchant elan stones pricing 2024-06-15 16:04:20 -05:00
FatBoy 7e5ad644d3 fix resource merchant elan stones 2024-06-15 16:04:02 -05:00
FatBoy 846b8a7cde fix resource merchant margins 2024-06-15 16:02:07 -05:00
FatBoy f27a4f174b error popup when trying to flag unboxed too frequently 2024-06-15 15:55:57 -05:00
FatBoy c6d4375aa8 error popup when trying to flag unboxed too frequently 2024-06-15 15:06:17 -05:00
FatBoy b9ec54c76a enrollment office removes DS effect 2024-06-15 15:04:07 -05:00
FatBoy b351d7c1ae enrollment officer system 2024-06-15 15:01:47 -05:00
FatBoy 729ebe7cd0 box checker 2024-06-15 14:48:20 -05:00
FatBoy f51c28e708 revert boxing enforcement 2024-06-15 14:36:33 -05:00
FatBoy 9fbf55127d sourcetype lookup fix 2024-06-15 14:25:40 -05:00
FatBoy f9fd61dc6b revert sourcetype lookup fix 2024-06-15 14:23:25 -05:00
FatBoy 4f198e1f53 Merge remote-tracking branch 'origin/lakebane-new' into lakebane-new 2024-06-15 14:22:11 -05:00
FatBoy 24c85a5140 revert sourcetype lookup fix 2024-06-15 14:21:57 -05:00
FatBoy 3e1a5f4ccd SpurceType lookup fixes for Piercing Crushing and Slashing 2024-06-15 14:19:29 -05:00
FatBoy 34e5a3878c SpurceType lookup fixes for Piercing Crushing and Slashing 2024-06-15 14:17:43 -05:00
FatBoy 663e285091 Deathshroud applied ot all boxed characters 2024-06-15 14:10:02 -05:00
FatBoy d87c03bb79 fixed combat message to reflect proper zerg multiplier values 2024-06-15 10:48:08 -05:00
FatBoy abc57688d3 reset zerg multipliers when window closes 2024-06-15 10:31:38 -05:00
FatBoy 29671d56fc display zerg multiplier in ./info 2024-06-15 10:17:43 -05:00
FatBoy e8cf6a722b remove hotzone form the game 2024-06-15 09:13:22 -05:00
FatBoy 2793ec331b mines revert to claimable at 1am CST 2024-06-15 09:07:31 -05:00
FatBoy 1a0b91b068 buying larger stacks of resources form resource vendor 2024-06-13 19:21:34 -05:00
FatBoy bec6cbe6e6 implement stat modifications for the ZergMultiplier 2024-06-13 18:54:09 -05:00
FatBoy f7ab10ff07 altered mine production values 2024-06-13 18:44:35 -05:00
FatBoy 9671cbdc1a unlimited sub guilds 2024-06-13 18:31:33 -05:00
FatBoy e0af1f5932 no caps on claimable mines for nations 2024-06-13 18:28:59 -05:00
FatBoy 8cb52c6142 zerg multiplier resets for players after mine closes 2024-06-13 18:27:09 -05:00
FatBoy e5133211a9 Zerg Mechanic for Mines 2024-06-12 19:18:05 -05:00
FatBoy 8548612a80 items auto ID 2024-06-12 18:48:32 -05:00
FatBoy 41c3193275 irekei movespeed fix 2024-06-12 18:42:16 -05:00
FatBoy 15771d2802 new characters start at level 10 2024-06-12 18:38:04 -05:00
FatBoy b4a62e5f3e update inventory when junking for gold 2024-06-12 18:36:10 -05:00
FatBoy fc7e6735a1 mine tower health scales with cap size 2024-06-12 18:35:22 -05:00
FatBoy aeb21c328e max slots for rank adjustments 2024-06-11 21:21:54 -05:00
FatBoy 9a34b13c2e junk from inventory 2024-06-11 21:10:54 -05:00
FatBoy 231feef7fe mines open during a reboot time frame now open correctly 2024-06-11 21:05:50 -05:00
FatBoy 0e6b68139f refactor mine processing to HalfHourlyJob 2024-06-11 21:02:13 -05:00
FatBoy ef62c2bb39 mines open and close 2024-06-11 20:53:33 -05:00
FatBoy 8f68997f3c terraform size correction 2024-06-11 20:32:59 -05:00
FatBoy aebe2698c3 terraform size correction 2024-06-11 20:29:30 -05:00
FatBoy 54e7a8fc7f display mine times correctly 2024-06-11 20:14:57 -05:00
FatBoy 8b4d37c53c fix for mines loading 2024-06-11 20:08:29 -05:00
FatBoy fbfca46d2f fix for mines loading 2024-06-11 20:02:58 -05:00
FatBoy 3228f473de fix for mines loading 2024-06-11 19:57:20 -05:00
FatBoy 17fcf0ee40 duplicated zone loading disabled 2024-06-11 19:51:53 -05:00
FatBoy 395fe31e02 duplicated zone loading disabled 2024-06-11 19:47:34 -05:00
FatBoy e98f9cf1f7 duplicated zone loading disabled 2024-06-11 19:40:14 -05:00
FatBoy fe0c0f97a5 duplicated zone loading disabled 2024-06-11 19:33:29 -05:00
FatBoy 7e27838818 mine changes 2024-06-11 19:07:44 -05:00
FatBoy bc8094c20c saetor race as minotaurs 2024-06-11 18:48:33 -05:00
MagicBot 3649c629b7 Revert "DamageType defined as in JSON"
This reverts commit 1c31070fc8.
2024-04-01 12:04:12 -04:00
MagicBot 1c31070fc8 DamageType defined as in JSON 2024-04-01 12:01:59 -04: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
741 changed files with 37911 additions and 20981 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!");
+150
View File
@@ -0,0 +1,150 @@
package engine.Dungeons;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.PowersManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.net.ByteBufferWriter;
import engine.objects.*;
import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
public class Dungeon {
public static int NoFlyEffectID = -1733819072;
public static int NoTeleportEffectID = -1971545187;
public static int NoSummonEffectID = 2122002462;
public ArrayList<PlayerCharacter> participants;
public int maxPerGuild;
public Vector3fImmutable entrance;
public ArrayList<Mob> dungeon_mobs;
public Long respawnTime = 0L;
public Dungeon(Vector3fImmutable entrance, int maxCount){
this.participants = new ArrayList<>();
this.entrance = entrance;
this.dungeon_mobs = new ArrayList<>();
this.maxPerGuild = maxCount;
}
public void applyDungeonEffects(PlayerCharacter player){
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
if(noFly != null)
player.addEffectNoTimer(noFly.getName(),noFly,40,true);
if(noTele != null)
player.addEffectNoTimer(noTele.getName(),noTele,40,true);
if(noSum != null)
player.addEffectNoTimer(noSum.getName(),noSum,40,true);
}
public void removeDungeonEffects(PlayerCharacter player) {
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
for (Effect eff : player.effects.values()) {
if (noFly != null && eff.getEffectsBase().equals(noFly))
eff.endEffect();
if (noTele != null && eff.getEffectsBase().equals(noTele))
eff.endEffect();
if (noSum != null && eff.getEffectsBase().equals(noSum))
eff.endEffect();
}
}
public static void serializeForClientMsgTeleport(ByteBufferWriter writer) {
Guild rulingGuild = Guild.getErrantGuild();
Guild rulingNation = Guild.getErrantGuild();
Zone zone = ZoneManager.getZoneByUUID(994);
// Begin Serialzing soverign guild data
writer.putInt(Enum.GameObjectType.Zone.ordinal());
writer.putInt(994);
writer.putString("Whitehorn Citadel");
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
writer.putString("Whitehorn Militants"); // guild name
writer.putString("In the Citadel, We Fight!"); // motto
writer.putString(rulingGuild.getLeadershipType());
// Serialize guild ruler's name
// If tree is abandoned blank out the name
// to allow them a rename.
writer.putString("Kol'roth The Destroyer");//sovreign
writer.putInt(rulingGuild.getCharter());
writer.putInt(0); // always 00000000
writer.put((byte)1);//set safehold
writer.put((byte) 1);
writer.put((byte) 1); // *** Refactor: What are these flags?
writer.put((byte) 1);
writer.put((byte) 1);
writer.put((byte) 1);
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
writer.putInt(0);// TODO Implement description text
writer.put((byte) 1);
writer.put((byte) 0);
writer.put((byte) 1);
// Begin serializing nation guild info
if (rulingNation.isEmptyGuild()) {
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
} else {
writer.putInt(rulingNation.getObjectType().ordinal());
writer.putInt(rulingNation.getObjectUUID());
}
// Serialize nation name
writer.putString("Whitehorn Militants"); //nation name
writer.putInt(-1);//city rank, -1 puts it at top of list always
writer.putInt(0xFFFFFFFF);
writer.putInt(0);
writer.putString("Kol'roth The Destroyer");//nation ruler
writer.putLocalDateTime(LocalDateTime.now());
//location
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
writer.putFloat(loc.x);
writer.putFloat(loc.y);
writer.putFloat(loc.z);
writer.putInt(0);
writer.put((byte) 1);
writer.put((byte) 0);
writer.putInt(0x64);
writer.put((byte) 0);
writer.put((byte) 0);
writer.put((byte) 0);
}
}
+105
View File
@@ -0,0 +1,105 @@
package engine.Dungeons;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import java.util.ArrayList;
import java.util.HashSet;
public class DungeonManager {
public static ArrayList<Dungeon> dungeons;
private static final float dungeonAiRange = 64f;
private static final float maxTravel = 64f;
public static void joinDungeon(PlayerCharacter pc, Dungeon dungeon){
if(requestEnter(pc,dungeon)) {
dungeon.participants.add(pc);
dungeon.applyDungeonEffects(pc);
translocateToDungeon(pc, dungeon);
}
}
public static void leaveDungeon(PlayerCharacter pc, Dungeon dungeon){
dungeon.participants.remove(pc);
dungeon.removeDungeonEffects(pc);
translocateOutOfDungeon(pc);
}
public static boolean requestEnter(PlayerCharacter pc, Dungeon dungeon){
int current = 0;
Guild nation = pc.guild.getNation();
if(nation == null)
return false;
for(PlayerCharacter participant : dungeon.participants){
if(participant.guild.getNation().equals(nation)){
current ++;
}
}
if(current >= dungeon.maxPerGuild)
return false;
return true;
}
public static void translocateToDungeon(PlayerCharacter pc, Dungeon dungeon){
pc.teleport(dungeon.entrance);
pc.setSafeMode();
}
public static void translocateOutOfDungeon(PlayerCharacter pc){
pc.teleport(pc.bindLoc);
pc.setSafeMode();
}
public static void pulse_dungeons(){
for(Dungeon dungeon : dungeons){
//early exit, if no players present don't waste resources
if(dungeon.participants.isEmpty())
continue;
if(dungeon.respawnTime > 0 && System.currentTimeMillis() > dungeon.respawnTime){
respawnMobs(dungeon);
}
//remove any players that have left
HashSet<AbstractWorldObject> obj = WorldGrid.getObjectsInRangePartial(dungeon.entrance,4096f,MBServerStatics.MASK_PLAYER);
for(PlayerCharacter player : dungeon.participants)
if(!obj.contains(player))
leaveDungeon(player,dungeon);
//cycle dungeon mob AI
for(Mob mob : dungeon.dungeon_mobs)
dungeonMobAI(mob);
}
}
public static void dungeonMobAI(Mob mob){
}
public static void respawnMobs(Dungeon dungeon){
for(Mob mob : dungeon.dungeon_mobs){
if(!mob.isAlive() && mob.despawned)
mob.respawn();
if(!mob.isAlive() && !mob.despawned){
mob.despawn();
mob.respawn();
}
}
}
}
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,21 +8,18 @@
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;
import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg;
import engine.net.client.msg.*;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
@@ -88,7 +85,7 @@ public enum InterestManager implements Runnable {
if (send) {
Dispatch dispatch = Dispatch.borrow(player, msg);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
}
}
@@ -140,7 +137,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)) {
@@ -270,7 +267,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 +289,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 +301,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 +337,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 +369,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 +411,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 +434,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());
@@ -467,7 +464,7 @@ public enum InterestManager implements Runnable {
if (awonpc.despawned == true)
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -480,9 +477,9 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive())
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
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 +489,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);
}
@@ -514,6 +511,18 @@ public enum InterestManager implements Runnable {
if (player == null)
return;
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.equals(player)){
try{
WorldGrid.RemoveWorldObject(player);
}catch(Exception e){
}
}
}
ClientConnection origin = player.getClientConnection();
if (origin == null)
@@ -521,10 +530,10 @@ public enum InterestManager implements Runnable {
// Update loaded upbjects lists
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
player.setDirtyLoad(true);
updateStaticList(player, origin);
updateMobileList(player, origin);
}
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
+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) {
+116
View File
@@ -0,0 +1,116 @@
package engine.ZergMehcanics;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.ZergManager;
import engine.objects.*;
import engine.server.MBServerStatics;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class MineAntiZerg {
public static HashMap<Mine,HashMap<PlayerCharacter,Long>> leaveTimers = new HashMap<>();
public static HashMap<Mine,ArrayList<PlayerCharacter>> currentPlayers = new HashMap<>();
public static void runMines(){
for(Mine mine : Mine.getMines()){
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
if(tower == null)
continue;
if(!mine.isActive)
continue;
logPlayersPresent(tower,mine);
auditPlayersPresent(tower,mine);
auditPlayers(mine);
}
}
public static void logPlayersPresent(Building tower, Mine mine){
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
ArrayList<PlayerCharacter> playersPresent = new ArrayList<>();
for(AbstractWorldObject player : loadedPlayers){
playersPresent.add((PlayerCharacter)player);
}
currentPlayers.put(mine,playersPresent);
}
public static void auditPlayersPresent(Building tower, Mine mine){
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
for(PlayerCharacter player : currentPlayers.get(mine)){
if(!loadedPlayers.contains(player)){
toRemove.add(player);
}
}
currentPlayers.get(mine).removeAll(toRemove);
for(PlayerCharacter player : toRemove){
if(leaveTimers.containsKey(mine)){
leaveTimers.get(mine).put(player,System.currentTimeMillis());
}else{
HashMap<PlayerCharacter,Long> leaveTime = new HashMap<>();
leaveTime.put(player,System.currentTimeMillis());
leaveTimers.put(mine,leaveTime);
}
}
toRemove.clear();
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
long timeGone = System.currentTimeMillis() - leaveTimers.get(mine).get(player);
if(timeGone > 180000L) {//3 minutes
toRemove.add(player);
player.ZergMultiplier = 1.0f;
}
}
for(PlayerCharacter player : toRemove) {
leaveTimers.get(mine).remove(player);
}
}
public static void auditPlayers(Mine mine){
HashMap<Guild,ArrayList<PlayerCharacter>> playersByNation = new HashMap<>();
for(PlayerCharacter player : currentPlayers.get(mine)){
if(playersByNation.containsKey(player.guild.getNation())){
playersByNation.get(player.guild.getNation()).add(player);
}else{
ArrayList<PlayerCharacter> players = new ArrayList<>();
players.add(player);
playersByNation.put(player.guild.getNation(),players);
}
}
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
if(playersByNation.containsKey(player.guild.getNation())){
playersByNation.get(player.guild.getNation()).add(player);
}else{
ArrayList<PlayerCharacter> players = new ArrayList<>();
players.add(player);
playersByNation.put(player.guild.getNation(),players);
}
}
for(Guild nation : playersByNation.keySet()){
for(PlayerCharacter player : playersByNation.get(nation)){
player.ZergMultiplier = ZergManager.getCurrentMultiplier(playersByNation.get(nation).size(), mine.capSize);
}
}
}
}
+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();
+34 -12
View File
@@ -9,25 +9,24 @@
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.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.Account;
import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
import java.util.ArrayList;
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) {
@@ -77,18 +76,24 @@ public class dbAccountHandler extends dbHandlerBase {
}
}
public void SET_TRASH(String machineID) {
public void SET_TRASH(String machineID, String type) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO dyn_trash(`machineID`, `count`)"
+ " VALUES (?, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO dyn_trash(`machineID`, `count`, `type`)"
+ " VALUES (?, 1, ?) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
preparedStatement.setString(1, machineID);
preparedStatement.setString(2, type);
preparedStatement.execute();
} catch (SQLException e) {
Logger.error(e);
}
ChatSystemMsg chatMsg = new ChatSystemMsg(null, "Account: " + machineID + " has been kicked from game for cheating");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
public ArrayList<String> GET_TRASH_LIST() {
@@ -204,7 +209,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());
}
@@ -270,4 +275,21 @@ public class dbAccountHandler extends dbHandlerBase {
}
}
public void TRASH_CHEATERS() {
try (Connection connection = DbManager.getConnection();
CallableStatement callableStatement = connection.prepareCall("{CALL BanAccountsWithMachineID()}")) {
boolean hasResultSet = callableStatement.execute();
if (!hasResultSet && callableStatement.getUpdateCount() > 0) {
Logger.info("TRASHED CHEATERS");
} else {
Logger.warn("No cheaters to trash.");
}
} catch (SQLException e) {
Logger.error("Error trashing cheaters: ", e);
}
}
}
+158 -8
View File
@@ -10,17 +10,13 @@
package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.objects.Bane;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.PlayerCharacter;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
public class dbBaneHandler extends dbHandlerBase {
@@ -89,6 +85,139 @@ public class dbBaneHandler extends dbHandlerBase {
return true;
}
public boolean SET_BANE_TIME_NEW(int hour, int cityUUID) {
hour += 12; // Adjust hour
try (Connection connection = DbManager.getConnection();
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `time_set`=? WHERE `cityUUID`=?")) {
// Retrieve placementDate and liveDate
getStatement.setInt(1, cityUUID);
try (ResultSet rs = getStatement.executeQuery()) {
if (rs.next()) {
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
// Explicitly check if liveDate is null
DateTime toSet;
if (liveDateTimestamp == null) {
// If liveDate is null, default to placementDate
toSet = placementDate;
} else {
// If liveDate is not null, use it
DateTime liveDate = new DateTime(liveDateTimestamp.getTime());
toSet = liveDate;
}
// Adjust the time
toSet = toSet.withHourOfDay(hour).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
// Update liveDate and time_set flag
updateStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
updateStatement.setInt(2, 1); // time_set flag
updateStatement.setInt(3, cityUUID);
updateStatement.execute();
return true;
}
}
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean SET_BANE_DAY_NEW(int dayOffset, int cityUUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `day_set`=? WHERE `cityUUID`=?")) {
// Retrieve placementDate and liveDate
getStatement.setInt(1, cityUUID);
try (ResultSet rs = getStatement.executeQuery()) {
if (rs.next()) {
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
// Explicitly check if liveDate is null
DateTime liveDate;
if (liveDateTimestamp == null) {
// If liveDate is null, default to placementDate
liveDate = placementDate;
} else {
// If liveDate is not null, use it
liveDate = new DateTime(liveDateTimestamp.getTime());
}
// Calculate the new liveDate while preserving the time component
DateTime updatedDate = placementDate.plusDays(dayOffset)
.withHourOfDay(liveDate.getHourOfDay())
.withMinuteOfHour(liveDate.getMinuteOfHour())
.withSecondOfMinute(liveDate.getSecondOfMinute())
.withMillisOfSecond(liveDate.getMillisOfSecond());
// Update liveDate and day_set flag
updateStatement.setTimestamp(1, new java.sql.Timestamp(updatedDate.getMillis()));
updateStatement.setInt(2, 1); // day_set flag
updateStatement.setInt(3, cityUUID);
updateStatement.execute();
return true;
}
}
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean SET_BANE_CAP_NEW(int count, int cityUUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
preparedStatement.setInt(1, count);
preparedStatement.setLong(2, cityUUID);
preparedStatement.execute();
} catch (SQLException e) {
Logger.error(e);
return false;
}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_set`=? WHERE `cityUUID`=?")) {
preparedStatement.setInt(1, 1);
preparedStatement.setLong(2, cityUUID);
preparedStatement.execute();
} catch (SQLException e) {
Logger.error(e);
return false;
}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
preparedStatement.setInt(1, count);
preparedStatement.setLong(2, cityUUID);
preparedStatement.execute();
} catch (SQLException e) {
Logger.error(e);
return false;
}
return true;
}
public boolean REMOVE_BANE(Bane bane) {
if (bane == null)
@@ -107,4 +236,25 @@ public class dbBaneHandler extends dbHandlerBase {
return true;
}
public DateTime getLiveDate(int cityUUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
statement.setInt(1, cityUUID);
try (ResultSet rs = statement.executeQuery()) {
if (rs.next()) {
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
if (liveDateTimestamp != null) {
return new DateTime(liveDateTimestamp.getTime());
}
}
}
} catch (SQLException e) {
Logger.error(e);
}
return null; // Return null if liveDate is not found or an error occurs
}
}
@@ -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) {
+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,8 +9,8 @@
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;
@@ -24,7 +24,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 +72,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 +95,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;
+28 -22
View File
@@ -9,12 +9,9 @@
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;
import engine.objects.Zone;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.sql.*;
@@ -25,7 +22,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 +31,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();
@@ -97,13 +92,24 @@ public class dbCityHandler extends dbHandlerBase {
return objectList;
}
public Integer GET_CAPITAL_CITY_COUNT() {
public ArrayList<City> GET_ALL_CITIES() {
int cityCount = 0;
for(Realm realm : Realm._realms.values()){
if(realm.isRuled())
cityCount ++;
}
return cityCount;
}
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 +123,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;
+76 -33
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);
@@ -77,41 +98,63 @@ public class dbContractHandler extends dbHandlerBase {
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
if(!contract.getName().contains("Sage")) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
preparedStatement.setInt(1, contract.getObjectUUID());
preparedStatement.setInt(1, contract.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
while (rs.next()) {
int type = rs.getInt("type");
int value = rs.getInt("value");
int type = rs.getInt("type");
int value = rs.getInt("value");
switch (type) {
case 1:
contract.getBuyItemType().add(value);
break;
case 2:
contract.getBuySkillToken().add(value);
break;
case 3:
contract.getBuyUnknownToken().add(value);
break;
switch (type) {
case 1:
contract.getBuyItemType().add(value);
break;
case 2:
contract.getBuySkillToken().add(value);
break;
case 3:
contract.getBuyUnknownToken().add(value);
break;
}
}
} catch (SQLException e) {
Logger.error(e);
}
}else{
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int value = rs.getInt("value");
if(!contract.getBuySkillToken().contains(value))
contract.getBuySkillToken().add(value);
if(!contract.getBuyItemType().contains(value))
contract.getBuyItemType().add(value);
if(!contract.getBuyUnknownToken().contains(value))
contract.getBuyUnknownToken().add(value);
}
} catch (SQLException e) {
Logger.error(e);
}
} catch (SQLException e) {
Logger.error(e);
}
}
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 +169,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 +178,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;
//
// }
}
+19 -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.AbstractGameObject;
import engine.objects.AbstractWorldObject;
import org.pmw.tinylog.Logger;
@@ -32,7 +32,6 @@ public abstract class dbHandlerBase {
try {
if (rs.next()) {
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(abstractGameObject);
}
} catch (Exception e) {
@@ -42,7 +41,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();
@@ -57,12 +56,28 @@ public abstract class dbHandlerBase {
while (rs.next()) {
int id = rs.getInt(1);
try {
if (rs.getInt("capSize") == 0) {
continue;
}
}catch(Exception e){
//not a mine
}
if (DbManager.inCache(localObjectType, id)) {
objectList.add((T) DbManager.getFromCache(localObjectType, id));
} else {
try{
if(rs.getInt("mineLiveHour") == 1)
continue;
}catch(Exception e){
//not a mine
}
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,162 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// 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 static final HashMap<Integer,Float> dexReductions = new HashMap<>();
public dbItemBaseHandler() {
}
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
preparedStatement.setInt(1, itemBase.getUUID());
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_DEX_REDUCTION(ItemBase itemBase) {
if(dexReductions.containsKey(itemBase.getUUID())){
itemBase.dexReduction = dexReductions.get(itemBase.getUUID());
}else{
itemBase.dexReduction = 0.0f;
}
}
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);
}
} catch (SQLException e) {
Logger.error(e);
}
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty`")) {
ResultSet rs = preparedStatement.executeQuery();
// Check if a result was found
if (rs.next()) {
int ID = rs.getInt("ID");
float factor = rs.getInt("item_bulk_factor");
dexReductions.put(ID,factor);
}
} catch (SQLException e) {
Logger.error(e);
}
}
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;
}
}
+53 -130
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();
@@ -148,9 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
worked = rs.getBoolean("result");
if (rs.next()) {
try {
worked = rs.getBoolean("result");
}catch(Exception e){
worked = false;
}
}
} 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,12 +350,7 @@ 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())
@@ -424,11 +366,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 +383,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 +416,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 +437,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 +457,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 +472,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 +487,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 +501,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) {
+5 -4
View File
@@ -8,10 +8,11 @@
package engine.db.handlers;
import engine.Enum;
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.sql.Connection;
@@ -24,7 +25,7 @@ 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) {
@@ -32,7 +33,7 @@ public class dbMineHandler extends dbHandlerBase {
if (id == 0)
return null;
Mine mine = (Mine) DbManager.getFromCache(mbEnums.GameObjectType.Mine, id);
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
if (mine != null)
return mine;
@@ -83,7 +84,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`=?")) {
+2 -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;
@@ -27,7 +26,7 @@ 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) {
+44 -49
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,30 +25,34 @@ 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) {
public Mob ADD_MOB(Mob toAdd) {
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);
preparedStatement.setInt(3, toAdd.guildUUID);
preparedStatement.setFloat(4, toAdd.bindLoc.x);
preparedStatement.setFloat(5, toAdd.bindLoc.y);
preparedStatement.setFloat(6, toAdd.bindLoc.z);
preparedStatement.setLong(1, toAdd.getParentZoneID());
preparedStatement.setInt(2, toAdd.getMobBaseID());
preparedStatement.setInt(3, toAdd.getGuildUUID());
preparedStatement.setFloat(4, toAdd.getSpawnX());
preparedStatement.setFloat(5, toAdd.getSpawnY());
preparedStatement.setFloat(6, toAdd.getSpawnZ());
preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius);
preparedStatement.setInt(9, toAdd.spawnDelay);
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());
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
if (toAdd.getContract() != null)
preparedStatement.setInt(10, toAdd.getContract().getContractID());
else
preparedStatement.setInt(10, 0);
preparedStatement.setInt(11, toAdd.getBuildingID());
preparedStatement.setInt(12, toAdd.getLevel());
preparedStatement.setString(13, toAdd.getFirstName());
ResultSet rs = preparedStatement.executeQuery();
@@ -65,23 +69,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();
@@ -119,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
return row_count;
}
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
public void LOAD_PATROL_POINTS(Mob captain) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
preparedStatement.setInt(1, captain.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String minionName = rs.getString("minionName");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
String name = rs.getString("name");
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
if (toCreate == null)
return;
@@ -144,13 +131,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 +149,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 +166,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) {
+157 -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);
@@ -168,6 +131,32 @@ public class dbNPCHandler extends dbHandlerBase {
return npc;
}
public int BANE_COMMANDER_EXISTS(final int objectUUID) {
int uid = 0;
String query = "SELECT `UID` FROM `obj_npc` WHERE `npc_buildingID` = ? LIMIT 1;";
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(query)) {
preparedStatement.setInt(1, objectUUID);
try (ResultSet rs = preparedStatement.executeQuery()) {
if (rs.next()) {
// Retrieve the UID column value
uid = rs.getInt("UID");
}
}
} catch (SQLException e) {
Logger.error(e);
}
return uid;
}
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
int rowCount;
@@ -213,6 +202,18 @@ public class dbNPCHandler extends dbHandlerBase {
return result;
}
public static void updateSpecialPricing(final NPC npc){
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
preparedStatement.setInt(1, npc.getSpecialPrice());
preparedStatement.setInt(2, npc.getDBID());
preparedStatement.executeUpdate();
} catch (SQLException e) {
Logger.error(e);
}
}
public void updateDatabase(final NPC npc) {
try (Connection connection = DbManager.getConnection();
@@ -310,22 +311,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 +346,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) {
@@ -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) {
+1 -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) {
@@ -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 {
@@ -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) {
@@ -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, true, zone, null, 0, "", 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, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
+22 -27
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;
@@ -31,7 +32,6 @@ public class AddNPCCmd extends AbstractDevCmd {
int contractID;
String name = "";
int level = 0;
if (words.length < 2) {
this.sendUsage(pc);
return;
@@ -39,59 +39,54 @@ public class AddNPCCmd extends AbstractDevCmd {
try {
contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]);
for (int i = 2; i < words.length; i++) {
name += words[i];
if (i + 1 < words.length)
name += "";
}
} catch (NumberFormatException e) {
throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer.");
return; // NaN
}
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if (contract == null || level < 1 || level > 75) {
throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level");
return; // NaN
}
// Pick a random name
if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
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'";
}
}
+54
View File
@@ -0,0 +1,54 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Dungeons.DungeonManager;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class DungenonCmd extends AbstractDevCmd {
public DungenonCmd() {
super("dungeon");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Zone parent = ZoneManager.findSmallestZone(pc.loc);
if(parent == null)
return;
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
pc.teleport(loc);
}
@Override
protected String _getHelpString() {
return "indicate mob or building followed by an id and a level";
}
@Override
protected String _getUsageString() {
return "'/dungeon mob 2001 10'";
}
}
+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";
}
}
+87
View File
@@ -0,0 +1,87 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.*;
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;
for (int i = 1; i < cnt; i++) {
String enchant = words[i];
boolean valid = true;
for (Effect eff : item.getEffects().values()) {
if (eff.getEffectsBase().getIDString().equals(enchant)) {
throwbackError(pc, "This item already has that enchantment");
return;
}
}
if (valid) {
item.addPermanentEnchantmentForDev(enchant, rank);
this.setResult(String.valueOf(item.getObjectUUID()));
} else
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
}
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 ...'";
}
}
+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";
}
}
+63
View File
@@ -0,0 +1,63 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.objects.*;
import engine.powers.EffectsBase;
import java.util.ArrayList;
/**
* @author Eighty
*/
public class GimmeCmd extends AbstractDevCmd {
public GimmeCmd() {
super("gimme");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int amt = 0;
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
amt = 10000000 - currentGold;
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
if(pc.level < 75) {
pc.setLevel((short) 75);
ChatManager.chatSayInfo(pc, "Level set to 75");
}
pc.getCharItemManager().updateInventory();
}
@Override
protected String _getHelpString() {
return "Round up current gold in inventory to 10,000,000";
}
@Override
protected String _getUsageString() {
return "'./gimme";
}
}
+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();
-77
View File
@@ -1,77 +0,0 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// 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;
/**
* ./hotzone <- display the current hotzone & time remaining
* ./hotzone random <- change hotzone to random new zone
*/
public class HotzoneCmd extends AbstractDevCmd {
public HotzoneCmd() {
super("hotzone");
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
AbstractGameObject target) {
StringBuilder data = new StringBuilder();
String outString;
for (String s : words) {
data.append(s);
data.append(' ');
}
String input = data.toString().trim();
if (input.length() == 0) {
outString = "Current hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
}
if (input.equalsIgnoreCase("random")) {
ZoneManager.generateAndSetRandomHotzone();
outString = "New hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
}
if (input.equalsIgnoreCase("reset")) {
ZoneManager.resetHotZones();
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
return;
}
return;
}
@Override
protected String _getHelpString() {
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
}
@Override
protected String _getUsageString() {
return "'./hotzone [random]";
}
}
+49 -34
View File
@@ -9,15 +9,19 @@
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.PowersManager;
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.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import engine.util.StringUtils;
import java.text.DecimalFormat;
@@ -253,9 +257,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,7 +282,7 @@ 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 += newline;
@@ -291,7 +295,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);
@@ -331,13 +335,18 @@ public class InfoCmd extends AbstractDevCmd {
output += "Movement State: " + targetPC.getMovementState().name();
output += newline;
output += "Movement Speed: " + targetPC.getSpeed();
output += newline;
output += "Altitude : " + targetPC.getLoc().y;
output += newline;
output += "Swimming : " + targetPC.isSwimming();
output += newline;
output += "isMoving : " + targetPC.isMoving();
output += newline;
output += "Zerg Multiplier : " + targetPC.ZergMultiplier + newline;
output += "Hidden : " + targetPC.getHidden() + newline;
output += "Target Loc: " + targetPC.loc + newline;
output += "Player Loc: " + pc.loc + newline;
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc);
break;
case NPC:
@@ -369,8 +378,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 +392,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,13 +445,11 @@ 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";
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
PlayerCharacter owner = targetMob.getOwner();
if (owner != null)
output += " owner: " + owner.getObjectUUID();
output += newline;
@@ -458,7 +463,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 +480,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 +501,31 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "No building found." + newline;
}
int max = (int) (4.882 * targetMob.level + 121.0);
if (max > 321) {
max = 321;
output += "Damage: " + targetMob.mobBase.getDamageMin() + " - " + targetMob.mobBase.getDamageMax() + newline;
output += "ATR: " + targetMob.mobBase.getAttackRating() + newline;
output += "DEF: " + targetMob.defenseRating + newline;
output += "RANGE: " + targetMob.getRange() + newline;
output += "Effects:" + newline;
for(MobBaseEffects mbe : targetMob.mobBase.mobbaseEffects){
EffectsBase eb = PowersManager.getEffectByToken(mbe.getToken());
output += eb.getName() + newline;
}
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();
@@ -533,6 +541,13 @@ public class InfoCmd extends AbstractDevCmd {
}
break;
case Corpse:
Corpse corpse = (Corpse)target;
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
output += "Despawn in: " + timeLeft;
output += newline;
break;
}
throwbackInfo(pc, output);
+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'";
}
}
+80 -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,48 @@ 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.");
return;
}
//add item to inventory
pc.getCharItemManager().addItemToInventory(item);
}
return;
}
if (words.length < 3 || words.length > 5) {
this.sendUsage(pc);
return;
@@ -58,23 +103,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 +120,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 +174,57 @@ 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.");
return;
}
//create prefix
if (!prefix.isEmpty())
item.addPermanentEnchantmentForDev(prefix, 0);
@@ -198,12 +243,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]'";
}
}

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