Compare commits

..

831 Commits

Author SHA1 Message Date
FatBoy 76284cf3c9 player update optimized 2025-02-17 16:36:12 -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
249 changed files with 14621 additions and 6813 deletions
+45 -29
View File
@@ -9,15 +9,13 @@
package engine; package engine;
import ch.claude_martin.enumbitset.EnumBitSetHelper; import ch.claude_martin.enumbitset.EnumBitSetHelper;
import engine.gameManager.BuildingManager;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.gameManager.PowersManager; import engine.gameManager.PowersManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector2f; import engine.math.Vector2f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter; import engine.objects.*;
import engine.objects.ItemBase;
import engine.objects.Shrine;
import engine.objects.Zone;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -139,8 +137,8 @@ public class Enum {
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f), HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1), HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1), HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f), IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f), IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1), SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1), SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f), MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
@@ -172,6 +170,8 @@ public class Enum {
} }
public static RaceType getRaceTypebyRuneID(int runeID) { public static RaceType getRaceTypebyRuneID(int runeID) {
if(runeID == 1999)
return _raceTypeByID.get(2017);
return _raceTypeByID.get(runeID); return _raceTypeByID.get(runeID);
} }
@@ -208,8 +208,8 @@ public class Enum {
SENTINEL(0, 0, 0, 0, 0, 0, 0), SENTINEL(0, 0, 0, 0, 0, 0, 0),
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f), STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f), CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f); MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f),
IREKEI(6.499500105f, 14.6685f, 4.2199998f, 14.6685f, 6.3299999f, 18.379999f, 6.5f);
private float walkStandard; private float walkStandard;
private float walkCombat; private float walkCombat;
private float runStandard; private float runStandard;
@@ -469,11 +469,14 @@ public class Enum {
// 14001 does not have a banestone to bind at // 14001 does not have a banestone to bind at
if (ruinZone.templateID == 14001) if (ruinZone.getLoadNum() == 14001) {
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30); spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
else }else {
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc() //spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30); //.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
}
} }
@@ -776,6 +779,7 @@ public class Enum {
Combat, Combat,
Spires, Spires,
Snare, Snare,
Snared,
Stun, Stun,
Blind, Blind,
Root, Root,
@@ -878,6 +882,7 @@ public class Enum {
Siege, Siege,
Slash, Slash,
Snare, Snare,
Snared,
Sorcery, Sorcery,
Spear, Spear,
SpearMastery, SpearMastery,
@@ -957,6 +962,17 @@ public class Enum {
Wizardry; Wizardry;
public static SourceType GetSourceType(String modName) { public static SourceType GetSourceType(String modName) {
switch(modName){
case "Slashing":
modName = "Slash";
break;
case "Crushing":
modName = "Crush";
break;
case "Piercing":
modName = "Pierce";
break;
}
SourceType returnMod; SourceType returnMod;
if (modName.isEmpty()) if (modName.isEmpty())
return SourceType.None; return SourceType.None;
@@ -1016,6 +1032,7 @@ public class Enum {
Silence, Silence,
Slash, Slash,
Snare, Snare,
Snared,
Stance, Stance,
Stun, Stun,
Summon, Summon,
@@ -1140,6 +1157,7 @@ public class Enum {
SkillDebuff, SkillDebuff,
SlashResistanceDebuff, SlashResistanceDebuff,
Snare, Snare,
Snared,
StackableAttrCONBuff, StackableAttrCONBuff,
StackableAttrDEXBuff, StackableAttrDEXBuff,
StackableAttrSTRBuff, StackableAttrSTRBuff,
@@ -2306,14 +2324,14 @@ public class Enum {
public enum CityBoundsType { public enum CityBoundsType {
GRID(640), GRID(544),
ZONE(875), ZONE(672),
PLACEMENT(876); PLACEMENT(673);
public final float halfExtents; public final float extents;
CityBoundsType(float halfExtents) { CityBoundsType(float extents) {
this.halfExtents = halfExtents; this.extents = extents;
} }
} }
@@ -2822,6 +2840,7 @@ public class Enum {
public enum MobBehaviourType { public enum MobBehaviourType {
None(null, false, false, false, false, false), None(null, false, false, false, false, false),
//Power
Power(null, false, true, true, true, false), Power(null, false, true, true, true, false),
PowerHelpee(Power, false, true, true, false, true), PowerHelpee(Power, false, true, true, false, true),
PowerHelpeeWimpy(Power, true, false, true, false, false), PowerHelpeeWimpy(Power, true, false, true, false, false),
@@ -2846,7 +2865,6 @@ public class Enum {
//Independent Types //Independent Types
SimpleStandingGuard(null, false, false, false, false, false), SimpleStandingGuard(null, false, false, false, false, false),
Pet1(null, false, false, true, false, false), Pet1(null, false, false, true, false, false),
SiegeEngine(null, false, false, false, false, false),
Simple(null, false, false, true, false, false), Simple(null, false, false, true, false, false),
Helpee(null, false, true, true, false, true), Helpee(null, false, true, true, false, true),
HelpeeWimpy(null, true, false, true, false, false), HelpeeWimpy(null, true, false, true, false, false),
@@ -2857,12 +2875,13 @@ public class Enum {
HamletGuard(null, false, true, false, false, false), HamletGuard(null, false, true, false, false, false),
AggroWanderer(null, false, false, true, false, false); AggroWanderer(null, false, false, true, false, false);
public final MobBehaviourType BehaviourHelperType; private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
public final boolean isWimpy; public MobBehaviourType BehaviourHelperType;
public final boolean isAgressive; public boolean isWimpy;
public final boolean canRoam; public boolean isAgressive;
public final boolean callsForHelp; public boolean canRoam;
public final boolean respondsToCallForHelp; public boolean callsForHelp;
public boolean respondsToCallForHelp;
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) { MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
this.BehaviourHelperType = helpeebehaviourType; this.BehaviourHelperType = helpeebehaviourType;
@@ -2877,11 +2896,8 @@ public class Enum {
public enum AIAgentType { public enum AIAgentType {
MOBILE, MOBILE,
GUARDCAPTAIN,
GUARDMINION,
GUARDWALLARCHER,
PET, PET,
CHARMED, CHARMED,
SIEGEENGINE; GUARD;
} }
} }
@@ -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;
}
}
@@ -19,10 +19,7 @@ import engine.net.AbstractNetMsg;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.LoadCharacterMsg; import engine.net.client.msg.*;
import engine.net.client.msg.LoadStructureMsg;
import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -140,7 +137,7 @@ public enum InterestManager implements Runnable {
else { else {
if (pc != null) if (pc != null)
if (pcc.getSeeInvis() < pc.hidden) if (pcc.getSeeInvis() < pc.getHidden())
continue; continue;
if (!cc.sendMsg(uom)) { if (!cc.sendMsg(uom)) {
@@ -340,7 +337,7 @@ public enum InterestManager implements Runnable {
if (loadedPlayer.getObjectUUID() == player.getObjectUUID()) if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
continue; continue;
if (player.getSeeInvis() < loadedPlayer.hidden) if (player.getSeeInvis() < loadedPlayer.getHidden())
continue; continue;
if (loadedPlayer.safemodeInvis()) if (loadedPlayer.safemodeInvis())
@@ -372,7 +369,7 @@ public enum InterestManager implements Runnable {
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) { if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject; PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
if (player.getSeeInvis() < loadedPlayer.hidden) if (player.getSeeInvis() < loadedPlayer.getHidden())
toRemove.add(playerLoadedObject); toRemove.add(playerLoadedObject);
else if (loadedPlayer.safemodeInvis()) else if (loadedPlayer.safemodeInvis())
toRemove.add(playerLoadedObject); toRemove.add(playerLoadedObject);
@@ -437,7 +434,7 @@ public enum InterestManager implements Runnable {
// dont load if invis // dont load if invis
if (player.getSeeInvis() < awopc.hidden) if (player.getSeeInvis() < awopc.getHidden())
continue; continue;
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii()); lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
@@ -467,7 +464,7 @@ public enum InterestManager implements Runnable {
if (awonpc.despawned == true) if (awonpc.despawned == true)
continue; continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
((Mob) awonpc).setCombatTarget(null); ((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii()); lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -480,7 +477,7 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive()) if (!awonpc.isAlive())
continue; continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE))) if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
((Mob) awonpc).setCombatTarget(null); ((Mob) awonpc).setCombatTarget(null);
@@ -521,10 +518,10 @@ public enum InterestManager implements Runnable {
// Update loaded upbjects lists // Update loaded upbjects lists
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
player.setDirtyLoad(true); player.setDirtyLoad(true);
updateStaticList(player, origin); updateStaticList(player, origin);
updateMobileList(player, origin); updateMobileList(player, origin);
} }
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) { public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
-230
View File
@@ -1,230 +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;
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 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;
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ public class CityRecord extends DataRecord {
cityRecord.locX = cityRecord.city.getTOL().getLoc().x; cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate 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(Enum.RecordEventType.CREATE)) if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
cityRecord.establishedDatetime = cityRecord.city.established; cityRecord.establishedDatetime = cityRecord.city.established;
+1 -1
View File
@@ -52,7 +52,7 @@ public class MineRecord extends DataRecord {
mineRecord.eventType = eventType; mineRecord.eventType = eventType;
} }
mineRecord.zoneHash = mine.getParentZone().hash; mineRecord.zoneHash = mine.getParentZone().getHash();
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
player = (PlayerCharacter) character; player = (PlayerCharacter) character;
+1 -1
View File
@@ -281,7 +281,7 @@ public class PvpRecord extends DataRecord {
outStatement.setInt(8, this.victim.getLevel()); outStatement.setInt(8, this.victim.getLevel());
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID())); 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(11, this.location.getX());
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
outStatement.setBoolean(13, this.pvpExp); outStatement.setBoolean(13, this.pvpExp);
+158 -8
View File
@@ -10,17 +10,13 @@
package engine.db.handlers; package engine.db.handlers;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.Bane; import engine.gameManager.ZoneManager;
import engine.objects.Building; import engine.math.Vector3fImmutable;
import engine.objects.City; import engine.objects.*;
import engine.objects.PlayerCharacter;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.Connection; import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class dbBaneHandler extends dbHandlerBase { public class dbBaneHandler extends dbHandlerBase {
@@ -89,6 +85,139 @@ public class dbBaneHandler extends dbHandlerBase {
return true; 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) { public boolean REMOVE_BANE(Bane bane) {
if (bane == null) if (bane == null)
@@ -107,4 +236,25 @@ public class dbBaneHandler extends dbHandlerBase {
return true; 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
}
} }
+44 -41
View File
@@ -13,7 +13,6 @@ import engine.Enum;
import engine.Enum.DbObjectType; import engine.Enum.DbObjectType;
import engine.Enum.ProtectionState; import engine.Enum.ProtectionState;
import engine.Enum.TaxType; import engine.Enum.TaxType;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
@@ -28,7 +27,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public class dbBuildingHandler extends dbHandlerBase { public class dbBuildingHandler extends dbHandlerBase {
@@ -90,12 +88,14 @@ public class dbBuildingHandler extends dbHandlerBase {
return removeFromBuildings(b); return removeFromBuildings(b);
} }
public ArrayList<Building> GET_ALL_BUILDINGS() { public ArrayList<Building> GET_ALL_BUILDINGS_FOR_ZONE(Zone zone) {
ArrayList<Building> buildings = new ArrayList<>(); ArrayList<Building> buildings = new ArrayList<>();
try (Connection connection = DbManager.getConnection(); 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(); ResultSet rs = preparedStatement.executeQuery();
buildings = getObjectsFromRs(rs, 1000); buildings = getObjectsFromRs(rs, 1000);
@@ -425,28 +425,26 @@ public class dbBuildingHandler extends dbHandlerBase {
return false; 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(); 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(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {
BuildingFriends friend = new BuildingFriends(rs); BuildingFriends friend = new BuildingFriends(rs);
switch (friend.getFriendType()) {
// Create map if it does not yet exist
if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID))
BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>());
switch (friend.friendType) {
case 7: case 7:
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend); building.getFriends().put(friend.getPlayerUID(), friend);
break; break;
case 8: case 8:
case 9: case 9:
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.guildUID, friend); building.getFriends().put(friend.getGuildUID(), friend);
break; 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(); 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(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {
Condemned condemned = new Condemned(rs); Condemned condemned = new Condemned(rs);
switch (condemned.getFriendType()) {
// Create map if it does not yet exist
if (!BuildingManager._buildingCondemned.containsKey(condemned.buildingUUID))
BuildingManager._buildingCondemned.put(condemned.buildingUUID, new ConcurrentHashMap<>());
switch (condemned.friendType) {
case 2: case 2:
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.playerUID, condemned); building.getCondemned().put(condemned.getPlayerUID(), condemned);
break; break;
case 4: case 4:
case 5: case 5:
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.guildUID, condemned); building.getCondemned().put(condemned.getGuildUID(), condemned);
break; 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(); 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(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {
float x1 = rs.getFloat("patrolX");
int buildingUUID = rs.getInt("buildingUID"); float y1 = rs.getFloat("patrolY");
float z1 = rs.getFloat("patrolZ");
if (!BuildingManager._buildingPatrolPoints.containsKey(buildingUUID)) Vector3fImmutable patrolPoint = new Vector3fImmutable(x1, y1, z1);
BuildingManager._buildingPatrolPoints.put(buildingUUID, new ArrayList<>()); patrolPoints.add(patrolPoint);
Vector3fImmutable patrolPoint = new Vector3fImmutable(rs.getFloat("patrolX"), rs.getFloat("patrolY"), rs.getFloat("patrolZ"));
BuildingManager._buildingPatrolPoints.get(buildingUUID).add(patrolPoint);
} }
} catch (SQLException e) { } catch (SQLException e) {
Logger.error(e); Logger.error(e);
} }
return patrolPoints;
} }
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) { 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` = ?")) { + "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
preparedStatement.setBoolean(1, active); preparedStatement.setBoolean(1, active);
preparedStatement.setInt(2, condemn.buildingUUID); preparedStatement.setInt(2, condemn.getParent());
preparedStatement.setInt(3, condemn.playerUID); preparedStatement.setInt(3, condemn.getPlayerUID());
preparedStatement.setInt(4, condemn.guildUID); preparedStatement.setInt(4, condemn.getGuildUID());
preparedStatement.setInt(5, condemn.friendType); preparedStatement.setInt(5, condemn.getFriendType());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
+14 -9
View File
@@ -11,10 +11,7 @@ package engine.db.handlers;
import engine.Enum; import engine.Enum;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.AbstractGameObject; import engine.objects.*;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.Zone;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.*; import java.sql.*;
@@ -34,19 +31,16 @@ public class dbCityHandler extends dbHandlerBase {
case "zone": case "zone":
Zone zone = new Zone(rs); Zone zone = new Zone(rs);
DbManager.addToCache(zone); DbManager.addToCache(zone);
zone.runAfterLoad();
list.add(zone); list.add(zone);
break; break;
case "building": case "building":
Building building = new Building(rs); Building building = new Building(rs);
DbManager.addToCache(building); DbManager.addToCache(building);
building.runAfterLoad();
list.add(building); list.add(building);
break; break;
case "city": case "city":
City city = new City(rs); City city = new City(rs);
DbManager.addToCache(city); DbManager.addToCache(city);
city.runAfterLoad();
list.add(city); list.add(city);
break; break;
} }
@@ -98,13 +92,24 @@ public class dbCityHandler extends dbHandlerBase {
return objectList; 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<>(); ArrayList<City> cityList = new ArrayList<>();
try (Connection connection = DbManager.getConnection(); 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(); ResultSet rs = preparedStatement.executeQuery();
cityList = getObjectsFromRs(rs, 100); cityList = getObjectsFromRs(rs, 100);
+41 -19
View File
@@ -98,32 +98,54 @@ public class dbContractHandler extends dbHandlerBase {
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) { public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
try (Connection connection = DbManager.getConnection(); if(!contract.getName().contains("Sage")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) { 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 type = rs.getInt("type");
int value = rs.getInt("value"); int value = rs.getInt("value");
switch (type) { switch (type) {
case 1: case 1:
contract.getBuyItemType().add(value); contract.getBuyItemType().add(value);
break; break;
case 2: case 2:
contract.getBuySkillToken().add(value); contract.getBuySkillToken().add(value);
break; break;
case 3: case 3:
contract.getBuyUnknownToken().add(value); contract.getBuyUnknownToken().add(value);
break; 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);
} }
} }
+16 -1
View File
@@ -32,7 +32,6 @@ public abstract class dbHandlerBase {
try { try {
if (rs.next()) { if (rs.next()) {
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs); abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(abstractGameObject); DbManager.addToCache(abstractGameObject);
} }
} catch (Exception e) { } catch (Exception e) {
@@ -57,12 +56,28 @@ public abstract class dbHandlerBase {
while (rs.next()) { while (rs.next()) {
int id = rs.getInt(1); int id = rs.getInt(1);
try {
if (rs.getInt("capSize") == 0) {
continue;
}
}catch(Exception e){
//not a mine
}
if (DbManager.inCache(localObjectType, id)) { if (DbManager.inCache(localObjectType, id)) {
objectList.add((T) DbManager.getFromCache(localObjectType, id)); objectList.add((T) DbManager.getFromCache(localObjectType, id));
} else { } else {
try{
if(rs.getInt("mineLiveHour") == 1)
continue;
}catch(Exception e){
//not a mine
}
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs); AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(toAdd); DbManager.addToCache(toAdd);
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
continue;
}
objectList.add((T) toAdd); objectList.add((T) toAdd);
if (toAdd != null && toAdd instanceof AbstractWorldObject) 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);
}
}
}
@@ -22,6 +22,7 @@ import java.util.HashMap;
public class dbItemBaseHandler extends dbHandlerBase { public class dbItemBaseHandler extends dbHandlerBase {
public static final HashMap<Integer,Float> dexReductions = new HashMap<>();
public dbItemBaseHandler() { public dbItemBaseHandler() {
} }
@@ -45,6 +46,14 @@ public class dbItemBaseHandler extends dbHandlerBase {
} }
} }
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) { public void LOAD_ANIMATIONS(ItemBase itemBase) {
ArrayList<Integer> tempList = new ArrayList<>(); ArrayList<Integer> tempList = new ArrayList<>();
@@ -94,6 +103,21 @@ public class dbItemBaseHandler extends dbHandlerBase {
} }
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size()); 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() { public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
+21 -3
View File
@@ -134,9 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) if (rs.next()) {
worked = rs.getBoolean("result"); try {
worked = rs.getBoolean("result");
}catch(Exception e){
worked = false;
}
}
} catch (SQLException e) { } catch (SQLException e) {
Logger.error(e); Logger.error(e);
} }
@@ -496,4 +500,18 @@ public class dbItemHandler extends dbHandlerBase {
return false; return false;
} }
} }
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 `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;
}
}
} }
+43 -47
View File
@@ -11,6 +11,7 @@ package engine.db.handlers;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.Zone;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -27,27 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.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; Mob mobile = null;
try (Connection connection = DbManager.getConnection(); 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.setLong(1, toAdd.getParentZoneID());
preparedStatement.setInt(2, toAdd.loadID); preparedStatement.setInt(2, toAdd.getMobBaseID());
preparedStatement.setInt(3, toAdd.guildUUID); preparedStatement.setInt(3, toAdd.getGuildUUID());
preparedStatement.setFloat(4, toAdd.bindLoc.x); preparedStatement.setFloat(4, toAdd.getSpawnX());
preparedStatement.setFloat(5, toAdd.bindLoc.y); preparedStatement.setFloat(5, toAdd.getSpawnY());
preparedStatement.setFloat(6, toAdd.bindLoc.z); preparedStatement.setFloat(6, toAdd.getSpawnZ());
preparedStatement.setInt(7, 0); preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius); preparedStatement.setFloat(8, toAdd.getSpawnRadius());
preparedStatement.setInt(9, toAdd.spawnDelay); preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
preparedStatement.setInt(10, toAdd.contractUUID);
preparedStatement.setInt(11, toAdd.buildingUUID); if (toAdd.getContract() != null)
preparedStatement.setInt(12, toAdd.level); preparedStatement.setInt(10, toAdd.getContract().getContractID());
preparedStatement.setString(13, toAdd.firstName); else
preparedStatement.setString(14, toAdd.behaviourType.toString()); preparedStatement.setInt(10, 0);
preparedStatement.setInt(11, toAdd.getBuildingID());
preparedStatement.setInt(12, toAdd.getLevel());
preparedStatement.setString(13, toAdd.getFirstName());
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
@@ -64,23 +69,6 @@ public class dbMobHandler extends dbHandlerBase {
return mobile; 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) { public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
@@ -118,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
return row_count; return row_count;
} }
public void LOAD_GUARD_MINIONS(Mob guardCaptain) { public void LOAD_PATROL_POINTS(Mob captain) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
preparedStatement.setInt(1, guardCaptain.getObjectUUID()); preparedStatement.setInt(1, captain.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {
String minionName = rs.getString("minionName"); String name = rs.getString("name");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName); Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
if (toCreate == null) if (toCreate == null)
return; return;
@@ -143,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(); 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.setLong(1, captainUID);
preparedStatement.setString(2, minionName); preparedStatement.setInt(2, mobBaseID);
preparedStatement.setString(3, name);
preparedStatement.setInt(4, slot);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -159,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(); 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.setLong(1, captainUID);
preparedStatement.setString(2, minionName); preparedStatement.setInt(2, mobBaseID);
preparedStatement.setInt(3, slot);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -175,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(); 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) { } catch (SQLException e) {
Logger.error(e); Logger.error(e);
return false;
} }
return mobileList;
} }
public Mob GET_MOB(final int objectUUID) { public Mob GET_MOB(final int objectUUID) {
+43 -2
View File
@@ -15,6 +15,7 @@ import engine.math.Vector3fImmutable;
import engine.objects.NPC; import engine.objects.NPC;
import engine.objects.NPCProfits; import engine.objects.NPCProfits;
import engine.objects.ProducedItem; import engine.objects.ProducedItem;
import engine.objects.Zone;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -93,12 +94,14 @@ public class dbNPCHandler extends dbHandlerBase {
return row_count; return row_count;
} }
public ArrayList<NPC> GET_ALL_NPCS() { public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) {
ArrayList<NPC> npcList = new ArrayList<>(); ArrayList<NPC> npcList = new ArrayList<>();
try (Connection connection = DbManager.getConnection(); 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(); ResultSet rs = preparedStatement.executeQuery();
npcList = getObjectsFromRs(rs, 1000); npcList = getObjectsFromRs(rs, 1000);
@@ -128,6 +131,32 @@ public class dbNPCHandler extends dbHandlerBase {
return npc; 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) { public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
int rowCount; int rowCount;
@@ -173,6 +202,18 @@ public class dbNPCHandler extends dbHandlerBase {
return result; 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) { public void updateDatabase(final NPC npc) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
@@ -15,9 +15,15 @@ import engine.gameManager.PowersManager;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.PreparedStatementShared; import engine.objects.PreparedStatementShared;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.MobPowerEntry;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
public class dbPowerHandler extends dbHandlerBase { public class dbPowerHandler extends dbHandlerBase {
@@ -80,4 +86,43 @@ public class dbPowerHandler extends dbHandlerBase {
} }
} }
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;
}
} }
@@ -11,8 +11,6 @@ package engine.db.handlers;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.RuneBase; import engine.objects.RuneBase;
import engine.powers.RunePowerEntry;
import engine.powers.RuneSkillAdjustEntry;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.Connection; import java.sql.Connection;
@@ -29,84 +27,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = engine.Enum.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;
}
public void GET_RUNE_REQS(final RuneBase rb) { public void GET_RUNE_REQS(final RuneBase rb) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
+25 -25
View File
@@ -109,7 +109,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
preparedStatement.setLong(1, locks); preparedStatement.setLong(1, locks);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -125,7 +125,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -141,7 +141,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -157,7 +157,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -173,7 +173,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -189,7 +189,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -205,7 +205,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -221,7 +221,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -237,7 +237,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -253,7 +253,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -269,7 +269,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -285,7 +285,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -301,7 +301,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -317,7 +317,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -333,7 +333,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -349,7 +349,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -365,7 +365,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -381,7 +381,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -397,7 +397,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -413,7 +413,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -429,7 +429,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -445,7 +445,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -461,7 +461,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -477,7 +477,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.UID); preparedStatement.setInt(2, wh.getUID());
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -545,7 +545,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
while (rs.next()) { while (rs.next()) {
warehouse = new Warehouse(rs); warehouse = new Warehouse(rs);
warehouse.runAfterLoad(); warehouse.runAfterLoad();
Warehouse.loadAllTransactions(warehouse); warehouse.loadAllTransactions();
} }
} catch (SQLException e) { } catch (SQLException e) {
+47 -38
View File
@@ -12,8 +12,8 @@ package engine.db.handlers;
import engine.Enum; import engine.Enum;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.objects.Zone; import engine.objects.Zone;
import engine.objects.ZoneTemplate;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.Connection; import java.sql.Connection;
@@ -29,21 +29,25 @@ public class dbZoneHandler extends dbHandlerBase {
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
} }
public ArrayList<Zone> GET_ALL_ZONES() { public ArrayList<Zone> GET_ALL_NODES(Zone zone) {
ArrayList<Zone> wsmList = new ArrayList<>();
ArrayList<Zone> zoneList = new ArrayList<>(); wsmList.addAll(zone.getNodes());
if (zone.absX == 0.0f) {
try (Connection connection = DbManager.getConnection(); zone.absX = zone.getXCoord();
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);
} }
if (zone.absY == 0.0f) {
return zoneList; 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) { public Zone GET_BY_UID(long ID) {
@@ -68,38 +72,43 @@ public class dbZoneHandler extends dbHandlerBase {
return zone; 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(); 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(); ResultSet rs = preparedStatement.executeQuery();
zoneList = getObjectsFromRs(rs, 2000);
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) Enum.CityBoundsType.ZONE.halfExtents;
zoneTemplate.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
zoneTemplate.terrain_type = "PLANAR";
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
} catch (SQLException e) { } catch (SQLException e) {
Logger.error(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) { public boolean DELETE_ZONE(final Zone zone) {
+31 -9
View File
@@ -9,16 +9,18 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum; import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.objects.AbstractGameObject; import engine.math.Vector3fImmutable;
import engine.objects.Mob; import engine.objects.*;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class AddMobCmd extends AbstractDevCmd { public class AddMobCmd extends AbstractDevCmd {
public AddMobCmd() { public AddMobCmd() {
@@ -35,8 +37,27 @@ public class AddMobCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); 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 { try {
loadID = Integer.parseInt(words[0]); loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
@@ -50,19 +71,20 @@ public class AddMobCmd extends AbstractDevCmd {
return; // NaN return; // NaN
} }
if (zone == null) { if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in."); throwbackError(pc, "Failed to find zone to place mob in.");
return; return;
} }
if (zone.guild_zone) { if (zone.isPlayerCity()) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead."); throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return; return;
} }
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, true, zone, null, 0, "", 1);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
ChatManager.chatSayInfo(pc, ChatManager.chatSayInfo(pc,
+21 -26
View File
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*; import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -31,7 +32,6 @@ public class AddNPCCmd extends AbstractDevCmd {
int contractID; int contractID;
String name = ""; String name = "";
int level = 0; int level = 0;
if (words.length < 2) { if (words.length < 2) {
this.sendUsage(pc); this.sendUsage(pc);
return; return;
@@ -39,59 +39,54 @@ public class AddNPCCmd extends AbstractDevCmd {
try { try {
contractID = Integer.parseInt(words[0]); contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]); level = Integer.parseInt(words[1]);
for (int i = 2; i < words.length; i++) { for (int i = 2; i < words.length; i++) {
name += words[i]; name += words[i];
if (i + 1 < words.length) if (i + 1 < words.length)
name += ""; name += "";
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throwbackError(pc, throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer."); "Failed to parse supplied contractID or level to an Integer.");
return; // NaN return; // NaN
} }
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID); Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if (contract == null || level < 1 || level > 75) { if (contract == null || level < 1 || level > 75) {
throwbackError(pc, throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level"); "Invalid addNPC Command. Need contract ID, and level");
return; // NaN return; // NaN
} }
// Pick a random name // Pick a random name
if (name.isEmpty()) if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID()); name = NPCManager.getPirateName(contract.getMobbaseID());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) { if (zone == null) {
throwbackError(pc, "Failed to find zone to place npc in."); throwbackError(pc, "Failed to find zone to place npc in.");
return; return;
} }
Building building = null;
if (target != null) if (target != null)
if (target.getObjectType() == GameObjectType.Building) { if (target.getObjectType() == GameObjectType.Building) {
Building parentBuilding = (Building) target; building = (Building)target;
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
return;
} }
NPC created;
NPC npc = NPC.createNPC(name, contractID, Guild guild = null;
pc.getLoc(), null, zone, (short) level, null); Vector3fImmutable loc;
if(building != null){
if (npc != null) { guild = building.getGuild();
WorldGrid.addObject(npc, pc); loc = building.loc;
ChatManager.chatSayInfo(pc, } else{
"NPC with ID " + npc.getDBID() + " added"); loc = pc.loc;
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);
} }
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 @Override
@@ -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.";
}
}
+3 -3
View File
@@ -40,8 +40,8 @@ public class AuditMobsCmd extends AbstractDevCmd {
if (size >= count) { if (size >= count) {
plusplus++; plusplus++;
throwbackInfo(pcSender, zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. "); throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
System.out.println(zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. "); System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
} }
@@ -80,7 +80,7 @@ public class AuditMobsCmd extends AbstractDevCmd {
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap(); //ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap(); // ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
throwbackInfo(pcSender, zone.zoneName + ", numMobs: " + zone.zoneMobSet.size()); throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc"); throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
+172 -45
View File
@@ -9,10 +9,11 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.InterestManagement.Terrain; import engine.InterestManagement.HeightMap;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector2f; import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.objects.Zone; import engine.objects.Zone;
@@ -21,79 +22,205 @@ public class GetHeightCmd extends AbstractDevCmd {
public GetHeightCmd() { public GetHeightCmd() {
super("getHeight"); super("getHeight");
this.addCmdString("height");
} }
@Override @Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
Zone currentZone; boolean end = true;
Zone parentZone;
Zone heightmapZone;
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc()); float height = HeightMap.getWorldHeight(pc);
heightmapZone = Terrain.getNextZoneWithTerrain(currentZone);
parentZone = Terrain.getNextZoneWithTerrain(currentZone.parent);
Vector2f childZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone); this.throwbackInfo(pc, "Altitude : " + height);
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);
float childHeight = heightmapZone.terrain.getInterpolatedTerrainHeight(childZoneLoc); this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
childHeight = childHeight + heightmapZone.global_height; this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
float parentHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentZoneLoc); Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
parentHeight += parentZone.global_height; 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 gridSquare;
Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1); Vector2f gridOffset;
Vector2f parentGrid;
Vector2f parentLoc = new Vector2f(-1, -1);
terrainCell.x = (float) Math.floor(terrainCell.x); Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
terrainCell.y = (float) Math.floor(terrainCell.y);
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]; //find the next parents heightmap if the currentzone heightmap is null.
short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y]; while (heightMap == null) {
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];
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName); if (currentZone == ZoneManager.getSeaFloor()) {
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(pc, "Could not find a heightmap to get height.");
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName); 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 + "]"); if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]"); this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend); this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y); return;
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset)); }
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 @Override
protected String _getHelpString() { protected String _getHelpString() {
return "Queries heightmap engine"; return "Temporarily Changes SubRace";
} }
@Override @Override
protected String _getUsageString() { protected String _getUsageString() {
return "' /getheight"; return "' /subrace mobBaseID";
} }
} }
+1 -1
View File
@@ -48,7 +48,7 @@ public class GetOffsetCmd extends AbstractDevCmd {
float difY = pcSender.getLoc().y - zone.absY; float difY = pcSender.getLoc().y - zone.absY;
float difZ = pcSender.getLoc().z - zone.absZ; 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 @Override
+1 -1
View File
@@ -51,7 +51,7 @@ public class GetZoneCmd extends AbstractDevCmd {
} }
for (Zone zone : allIn) for (Zone zone : allIn)
throwbackInfo(pcSender, zone.zoneName + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.templateID); throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
} }
@Override @Override
@@ -9,59 +9,55 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase;
import java.util.HashMap; import java.util.ArrayList;
/** /**
* * @author Eighty
*/ */
public class GimmeCmd extends AbstractDevCmd {
public class PrintEffectsCmd extends AbstractDevCmd { public GimmeCmd() {
super("gimme");
public PrintEffectsCmd() {
super("printeffects");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
if (equip.containsKey(slot)) {
MobEquipment item = equip.get(slot);
if (item != null && item.getItemBase() != null) {
return item.getItemBase();
}
}
return null;
} }
@Override @Override
protected void _doCmd(PlayerCharacter pc, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
int amt = 0;
AbstractCharacter tar; int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
amt = 10000000 - currentGold;
if (target != null && target instanceof AbstractCharacter) { if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
tar = (AbstractCharacter) target; throwbackError(pc, "Failed to add gold to inventory");
return;
String newline = "\r\n ";
String output = "Effects For Character: " + tar.getName() + newline;
for(String effect : tar.effects.keySet()){
output += effect + newline;
}
throwbackInfo(pc, output);
} }
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 @Override
protected String _getHelpString() { protected String _getHelpString() {
return "Returns the player's current stats"; return "Round up current gold in inventory to 10,000,000";
} }
@Override @Override
protected String _getUsageString() { protected String _getUsageString() {
return "' /printstats'"; return "'./gimme";
} }
} }
+3 -3
View File
@@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd {
continue; continue;
Zone zone = city.getParent(); Zone zone = city.getParent();
if (zone != null) { if (zone != null) {
if (zone.isNPCCity || zone.guild_zone) if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else else
loc = zone.getLoc(); loc = zone.getLoc();
@@ -97,10 +97,10 @@ public class GotoCmd extends AbstractDevCmd {
Zone zone = (Zone) zoneAgo; Zone zone = (Zone) zoneAgo;
if (zone == null) if (zone == null)
continue; continue;
if (!zone.zoneName.equalsIgnoreCase(cityName)) if (!zone.getName().equalsIgnoreCase(cityName))
continue; continue;
if (zone != null) { if (zone != null) {
if (zone.isNPCCity || zone.guild_zone) if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else else
loc = zone.getLoc(); loc = zone.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]";
}
}
+29 -15
View File
@@ -15,9 +15,13 @@ import engine.Enum.GameObjectType;
import engine.Enum.TargetColor; import engine.Enum.TargetColor;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
import engine.gameManager.PowersManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import engine.util.StringUtils; import engine.util.StringUtils;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -220,16 +224,16 @@ public class InfoCmd extends AbstractDevCmd {
// List hirelings // List hirelings
if (targetBuilding.hirelings.isEmpty() == false) { if (targetBuilding.getHirelings().isEmpty() == false) {
output += newline; output += newline;
output += "Hirelings List: name / slot / floor"; output += "Hirelings List: name / slot / floor";
for (AbstractCharacter npc : targetBuilding.hirelings) { for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
if (npc.getObjectType() != GameObjectType.NPC) if (npc.getObjectType() != GameObjectType.NPC)
continue; continue;
output += newline + npc.getName() + " slot " + targetBuilding.hirelings.indexOf(npc); output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
output += newline + "location " + npc.getLoc(); output += newline + "location " + npc.getLoc();
} }
} }
@@ -337,7 +341,9 @@ public class InfoCmd extends AbstractDevCmd {
output += "Swimming : " + targetPC.isSwimming(); output += "Swimming : " + targetPC.isSwimming();
output += newline; output += newline;
output += "isMoving : " + targetPC.isMoving(); output += "isMoving : " + targetPC.isMoving();
output += newline;
output += "Zerg Multiplier : " + targetPC.ZergMultiplier+ newline;
output += "Hidden : " + targetPC.getHidden();
break; break;
case NPC: case NPC:
@@ -387,7 +393,7 @@ public class InfoCmd extends AbstractDevCmd {
output += newline; output += newline;
output += "EquipSet: " + targetNPC.getEquipmentSetID(); output += "EquipSet: " + targetNPC.getEquipmentSetID();
output += newline; output += newline;
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().templateID; output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
} }
@@ -440,9 +446,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "isSummonedPet: true"; output += "isSummonedPet: true";
else else
output += "isSummonedPet: false"; output += "isSummonedPet: false";
PlayerCharacter owner = targetMob.getOwner();
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
if (owner != null) if (owner != null)
output += " owner: " + owner.getObjectUUID(); output += " owner: " + owner.getObjectUUID();
output += newline; output += newline;
@@ -473,7 +477,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "EquipSet: " + targetMob.equipmentSetID; output += "EquipSet: " + targetMob.equipmentSetID;
output += newline; output += newline;
try { try {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID; output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
} catch (Exception ex) { } catch (Exception ex) {
//who cares //who cares
} }
@@ -494,13 +498,16 @@ public class InfoCmd extends AbstractDevCmd {
output += newline; output += newline;
output += "No building found." + newline; output += "No building found." + newline;
} }
int max = (int)(4.882 * targetMob.level + 121.0);
if(max > 321){ output += "Damage: " + targetMob.mobBase.getDamageMin() + " - " + targetMob.mobBase.getDamageMax() + newline;
max = 321; 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; break;
case Item: //intentional passthrough case Item: //intentional passthrough
case MobLoot: case MobLoot:
@@ -531,6 +538,13 @@ public class InfoCmd extends AbstractDevCmd {
} }
break; 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); throwbackInfo(pc, output);
+3 -3
View File
@@ -111,12 +111,12 @@ public class MakeBaneCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.guild_zone) { if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }
City city = City.getCity(zone.playerCityUUID); City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) { if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone."); throwbackError(pc, "Unable to find the city associated with this zone.");
return; return;
@@ -167,7 +167,7 @@ public class MakeBaneCmd extends AbstractDevCmd {
return; return;
} }
stone.addEffectBit((1 << 19)); stone.addEffectBit((1 << 19));
BuildingManager.setRank(stone, (byte) rank); stone.setRank((byte) rank);
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank())); stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
stone.setCurrentHitPoints(stone.getMaxHitPoints()); stone.setCurrentHitPoints(stone.getMaxHitPoints());
BuildingManager.setUpgradeDateTime(stone, null, 0); BuildingManager.setUpgradeDateTime(stone, null, 0);
+3 -2
View File
@@ -16,6 +16,7 @@ import engine.objects.AbstractGameObject;
import engine.objects.Building; import engine.objects.Building;
import engine.objects.Mine; import engine.objects.Mine;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.workthreads.HalfHourlyJobThread;
import engine.workthreads.HourlyJobThread; import engine.workthreads.HourlyJobThread;
/** /**
@@ -41,10 +42,10 @@ public class MineActiveCmd extends AbstractDevCmd {
String trigger = args[0]; String trigger = args[0];
switch (trigger) { switch (trigger) {
case "true": case "true":
HourlyJobThread.mineWindowOpen(mine); HalfHourlyJobThread.mineWindowOpen(mine);
break; break;
case "false": case "false":
HourlyJobThread.mineWindowClose(mine); HalfHourlyJobThread.mineWindowClose(mine);
break; break;
default: default:
this.sendUsage(pcSender); this.sendUsage(pcSender);
-67
View File
@@ -1,67 +0,0 @@
// ·. · · · · .
// · ·
// · ·
//
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.*;
import java.util.HashMap;
/**
*
*/
public class PrintRunesCmd extends AbstractDevCmd {
public PrintRunesCmd() {
super("printrunes");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
if (equip.containsKey(slot)) {
MobEquipment item = equip.get(slot);
if (item != null && item.getItemBase() != null) {
return item.getItemBase();
}
}
return null;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractCharacter tar;
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);
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current stats";
}
@Override
protected String _getUsageString() {
return "' /printstats'";
}
}
@@ -49,6 +49,8 @@ public class PrintSkillsCmd extends AbstractDevCmd {
+ skill.getModifiedAmount() + '(' + skill.getModifiedAmount() + '('
+ skill.getTotalSkillPercet() + " )"); + skill.getTotalSkillPercet() + " )");
} }
//throwbackInfo(pc, "= = = = = NEW CALCULATIONS = = = = =");
// PlayerCombatStats.PrintSkillsToClient(pc);
} else } else
throwbackInfo(pc, "Skills not found for player"); throwbackInfo(pc, "Skills not found for player");
} }
+40 -30
View File
@@ -9,6 +9,7 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.objects.*; import engine.objects.*;
@@ -56,23 +57,36 @@ public class PrintStatsCmd extends AbstractDevCmd {
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) { public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
String newline = "\r\n "; String newline = "\r\n ";
String out = "Server stats for Player " + tar.getFirstName() + newline;
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline; String newOut = "Server stats for Player " + tar.getFirstName() + newline;
out += "Stats Base (Modified)" + newline; newOut += "HEALTH: " + tar.getHealth() + " / " + tar.getHealthMax() + newline;
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline; newOut += "MANA: " + tar.getMana() + " / " + tar.getManaMax() + newline;
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline; newOut += "STAMINA: " + tar.getStamina() + " / " + tar.getStaminaMax() + newline;
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline; newOut += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline; newOut += "Stats Base (Modified)" + newline;
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline; newOut += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
throwbackInfo(pc, out); newOut += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline; newOut += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline; newOut += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline; newOut += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
out += "Defense: " + tar.getDefenseRating() + newline; newOut += "Move Speed: " + tar.getSpeed() + newline;
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline; newOut += "Health Regen: " + tar.combatStats.healthRegen + newline;
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline; newOut += "Mana Regen: " + tar.combatStats.manaRegen + newline;
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline; newOut += "Stamina Regen: " + tar.combatStats.staminaRegen + newline;
throwbackInfo(pc, out); newOut += "DEFENSE: " + tar.combatStats.defense + newline;
newOut += "HAND ONE" + newline;
newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
newOut += "HAND TWO" + newline;
newOut += "ATR: " + tar.combatStats.atrHandTwo + newline;
newOut += "MIN: " + tar.combatStats.minDamageHandTwo + newline;
newOut += "MAX: " + tar.combatStats.maxDamageHandTwo + newline;
newOut += "RANGE: " + tar.combatStats.rangeHandTwo + newline;
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandTwo + newline;
throwbackInfo(pc, newOut);
} }
public void printStatsMob(PlayerCharacter pc, Mob tar) { public void printStatsMob(PlayerCharacter pc, Mob tar) {
@@ -103,19 +117,15 @@ public class PrintStatsCmd extends AbstractDevCmd {
main = getWeaponBase(1, equip); main = getWeaponBase(1, equip);
ItemBase off = null; ItemBase off = null;
if(equip != null){ if (equip != null)
if(equip.get(2) != null && !equip.get(2).getItemBase().isShield()){ getWeaponBase(2, equip);
//off hand weapon if (main == null && off == null) {
out += "Attack Rating: " + tar.atrHandTwo + newline; out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline; } else {
out += "Range: " + tar.rangeHandTwo + newline; if (main != null)
out += "Attack Speed: " + tar.speedHandTwo + newline; out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
} else{ if (off != null)
out += "Attack Rating: " + tar.atrHandOne + newline; out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
out += "Damage: " + tar.minDamageHandOne + " - " + tar.maxDamageHandOne + newline;
out += "Range: " + tar.rangeHandOne + newline;
out += "Attack Speed: " + tar.speedHandOne + newline;
}
} }
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline; out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
+11 -16
View File
@@ -42,13 +42,13 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
private static void PurgeWalls(Zone zone, PlayerCharacter pc) { private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
if (!zone.guild_zone) if (!zone.isPlayerCity())
return; return;
for (Building building : zone.zoneBuildingSet) { for (Building building : zone.zoneBuildingSet) {
if (!BuildingManager.IsWallPiece(building)) if (!BuildingManager.IsWallPiece(building))
continue; continue;
for (AbstractCharacter ac : building.hirelings) { for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null; NPC npc = null;
Mob mobA = null; Mob mobA = null;
@@ -59,25 +59,22 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) { if (npc != null) {
for (Integer minionUUID : npc.minions) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
Mob mob = Mob.getMob(minionUUID);
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null) if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob); mob.getParentZone().zoneMobSet.remove(mob);
} }
DbManager.NPCQueries.DELETE_NPC(npc); DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(GameObjectType.NPC, DbManager.removeFromCache(GameObjectType.NPC,
npc.getObjectUUID()); npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc); WorldGrid.RemoveWorldObject(npc);
} else if (mobA != null) { } else if (mobA != null) {
for (Integer minionUUID : mobA.minions) { for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
Mob mob = Mob.getMob(minionUUID);
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null) if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob); mob.getParentZone().zoneMobSet.remove(mob);
} }
@@ -143,7 +140,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)) if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
building.disableSpire(false); building.disableSpire(false);
for (AbstractCharacter ac : building.hirelings) { for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null; NPC npc = null;
Mob mobA = null; Mob mobA = null;
@@ -154,11 +151,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) { if (npc != null) {
for (Integer minionUUID : npc.minions) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
Mob mob = Mob.getMob(minionUUID);
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null) if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob); mob.getParentZone().zoneMobSet.remove(mob);
} }
@@ -167,11 +163,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
npc.getObjectUUID()); npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc); WorldGrid.RemoveWorldObject(npc);
} else if (mobA != null) { } else if (mobA != null) {
for (Integer minionUUID : mobA.minions) { for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
Mob mob = Mob.getMob(minionUUID);
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null) if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob); mob.getParentZone().zoneMobSet.remove(mob);
} }
+3 -3
View File
@@ -60,12 +60,12 @@ public class RealmInfoCmd extends AbstractDevCmd {
outString += ")"; outString += ")";
outString += newline; outString += newline;
outString += " Zone: " + serverZone.zoneName; outString += " Zone: " + serverZone.getName();
outString += newline; outString += newline;
if (serverZone.parent != null) if (serverZone.getParent() != null)
outString += " Parent: " + serverZone.parent.zoneName; outString += " Parent: " + serverZone.getParent().getName();
else else
outString += "Parent: NONE"; outString += "Parent: NONE";
+32 -19
View File
@@ -9,10 +9,9 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.objects.AbstractGameObject;
import engine.objects.*; import engine.objects.PlayerCharacter;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -26,28 +25,42 @@ public class RegionCmd extends AbstractDevCmd {
protected void _doCmd(PlayerCharacter pc, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
String newline = "\r\n ";
String output;
output = "Target Region Information:" + newline;
Building building = BuildingManager.getBuildingAtLocation(((AbstractCharacter) target).loc); if (pc.region == null) {
if(building == null){
this.throwbackInfo(pc, "No Building At This Location.") ;
}
Regions region = ((AbstractCharacter)target).region;
if (region == null) {
this.throwbackInfo(pc, "No Region Found."); this.throwbackInfo(pc, "No Region Found.");
return; return;
} }
if(region != null) {
output += "Player Info: " + ((AbstractCharacter) target).getName() + newline; String newLine = System.getProperty("line.separator");
output += "Region Building: " + building.getName() + newline; String result = "";
output += "Region Height: " + region.lerpY((AbstractCharacter)target) + newline; result += (pc.region.getClass().getSimpleName());
output += "is Stairs: " + region.isStairs() + newline; result += (" {");
output += "is Outside: " + region.isOutside(); result += (newLine);
this.throwbackInfo(pc, output); Field[] fields = pc.region.getClass().getDeclaredFields();
//print field names paired with their values
for (Field field : fields) {
field.setAccessible(true);
result += (" ");
try {
if (field.getName().contains("Furniture"))
continue;
result += (field.getName());
result += (": ");
//requires access to private field:
result += (field.get(pc.region).toString());
} catch (IllegalAccessException ex) {
System.out.println(ex);
}
result.trim();
result += (newLine);
} }
result += ("}");
this.throwbackInfo(pc, result.toString());
} }
+2 -2
View File
@@ -34,12 +34,12 @@ public class RemoveBaneCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.guild_zone) { if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }
City city = City.getCity(zone.playerCityUUID); City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) { if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone."); throwbackError(pc, "Unable to find the city associated with this zone.");
return; return;
+45 -13
View File
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
import engine.Enum.BuildingGroup; import engine.Enum.BuildingGroup;
import engine.Enum.DbObjectType; import engine.Enum.DbObjectType;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
@@ -130,23 +131,56 @@ public class RemoveObjectCmd extends AbstractDevCmd {
building.disableSpire(false); building.disableSpire(false);
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) { if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
City city = City.getCity(building.getParentZone().playerCityUUID); City city = City.getCity(building.getParentZone().getPlayerCityUUID());
if (city != null) { if (city != null) {
city.setWarehouseBuildingID(0); city.setWarehouseBuildingID(0);
} }
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID()); Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
} }
//remove cached shrines. //remove cached shrines.
if ((building.getBlueprintUUID() != 0) if ((building.getBlueprintUUID() != 0)
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building); Shrine.RemoveShrineFromCacheByBuilding(building);
// Remove hirelings for this building for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
for (AbstractCharacter abstractCharacter : building.hirelings) if (ac.getObjectType() == GameObjectType.NPC)
BuildingManager.removeHireling(building, abstractCharacter); npc = (NPC) ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob) ac;
if (npc != null) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
} else if (mobA != null) {
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(mobA);
WorldGrid.RemoveWorldObject(mobA);
WorldGrid.removeObject(mobA, pc);
}
}
Zone zone = building.getParentZone(); Zone zone = building.getParentZone();
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building); DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building); DbManager.removeFromCache(building);
@@ -173,15 +207,13 @@ public class RemoveObjectCmd extends AbstractDevCmd {
// Remove npc from hirelings list. // Remove npc from hirelings list.
if (npc.building != null) if (npc.building != null)
npc.building.hirelings.remove(npc); npc.building.getHirelings().remove(npc);
for (Integer minionUUID : npc.minions) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
Mob minionMob = Mob.getMob(minionUUID); WorldGrid.RemoveWorldObject(mob);
WorldGrid.RemoveWorldObject(minionMob); WorldGrid.removeObject(mob, pc);
WorldGrid.removeObject(minionMob, pc); if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
if (minionMob.getParentZone() != null)
minionMob.getParentZone().zoneMobSet.remove(minionMob);
} }
DbManager.NPCQueries.DELETE_NPC(npc); DbManager.NPCQueries.DELETE_NPC(npc);
@@ -210,7 +242,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
// Remove npc from hirelings list. // Remove npc from hirelings list.
if (mob.building != null) if (mob.building != null)
mob.building.hirelings.remove(mob); mob.building.getHirelings().remove(mob);
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane.. mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc.. mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
+2 -2
View File
@@ -41,12 +41,12 @@ public class SetBaneActiveCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.guild_zone) { if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }
City city = City.getCity(zone.playerCityUUID); City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) { if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone."); throwbackError(pc, "Unable to find the city associated with this zone.");
return; return;
@@ -31,9 +31,9 @@ public class SetForceRenameCityCmd extends AbstractDevCmd {
if (zone == null) if (zone == null)
return; return;
boolean rename = words[0].equalsIgnoreCase("true") ? true : false; boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
if (zone.playerCityUUID == 0) if (zone.getPlayerCityUUID() == 0)
return; return;
City city = City.getCity(zone.playerCityUUID); City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) if (city == null)
return; return;
city.setForceRename(rename); city.setForceRename(rename);
+2 -2
View File
@@ -46,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
this.sendUsage(pc); this.sendUsage(pc);
return; return;
} }
if (level < 1 || level > 75) { if (level < 1 || level > 80) {
this.sendHelp(pc); this.sendHelp(pc);
return; return;
} }
@@ -62,7 +62,7 @@ public class SetLevelCmd extends AbstractDevCmd {
@Override @Override
protected String _getHelpString() { protected String _getHelpString() {
return "Sets your character's level to 'amount'. 'amount' must be between 1-75"; return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
} }
@Override @Override
+4 -3
View File
@@ -57,7 +57,7 @@ public class SetRankCmd extends AbstractDevCmd {
Blueprint blueprint = targetBuilding.getBlueprint(); Blueprint blueprint = targetBuilding.getBlueprint();
if (blueprint == null) { if (blueprint == null) {
BuildingManager.setRank(targetBuilding, targetRank); targetBuilding.setRank(targetRank);
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID()); ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
return; return;
} }
@@ -68,8 +68,9 @@ public class SetRankCmd extends AbstractDevCmd {
} }
// Set the current targetRank // Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID();
targetBuilding.setRank(targetRank);
BuildingManager.setRank(targetBuilding, targetRank);
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank); ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
break; break;
case NPC: case NPC:
@@ -113,7 +114,7 @@ public class SetRankCmd extends AbstractDevCmd {
// Set the current targetRank // Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID(); int lastMeshID = targetBuilding.getMeshUUID();
BuildingManager.setRank(targetBuilding, targetRank); targetBuilding.setRank(targetRank);
if (lastMeshID != targetBuilding.getMeshUUID()) if (lastMeshID != targetBuilding.getMeshUUID())
targetBuilding.refresh(true); targetBuilding.refresh(true);
+1 -1
View File
@@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
// pum.setEffectID(token); // pum.setEffectID(token);
// pum.setSourceType(pc.getObjectType().ordinal()); // pum.setSourceType(pc.getObjectType().ordinal());
// pum.setSourceID(pc.getObjectUUID()); // pum.setSourceID(pc.getObjectUUID());
// pum.setStartLocType(pc.getObjectType().ordinal()); // pum.setTargetType(pc.getObjectType().ordinal());
// pum.setTargetID(pc.getObjectUUID()); // pum.setTargetID(pc.getObjectUUID());
// pum.setNumTrains(40); // pum.setNumTrains(40);
// pum.setDuration(-1); // pum.setDuration(-1);
+71 -3
View File
@@ -1,5 +1,6 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.LootManager; import engine.gameManager.LootManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
@@ -10,6 +11,8 @@ import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
public class SimulateBootyCmd extends AbstractDevCmd { public class SimulateBootyCmd extends AbstractDevCmd {
public int simCount = 250;
public SimulateBootyCmd() { public SimulateBootyCmd() {
super("bootysim"); super("bootysim");
} }
@@ -24,8 +27,61 @@ public class SimulateBootyCmd extends AbstractDevCmd {
String newline = "\r\n "; String newline = "\r\n ";
String output; String output;
if(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
int ATR = Integer.parseInt(words[0]);
int DEF = Integer.parseInt(words[1]);
int attacks = Integer.parseInt(words[2]);
output = "Booty Simulation:" + newline; int hits = 0;
int misses = 0;
int defaultHits = 0;
int defualtMisses = 0;
float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
float convertedChance = chance * 100;
output = "" + newline;
output += "DEF VS ATR SIMULATION: " + attacks + " ATTACKS SIMULATED" + newline;
output += "DEF = " + DEF + newline;
output += "ATR = " + ATR + newline;
output += "CHANCE TO LAND HIT: " + convertedChance + "%" + newline;
if(convertedChance < 5){
output += "CHANCE ADJUSTED TO 5.0%" + newline;
convertedChance = 5.0f;
}
if(convertedChance > 95){
output += "CHANCE ADJUSTED TO 95.0%" + newline;
convertedChance = 95.0f;
}
for(int i = 0; i < attacks; i++){
int roll = ThreadLocalRandom.current().nextInt(101);
if(roll <= convertedChance){
hits += 1;
}else{
misses += 1;
}
}
float totalHits = defaultHits + hits;
float totalMisses = defualtMisses + misses;
float hitPercent = Math.round(totalHits / attacks * 100);
float missPercent = Math.round(totalMisses / attacks * 100);
output += "HITS LANDED: " + (defaultHits + hits) + "(" + Math.round(hitPercent) + "%)" + newline;
output += "HITS MISSED: " + (defualtMisses + misses) + "(" + Math.round(missPercent) + "%)";
throwbackInfo(playerCharacter,output);
return;
}
try
{
simCount = Integer.parseInt(words[0]);
}catch(Exception e)
{
}
output = "Booty Simulation: Rolls:" + simCount + newline;
Mob mob = (Mob) target; Mob mob = (Mob) target;
output += "Name: " + mob.getName() + newline; output += "Name: " + mob.getName() + newline;
@@ -44,6 +100,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
ArrayList<Item> Resources = new ArrayList<Item>(); ArrayList<Item> Resources = new ArrayList<Item>();
ArrayList<Item> Runes = new ArrayList<Item>(); ArrayList<Item> Runes = new ArrayList<Item>();
ArrayList<Item> Contracts = new ArrayList<Item>(); ArrayList<Item> Contracts = new ArrayList<Item>();
ArrayList<Item> GuardContracts = new ArrayList<Item>();
ArrayList<Item> Offerings = new ArrayList<Item>(); ArrayList<Item> Offerings = new ArrayList<Item>();
ArrayList<Item> OtherDrops = new ArrayList<Item>(); ArrayList<Item> OtherDrops = new ArrayList<Item>();
ArrayList<Item> EquipmentDrops = new ArrayList<Item>(); ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
@@ -51,14 +108,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
int failures = 0; int failures = 0;
int goldAmount = 0; int goldAmount = 0;
for (int i = 0; i < 100; ++i) { for (int i = 0; i < simCount; ++i) {
try { try {
mob.loadInventory(); mob.loadInventory();
for (Item lootItem : mob.getCharItemManager().getInventory()) { for (Item lootItem : mob.getCharItemManager().getInventory()) {
switch (lootItem.getItemBase().getType()) { switch (lootItem.getItemBase().getType()) {
case CONTRACT: //CONTRACT case CONTRACT: //CONTRACT
Contracts.add(lootItem); if(lootItem.getName().contains("Captain"))
GuardContracts.add(lootItem);
else
Contracts.add(lootItem);
break; break;
case OFFERING: //OFFERING case OFFERING: //OFFERING
Offerings.add(lootItem); Offerings.add(lootItem);
@@ -130,9 +190,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
} }
} }
int baseBound = 100000;
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
int totalRange = baseBound + levelPenalty;
if(mob.level >= 50){
totalRange = baseBound;
}
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
output += "GLASS DROPS: " + GlassItems.size() + newline; output += "GLASS DROPS: " + GlassItems.size() + newline;
output += "RUNE DROPS: " + Runes.size() + newline; output += "RUNE DROPS: " + Runes.size() + newline;
output += "CONTRACTS DROPS: " + Contracts.size() + newline; output += "CONTRACTS DROPS: " + Contracts.size() + newline;
output += "GUARD CONTRACTS DROPS: " + GuardContracts.size() + newline;
output += "RESOURCE DROPS: " + Resources.size() + newline; output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline; output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline; output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
+5 -5
View File
@@ -53,7 +53,7 @@ public class SlotTestCmd extends AbstractDevCmd {
int slot = Integer.parseInt(args[0]); int slot = Integer.parseInt(args[0]);
Vector3fImmutable slotLocation; Vector3fImmutable slotLocation;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot); BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
slotLocation = building.getLoc().add(buildingLocation.getLocation()); slotLocation = building.getLoc().add(buildingLocation.getLocation());
slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY); slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
playerCharacter.teleport(slotLocation); playerCharacter.teleport(slotLocation);
@@ -61,17 +61,17 @@ public class SlotTestCmd extends AbstractDevCmd {
} }
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID)) for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
outString += buildingLocation.getSlot() - 1 + buildingLocation.getLocation().toString() + "\r\n"; outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building); outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
if (building.hirelings.isEmpty() == false) { if (building.getHirelings().isEmpty() == false) {
outString += "\r\n\r\n"; outString += "\r\n\r\n";
outString += "Hirelings List:"; outString += "Hirelings List:";
for (AbstractCharacter hireling : building.hirelings) for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + " slot : " + building.hirelings.indexOf(hireling); outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
} }
+1 -2
View File
@@ -1,6 +1,5 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
mobile = Mob.createMob(_mobileUUID, mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange), Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE); null, true, serverZone, null, 0, "", 1);
if (mobile != null) { if (mobile != null) {
mobile.updateDatabase(); mobile.updateDatabase();
+1 -1
View File
@@ -40,7 +40,7 @@ public class SummonCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
String location = "Somewhere"; String location = "Somewhere";
if (zone != null) if (zone != null)
location = zone.zoneName; location = zone.getName();
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(), RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
location, false); location, false);
toSummon.getClientConnection().sendMsg(rsrm); toSummon.getClientConnection().sendMsg(rsrm);
+20 -17
View File
@@ -73,41 +73,44 @@ public class ZoneInfoCmd extends AbstractDevCmd {
output = "Target Information:" + newline; output = "Target Information:" + newline;
output += StringUtils.addWS("UUID: " + objectUUID, 20); output += StringUtils.addWS("UUID: " + objectUUID, 20);
output += newline; output += newline;
output += "name: " + zone.zoneName; output += "name: " + zone.getName();
output += newline; output += newline;
output += "loadNum: " + zone.templateID; output += "loadNum: " + zone.getLoadNum();
if (zone.parent != null) { if (zone.getParent() != null) {
output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30); output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
output += "Parentabs: x: " + zone.parent.absX + ", y: " + zone.parent.absY + ", z: " + zone.parent.absZ; output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
} else } else
output += StringUtils.addWS(", parent: none", 30); output += StringUtils.addWS(", parent: none", 30);
output += newline; output += newline;
output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ; output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
output += newline; output += newline;
output += "offset: x: " + zone.xOffset + ", y: " + zone.yOffset + ", z: " + zone.zOffset; output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
output += newline; output += newline;
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y; output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline; output += newline;
if (zone.terrain != null) { if (zone.getHeightMap() != null) {
output += "Terrain image: " + zone.template.terrain_image; output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
output += newline; output += newline;
} output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
output += newline;
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y; }
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline; output += newline;
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl(); // output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
output += newline; output += newline;
output += "Sea Level = " + zone.sea_level; output += "Sea Level = " + zone.getSeaLevel();
output += newline; output += newline;
output += "World Altitude = " + zone.global_height; output += "World Altitude = " + zone.getWorldAltitude();
throwbackInfo(player, output); throwbackInfo(player, output);
City city = ZoneManager.getCityAtLocation(player.getLoc()); City city = ZoneManager.getCityAtLocation(player.getLoc());
output += newline; output += newline;
output += (city == null) ? "None" : city.getParent().zoneName; output += (city == null) ? "None" : city.getParent().getName();
if (city != null) { if (city != null) {
@@ -120,14 +123,14 @@ public class ZoneInfoCmd extends AbstractDevCmd {
} else { } else {
output = "children:"; output = "children:";
ArrayList<Zone> nodes = zone.nodes; ArrayList<Zone> nodes = zone.getNodes();
if (nodes.isEmpty()) if (nodes.isEmpty())
output += " none"; output += " none";
for (Zone child : nodes) { for (Zone child : nodes) {
output += newline; output += newline;
output += child.zoneName + " (" + child.templateID + ')'; output += child.getName() + " (" + child.getLoadNum() + ')';
} }
} }
throwbackInfo(player, output); throwbackInfo(player, output);
+1 -1
View File
@@ -40,7 +40,7 @@ public class ZoneSetCmd extends AbstractDevCmd {
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc()); zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.templateID + ") " + zone.getObjectUUID()); throwbackInfo(playerCharacter, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
// NPC // NPC
+16 -80
View File
@@ -9,17 +9,12 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.mobileAI.MobAI;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.powers.RunePowerEntry;
import java.util.ArrayList;
import java.util.Map; import java.util.Map;
@@ -61,95 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
Mob mob = (Mob) target; Mob mob = (Mob) target;
output = "Mob AI Information:" + newline; output = "Mob AI Information:" + newline;
output += mob.getName() + newline; output += mob.getName() + newline;
output += mob.agentType.toString() + newline; if (mob.BehaviourType != null) {
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
int contractID = 0; if (mob.BehaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
if (mob.isPlayerGuard() == true) {
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
contractID = mob.guardCaptain.contract.getContractID();
else
contractID = mob.contract.getContractID();
}
if (contractID != 0) {
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
output += "Captain Contract: " + contractID + newline;
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
} else
output += "Contract: " + contractID + newline;
}
if (mob.behaviourType != null) {
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
if (mob.behaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
} else { } else {
output += "Behaviour Helper Type: NULL" + newline; output += "Behaviour Helper Type: NULL" + newline;
} }
output += "Wimpy: " + mob.behaviourType.isWimpy + newline; output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
output += "Agressive: " + mob.behaviourType.isAgressive + newline; output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
output += "Can Roam: " + mob.behaviourType.canRoam + newline; output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline; output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline; output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
} else { } else {
output += "BehaviourType: NULL" + newline; output += "BehaviourType: NULL" + newline;
} }
output += "Aggro Range: " + mob.getAggroRange() + newline; output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline; output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if (mob.playerAgroMap.size() > 0) { if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline; output += "Players Loaded:" + newline;
} }
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) { for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline; output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
} }
if (mob.getCombatTarget() != null) if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline; output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else else
output += "Current Target: NULL" + newline; output += "Current Target: NULL" + newline;
if (mob.guardedCity != null) for (int token : mob.mobPowers.keySet())
output += "Patrolling: " + mob.guardedCity.getCityName() + newline; output += token + newline;
output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline;
output += "Can Cast: " + MobAI.canCast(mob) + newline;
output += "Powers:" + newline;
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
// Additional powers may come from the contract ID. This is to support
// powers for player guards irrespective of the mobbase used.
if (mob.isPlayerGuard()) {
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
if (mob.contract != null)
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
powerEntries.addAll(contractEntries);
}
for (RunePowerEntry runePowerEntry : powerEntries)
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
// List outlaws defined for this player guard's city
if (mob.isPlayerGuard()) {
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
if (outlaws.isEmpty() == false)
output += "Outlaws: " + newline;
for (Integer outlawUUID : outlaws)
output += outlawUUID + newline;
}
throwbackInfo(playerCharacter, output); throwbackInfo(playerCharacter, output);
} }
+168
View File
@@ -0,0 +1,168 @@
package engine.gameManager;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.exception.MsgSendException;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class ArenaManager {
private static final List<Arena> activeArenas = new ArrayList<>();
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
public static Long pulseDelay = 180000L;
public static Long lastExecution = 0L;
public static void pulseArenas() {
if(lastExecution == 0L){
lastExecution = System.currentTimeMillis();
}
if(activeArenas.isEmpty() && playerQueue.isEmpty())
return;
Iterator<Arena> iterator = activeArenas.iterator();
while (iterator.hasNext()) {
Arena arena = iterator.next();
if (arena.checkToComplete()) {
iterator.remove();
}
}
if(lastExecution + pulseDelay > System.currentTimeMillis())
return;
lastExecution = System.currentTimeMillis();
while (playerQueue.size() > 1) {
createArena();
}
}
public static void joinQueue(PlayerCharacter player) {
if (!playerQueue.contains(player)) {
playerQueue.add(player);
}
for(PlayerCharacter pc : playerQueue){
if(pc.equals(player))
continue;
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
}
}
public static void leaveQueue(PlayerCharacter player) {
playerQueue.remove(player);
for(PlayerCharacter pc : playerQueue){
if(pc.equals(player))
continue;
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
}
}
private static void createArena() {
if (playerQueue.size() > 1) {
Collections.shuffle(playerQueue);
Arena newArena = new Arena();
//set starting time
newArena.startTime = System.currentTimeMillis();
//decide an arena location
newArena.loc = selectRandomArenaLocation();
// Assign players to the arena
newArena.player1 = playerQueue.remove(0);
newArena.player2 = playerQueue.remove(0);
// Teleport players to the arena location
Zone sdr = ZoneManager.getZoneByUUID(656);
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
// Add the new arena to the active arenas list
activeArenas.add(newArena);
}
}
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
if (winner != null && loser != null) {
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
arena.player1.getName(), arena.player2.getName(), winner.getName());
} else {
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
arena.player1.getName(), arena.player2.getName());
}
// Teleport players to the arena location
Zone sdr = ZoneManager.getZoneByUUID(656);
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
activeArenas.remove(arena);
if(winner != null){
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
//handle prize distribution
//ItemBase specialLoot = ItemBase.getItemBase(866);
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
//promoted.setNumOfItems(21235);
//promoted.setName("Special Banker(21235)");
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
//winner.getCharItemManager().addItemToInventory(promoted);
//winner.getCharItemManager().updateInventory();
}
}
public static Vector3fImmutable selectRandomArenaLocation() {
boolean locSet = false;
Vector3fImmutable loc = Vector3fImmutable.ZERO;
while (!locSet) {
try {
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
float y = 0; // Y coordinate is always 0
loc = new Vector3fImmutable(x, y, z * -1);
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
if(inRange.isEmpty() && !isUnderWater(loc))
locSet = true;
//}
}catch(Exception e){
}
}
return loc;
}
public static boolean isUnderWater(Vector3fImmutable loc) {
try {
Zone zone = ZoneManager.findSmallestZone(loc);
if (zone.getSeaLevel() != 0) {
float localAltitude = loc.y;
if (localAltitude < zone.getSeaLevel())
return true;
} else {
if (loc.y < 0)
return true;
}
} catch (Exception e) {
}
return false;
}
}
+175 -253
View File
@@ -19,7 +19,10 @@ import engine.job.JobScheduler;
import engine.jobs.UpgradeBuildingJob; import engine.jobs.UpgradeBuildingJob;
import engine.math.Bounds; import engine.math.Bounds;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.ManageCityAssetsMsg;
import engine.net.client.msg.PlaceAssetMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -28,7 +31,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
public enum BuildingManager { public enum BuildingManager {
@@ -38,9 +40,6 @@ public enum BuildingManager {
public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>(); public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>();
public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>(); public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>();
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
public static int getAvailableSlot(Building building) { public static int getAvailableSlot(Building building) {
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID); ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
@@ -53,14 +52,12 @@ public enum BuildingManager {
int numOfSlots = _slotLocations.get(building.meshUUID).size(); int numOfSlots = _slotLocations.get(building.meshUUID).size();
if (building.hirelings.isEmpty()) for (int i = 1; i <= numOfSlots; i++) {
return 0;
if (building.hirelings.size() == numOfSlots)
return -1;
return building.hirelings.size();
if (!building.getHirelings().containsValue(i))
return i;
}
return -1;
} }
public static int getLastAvailableSlot(Building building) { public static int getLastAvailableSlot(Building building) {
@@ -75,13 +72,12 @@ public enum BuildingManager {
int numOfSlots = _slotLocations.get(building.meshUUID).size(); int numOfSlots = _slotLocations.get(building.meshUUID).size();
if (building.hirelings.isEmpty()) for (int i = numOfSlots; i > 0; i--) {
return numOfSlots - 1;
if (building.hirelings.size() == numOfSlots) if (!building.getHirelings().containsValue(i))
return -1; return i;
}
return numOfSlots - 1; return -1;
} }
public static BuildingLocation getSlotLocation(Building building, int slot) { public static BuildingLocation getSlotLocation(Building building, int slot) {
@@ -91,7 +87,7 @@ public enum BuildingManager {
if (slot == -1) if (slot == -1)
return buildingLocation; return buildingLocation;
buildingLocation = _slotLocations.get(building.meshUUID).get(slot); // array index buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
if (buildingLocation == null) { if (buildingLocation == null) {
Logger.error("Invalid slot for building: " + building.getObjectUUID()); Logger.error("Invalid slot for building: " + building.getObjectUUID());
@@ -100,20 +96,6 @@ public enum BuildingManager {
return buildingLocation; return buildingLocation;
} }
public static void updateHirelingSlots(Building building) {
// Method updates all hirelings with the slot locations
// for the current mesh. The position and region can change
// such as when upgrading a TOL to R8.
for (AbstractCharacter hireling : building.hirelings) {
hireling.setLoc(getSlotLocation(building, building.hirelings.indexOf(hireling)).getLocation());
InterestManager.setObjectDirty(hireling);
}
}
public static boolean playerCanManage(PlayerCharacter player, Building building) { public static boolean playerCanManage(PlayerCharacter player, Building building) {
if (player == null) if (player == null)
@@ -122,6 +104,7 @@ public enum BuildingManager {
if (building == null) if (building == null)
return false; return false;
if (building.getRank() == -1) if (building.getRank() == -1)
return false; return false;
@@ -129,25 +112,26 @@ public enum BuildingManager {
return true; return true;
//individual friend. //individual friend.
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null) if (building.getFriends().get(player.getObjectUUID()) != null)
return true; return true;
//Admins can access stuff //Admin's can access stuff
if (player.isCSR()) if (player.isCSR())
return true; return true;
//Guild stuff //Guild stuff
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
return true; return true;
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) && building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 8)
return true; return true;
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 9
&& GuildStatusController.isInnerCouncil(player.getGuildStatus())) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
return true; return true;
@@ -248,15 +232,15 @@ public enum BuildingManager {
ChatManager.chatSystemInfo(player, "You can not carry any more of that item."); ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
return false; return false;
} }
if (warehouse.resources.get(resourceBase) == null) if (warehouse.getResources().get(resourceBase) == null)
continue; continue;
int resourceAmount = warehouse.resources.get(resourceBase); int resourceAmount = warehouse.getResources().get(resourceBase);
if (resourceAmount <= 0) if (resourceAmount <= 0)
continue; continue;
if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true)) if (warehouse.loot(player, resourceBase, resourceAmount, true))
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName()); ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
} }
break; break;
@@ -305,7 +289,7 @@ public enum BuildingManager {
// Method transfers ownership of all hirelings in a building // Method transfers ownership of all hirelings in a building
public static void updateHirelingGuilds(Building building) { public static void refreshHirelings(Building building) {
if (building == null) if (building == null)
return; return;
@@ -317,79 +301,13 @@ public enum BuildingManager {
else else
newGuild = building.getOwner().getGuild(); newGuild = building.getOwner().getGuild();
for (AbstractCharacter hireling : building.hirelings) { for (AbstractCharacter hireling : building.getHirelings().keySet()) {
hireling.setGuild(newGuild); hireling.setGuild(newGuild);
WorldGrid.updateObject(hireling); WorldGrid.updateObject(hireling);
} }
} }
public static void removeHireling(Building building, AbstractCharacter hireling) {
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
Mob guardCaptain = (Mob) hireling;
// Clear minions from database if a guard captain
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
}
// Clear minions from world
for (Integer minionUUID : hireling.minions) {
Mob minionMob = Mob.getMob(minionUUID);
DbManager.removeFromCache(minionMob);
WorldGrid.RemoveWorldObject(minionMob);
WorldGrid.unloadObject(minionMob);
if (minionMob.getParentZone() != null)
minionMob.getParentZone().zoneMobSet.remove(minionMob);
}
// Remove hireling from building
building.hirelings.remove(hireling);
// Remove from zone mob set
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
Mob hirelingMob = (Mob) hireling;
if (hirelingMob.getParentZone() != null)
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
}
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
NPC hirelingNPC = (NPC) hireling;
if (hirelingNPC.getParentZone() != null)
if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC))
hirelingNPC.getParentZone().zoneNPCSet.remove(hireling);
}
// Unload hireling from world
DbManager.removeFromCache(hireling);
WorldGrid.RemoveWorldObject(hireling);
WorldGrid.removeObject(hireling);
// Delete hireling from database
if (hireling.getObjectType().equals(GameObjectType.Mob))
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
else
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
}
public static void cleanupHirelings(Building building) { public static void cleanupHirelings(Building building) {
// Early exit: Cannot have hirelings in a building // Early exit: Cannot have hirelings in a building
@@ -402,25 +320,46 @@ public enum BuildingManager {
if (building.getRank() < 1) { if (building.getRank() < 1) {
for (AbstractCharacter slottedNPC : building.hirelings) for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
BuildingManager.removeHireling(building, slottedNPC);
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
((NPC) slottedNPC).remove();
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
}
return; return;
} }
// Delete hireling if building has deranked. // Delete hireling if building has deranked.
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
for (AbstractCharacter hireling : building.hirelings) { NPC npc = null;
Mob mob = null;
if (building.hirelings.indexOf(hireling) + 1 > building.getBlueprint().getSlotsForRank(building.getRank())) if (hireling.getObjectType() == Enum.GameObjectType.NPC)
BuildingManager.removeHireling(building, hireling); npc = (NPC) hireling;
else if (hireling.getObjectType() == Enum.GameObjectType.Mob)
mob = (Mob) hireling;
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
if (npc != null) {
if (!npc.remove())
Logger.error("Failed to remove npc " + npc.getObjectUUID()
+ "from Building " + building.getObjectUUID());
else
building.getHirelings().remove(npc);
} else if (mob != null) {
if (!NPCManager.removeMobileFromBuilding(mob, building))
Logger.error("Failed to remove npc " + npc.getObjectUUID()
+ "from Building " + building.getObjectUUID());
else
building.getHirelings().remove(npc);
}
} }
// Update hireling guilds and locations refreshHirelings(building);
updateHirelingGuilds(building);
updateHirelingSlots(building);
} }
public static Building getBuilding(int id) { public static Building getBuilding(int id) {
@@ -499,6 +438,18 @@ public enum BuildingManager {
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) { public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BANESTONE))
{
Guild playerNation = player.guild.getNation();
City banedCity = ZoneManager.getCityAtLocation(building.loc);
if(banedCity != null){
if(banedCity.getGuild().getNation().equals(playerNation)){
return false;
}else{
return true;
}
}
}
//Nation Members and Guild members are not hostile. //Nation Members and Guild members are not hostile.
// if (building.getGuild() != null){ // if (building.getGuild() != null){
// if (pc.getGuild() != null) // if (pc.getGuild() != null)
@@ -513,18 +464,18 @@ public enum BuildingManager {
Condemned condemn = building.getCondemned().get(player.getObjectUUID()); Condemned condemn = building.getCondemned().get(player.getObjectUUID());
if (condemn != null && condemn.active) if (condemn != null && condemn.isActive())
return true; return true;
if (player.getGuild() != null) { if (player.getGuild() != null) {
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID()); Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
if (guildCondemn != null && guildCondemn.active) if (guildCondemn != null && guildCondemn.isActive())
return true; return true;
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID()); Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
return nationCondemn != null && nationCondemn.active && nationCondemn.friendType == Condemned.NATION; return nationCondemn != null && nationCondemn.isActive() && nationCondemn.getFriendType() == Condemned.NATION;
} else { } else {
//TODO ADD ERRANT KOS CHECK //TODO ADD ERRANT KOS CHECK
} }
@@ -532,18 +483,18 @@ public enum BuildingManager {
Condemned condemn = building.getCondemned().get(player.getObjectUUID()); Condemned condemn = building.getCondemned().get(player.getObjectUUID());
if (condemn != null && condemn.active) if (condemn != null && condemn.isActive())
return false; return false;
if (player.getGuild() != null) { if (player.getGuild() != null) {
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID()); Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
if (guildCondemn != null && guildCondemn.active) if (guildCondemn != null && guildCondemn.isActive())
return false; return false;
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID()); Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
return nationCondemn == null || !nationCondemn.active || nationCondemn.friendType != Condemned.NATION; return nationCondemn == null || !nationCondemn.isActive() || nationCondemn.getFriendType() != Condemned.NATION;
} else { } else {
//TODO ADD ERRANT KOS CHECK //TODO ADD ERRANT KOS CHECK
} }
@@ -562,7 +513,7 @@ public enum BuildingManager {
NPC npc = null; NPC npc = null;
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building); npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building);
if (npc == null) if (npc == null)
return false; return false;
@@ -581,7 +532,30 @@ public enum BuildingManager {
if (building.getBlueprintUUID() == 0) if (building.getBlueprintUUID() == 0)
return false; return false;
if (building.getBlueprint().getMaxSlots() == building.hirelings.size()) if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL)){
if(contract.getContractID() == 850) {
boolean hasRunemaster = false;
for (AbstractCharacter npc : building.getHirelings().keySet()) {
if (npc.getObjectType() != GameObjectType.NPC)
continue;
if(npc.contractUUID == 850)
hasRunemaster = true;
}
if(hasRunemaster)
return false;
}
}
int maxSlots = building.getBlueprint().getMaxSlots();
if(building.getBlueprint().getBuildingGroup() != null) {
maxSlots = building.getBlueprint().getSlotsForRank(building.getRank());
}
if (maxSlots == building.getHirelings().size())
return false; return false;
String pirateName = NPCManager.getPirateName(contract.getMobbaseID()); String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
@@ -591,63 +565,41 @@ public enum BuildingManager {
else else
rank = 10; rank = 10;
Mob mobile; Mob mob;
NPC npc; NPC npc;
if (NPC.ISWallArcher(contract)) { if (NPC.ISWallArcher(contract)) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null) if (mob == null)
return false; return false;
// Configure AI and write new mobile to disk mob.setLoc(mob.getLoc());
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
return true; return true;
} }
if (NPC.ISGuardCaptain(contract.getContractID())) { if (NPC.ISGuardCaptain(contract.getContractID())) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null) if (mob == null)
return false; return false;
// Configure AI and write new mobile to disk mob.setLoc(mob.getLoc());
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
return true; return true;
} }
if (contract.getContractID() == 910) { if (contract.getContractID() == 910) {
//guard dog //guard dog
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null) if (mob == null)
return false; return false;
// Configure AI and write new mobile to disk mob.setLoc(mob.getLoc());
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
return true; return true;
} }
@@ -794,110 +746,80 @@ public enum BuildingManager {
} }
public static void rebuildMine(Building mineBuilding) { public static void processRedeedNPC(NPC npc, Building building, ClientConnection origin) {
setRank(mineBuilding, 1);
mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank);
// New rank mean new max hit points. // Member variable declaration
PlayerCharacter player;
Contract contract;
CharacterItemManager itemMan;
ItemBase itemBase;
Item item;
mineBuilding.healthMax = mineBuilding.getBlueprint().getMaxHealth(mineBuilding.rank); npc.lock.writeLock().lock();
mineBuilding.setCurrentHitPoints(mineBuilding.healthMax);
mineBuilding.getBounds().setBounds(mineBuilding);
}
public static void setRank(Building building, int rank) { try {
int newMeshUUID;
boolean success;
// If this building has no blueprint then set rank and exit immediately.
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
building.rank = rank;
DbManager.BuildingQueries.CHANGE_RANK(building.getObjectUUID(), rank);
return;
}
// Delete any upgrade jobs before doing anything else. It won't quite work
// if in a few lines we happen to delete this building.
JobContainer jc = building.getTimers().get("UPGRADE");
if (jc != null) {
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
Logger.error("failed to cancel existing upgrade job.");
}
// Attempt to write to database, or delete the building
// if we are destroying it.
if (rank == -1)
success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
else
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
if (success == false) {
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
return;
}
building.isDeranking.compareAndSet(false, true);
// Change the building's rank
building.rank = rank;
// New rank means new mesh
newMeshUUID = building.getBlueprint().getMeshForRank(building.rank);
building.meshUUID = newMeshUUID;
// New rank mean new max hitpoints.
building.healthMax = building.getBlueprint().getMaxHealth(building.rank);
building.setCurrentHitPoints(building.healthMax);
if (building.getUpgradeDateTime() != null)
setUpgradeDateTime(building, null, 0);
// If we destroyed this building make sure to turn off
// protection
if (building.rank == -1)
building.protectionState = Enum.ProtectionState.NONE;
if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
&& (building.rank == 8))
building.meshUUID = Realm.getRealmMesh(building.getCity());
// update object to clients
building.refresh(true);
if (building.getBounds() != null)
building.getBounds().setBounds(building);
// Cleanup hirelings resulting from rank change
cleanupHirelings(building);
building.isDeranking.compareAndSet(true, false);
}
public static Building getBuildingAtLocation(Vector3fImmutable loc) {
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc, 64, MBServerStatics.MASK_BUILDING)) {
Building building = (Building) awo;
if (building == null) if (building == null)
continue; return;
player = SessionManager.getPlayerCharacter(origin);
itemMan = player.getCharItemManager();
if (Bounds.collide(loc, building.getBounds())) contract = npc.getContract();
return building;
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
ErrorPopupMsg.sendErrorPopup(player, 21);
return;
}
if (!building.getHirelings().containsKey(npc))
return;
if (!npc.remove()) {
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return;
}
building.getHirelings().remove(npc);
itemBase = ItemBase.getItemBase(contract.getContractID());
if (itemBase == null) {
Logger.error("Could not find Contract for npc: " + npc.getObjectUUID());
return;
}
boolean itemWorked = false;
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) npc.getRank() - 1), (byte) ((byte) npc.getRank() - 1),
(short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
item.setNumOfItems(1);
item.containerType = Enum.ItemContainerType.INVENTORY;
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
itemWorked = true;
} catch (Exception e) {
Logger.error(e);
}
if (itemWorked) {
itemMan.addItemToInventory(item);
itemMan.updateInventory();
}
ManageCityAssetsMsg mca = new ManageCityAssetsMsg();
mca.actionType = NPC.SVR_CLOSE_WINDOW;
mca.setTargetType(building.getObjectType().ordinal());
mca.setTargetID(building.getObjectUUID());
origin.sendMsg(mca);
} catch (Exception e) {
Logger.error(e);
} finally {
npc.lock.writeLock().unlock();
} }
return null;
}
}
} }
+6 -1
View File
@@ -27,6 +27,7 @@ import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.server.world.WorldServer; import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
import engine.util.KeyCloneAudit;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
@@ -84,6 +85,10 @@ public enum ChatManager {
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD)) if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
isFlood = true; isFlood = true;
if(KeyCloneAudit.auditChatMsg(pc,msg.getMessage())){
return;
}
switch (protocolMsg) { switch (protocolMsg) {
case CHATSAY: case CHATSAY:
ChatManager.chatSay(pc, msg.getMessage(), isFlood); ChatManager.chatSay(pc, msg.getMessage(), isFlood);
@@ -788,7 +793,7 @@ public enum ChatManager {
it.remove(); it.remove();
else { else {
PlayerCharacter pcc = (PlayerCharacter) awo; PlayerCharacter pcc = (PlayerCharacter) awo;
if (pcc.getSeeInvis() < pc.hidden) if (pcc.getSeeInvis() < pc.getHidden())
it.remove(); it.remove();
} }
} }
+342 -141
View File
@@ -30,6 +30,8 @@ import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static engine.math.FastMath.sqr;
public enum CombatManager { public enum CombatManager {
COMBATMANAGER; COMBATMANAGER;
@@ -39,6 +41,63 @@ public enum CombatManager {
/** /**
* Message sent by player to attack something. * Message sent by player to attack something.
*/ */
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
PlayerCharacter player;
int targetType;
AbstractWorldObject target;
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
return;
player = SessionManager.getPlayerCharacter(origin);
if (player == null)
return;
//source must match player this account belongs to
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
return;
}
targetType = msg.getTargetType();
if (targetType == GameObjectType.PlayerCharacter.ordinal()) {
target = PlayerCharacter.getFromCache(msg.getTargetID());
} else if (targetType == GameObjectType.Building.ordinal()) {
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
} else if (targetType == GameObjectType.Mob.ordinal()) {
target = Mob.getFromCache(msg.getTargetID());
} else {
player.setCombatTarget(null);
return; //not valid type to attack
}
// quit of the combat target is already the current combat target
// or there is no combat target
if (target == null)
return;
//set sources target
player.setCombatTarget(target);
//put in combat if not already
if (!player.isCombat())
toggleCombat(true, origin);
//make character stand if sitting
if (player.isSit())
toggleSit(false, origin);
AttackTarget(player, target);
}
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) { public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
@@ -82,6 +141,11 @@ public enum CombatManager {
if (off == null) if (off == null)
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
} }
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
} }
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException { public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
@@ -237,6 +301,17 @@ public enum CombatManager {
if (target == null) if (target == null)
return 0; return 0;
//pet to assist in attacking target
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter attacker = (PlayerCharacter)abstractCharacter;
if(attacker.getPet() != null){
Mob pet = attacker.getPet();
if(pet.combatTarget == null && pet.assist)
pet.setCombatTarget(attacker.combatTarget);
}
}
//target must be valid type //target must be valid type
if (AbstractWorldObject.IsAbstractCharacter(target)) { if (AbstractWorldObject.IsAbstractCharacter(target)) {
@@ -419,16 +494,24 @@ public enum CombatManager {
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
else { else {
int wepSpeed = (int) (wb.getSpeed()); int wepSpeed = (int) (wb.getSpeed());
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
if(slot == 1){
wepSpeed = (int) pc.combatStats.attackSpeedHandOne;
}else{
wepSpeed = (int) pc.combatStats.attackSpeedHandTwo;
}
}else {
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None)); wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None)); wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
if (wepSpeed < 10)
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
if (wepSpeed < 10)
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
}
createTimer(abstractCharacter, slot, wepSpeed, true); createTimer(abstractCharacter, slot, wepSpeed, true);
} }
@@ -459,7 +542,7 @@ public enum CombatManager {
/** /**
* Attempt to attack target * Attempt to attack target
*/ */
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) { private static void attack(AbstractCharacter ac, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
float atr; float atr;
int minDamage, maxDamage; int minDamage, maxDamage;
@@ -467,20 +550,34 @@ public enum CombatManager {
try { try {
if (attacker == null) if (ac == null)
return; return;
if (target == null) if (target == null)
return; return;
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
if (mainHand) { PlayerCharacter pc = (PlayerCharacter) ac;
atr = attacker.getAtrHandOne(); pc.combatStats.calculateATR(true);
minDamage = attacker.getMinDamageHandOne(); pc.combatStats.calculateATR(false);
maxDamage = attacker.getMaxDamageHandOne(); if (mainHand) {
} else { atr = pc.combatStats.atrHandOne;
atr = attacker.getAtrHandTwo(); minDamage = pc.combatStats.minDamageHandOne;
minDamage = attacker.getMinDamageHandTwo(); maxDamage = pc.combatStats.maxDamageHandOne;
maxDamage = attacker.getMaxDamageHandTwo(); } else {
atr = pc.combatStats.atrHandTwo;
minDamage = pc.combatStats.minDamageHandTwo;
maxDamage = pc.combatStats.maxDamageHandTwo;
}
}else {
if (mainHand) {
atr = ac.getAtrHandOne();
minDamage = ac.getMinDamageHandOne();
maxDamage = ac.getMaxDamageHandOne();
} else {
atr = ac.getAtrHandTwo();
minDamage = ac.getMinDamageHandTwo();
maxDamage = ac.getMaxDamageHandTwo();
}
} }
boolean tarIsRat = false; boolean tarIsRat = false;
@@ -499,9 +596,9 @@ public enum CombatManager {
//Dont think we need to do this anymore. //Dont think we need to do this anymore.
if (tarIsRat) if (tarIsRat)
if (attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat % if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
float percent = 1 + attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat); float percent = 1 + ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
minDamage *= percent; minDamage *= percent;
maxDamage *= percent; maxDamage *= percent;
@@ -512,24 +609,24 @@ public enum CombatManager {
//subtract stamina //subtract stamina
if (wb == null) if (wb == null)
attacker.modifyStamina(-0.5f, attacker, true); ac.modifyStamina(-0.5f, ac, true);
else { else {
float stam = wb.getWeight() / 3; float stam = wb.getWeight() / 3;
stam = (stam < 1) ? 1 : stam; stam = (stam < 1) ? 1 : stam;
attacker.modifyStamina(-(stam), attacker, true); ac.modifyStamina(-(stam), ac, true);
} }
attacker.cancelOnAttackSwing(); ac.cancelOnAttackSwing();
errorTrack = 2; errorTrack = 2;
//set last time this player has attacked something. //set last time this player has attacked something.
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != attacker.getObjectUUID() && attacker.getObjectType() == GameObjectType.PlayerCharacter) { if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != ac.getObjectUUID() && ac.getObjectType() == GameObjectType.PlayerCharacter) {
attacker.setTimeStamp("LastCombatPlayer", System.currentTimeMillis()); ac.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis()); ((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
} else } else
attacker.setTimeStamp("LastCombatMob", System.currentTimeMillis()); ac.setTimeStamp("LastCombatMob", System.currentTimeMillis());
errorTrack = 3; errorTrack = 3;
@@ -540,46 +637,77 @@ public enum CombatManager {
if (target.getObjectType().equals(GameObjectType.Building)) { if (target.getObjectType().equals(GameObjectType.Building)) {
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) { if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
attacker.setCombatTarget(null); ac.setCombatTarget(null);
return; return;
} }
defense = 0; defense = 0;
Building building = (Building) target;
if (building.getParentZone() != null && building.getParentZone().isPlayerCity()) {
if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")) {
building.getTimestamps().put("CallForHelp", System.currentTimeMillis() + 15000);
for (Mob mob : building.getParentZone().zoneMobSet) {
if (!mob.isPlayerGuard())
continue;
if (mob.getCombatTarget() != null)
continue;
if (mob.getGuild() != null && building.getGuild() != null)
if (!Guild.sameGuild(mob.getGuild().getNation(), building.getGuild().getNation()))
continue;
if (mob.getLoc().distanceSquared2D(building.getLoc()) > sqr(300))
continue;
mob.setCombatTarget(ac);
}
}
}
} else { } else {
AbstractCharacter tar = (AbstractCharacter) target; AbstractCharacter tar = (AbstractCharacter) target;
defense = tar.getDefenseRating(); if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
handleRetaliate(tar, attacker); //Handle target attacking back if in combat and has no other target ((PlayerCharacter)tar).combatStats.calculateDefense();
defense = ((PlayerCharacter)tar).combatStats.defense;
}else {
defense = tar.getDefenseRating();
}
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
} }
errorTrack = 4; errorTrack = 4;
//Get hit chance //Get hit chance
int chance; //int chance;
float dif = atr - defense; //float dif = atr - defense;
if (dif > 100) //if (dif > 100)
chance = 94; // chance = 94;
else if (dif < -100) //else if (dif < -100)
chance = 4; // chance = 4;
else //else
chance = (int) ((0.45 * dif) + 49); // chance = (int) ((0.45 * dif) + 49);
errorTrack = 5; errorTrack = 5;
//calculate hit/miss //calculate hit/miss
int roll = ThreadLocalRandom.current().nextInt(100);
DeferredPowerJob dpj = null; DeferredPowerJob dpj = null;
if (roll < chance) { boolean hitLanded = LandHit((int)atr,(int)defense);
if (hitLanded) {
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
updateAttackTimers((PlayerCharacter) attacker, target, true); updateAttackTimers((PlayerCharacter) ac, target, true);
boolean skipPassives = false; boolean skipPassives = false;
PlayerBonuses bonuses = attacker.getBonuses(); PlayerBonuses bonuses = ac.getBonuses();
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None)) if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
skipPassives = true; skipPassives = true;
@@ -594,30 +722,42 @@ public enum CombatManager {
// Apply Weapon power effect if any. don't try to apply twice if // Apply Weapon power effect if any. don't try to apply twice if
// dual wielding. Perform after passive test for sync purposes. // dual wielding. Perform after passive test for sync purposes.
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) { if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
dpj = ((PlayerCharacter) attacker).getWeaponPower(); dpj = ((PlayerCharacter) ac).getWeaponPower();
if (dpj != null) { if (dpj != null) {
PlayerBonuses bonus = attacker.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
float attackRange = getWeaponRange(wb, bonus); float attackRange = getWeaponRange(wb, bonus);
dpj.attack(target, attackRange); if(specialCaseHitRoll(dpj.getPowerToken())) {
if(hitLanded) {
dpj.attack(target, attackRange);
}
}else{
dpj.attack(target, attackRange);
}
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
((PlayerCharacter) attacker).setWeaponPower(dpj); ((PlayerCharacter) ac).setWeaponPower(dpj);
} }
} }
//check to apply second backstab. //check to apply second backstab.
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) { if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
dpj = ((PlayerCharacter) attacker).getWeaponPower(); dpj = ((PlayerCharacter) ac).getWeaponPower();
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) { if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
float attackRange = getWeaponRange(wb, bonuses); float attackRange = getWeaponRange(wb, bonuses);
dpj.attack(target, attackRange); if(specialCaseHitRoll(dpj.getPowerToken())) {
if(hitLanded) {
dpj.attack(target, attackRange);
}
}else{
dpj.attack(target, attackRange);
}
} }
} }
@@ -633,24 +773,24 @@ public enum CombatManager {
//Handle Block passive //Handle Block passive
if (testPassive(attacker, tarAc, "Block") && canTestBlock(attacker, target)) { if (testPassive(ac, tarAc, "Block") && canTestBlock(ac, target)) {
if (!target.isAlive()) if (!target.isAlive())
return; return;
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand); sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
passiveFired = true; passiveFired = true;
} }
//Handle Parry passive //Handle Parry passive
if (!passiveFired) if (!passiveFired)
if (canTestParry(attacker, target) && testPassive(attacker, tarAc, "Parry")) { if (canTestParry(ac, target) && testPassive(ac, tarAc, "Parry")) {
if (!target.isAlive()) if (!target.isAlive())
return; return;
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand); sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
passiveFired = true; passiveFired = true;
} }
@@ -661,12 +801,12 @@ public enum CombatManager {
//Handle Dodge passive //Handle Dodge passive
if (!passiveFired) if (!passiveFired)
if (testPassive(attacker, tarAc, "Dodge")) { if (testPassive(ac, tarAc, "Dodge")) {
if (!target.isAlive()) if (!target.isAlive())
return; return;
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand); sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
passiveFired = true; passiveFired = true;
} }
} }
@@ -682,7 +822,7 @@ public enum CombatManager {
//if target is player, set last attack timestamp //if target is player, set last attack timestamp
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
updateAttackTimers((PlayerCharacter) target, attacker, false); updateAttackTimers((PlayerCharacter) target, ac, false);
//Get damage Type //Get damage Type
@@ -690,7 +830,7 @@ public enum CombatManager {
if (wb != null) if (wb != null)
damageType = wb.getDamageType(); damageType = wb.getDamageType();
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege()) else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege())
damageType = DamageType.Siege; damageType = DamageType.Siege;
else else
damageType = DamageType.Crush; damageType = DamageType.Crush;
@@ -709,7 +849,7 @@ public enum CombatManager {
//make sure target is not immune to damage type; //make sure target is not immune to damage type;
if (resists != null && resists.immuneTo(damageType)) { if (resists != null && resists.immuneTo(damageType)) {
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand); sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
return; return;
} }
@@ -720,9 +860,25 @@ public enum CombatManager {
float damage; float damage;
if (wb != null) if (wb != null)
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists); damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
else else
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists); damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
if(weapon != null && weapon.effects != null){
float armorPierce = 0;
for(Effect eff : weapon.effects.values()){
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
if(mod.modType.equals(ModType.ArmorPiercing)){
armorPierce += mod.minMod * (mod.getRamp() * eff.getTrains());
}
}
}
if(armorPierce > 0){
damage *= 1 - armorPierce;
}
}
//Resists.handleFortitude(tarAc,damageType,damage);
float d = 0f; float d = 0f;
@@ -735,35 +891,40 @@ public enum CombatManager {
if (tarAc.isSit()) if (tarAc.isSit())
damage *= 2.5f; //increase damage if sitting damage *= 2.5f; //increase damage if sitting
if (tarAc.getObjectType() == GameObjectType.Mob) {
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
((Mob) tarAc).handleDirectAggro(ac);
}
if (tarAc.getHealth() > 0) if (tarAc.getHealth() > 0)
d = tarAc.modifyHealth(-damage, attacker, false); d = tarAc.modifyHealth(-damage, ac, false);
} else if (target.getObjectType().equals(GameObjectType.Building)) { } else if (target.getObjectType().equals(GameObjectType.Building)) {
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) { if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
attacker.setCombatTarget(null); ac.setCombatTarget(null);
return; return;
} }
if (target.getHealth() > 0) if (target.getHealth() > 0)
d = ((Building) target).modifyHealth(-damage, attacker); d = ((Building) target).modifyHealth(-damage, ac);
} }
errorTrack = 13; errorTrack = 13;
//Test to see if any damage needs done to weapon or armor //Test to see if any damage needs done to weapon or armor
testItemDamage(attacker, target, weapon, wb); testItemDamage(ac, target, weapon, wb);
// if target is dead, we got the killing blow, remove attack timers on our weapons // if target is dead, we got the killing blow, remove attack timers on our weapons
if (tarAc != null && !tarAc.isAlive()) if (tarAc != null && !tarAc.isAlive())
removeAttackTimers(attacker); removeAttackTimers(ac);
//test double death fix //test double death fix
if (d != 0) if (d != 0)
sendCombatMessage(attacker, target, damage, wb, dpj, mainHand); //send damage message sendCombatMessage(ac, target, damage, wb, dpj, mainHand); //send damage message
errorTrack = 14; errorTrack = 14;
@@ -771,27 +932,18 @@ public enum CombatManager {
if (weapon != null && tarAc != null && tarAc.isAlive()) { if (weapon != null && tarAc != null && tarAc.isAlive()) {
ConcurrentHashMap<String, Effect> effects = weapon.getEffects(); if(weapon.effects != null){
for (Effect eff : weapon.effects.values()){
for (Effect eff : effects.values()) { for(AbstractEffectModifier mod : eff.getEffectModifiers()){
if (eff == null) if(mod.modType.equals(ModType.WeaponProc)){
continue;
HashSet<AbstractEffectModifier> aems = eff.getEffectModifiers();
if (aems != null) {
for (AbstractEffectModifier aem : aems) {
if (!tarAc.isAlive())
break;
if (aem instanceof WeaponProcEffectModifier) {
int procChance = ThreadLocalRandom.current().nextInt(100); int procChance = ThreadLocalRandom.current().nextInt(100);
if (procChance < MBServerStatics.PROC_CHANCE) {
if (procChance < MBServerStatics.PROC_CHANCE) try {
((WeaponProcEffectModifier) aem).applyProc(attacker, target); ((WeaponProcEffectModifier) mod).applyProc(ac, target);
}catch(Exception e){
Logger.error(eff.getName() + " Failed To Cast Proc");
}
}
} }
} }
} }
@@ -802,52 +954,58 @@ public enum CombatManager {
//handle damage shields //handle damage shields
if (attacker.isAlive() && tarAc != null && tarAc.isAlive()) if (ac.isAlive() && tarAc != null && tarAc.isAlive())
handleDamageShields(attacker, tarAc, damage); handleDamageShields(ac, tarAc, damage);
} else { } else {
// Apply Weapon power effect if any. // Apply Weapon power effect if any.
// don't try to apply twice if dual wielding. // don't try to apply twice if dual wielding.
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) { if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
dpj = ((PlayerCharacter) attacker).getWeaponPower(); dpj = ((PlayerCharacter) ac).getWeaponPower();
if (dpj != null) { if (dpj != null) {
PowersBase wp = dpj.getPower(); PowersBase wp = dpj.getPower();
if (wp.requiresHitRoll() == false) { if (wp.requiresHitRoll() == false) {
PlayerBonuses bonus = attacker.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
float attackRange = getWeaponRange(wb, bonus); float attackRange = getWeaponRange(wb, bonus);
dpj.attack(target, attackRange); if(specialCaseHitRoll(dpj.getPowerToken())) {
if(hitLanded) {
dpj.attack(target, attackRange);
}
}else{
dpj.attack(target, attackRange);
}
} else } else
((PlayerCharacter) attacker).setWeaponPower(null); ((PlayerCharacter) ac).setWeaponPower(null);
} }
} }
if (target.getObjectType() == GameObjectType.Mob) if (target.getObjectType() == GameObjectType.Mob)
((Mob) target).handleDirectAggro(attacker); ((Mob) target).handleDirectAggro(ac);
errorTrack = 17; errorTrack = 17;
//miss, Send miss message //miss, Send miss message
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand); sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
//if attacker is player, set last attack timestamp //if attacker is player, set last attack timestamp
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
updateAttackTimers((PlayerCharacter) attacker, target, true); updateAttackTimers((PlayerCharacter) ac, target, true);
} }
errorTrack = 18; errorTrack = 18;
//cancel effects that break on attack or attackSwing //cancel effects that break on attack or attackSwing
attacker.cancelOnAttack(); ac.cancelOnAttack();
} catch (Exception e) { } catch (Exception e) {
Logger.error(attacker.getName() + ' ' + errorTrack + ' ' + e); Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e);
} }
} }
@@ -927,10 +1085,12 @@ public enum CombatManager {
//calculate resists in if any //calculate resists in if any
if (resists != null) if (resists != null)
return resists.getResistedDamage(source, target, damageType, damage, 0); damage = resists.getResistedDamage(source, target, damageType, damage, 0);
else
return damage; return damage;
} }
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) { private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
@@ -959,6 +1119,10 @@ public enum CombatManager {
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295)) if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
swingAnimation = 0; swingAnimation = 0;
if(source != null && source.getObjectType().equals(GameObjectType.PlayerCharacter)){
damage *= ((PlayerCharacter)source).ZergMultiplier;
} // Health modifications are modified by the ZergMechanic
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation); TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
DispatchMessage.sendToAllInRange(target, cmm); DispatchMessage.sendToAllInRange(target, cmm);
} }
@@ -1080,6 +1244,14 @@ public enum CombatManager {
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) { private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
if(target.getBonuses() != null)
if(target.getBonuses().getBool(ModType.Stunned, SourceType.None))
return false;
if(source.getBonuses() != null)
if(source.getBonuses().getBool(ModType.IgnorePassiveDefense, SourceType.None))
return false;
float chance = target.getPassiveChance(type, source.getLevel(), true); float chance = target.getPassiveChance(type, source.getLevel(), true);
if (chance == 0f) if (chance == 0f)
@@ -1090,7 +1262,7 @@ public enum CombatManager {
if (chance > 75f) if (chance > 75f)
chance = 75f; chance = 75f;
int roll = ThreadLocalRandom.current().nextInt(100); int roll = ThreadLocalRandom.current().nextInt(1,100);
return roll < chance; return roll < chance;
@@ -1125,7 +1297,7 @@ public enum CombatManager {
toggleCombat(msg.getToggle(), origin); toggleCombat(msg.getToggle(), origin);
} }
public static void toggleCombat(boolean toggle, ClientConnection origin) { private static void toggleCombat(boolean toggle, ClientConnection origin) {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
@@ -1149,7 +1321,10 @@ public enum CombatManager {
if (pc == null) if (pc == null)
return; return;
pc.setSit(toggle); if(pc.isFlying())
pc.setSit(false);
else
pc.setSit(toggle);
UpdateStateMsg rwss = new UpdateStateMsg(); UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(pc); rwss.setPlayer(pc);
@@ -1172,69 +1347,68 @@ public enum CombatManager {
} }
//Called when character takes damage. //Called when character takes damage.
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) { public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
if (attacker == null || target == null) if (ac == null || tarAc == null)
return; return;
if (attacker.equals(target)) if (ac.equals(tarAc))
return; return;
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter)) if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
return; return;
if (!target.isAlive() || !attacker.isAlive()) if (!tarAc.isAlive() || !ac.isAlive())
return; return;
boolean isCombat = target.isCombat(); boolean isCombat = tarAc.isCombat();
//If target in combat and has no target, then attack back //If target in combat and has no target, then attack back
AbstractWorldObject awoCombTar = target.getCombatTarget(); AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege())) if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege()))
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
PlayerCharacter pc = (PlayerCharacter) target; PlayerCharacter pc = (PlayerCharacter) tarAc;
target.setCombatTarget(attacker); tarAc.setCombatTarget(ac);
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID()); pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
if (target.getTimers() != null) if (tarAc.getTimers() != null)
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND)) if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget()); CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
} }
//Handle pet retaliate if assist is on and pet doesn't have a target. //Handle pet retaliate if assist is on and pet doesn't have a target.
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
Mob pet = ((PlayerCharacter) target).getPet(); Mob pet = ((PlayerCharacter) tarAc).getPet();
if (pet != null && pet.assist && pet.getCombatTarget() == null) if (pet != null && pet.assist && pet.getCombatTarget() == null)
pet.setCombatTarget(attacker); pet.setCombatTarget(ac);
} }
//Handle Mob Retaliate. //Handle Mob Retaliate.
if (target.getObjectType() == GameObjectType.Mob) { if (tarAc.getObjectType() == GameObjectType.Mob) {
Mob attackedMobile = (Mob) target; Mob retaliater = (Mob) tarAc;
//handle minion informing his captain of an attack if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
if (attackedMobile.agentType.equals(AIAgentType.GUARDMINION) && attackedMobile.guardCaptain != null && attackedMobile.guardCaptain.isAlive()) {
if (attackedMobile.guardCaptain.combatTarget == null)
attackedMobile.guardCaptain.setCombatTarget(attacker);
}
// Mobile already has a target; don't switch.
if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege())
return; return;
attackedMobile.setCombatTarget(attacker); if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
return;
retaliater.setCombatTarget(ac);
if(retaliater.isPlayerGuard && (retaliater.BehaviourType.equals(MobBehaviourType.GuardMinion) || retaliater.BehaviourType.equals(MobBehaviourType.GuardCaptain))){
for(Mob guard : retaliater.guardedCity.getParent().zoneMobSet){
if(guard.isPlayerGuard && guard.combatTarget == null){
guard.setCombatTarget(ac);
}
}
}
} }
} }
@@ -1266,9 +1440,9 @@ public enum CombatManager {
Resists resists = ac.getResists(); Resists resists = ac.getResists();
if (resists != null) if (resists != null) {
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0); amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
}
total += amount; total += amount;
} }
@@ -1351,4 +1525,31 @@ public enum CombatManager {
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1); ((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
} }
public static boolean LandHit(int ATR, int DEF){
//float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
//float convertedChance = chance * 100;
int roll = ThreadLocalRandom.current().nextInt(101);
//if(roll <= 5)//always 5% chance to miss
// return false;
//if(roll >= 95)//always 5% chance to hit
// return true;
float chance = PlayerCombatStats.getHitChance(ATR,DEF);
return chance >= roll;
}
public static boolean specialCaseHitRoll(int powerID){
switch(powerID) {
case 563200808: // Naargal's Bite
case 563205337: // Naargal's Dart
case 563205930: // Sword of Saint Malorn
return true;
default:
return false;
}
}
} }
+3 -1
View File
@@ -65,6 +65,7 @@ public enum ConfigManager {
MB_WORLD_MAINTENANCE, MB_WORLD_MAINTENANCE,
MB_WORLD_GREETING, MB_WORLD_GREETING,
MB_WORLD_KEYCLONE_MAX, MB_WORLD_KEYCLONE_MAX,
MB_WORLD_TESTMODE,
MB_USE_RUINS, MB_USE_RUINS,
// Mobile AI modifiers // Mobile AI modifiers
@@ -97,7 +98,8 @@ public enum ConfigManager {
MB_MAGICBOT_FORTOFIX, MB_MAGICBOT_FORTOFIX,
MB_MAGICBOT_RECRUIT, MB_MAGICBOT_RECRUIT,
MB_MAGICBOT_MAGICBOX, MB_MAGICBOT_MAGICBOX,
MB_MAGICBOT_ADMINLOG; MB_MAGICBOT_ADMINLOG,
MB_WORLD_BOXLIMIT;
// Map to hold our config pulled in from the environment // Map to hold our config pulled in from the environment
// We also use the config to point to the current message pump // We also use the config to point to the current message pump
+1
View File
@@ -70,6 +70,7 @@ public enum DbManager {
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler(); public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
public static final dbBoonHandler BoonQueries = new dbBoonHandler(); public static final dbBoonHandler BoonQueries = new dbBoonHandler();
public static final dbShrineHandler ShrineQueries = new dbShrineHandler(); public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler(); public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
public static final dbPowerHandler PowerQueries = new dbPowerHandler(); public static final dbPowerHandler PowerQueries = new dbPowerHandler();
+39 -5
View File
@@ -46,11 +46,9 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new GetZoneCmd()); DevCmdManager.registerDevCmd(new GetZoneCmd());
DevCmdManager.registerDevCmd(new ZoneSetCmd()); DevCmdManager.registerDevCmd(new ZoneSetCmd());
DevCmdManager.registerDevCmd(new PrintBankCmd()); DevCmdManager.registerDevCmd(new PrintBankCmd());
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
DevCmdManager.registerDevCmd(new PrintEquipCmd()); DevCmdManager.registerDevCmd(new PrintEquipCmd());
DevCmdManager.registerDevCmd(new PrintInventoryCmd()); DevCmdManager.registerDevCmd(new PrintInventoryCmd());
DevCmdManager.registerDevCmd(new PrintVaultCmd()); DevCmdManager.registerDevCmd(new PrintVaultCmd());
DevCmdManager.registerDevCmd(new PrintRunesCmd());
DevCmdManager.registerDevCmd(new PrintStatsCmd()); DevCmdManager.registerDevCmd(new PrintStatsCmd());
DevCmdManager.registerDevCmd(new PrintSkillsCmd()); DevCmdManager.registerDevCmd(new PrintSkillsCmd());
DevCmdManager.registerDevCmd(new PrintPowersCmd()); DevCmdManager.registerDevCmd(new PrintPowersCmd());
@@ -81,7 +79,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new AddGoldCmd()); DevCmdManager.registerDevCmd(new AddGoldCmd());
DevCmdManager.registerDevCmd(new ZoneInfoCmd()); DevCmdManager.registerDevCmd(new ZoneInfoCmd());
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd()); DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
DevCmdManager.registerDevCmd(new HotzoneCmd());
DevCmdManager.registerDevCmd(new MineActiveCmd()); DevCmdManager.registerDevCmd(new MineActiveCmd());
// Dev // Dev
DevCmdManager.registerDevCmd(new ApplyStatModCmd()); DevCmdManager.registerDevCmd(new ApplyStatModCmd());
@@ -105,6 +102,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new SetAdminRuneCmd()); DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
DevCmdManager.registerDevCmd(new SetInvulCmd()); DevCmdManager.registerDevCmd(new SetInvulCmd());
DevCmdManager.registerDevCmd(new MakeItemCmd()); DevCmdManager.registerDevCmd(new MakeItemCmd());
DevCmdManager.registerDevCmd(new GimmeCmd());
DevCmdManager.registerDevCmd(new EnchantCmd()); DevCmdManager.registerDevCmd(new EnchantCmd());
DevCmdManager.registerDevCmd(new SetSubRaceCmd()); DevCmdManager.registerDevCmd(new SetSubRaceCmd());
// Admin // Admin
@@ -130,6 +128,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd()); DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
DevCmdManager.registerDevCmd(new GotoObj()); DevCmdManager.registerDevCmd(new GotoObj());
DevCmdManager.registerDevCmd(new convertLoc()); DevCmdManager.registerDevCmd(new convertLoc());
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd()); DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd()); DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd()); DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
@@ -144,6 +143,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new ApplyBonusCmd()); DevCmdManager.registerDevCmd(new ApplyBonusCmd());
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd()); DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
DevCmdManager.registerDevCmd(new SlotTestCmd()); DevCmdManager.registerDevCmd(new SlotTestCmd());
} }
private static void registerDevCmd(AbstractDevCmd cmd) { private static void registerDevCmd(AbstractDevCmd cmd) {
@@ -177,10 +177,44 @@ public enum DevCmdManager {
return false; return false;
} }
if(!pcSender.getTimestamps().containsKey("DEVCOMMAND"))
pcSender.getTimestamps().put("DEVCOMMAND",System.currentTimeMillis() - 1500L);
else if(System.currentTimeMillis() - pcSender.getTimestamps().get("DEVCOMMAND") < 1000L)
return false;
//kill any commands not available to everyone on production server //kill any commands not available to everyone on production server
//only admin level can run dev commands on production //only admin level can run dev commands on production
boolean playerAllowed = false;
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) { if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
switch (adc.getMainCmdString()) {
case "printresists":
case "printstats":
case "printskills":
case "printpowers":
case "gimme":
case "goto":
case "teleportmode":
case "printbonuses":
playerAllowed = true;
if (!a.status.equals(Enum.AccountStatus.ADMIN))
target = pcSender;
break;
}
}else{
switch (adc.getMainCmdString()) {
case "printresists":
case "printstats":
case "printskills":
case "printpowers":
case "printbonuses":
//case "gimme":
playerAllowed = true;
if (!a.status.equals(Enum.AccountStatus.ADMIN))
target = pcSender;
break;
}
}
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd); Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
return false; return false;
} }
+563 -100
View File
@@ -17,7 +17,9 @@ import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
/** /**
@@ -34,6 +36,12 @@ public enum LootManager {
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>(); public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>(); public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
public static final ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510));
public static final ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(27570,188900,188910,188920,188930,188940,188950,189500));
public static final ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(27550,27560,189100,189110,189120,189130,189140,189150));
public static final ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(27600,188700,188720,189550,189560));
public static final ArrayList<Integer> racial_guard_uuids = new ArrayList<>(Arrays.asList(841,951,952,1050,1052,1180,1182,1250,1252,1350,1352,1450,1452,1500,1502,1525,1527,1550,1552,1575,1577,1600,1602,1650,1652,1700,980100,980102));
// Drop Rates // Drop Rates
public static float NORMAL_DROP_RATE; public static float NORMAL_DROP_RATE;
@@ -68,49 +76,128 @@ public enum LootManager {
public static void GenerateMobLoot(Mob mob) { public static void GenerateMobLoot(Mob mob) {
if(mob == null){
return;
}
//determine if mob is in hotzone //determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc()); boolean inHotzone = false;
//iterate the booty sets //iterate the booty sets
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true) if(mob.mobBase == null || mob.getMobBaseID() == 253003){
int i = 0;
}
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet))
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone); RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true) if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet)) {
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone); RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
}else if(mob.bootySet != 0 && ItemBase.getItemBase(mob.bootySet) != null){
MobLoot specialDrop = null;
specialDrop = new MobLoot(mob,ItemBase.getItemBase(mob.bootySet),true);
if(specialDrop != null) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
mob.getCharItemManager().addItemToInventory(specialDrop);
mob.setResists(new Resists("Dropper"));
if(!Mob.discDroppers.contains(mob))
Mob.AddDiscDropper(mob);
}
}
//lastly, check mobs inventory for godly or disc runes to send a server announcement //lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) { for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase(); ItemBase ib = it.getItemBase();
if(ib == null) if (ib == null)
break; break;
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) { if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + ib.getName() + ". Are you tough enough to take it?"); ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10); chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg); DispatchMessage.dispatchMsgToAll(chatMsg);
}
} }
}
} }
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) { private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
boolean hotzoneWasRan = false; boolean hotzoneWasRan = false;
float dropRate = 1.0f; float dropRate;
if (!mob.getSafeZone()) {
int contractLow = 1, contractHigh = 400;
int runeLow = 401, runeHigh = 800;
int resourceLow = 801, resourceHigh = 900;
int glassLow = 901, glassHigh = 910;
int guardLow = 911, guardHigh = 920;
// Pre-compute adjusted high values
int contractAdjust = 0, runeAdjust = 0, resourceAdjust = 0, glassAdjust = 0, guardAdjust = 0;
if (mob.level < 50) {
int dif = 50 - mob.level;
contractAdjust = (int)(400 * (dif * 0.02f));
runeAdjust = (int)(400 * (dif * 0.02f));
resourceAdjust = (int)(100 * (dif * 0.02f));
glassAdjust = (int)(10 * (dif * 0.02f));
guardAdjust = (int)(10 * (dif * 0.02f));
}
// Generate a single random roll
int specialCaseRoll = ThreadLocalRandom.current().nextInt(1, 100001);
// Calculate adjusted high values once
int contractHighAdjusted = contractHigh - contractAdjust;
int runeHighAdjusted = runeHigh - runeAdjust;
int resourceHighAdjusted = resourceHigh - resourceAdjust;
int glassHighAdjusted = glassHigh - glassAdjust;
int guardHighAdjusted = guardHigh - guardAdjust;
// Check the roll range and handle accordingly
if (specialCaseRoll >= contractLow && specialCaseRoll <= contractHighAdjusted) {
SpecialCaseContractDrop(mob, entries);
} else if (specialCaseRoll >= runeLow && specialCaseRoll <= runeHighAdjusted) {
SpecialCaseRuneDrop(mob, entries);
} else if (specialCaseRoll >= resourceLow && specialCaseRoll <= resourceHighAdjusted) {
SpecialCaseResourceDrop(mob, entries);
} else if (specialCaseRoll >= glassLow && specialCaseRoll <= glassHighAdjusted) {
int glassID = rollRandomItem(126);
ItemBase glassItem = ItemBase.getItemBase(glassID);
if (glassItem != null) {
MobLoot toAddGlass = new MobLoot(mob, glassItem, false);
mob.getCharItemManager().addItemToInventory(toAddGlass);
}
} else if (specialCaseRoll >= guardLow && specialCaseRoll <= guardHighAdjusted) {
int guardContractID = racial_guard_uuids.get(new java.util.Random().nextInt(racial_guard_uuids.size()));
ItemBase guardContract = ItemBase.getItemBase(guardContractID);
if (guardContract != null) {
MobLoot toAddContract = new MobLoot(mob, guardContract, false);
mob.getCharItemManager().addItemToInventory(toAddContract);
}
}
}
// Iterate all entries in this bootySet and process accordingly // Iterate all entries in this bootySet and process accordingly
Zone zone = ZoneManager.findSmallestZone(mob.loc);
for (BootySetEntry bse : entries) { for (BootySetEntry bse : entries) {
switch (bse.bootyType) { switch (bse.bootyType) {
case "GOLD": case "GOLD":
if (zone != null && zone.getSafeZone() == (byte)1)
return; // no loot to drop in safezones
GenerateGoldDrop(mob, bse, inHotzone); GenerateGoldDrop(mob, bse, inHotzone);
break; break;
case "LOOT": case "LOOT":
if (zone != null && zone.getSafeZone() == (byte)1)
return; // no loot to drop in safezones
if (mob.getSafeZone() == false) dropRate = LootManager.NORMAL_DROP_RATE;
dropRate = LootManager.NORMAL_DROP_RATE;
if (inHotzone == true) if (inHotzone == true)
dropRate = LootManager.HOTZONE_DROP_RATE; dropRate = LootManager.HOTZONE_DROP_RATE;
@@ -135,6 +222,109 @@ public enum LootManager {
} }
} }
public static void SpecialCaseContractDrop(Mob mob,ArrayList<BootySetEntry> entries){
int lootTableID = 0;
for(BootySetEntry entry : entries){
if(entry.bootyType.equals("LOOT")){
lootTableID = entry.genTable;
break;
}
}
if(lootTableID == 0)
return;
int ContractTableID = 0;
for(GenTableEntry entry : _genTables.get(lootTableID)){
try {
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.CONTRACT)) {
ContractTableID = entry.itemTableID;
break;
}
}catch(Exception e){
}
}
if(ContractTableID == 0)
return;
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ContractTableID));
if(ib != null){
MobLoot toAdd = new MobLoot(mob,ib,false);
mob.getCharItemManager().addItemToInventory(toAdd);
}
}
public static void SpecialCaseRuneDrop(Mob mob,ArrayList<BootySetEntry> entries){
int lootTableID = 0;
for(BootySetEntry entry : entries){
if(entry.bootyType.equals("LOOT")){
lootTableID = entry.genTable;
break;
}
}
if(lootTableID == 0)
return;
int RuneTableID = 0;
for(GenTableEntry entry : _genTables.get(lootTableID)){
try {
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RUNE)) {
RuneTableID = entry.itemTableID;
break;
}
}catch(Exception e){
}
}
if(RuneTableID == 0)
return;
ItemBase ib = ItemBase.getItemBase(rollRandomItem(RuneTableID));
if(ib != null){
MobLoot toAdd = new MobLoot(mob,ib,false);
mob.getCharItemManager().addItemToInventory(toAdd);
}
}
public static void SpecialCaseResourceDrop(Mob mob,ArrayList<BootySetEntry> entries){
int lootTableID = 0;
for(BootySetEntry entry : entries){
if(entry.bootyType.equals("LOOT")){
lootTableID = entry.genTable;
break;
}
}
if(lootTableID == 0)
return;
int ResourceTableID = 0;
for(GenTableEntry entry : _genTables.get(lootTableID)){
try {
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RESOURCE)) {
ResourceTableID = entry.itemTableID;
break;
}
}catch(Exception e){
}
}
if(ResourceTableID == 0)
return;
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ResourceTableID));
if(ib != null){
MobLoot toAdd = new MobLoot(mob,ib,false);
mob.getCharItemManager().addItemToInventory(toAdd);
}
}
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) { public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
if (mob == null || _genTables.containsKey(genTableID) == false) if (mob == null || _genTables.containsKey(genTableID) == false)
@@ -156,11 +346,10 @@ public enum LootManager {
//gets the 1-320 roll for this mob //gets the 1-320 roll for this mob
int itemTableRoll = 0; int itemTableRoll = 0;
int objectType = mob.getObjectType().ordinal();
if(mob.getObjectType().ordinal() == 52) { //52 = player character if(mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{ } else{
itemTableRoll = TableRoll(mob.level, inHotzone); itemTableRoll = TableRoll(mob.level);
} }
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll); ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
if (tableRow == null) if (tableRow == null)
@@ -172,13 +361,23 @@ public enum LootManager {
return null; return null;
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
if(ThreadLocalRandom.current().nextInt(1,101) < 91)
return null; // cut down world drops rates of resources by 90%
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1); int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false); return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
} }
if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.RUNE)){
int randomRune = rollRandomItem(itemTableId);
if(randomRune != 0) {
itemUUID = randomRune;
}
} else if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.CONTRACT)){
int randomContract = rollRandomItem(itemTableId);
if(randomContract != 0) {
itemUUID = randomContract;
}
}
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
Enum.ItemType outType = outItem.getItemBase().getType();
if(selectedRow.pModTable != 0){ if(selectedRow.pModTable != 0){
try { try {
@@ -196,6 +395,12 @@ public enum LootManager {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName()); Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
} }
} }
if(outItem.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || outItem.getItemBase().getType().equals(Enum.ItemType.RUNE)){
if(ThreadLocalRandom.current().nextInt(1,101) < 66)
return null; // cut down world drops rates of resources by 65%
}
return outItem; return outItem;
} }
@@ -216,7 +421,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) { if(mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{ } else{
prefixTableRoll = TableRoll(mob.level, inHotzone); prefixTableRoll = TableRoll(mob.level);
} }
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll); ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@@ -248,7 +453,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) { if(mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{ } else{
suffixTableRoll = TableRoll(mob.level, inHotzone); suffixTableRoll = TableRoll(mob.level);
} }
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll); ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@@ -263,23 +468,36 @@ public enum LootManager {
return inItem; return inItem;
} }
public static int TableRoll(int mobLevel, Boolean inHotzone) { public static int TableRoll(int mobLevel) {
if (mobLevel > 65) int rank = (int)(mobLevel * 0.1f);
mobLevel = 65; int min = 50;
int max = 100;
int max = (int) (4.882 * mobLevel + 127.0); switch(rank){
case 1:
if (max > 319) min = 200;
max = 319; max = 250;
break;
int min = (int) (4.469 * mobLevel - 3.469); case 2:
min = 210;
if (min < 70) max = 275;
min = 70; break;
case 3:
if (inHotzone) min = 220;
min += mobLevel; max = 300;
break;
case 4:
min = 230;
max = 320;
break;
case 5:
case 6:
case 7:
case 8:
min = 240;
max = 320;
break;
}
int roll = ThreadLocalRandom.current().nextInt(min, max + 1); int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
@@ -299,12 +517,7 @@ public enum LootManager {
int high = bse.highGold; int high = bse.highGold;
int low = bse.lowGold; int low = bse.lowGold;
int gold = ThreadLocalRandom.current().nextInt(low, high + 1); int gold = (int) (ThreadLocalRandom.current().nextInt(low, high + 1) * NORMAL_GOLD_RATE);
if (inHotzone == true)
gold = (int) (gold * HOTZONE_GOLD_RATE);
else
gold = (int) (gold * NORMAL_GOLD_RATE);
if (gold > 0) { if (gold > 0) {
MobLoot goldAmount = new MobLoot(mob, gold); MobLoot goldAmount = new MobLoot(mob, gold);
@@ -315,47 +528,63 @@ public enum LootManager {
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) { public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
try { MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
if(toAdd != null){
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone); ItemBase ib = toAdd.getItemBase();
switch(ib.getType()){
if (toAdd != null) case CONTRACT:
mob.getCharItemManager().addItemToInventory(toAdd); case RUNE:
case RESOURCE:
} catch (Exception e) { return;
//TODO chase down loot generation error, affects roughly 2% of drops }
int i = 0; toAdd.setIsID(true);
mob.getCharItemManager().addItemToInventory(toAdd);
} }
} }
public static void GenerateEquipmentDrop(Mob mob) { public static void GenerateEquipmentDrop(Mob mob) {
if(mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard)) if (mob == null || mob.getSafeZone())
return; // safehold guards don't drop their equipment return; // no equipment to drop in safezones
if(mob.StrongholdGuardian || mob.StrongholdCommander || mob.StrongholdEpic)
return; // stronghold mobs don't drop equipment
//do equipment here //do equipment here
int dropCount = 0; if (mob.getEquip() != null) {
if (mob.getEquip() != null) boolean isVorg = false;
for (MobEquipment me : mob.getEquip().values()) { for (MobEquipment me : mob.getEquip().values()) {
if (me.getDropChance() == 0) if (me.getDropChance() == 0)
continue; continue;
String name = me.getItemBase().getName().toLowerCase();
if (name.contains("vorgrim legionnaire's") || name.contains("vorgrim auxiliary's") ||name.contains("bellugh nuathal") || name.contains("crimson circle"))
isVorg = true;
if(isVorg && !mob.isDropper){
continue;
}
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
float dropChance = me.getDropChance() * 100; float dropChance = me.getDropChance() * 100;
ItemBase itemBase = me.getItemBase();
if(isVorg) {
mob.spawnTime = ThreadLocalRandom.current().nextInt(300, 2700);
dropChance = 10;
itemBase = getRandomVorg(itemBase);
}
if (equipmentRoll > dropChance) if (equipmentRoll > dropChance)
continue; continue;
MobLoot ml = new MobLoot(mob, me.getItemBase(), false); MobLoot ml = new MobLoot(mob, itemBase, false);
if (ml != null && dropCount < 1) { ml.setIsID(true);
ml.setIsID(true); ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1)); mob.getCharItemManager().addItemToInventory(ml);
mob.getCharItemManager().addItemToInventory(ml);
dropCount = 1;
//break; // Exit on first successful roll.
}
} }
}
} }
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) { public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
@@ -369,8 +598,11 @@ public enum LootManager {
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
if (lootItem != null) if (lootItem != null) {
mob.getCharItemManager().addItemToInventory(lootItem); mob.getCharItemManager().addItemToInventory(lootItem);
if(lootItem.getItemBase().isDiscRune() && !Mob.discDroppers.contains(mob))
Mob.AddDiscDropper(mob);
}
} }
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) { public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
@@ -394,12 +626,12 @@ public enum LootManager {
//check if player owns the gift he is trying to open //check if player owns the gift he is trying to open
if (itemMan.doesCharOwnThisItem(gift.getObjectUUID()) == false) if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
return; return;
//roll 1-100 for the gen table selection //roll 1-100 for the gen table selection
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); int genRoll = ThreadLocalRandom.current().nextInt(94, 100) + 1;
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE); GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
if(selectedRow == null) if(selectedRow == null)
@@ -415,45 +647,276 @@ public enum LootManager {
//create the item from the table, quantity is always 1 //create the item from the table, quantity is always 1
MobLoot winnings = new MobLoot(playerCharacter, ItemBase.getItemBase(selectedItem.cacheID), 1, false); ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID);
if(ib.getUUID() == Warehouse.coalIB.getUUID()){
//no more coal, give gold instead
if (itemMan.getGoldInventory().getNumOfItems() + 250000 > 10000000) {
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
return;
}
itemMan.addGoldToInventory(250000,false);
itemMan.updateInventory();
}else {
MobLoot winnings = new MobLoot(playerCharacter, ib, 1, false);
if (winnings == null) if (winnings == null)
return; return;
//early exit if the inventory of the player will not old the item //early exit if the inventory of the player will not hold the item
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) { if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21); ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
return; return;
}
//determine if the winning item needs a prefix
if (selectedRow.pModTable != 0) {
int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
if (prefix != null)
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
}
//determine if the winning item needs a suffix
if (selectedRow.sModTable != 0) {
int suffixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
if (suffix != null)
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
}
winnings.setIsID(true);
//remove gift from inventory
itemMan.consume(gift);
//add winnings to player inventory
Item playerWinnings = winnings.promoteToItem(playerCharacter);
itemMan.addItemToInventory(playerWinnings);
itemMan.updateInventory();
}
}
public static int rollRandomItem(int itemTable){
int returnedID = ItemTableEntry.getRandomItem(itemTable);
return returnedID;
}
public static ItemBase getRandomVorg(ItemBase itemBase){
int roll = 0;
if(vorg_ha_uuids.contains(itemBase.getUUID())) {
roll = ThreadLocalRandom.current().nextInt(0, 10);
switch (roll) {
case 1:
return ItemBase.getItemBase(vorg_ha_uuids.get(0));
case 2:
return ItemBase.getItemBase(vorg_ha_uuids.get(1));
case 3:
return ItemBase.getItemBase(vorg_ha_uuids.get(2));
case 4:
return ItemBase.getItemBase(vorg_ha_uuids.get(3));
case 5:
return ItemBase.getItemBase(vorg_ha_uuids.get(4));
case 6:
return ItemBase.getItemBase(vorg_ha_uuids.get(5));
case 7:
return ItemBase.getItemBase(vorg_ha_uuids.get(6));
case 8:
return ItemBase.getItemBase(vorg_ha_uuids.get(7));
default:
return ItemBase.getItemBase(vorg_ha_uuids.get(8));
}
} }
//determine if the winning item needs a prefix if(vorg_ma_uuids.contains(itemBase.getUUID())) {
roll = ThreadLocalRandom.current().nextInt(0, 10);
if(selectedRow.pModTable != 0){ switch (roll) {
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1); case 1:
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll); return ItemBase.getItemBase(vorg_ma_uuids.get(0));
if(prefix != null) case 2:
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true); return ItemBase.getItemBase(vorg_ma_uuids.get(1));
case 3:
return ItemBase.getItemBase(vorg_ma_uuids.get(2));
case 4:
return ItemBase.getItemBase(vorg_ma_uuids.get(3));
case 5:
return ItemBase.getItemBase(vorg_ma_uuids.get(4));
case 6:
return ItemBase.getItemBase(vorg_ma_uuids.get(5));
case 7:
return ItemBase.getItemBase(vorg_ma_uuids.get(6));
default:
return ItemBase.getItemBase(vorg_ma_uuids.get(7));
}
} }
//determine if the winning item needs a suffix if(vorg_la_uuids.contains(itemBase.getUUID())) {
roll = ThreadLocalRandom.current().nextInt(0, 10);
if(selectedRow.sModTable != 0){ switch (roll) {
int suffixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1); case 1:
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll); return ItemBase.getItemBase(vorg_la_uuids.get(0));
if (suffix != null) case 2:
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true); return ItemBase.getItemBase(vorg_la_uuids.get(1));
case 3:
return ItemBase.getItemBase(vorg_la_uuids.get(2));
case 4:
return ItemBase.getItemBase(vorg_la_uuids.get(3));
case 5:
return ItemBase.getItemBase(vorg_la_uuids.get(4));
case 6:
return ItemBase.getItemBase(vorg_la_uuids.get(5));
case 7:
return ItemBase.getItemBase(vorg_la_uuids.get(6));
default:
return ItemBase.getItemBase(vorg_la_uuids.get(7));
}
} }
winnings.setIsID(true);
//remove gift from inventory if(vorg_cloth_uuids.contains(itemBase.getUUID())) {
roll = ThreadLocalRandom.current().nextInt(0, 10);
switch (roll) {
case 1:
return ItemBase.getItemBase(vorg_cloth_uuids.get(0));
case 2:
return ItemBase.getItemBase(vorg_cloth_uuids.get(1));
case 3:
return ItemBase.getItemBase(vorg_cloth_uuids.get(2));
case 4:
return ItemBase.getItemBase(vorg_cloth_uuids.get(3));
default:
return ItemBase.getItemBase(vorg_cloth_uuids.get(4));
}
}
itemMan.consume(gift); return null;
}
//add winnings to player inventory public static void DropPresent(Mob mob){
int random = 971049 + ThreadLocalRandom.current().nextInt(24);
if (random > 971071)
random = 971071;
Item playerWinnings = winnings.promoteToItem(playerCharacter); ItemBase present = ItemBase.getItemBase(random);
itemMan.addItemToInventory(playerWinnings); if (present != null) {
itemMan.updateInventory(); MobLoot toAdd = new MobLoot(mob, present, true);
if (toAdd != null)
mob.getCharItemManager().addItemToInventory(toAdd);
}
}
public static void GenerateStrongholdLoot(Mob mob, boolean commander, boolean epic) {
mob.getCharItemManager().clearInventory();
int multiplier = 1;
if (commander)
multiplier = 2;
if(epic)
multiplier = 10;
int high = 125000;
int low = 50000;
int gold = ThreadLocalRandom.current().nextInt(low, high + 1) * multiplier;
if (gold > 0) {
MobLoot goldAmount = new MobLoot(mob, gold);
mob.getCharItemManager().addItemToInventory(goldAmount);
}
//present drop chance for all
if (ThreadLocalRandom.current().nextInt(100) < 35)
DropPresent(mob);
//random contract drop chance for all
if (ThreadLocalRandom.current().nextInt(100) < 40) {
int contractTableID = 250;
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
if (contractTableID > 259)
contractTableID = 659;
int id = rollRandomItem(contractTableID);
ItemBase ib = ItemBase.getItemBase(id);
if (ib != null) {
MobLoot contract = new MobLoot(mob, ib, true);
if (contract != null)
mob.getCharItemManager().addItemToInventory(contract);
}
}
//special commander drop chances
if (commander)
GenerateCommanderLoot(mob,false);
//special epic drop chances
if (epic) {
GenerateCommanderLoot(mob, true);
GenerateCommanderLoot(mob,false);
}
}
public static void GenerateCommanderLoot(Mob mob, boolean epic){
//present chance
if (ThreadLocalRandom.current().nextInt(100) < 25)
DropPresent(mob);
//present chance
if (ThreadLocalRandom.current().nextInt(100) < 25)
DropPresent(mob);
//chance for glass
if (ThreadLocalRandom.current().nextInt(100) < 75) {
int glassID = rollRandomItem(126);
ItemBase glassItem = ItemBase.getItemBase(glassID);
if (glassItem != null) {
MobLoot toAdd2 = new MobLoot(mob, glassItem, true);
if (toAdd2 != null)
mob.getCharItemManager().addItemToInventory(toAdd2);
}
}
//chance for disc
if (ThreadLocalRandom.current().nextInt(100) < 75) {
int discID = rollRandomItem(3202);
ItemBase discItem = ItemBase.getItemBase(discID);
if (discItem != null) {
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
if (toAdd3 != null)
mob.getCharItemManager().addItemToInventory(toAdd3);
}
}
//chance for stat rune
if (ThreadLocalRandom.current().nextInt(100) < 75) {
int runeID = rollRandomItem(3201);
ItemBase runeItem = ItemBase.getItemBase(runeID);
if (runeItem != null) {
MobLoot toAdd4 = new MobLoot(mob, runeItem, true);
if (toAdd4 != null)
mob.getCharItemManager().addItemToInventory(toAdd4);
}
}
if(epic){
int contractTableID = 250;
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
if (contractTableID > 259)
contractTableID = 659;
int id = rollRandomItem(contractTableID);
ItemBase ib = ItemBase.getItemBase(id);
if (ib != null) {
MobLoot contract = new MobLoot(mob, ib, true);
if (contract != null)
mob.getCharItemManager().addItemToInventory(contract);
}
}
} }
} }
+23 -121
View File
@@ -24,7 +24,7 @@ public enum MaintenanceManager {
public static void setMaintDateTime(Building building, LocalDateTime maintDate) { public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
building.maintDateTime = maintDate; building.maintDateTime = maintDate.withHour(1).withMinute(0).withSecond(0);
DbManager.BuildingQueries.updateMaintDate(building); DbManager.BuildingQueries.updateMaintDate(building);
} }
@@ -45,28 +45,19 @@ public enum MaintenanceManager {
// Deduct upkeep and build list of buildings // Deduct upkeep and build list of buildings
// which did not have funds available // which did not have funds available
try { for (Building building : maintList) {
for (Building building : maintList)
if (chargeUpkeep(building) == false)
derankList.add(building);
} catch (Exception e) {
Logger.error(e);
}
// Reset maintenance dates for these buildings
for (Building building : maintList) if (chargeUpkeep(building) == false)
setMaintDateTime(building, LocalDateTime.now().plusDays(7)); derankList.add(building);
else
// Derak or destroy buildings that did not setMaintDateTime(building, LocalDateTime.now().plusDays(7));
// have funds available.
try {
for (Building building : derankList)
building.destroyOrDerank(null);
} catch (Exception e) {
Logger.error(e);
} }
for (Building building : derankList) {
building.destroyOrDerank(null);
if(building.getRank() > 0)
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
}
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size()); Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
} }
@@ -103,6 +94,10 @@ public enum MaintenanceManager {
continue; continue;
} }
//only ToL pays maintenance
if(building.getBlueprint().getBuildingGroup() != null && !building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
continue;
// No maintenance on banestones omfg // No maintenance on banestones omfg
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE)) if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
@@ -127,9 +122,9 @@ public enum MaintenanceManager {
//no maintenance if day of week doesnt match //no maintenance if day of week doesnt match
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) { //if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
continue; // continue;
} //}
// Add building to maintenance queue // Add building to maintenance queue
maintList.add(building); maintList.add(building);
@@ -184,56 +179,15 @@ public enum MaintenanceManager {
if ((overDraft > 0)) if ((overDraft > 0))
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) && if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
(warehouse != null) && building.assetIsProtected() == true && (warehouse != null) && building.assetIsProtected() == true &&
(warehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) { (warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
hasFunds = true; hasFunds = true;
} }
// If this is an R8 tree, validate that we can // If this is an R8 tree, validate that we can
// cover the resources required // cover the resources required
if (building.getRank() == 8) {
hasResources = true;
if (warehouse == null)
hasResources = false;
else {
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (resourceValue < 1500)
hasResources = false;
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (resourceValue < 1500)
hasResources = false;
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (resourceValue < 5)
hasResources = false;
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (resourceValue < 5)
hasResources = false;
}
}
// Validation completed but has failed. We can derank
// the target building and early exit
if ((hasFunds == false) ||
((building.getRank() == 8) && !hasResources)) {
// Add cash back to strongbox for lost rank if the building isn't being destroyed
// and it's not an R8 deranking
if ((building.getRank() > 1) && (building.getRank() < 8)) {
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
}
if (hasFunds == false) {
return false; // Early exit for having failed to meet maintenance return false; // Early exit for having failed to meet maintenance
} }
@@ -247,69 +201,17 @@ public enum MaintenanceManager {
if (overDraft > 0) { if (overDraft > 0) {
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7)); resourceValue = warehouse.getResources().get(Warehouse.goldIB);
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) { if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - overDraft); warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft);
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft); warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
} else { } else {
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true; return true;
} }
} }
// Early exit as we're done if we're not an R8 tree
if (building.getRank() < 8)
return true;
// Now for the resources if it's an R8 tree
// Withdraw Stone
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 1500);
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
} else {
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true;
}
// Withdraw Lumber
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 1500);
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
} else {
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true;
}
// Withdraw Galvor
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 5);
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
} else {
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true;
}
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 5);
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
} else {
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
}
return true; return true;
} }
+40 -22
View File
@@ -67,8 +67,10 @@ public enum MovementManager {
return; return;
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) { if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
if (((PlayerCharacter) toMove).isCasting()) if (((PlayerCharacter) toMove).isCasting()) {
((PlayerCharacter) toMove).update(); ((PlayerCharacter) toMove).updateLocation();
((PlayerCharacter) toMove).updateMovementState();
}
} }
@@ -96,7 +98,7 @@ public enum MovementManager {
if (!toMove.isMoving()) if (!toMove.isMoving())
toMove.resetLastSetLocUpdate(); toMove.resetLastSetLocUpdate();
else else
toMove.update(); toMove.update(false);
// Update movement for the player // Update movement for the player
@@ -116,8 +118,8 @@ public enum MovementManager {
// if inside a building, convert both locations from the building local reference frame to the world reference frame // if inside a building, convert both locations from the building local reference frame to the world reference frame
if (msg.getInBuildingUUID() > 0) { if (msg.getTargetID() > 0) {
Building building = BuildingManager.getBuildingFromCache(msg.getInBuildingUUID()); Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
if (building != null) { if (building != null) {
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation)); Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
@@ -128,8 +130,8 @@ public enum MovementManager {
// } // }
// else { // else {
toMove.setInBuilding(msg.getInBuilding()); toMove.setInBuilding(msg.getInBuilding());
toMove.setInFloorID(msg.getInBuildingFloor()); toMove.setInFloorID(msg.getUnknown01());
toMove.setInBuildingID(msg.getInBuildingUUID()); toMove.setInBuildingID(msg.getTargetID());
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc())); msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) { if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
@@ -174,9 +176,9 @@ public enum MovementManager {
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc())); msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation)); msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
msg.setInBuilding(toMove.region.level); msg.setInBuilding(toMove.region.level);
msg.setInBuildingFloor(toMove.region.room); msg.setUnknown01(toMove.region.room);
msg.setStartLocType(GameObjectType.Building.ordinal()); msg.setTargetType(GameObjectType.Building.ordinal());
msg.setInBuildingUUID(regionBuilding.getObjectUUID()); msg.setTargetID(regionBuilding.getObjectUUID());
} }
} else { } else {
@@ -185,8 +187,8 @@ public enum MovementManager {
toMove.setInBuilding(-1); toMove.setInBuilding(-1);
msg.setStartCoord(toMove.getLoc()); msg.setStartCoord(toMove.getLoc());
msg.setEndCoord(endLocation); msg.setEndCoord(endLocation);
msg.setStartLocType(0); msg.setTargetType(0);
msg.setInBuildingUUID(0); msg.setTargetID(0);
} }
//checks sync between character and server, if out of sync, teleport player to original position and return. //checks sync between character and server, if out of sync, teleport player to original position and return.
@@ -233,7 +235,7 @@ public enum MovementManager {
toMove.cancelOnMove(); toMove.cancelOnMove();
//cancel any attacks for manual move. //cancel any attacks for manual move.
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getInitiatedFromAttack() == 0) if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
toMove.setCombatTarget(null); toMove.setCombatTarget(null);
@@ -267,7 +269,7 @@ public enum MovementManager {
Zone serverZone = null; Zone serverZone = null;
serverZone = ZoneManager.findSmallestZone(player.getLoc()); serverZone = ZoneManager.findSmallestZone(player.getLoc());
cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.playerCityUUID); cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.getPlayerCityUUID());
// Do not send group messages if player is on grid // Do not send group messages if player is on grid
@@ -351,7 +353,7 @@ public enum MovementManager {
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ()); ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
//Send run/walk/sit/stand to tell the client we are flying / landing etc //Send run/walk/sit/stand to tell the client we are flying / landing etc
ac.update(); ac.update(false);
ac.stopMovement(ac.getLoc()); ac.stopMovement(ac.getLoc());
if (ac.isAlive()) if (ac.isAlive())
MovementManager.sendRWSSMsg(ac); MovementManager.sendRWSSMsg(ac);
@@ -408,7 +410,9 @@ public enum MovementManager {
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None)) if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
continue; continue;
member.update(); //member.update(false);
member.updateLocation();
member.updateMovementState();
// All checks passed, let's move the player // All checks passed, let's move the player
@@ -464,20 +468,34 @@ public enum MovementManager {
} }
} }
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc) { public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
if (targetLoc == null) if (targetLoc == null)
return; return;
teleporter.stopMovement(targetLoc);
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc()); Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
teleporter.setLoc(targetLoc);
teleporter.stopMovement(targetLoc);
teleporter.setRegion(region);
//mobs ignore region sets for now.
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
teleporter.setInBuildingID(0);
teleporter.setInBuilding(-1);
teleporter.setInFloorID(-1);
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
return;
}
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
//we shouldnt need to send teleport message to new area, as loadjob should pick it up.
// DispatchMessage.dispatchMsgToInterestArea(teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter)) if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter))
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter); InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, teleporter.loc.getX(), teleporter.loc.getY(), teleporter.loc.getZ(), 0, -1, -1);
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
} }
private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) { private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) {
+163 -264
View File
@@ -10,7 +10,6 @@ import engine.net.DispatchMessage;
import engine.net.client.msg.PetMsg; import engine.net.client.msg.PetMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.RuneSkillAdjustEntry;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
@@ -24,6 +23,92 @@ public enum NPCManager {
NPC_MANAGER; NPC_MANAGER;
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>(); public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static void LoadAllRuneSets() {
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
}
public static void LoadAllBootySets() {
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
}
public static void applyRuneSetEffects(Mob mob) {
// Early exit
if (mob.runeSet == 0)
return;
//Apply all rune effects.
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
mob.isPlayerGuard = true;
}
// Only captains have contracts
if (mob.contract != null || mob.isPlayerGuard)
applyEffectsForRune(mob, 252621);
// Apply effects from RuneSet
if (mob.runeSet != 0)
for (int runeID : _runeSetMap.get(mob.runeSet))
applyEffectsForRune(mob, runeID);
// Not sure why but apply Warrior effects for some reason?
applyEffectsForRune(mob, 2518);
}
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
EffectsBase effectsBase;
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
// Race runes are in the runeset but not in runebase for some reason
if (sourceRune == null)
return;
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
if (effectsBase == null) {
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
continue;
}
//check to upgrade effects if needed.
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
if (mbe.getReqLvl() > (int) character.level)
continue;
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
if (eff == null)
continue;
//Current effect is a higher rank, dont apply.
if (eff.getTrains() > mbe.getRank())
continue;
//new effect is of a higher rank. remove old effect and apply new one.
eff.cancelJob();
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
} else {
if (mbe.getReqLvl() > (int) character.level)
continue;
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
}
}
}
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) { public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
necroPet.setCombatTarget(null); necroPet.setCombatTarget(null);
@@ -42,12 +127,10 @@ public enum NPCManager {
DbManager.removeFromCache(necroPet); DbManager.removeFromCache(necroPet);
PlayerCharacter petOwner = necroPet.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
if (petOwner != null) { if (petOwner != null) {
necroPet.setOwner(null);
necroPet.guardCaptain = null;
petOwner.setPet(null); petOwner.setPet(null);
if (updateOwner == false) if (updateOwner == false)
@@ -119,6 +202,78 @@ public enum NPCManager {
playerCharacter.necroPets.clear(); playerCharacter.necroPets.clear();
} }
public static void removeSiegeMinions(Mob mobile) {
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
if (mobile.isMoving()) {
mobile.stopMovement(mobile.getLoc());
if (toRemove.parentZone != null)
toRemove.parentZone.zoneMobSet.remove(toRemove);
}
try {
toRemove.clearEffects();
} catch (Exception e) {
Logger.error(e.getMessage());
}
if (toRemove.parentZone != null)
toRemove.parentZone.zoneMobSet.remove(toRemove);
WorldGrid.RemoveWorldObject(toRemove);
WorldGrid.removeObject(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
}
}
}
public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
// Remove npc from it's building
try {
mobile.clearEffects();
} catch (Exception e) {
Logger.error(e.getMessage());
}
if (mobile.parentZone != null)
mobile.parentZone.zoneMobSet.remove(mobile);
if (building != null) {
building.getHirelings().remove(mobile);
removeSiegeMinions(mobile);
}
// Delete npc from database
if (DbManager.MobQueries.DELETE_MOB(mobile) == 0)
return false;
// Remove npc from the simulation
mobile.removeFromCache();
DbManager.removeFromCache(mobile);
WorldGrid.RemoveWorldObject(mobile);
WorldGrid.removeObject(mobile);
return true;
}
public static void loadAllPirateNames() { public static void loadAllPirateNames() {
DbManager.NPCQueries.LOAD_PIRATE_NAMES(); DbManager.NPCQueries.LOAD_PIRATE_NAMES();
@@ -185,19 +340,10 @@ public enum NPCManager {
else else
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building); buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
// Override slot for siege engines //if (buildingSlot == -1)
//Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) { abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
Mob siegeMobile = (Mob) abstractCharacter;
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
}
if (buildingSlot == -1)
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
// Pets are regular mobiles not hirelings (Siege engines)
if (abstractCharacter.contract != null)
abstractCharacter.building.hirelings.addIfAbsent(abstractCharacter);
// Override bind and location for this npc derived // Override bind and location for this npc derived
// from BuildingManager slot location data. // from BuildingManager slot location data.
@@ -224,251 +370,4 @@ public enum NPCManager {
return buildingSlot; return buildingSlot;
} }
public static void AssignPatrolPoints(Mob mob) {
mob.patrolPoints = new ArrayList<>();
for (int i = 0; i < 5; ++i) {
float patrolRadius = mob.getSpawnRadius();
if (patrolRadius > 256)
patrolRadius = 256;
if (patrolRadius < 60)
patrolRadius = 60;
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
mob.patrolPoints.add(newPatrolPoint);
if (i == 1) {
mob.setLoc(newPatrolPoint);
mob.endLoc = newPatrolPoint;
}
}
}
public static void applyGuardStanceModifiers(Mob guard){
float damageModifier = 1;
float attackRatingModifier = 1;
float defenseModifier = 1;
float attackSpeedModifier = 1;
float powerDamageModifier = 1;
//handle stance modifiers for guard mob
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){
//apply rogue bonuses
attackRatingModifier += 0.5f;
defenseModifier += 0.5f;
damageModifier += 0.5f;
attackSpeedModifier -= 0.36f;
}else {
Integer contractID;
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
contractID = guard.guardCaptain.contract.getContractID();
} else{
contractID = guard.contract.getContractID();
}
if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()){
//apply mage offensive Stance
powerDamageModifier += 0.5f;
} else{
//apply fighter offensive stance
damageModifier += 0.5f;
attackSpeedModifier -= 0.36f;
}
}
guard.minDamageHandOne *= damageModifier;
guard.minDamageHandTwo *= damageModifier;
guard.maxDamageHandOne *= damageModifier;
guard.maxDamageHandTwo *= damageModifier;
guard.atrHandOne *= attackRatingModifier;
guard.atrHandTwo *= attackRatingModifier;
guard.defenseRating *= defenseModifier;
guard.speedHandOne *= attackSpeedModifier;
guard.speedHandTwo *= attackSpeedModifier;
//TODO figure out how to apply +50% powerdamage to mage guards
}
public static void setDamageAndSpeedForGuard(Mob guard){
float rankModifier = 1 + (guard.getRank() * 0.1f);
int primaryStat = 0;
if(guard.equip == null) {
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier);
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier);
guard.speedHandOne = 30.0f;
}else{
if(guard.equip.containsKey(1)){
//has main hand weapon
ItemBase weapon = guard.equip.get(1).getItemBase();
if(weapon.isStrBased())
primaryStat = guard.getStatStrCurrent();
else
primaryStat = guard.getStatDexCurrent();
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
guard.speedHandOne = weapon.getSpeed();
guard.rangeHandOne = weapon.getRange();
} else if(guard.equip.containsKey(2) && !guard.equip.get(2).getItemBase().isShield()){
//has off hand weapon
ItemBase weapon = guard.equip.get(2).getItemBase();
if(weapon.isStrBased())
primaryStat = guard.getStatStrCurrent();
else
primaryStat = guard.getStatDexCurrent();
guard.minDamageHandTwo = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
guard.maxDamageHandTwo = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
guard.speedHandTwo = weapon.getSpeed();
guard.rangeHandTwo = weapon.getRange();
} else {
primaryStat = guard.getStatStrCurrent();
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
guard.speedHandOne = 30.0f;
guard.rangeHandOne = 3;
}
}
}
public static void setDefenseForGuard(Mob guard){
int dexterity = guard.getStatDexCurrent();
if(dexterity < 1)
dexterity = 1;
int baseDef = guard.mobBase.getDefenseRating();
int armorDefense = 0;
for(MobEquipment equipped : guard.equip.values())
if(equipped.getItemBase().isArmor() || equipped.getItemBase().isShield())
armorDefense += equipped.getItemBase().getDefense();
guard.defenseRating = dexterity + baseDef + armorDefense;
}
public static void setAttackRatingForGuard(Mob guard) {
int strength = guard.getStatStrCurrent();
int baseAtr = guard.mobBase.getAttackRating();
if (guard.equip.get(1) != null)
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(1).getItemBase().getPercentRequired() * 4) + (guard.equip.get(1).getItemBase().getPercentRequired() * 3));
else if (guard.equip.get(2) != null && !guard.equip.get(2).getItemBase().isShield())
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(2).getItemBase().getPercentRequired() * 4) + (guard.equip.get(2).getItemBase().getPercentRequired() * 3));
else
guard.atrHandOne = baseAtr;
}
public static void setMaxHealthForGuard(Mob guard){
//values derived fom reading memory address for health on client when selecting player guards
switch(guard.getRank()){
default:
guard.healthMax = 750; //rank 1
break;
case 2:
guard.healthMax = 2082;
break;
case 3:
guard.healthMax = 2740;
break;
case 4:
guard.healthMax = 3414;
break;
case 5:
guard.healthMax = 4080;
break;
case 6:
guard.healthMax = 4746;
break;
case 7:
guard.healthMax = 5412;
break;
}
}
public static void applyMobbaseEffects(Mob mob) {
EffectsBase effectsBase;
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
if (effectsBase == null) {
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
continue;
}
//check to upgrade effects if needed.
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
if (mbe.getReqLvl() > (int) mob.level)
continue;
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
if (eff == null)
continue;
//Current effect is a higher rank, dont apply.
if (eff.getTrains() > mbe.getRank())
continue;
//new effect is of a higher rank. remove old effect and apply new one.
eff.cancelJob();
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
} else {
if (mbe.getReqLvl() > (int) mob.level)
continue;
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
}
}
}
public static void applyEquipmentResists(Mob mob){
if(mob.equip != null){
for(MobEquipment equipped : mob.equip.values()){
ItemBase itemBase = equipped.getItemBase();
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
}
}
}
}
public static void applyMobbaseSkill(Mob mob) {
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
if(baseSkill != null)
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
}
public static void applyRuneSkills(Mob mob, int runeID){
//load mob skill adjustments from mobbase rune
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
if(SkillsBase.getFromCache(entry.skill_type) == null)
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
if(skillBase == null)
continue;
if (entry.level <= mob.level)
if (mob.skills.containsKey(entry.name) == false)
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
else
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
}
}
public static void applyRunesForNPC(NPC npc){
npc.runes = new ArrayList<>();
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID());
npc.runes.add(shopkeeper);
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
for (int runeID : _runeSetMap.get(npc.runeSetID)) {
RuneBase rb = RuneBase.getRuneBase(runeID);
if(rb != null) {
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
npc.runes.add(toApply);
}
}
}
}
} }
+398 -75
View File
@@ -9,7 +9,8 @@
package engine.gameManager; package engine.gameManager;
import engine.Enum.*; import engine.Enum.*;
import engine.InterestManagement.Terrain; import engine.InterestManagement.HeightMap;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.db.handlers.dbEffectsBaseHandler; import engine.db.handlers.dbEffectsBaseHandler;
import engine.db.handlers.dbPowerHandler; import engine.db.handlers.dbPowerHandler;
@@ -53,10 +54,13 @@ public enum PowersManager {
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>(); public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>(); public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>(); public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers; public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
private static JobScheduler js; private static JobScheduler js;
private PowersManager() {
}
public static void initPowersManager(boolean fullPowersLoad) { public static void initPowersManager(boolean fullPowersLoad) {
if (fullPowersLoad) if (fullPowersLoad)
@@ -100,16 +104,6 @@ public enum PowersManager {
} }
} }
public static ArrayList<RunePowerEntry> getPowersForRune(int rune_id) {
ArrayList<RunePowerEntry> powerEntries = PowersManager._allRunePowers.get(rune_id);
if (powerEntries == null)
powerEntries = new ArrayList<>();
return powerEntries;
}
// This pre-loads all powers and effects // This pre-loads all powers and effects
public static void InitializePowers() { public static void InitializePowers() {
@@ -170,6 +164,22 @@ public enum PowersManager {
public static void usePower(final PerformActionMsg msg, ClientConnection origin, public static void usePower(final PerformActionMsg msg, ClientConnection origin,
boolean sendCastToSelf) { boolean sendCastToSelf) {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
if(pc == null)
return;
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
CombatManager.toggleSit(false,origin);
if(pc.isMoving())
pc.stopMovement(pc.getMovementLoc());
if(msg.getPowerUsedID() == 429429978){
applyPower(origin.getPlayerCharacter(),origin.getPlayerCharacter(),origin.getPlayerCharacter().getLoc(),429429978,msg.getNumTrains(),false);
return;
}
if (usePowerA(msg, origin, sendCastToSelf)) { if (usePowerA(msg, origin, sendCastToSelf)) {
// Cast failed for some reason, reset timer // Cast failed for some reason, reset timer
@@ -178,13 +188,10 @@ public enum PowersManager {
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
// Send Fail to cast message // Send Fail to cast message
PlayerCharacter pc = SessionManager
.getPlayerCharacter(origin);
if (pc != null) { if (pc != null) {
sendPowerMsg(pc, 2, msg); sendPowerMsg(pc, 2, msg);
if (pc.isCasting()) { if (pc.isCasting()) {
pc.update(); pc.update(false);
} }
pc.setIsCasting(false); pc.setIsCasting(false);
@@ -199,7 +206,8 @@ public enum PowersManager {
msg.setUnknown04(1); msg.setUnknown04(1);
if (useMobPowerA(msg, caster)) { if (useMobPowerA(msg, caster)) {
//sendMobPowerMsg(caster,2,msg); //Lol wtf was i thinking sending msg's to mobs... ZZZZ if(pb.token == -1994153779)
InterestManager.setObjectDirty(caster);
} }
} }
@@ -212,6 +220,48 @@ public enum PowersManager {
boolean CSRCast = false; boolean CSRCast = false;
if(msg.getPowerUsedID() == 430628895) {
boolean failed = false;// group teleport
City city = ZoneManager.getCityAtLocation(playerCharacter.loc);
if (city == null) {
failed = true;
}//else{
// Bane bane = city.getBane();
// if (bane == null) {
// failed = true;
// }else{
// if(!bane.getSiegePhase().equals(SiegePhase.WAR)){
// failed = true;
// }
// }
//}
if(failed){
//check to see if we are at an active mine
Zone zone = ZoneManager.findSmallestZone(playerCharacter.loc);
if(zone != null){
Mine mine = null;
for(Building building : zone.zoneBuildingSet){
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)){
mine = Mine.getMineFromTower(building.getObjectUUID());
}
}
if(mine != null){
failed = !mine.isActive;
}
}
}
if(failed) {
playerCharacter.setIsCasting(false);
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
return false;
}
}
if (MBServerStatics.POWERS_DEBUG) { if (MBServerStatics.POWERS_DEBUG) {
ChatManager.chatSayInfo( ChatManager.chatSayInfo(
@@ -248,6 +298,7 @@ public enum PowersManager {
// get power // get power
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
if (pb == null) { if (pb == null) {
ChatManager.chatSayInfo(playerCharacter, ChatManager.chatSayInfo(playerCharacter,
"This power is not implemented yet."); "This power is not implemented yet.");
@@ -259,6 +310,35 @@ public enum PowersManager {
// return false; // return false;
} }
//check for movement buffs while flying
if(playerCharacter.isFlying()) {
switch(pb.token){
case 429005674:
case 429505739:
case 431054700:
case 428005600:
case 431610080:
case 427935608:
case 427857146:
case 427988218:
case 431854842:
case 421074170:
case 429611355:
case 428955899:
case 1794395699:
case 429428796:
case 1514898036:
ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff");
//resync stamina
playerCharacter.setStamina(playerCharacter.getStamina(), playerCharacter);
// Update all surrounding clients.
TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter);
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
return true;
}
}
if (playerCharacter.getLastPower() != null) if (playerCharacter.getLastPower() != null)
return true; return true;
@@ -266,17 +346,18 @@ public enum PowersManager {
// Check powers for normal users // Check powers for normal users
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) if(msg.getPowerUsedID() != 421084024) {
if (!playerCharacter.isCSR()) { if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
if (!MBServerStatics.POWERS_DEBUG) { if (!playerCharacter.isCSR()) {
// ChatManager.chatSayInfo(pc, "You may not cast that spell!"); if (!MBServerStatics.POWERS_DEBUG) {
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName());
return true;
}
} else
CSRCast = true;
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName());
return true;
}
} else
CSRCast = true;
}
// get numTrains for power // get numTrains for power
int trains = msg.getNumTrains(); int trains = msg.getNumTrains();
@@ -286,6 +367,14 @@ public enum PowersManager {
msg.setNumTrains(trains); msg.setNumTrains(trains);
} }
//double stack point values for some useless disc spells
switch(pb.token){
case 429420458: // BH eyes
case 429601664: // huntsman skin the beast
msg.setNumTrains(msg.getNumTrains() * 2);
break;
}
// can't go over total trains by player // can't go over total trains by player
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) { if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID()); CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
@@ -377,15 +466,20 @@ public enum PowersManager {
float range = pb.getRange(); float range = pb.getRange();
// verify target is in range // verify target is in range
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, target, range))
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
return true;
// verify target is valid type
if (!validateTarget(target, playerCharacter, pb))
return true;
}else{
pb.isSpell = false;
}
if (verifyInvalidRange(playerCharacter, target, range))
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
return true;
// verify target is valid type
if (!validateTarget(target, playerCharacter, pb))
return true;
if (AbstractWorldObject.IsAbstractCharacter(target)) if (AbstractWorldObject.IsAbstractCharacter(target))
@@ -416,6 +510,23 @@ public enum PowersManager {
} }
} }
if(!passed){
if (playerCharacter.getRace().getName().contains("Shade")) {
if(playerCharacter.getHidden() > 0){
switch(msg.getPowerUsedID()){
case -1851459567:
case 2094922127:
case -355707373:
case 246186475:
case 666419835:
case 1480354319:
passed = true;
break;
}
}
}
}
if (!passed) if (!passed)
return true; return true;
} }
@@ -494,7 +605,6 @@ public enum PowersManager {
// Validity checks passed, move on to casting spell // Validity checks passed, move on to casting spell
//get caster's live counter //get caster's live counter
int casterLiveCounter = playerCharacter.getLiveCounter(); int casterLiveCounter = playerCharacter.getLiveCounter();
// run recycle job for when cast is available again, don't bother adding the timer for CSRs // run recycle job for when cast is available again, don't bother adding the timer for CSRs
if (time > 0) { if (time > 0) {
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg); FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
@@ -521,7 +631,7 @@ public enum PowersManager {
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up) // make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) { if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
playerCharacter.update(); playerCharacter.update(false);
playerCharacter.setSit(false); playerCharacter.setSit(false);
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter); UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
@@ -529,10 +639,12 @@ public enum PowersManager {
} }
// update cast (use skill) fail condition // update cast (use skill) fail condition
playerCharacter.cancelOnCast(); if(pb.token != 429396028 && pb.breaksForm) {
playerCharacter.cancelOnCast();
}
// update castSpell (use spell) fail condition if spell // update castSpell (use spell) fail condition if spell
if (pb.isSpell()) if (pb.isSpell() && pb.breaksForm)
playerCharacter.cancelOnSpell(); playerCharacter.cancelOnSpell();
// get cast time in ms. // get cast time in ms.
@@ -542,13 +654,12 @@ public enum PowersManager {
if (time > 100) { if (time > 100) {
playerCharacter.update(); playerCharacter.update(false);
playerCharacter.setIsCasting(true); playerCharacter.setIsCasting(true);
} }
playerCharacter.setLastMovementState(playerCharacter.getMovementState()); playerCharacter.setLastMovementState(playerCharacter.getMovementState());
// run timer job to end cast // run timer job to end cast
if (time < 1) // run immediately if (time < 1) // run immediately
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter); finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
@@ -674,10 +785,11 @@ public enum PowersManager {
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up) // make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
// update cast (use skill) fail condition // update cast (use skill) fail condition
caster.cancelOnCast(); if(pb.breaksForm)
caster.cancelOnCast();
// update castSpell (use spell) fail condition if spell // update castSpell (use spell) fail condition if spell
if (pb.isSpell()) if (pb.isSpell() && pb.breaksForm)
caster.cancelOnSpell(); caster.cancelOnSpell();
// get cast time in ms. // get cast time in ms.
@@ -713,8 +825,38 @@ public enum PowersManager {
if (playerCharacter == null || msg == null) if (playerCharacter == null || msg == null)
return; return;
//handle sprint for bard sprint
if(msg.getPowerUsedID() == 429005674){
msg.setPowerUsedID(429611355);
}
//handle root and snare break for wildkin's chase
if(msg.getPowerUsedID() == 429494441) {
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
}
//handle power block portion for shade hide
if(playerCharacter.getRace().getName().contains("Shade")) {
if (msg.getPowerUsedID() == 429407306 || msg.getPowerUsedID() == 429495514) {
int trains = msg.getNumTrains() - 1;
if (trains < 1)
trains = 1;
applyPower(playerCharacter, playerCharacter, playerCharacter.loc, 429397210, trains, false);
playerCharacter.removeEffectBySource(EffectSourceType.Invisibility,40,true);
applyPower(playerCharacter, playerCharacter, playerCharacter.loc, msg.getPowerUsedID(), msg.getNumTrains(), false);
}
}
if(msg.getTargetType() == GameObjectType.PlayerCharacter.ordinal()) {
PlayerCharacter target = PlayerCharacter.getPlayerCharacter(msg.getTargetID());
if (msg.getPowerUsedID() == 429601664)
if(target.getPromotionClassID() != 2516)
PlayerCharacter.getPlayerCharacter(msg.getTargetID()).removeEffectBySource(EffectSourceType.Transform, msg.getNumTrains(), true);
}
if (playerCharacter.isCasting()) { if (playerCharacter.isCasting()) {
playerCharacter.update(); playerCharacter.update(false);
playerCharacter.updateStamRegen(-100); playerCharacter.updateStamRegen(-100);
} }
@@ -816,15 +958,16 @@ public enum PowersManager {
} }
float range = pb.getRange() + speedRange; float range = pb.getRange() + speedRange;
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, mainTarget, range)) { if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
sendPowerMsg(playerCharacter, 8, msg); sendPowerMsg(playerCharacter, 8, msg);
return; return;
}
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
} }
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
// TODO send message that target is out of range
} }
@@ -846,6 +989,8 @@ public enum PowersManager {
return; return;
} }
playerCharacter.setHateValue(pb.getHateValue(trains));
//Send Cast Message. //Send Cast Message.
// PerformActionMsg castMsg = new PerformActionMsg(msg); // PerformActionMsg castMsg = new PerformActionMsg(msg);
// castMsg.setNumTrains(9999); // castMsg.setNumTrains(9999);
@@ -896,6 +1041,8 @@ public enum PowersManager {
//Power is aiding a target, handle aggro if combat target is a Mob. //Power is aiding a target, handle aggro if combat target is a Mob.
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) { if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target; PlayerCharacter pcTarget = (PlayerCharacter) target;
if (!pb.isHarmful())
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
} }
// update target of used power timer // update target of used power timer
@@ -1236,7 +1383,7 @@ public enum PowersManager {
PlayerCharacter target = SessionManager PlayerCharacter target = SessionManager
.getPlayerCharacterByLowerCaseName(msg.getTargetName()); .getPlayerCharacterByLowerCaseName(msg.getTargetName());
if (target == null || target.equals(pc) || target.isCombat()) { if (target == null || target.equals(pc)) {
if (target == null) // Player not found. Send not found message if (target == null) // Player not found. Send not found message
ChatManager.chatInfoError(pc, ChatManager.chatInfoError(pc,
@@ -1340,6 +1487,16 @@ public enum PowersManager {
else else
duration = 45000; // Belgosh Summons, 45 seconds duration = 45000; // Belgosh Summons, 45 seconds
boolean enemiesNear = false;
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)){
PlayerCharacter playerCharacter = (PlayerCharacter)awo;
if(!playerCharacter.guild.getNation().equals(pc.guild.getNation())){
enemiesNear = true;
}
}
if(enemiesNear && !pc.isInSafeZone())
duration += 60000;
// Teleport to summoners location // Teleport to summoners location
FinishSummonsJob fsj = new FinishSummonsJob(source, pc); FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
@@ -1465,8 +1622,18 @@ public enum PowersManager {
} }
// create list of characters // create list of characters
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList( HashSet<AbstractCharacter> trackChars;
allTargets, playerCharacter, maxTargets); switch(msg.getPowerToken()){
case 431511776:
case 429578587:
case 429503360:
case 44106356:
trackChars = getTrackList(playerCharacter);
break;
default:
trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
break;
}
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg); TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
@@ -1479,6 +1646,30 @@ public enum PowersManager {
} }
public static HashSet<AbstractCharacter> getTrackList(PlayerCharacter tracker){
HashSet<AbstractCharacter> list = new HashSet<AbstractCharacter>();
HashSet<AbstractWorldObject> shortList = WorldGrid.getObjectsInRangePartial(tracker.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
HashSet<AbstractWorldObject> fullList = WorldGrid.getObjectsInRangePartial(tracker.loc,1408, MBServerStatics.MASK_PLAYER);
ArrayList<Guild> guildsPresent = new ArrayList<>();
for(AbstractWorldObject awo : shortList){
PlayerCharacter pc = (PlayerCharacter)awo;
if(!guildsPresent.contains(pc.guild.getNation())){
guildsPresent.add(pc.guild.getNation());
}
}
for(AbstractWorldObject awo : fullList){
if(awo.equals(tracker))
continue;
PlayerCharacter pc = (PlayerCharacter)awo;
if(!pc.isAlive())
continue;
if(guildsPresent.contains(pc.guild.getNation()))
list.add(pc);
}
return list;
}
private static void sendRecyclePower(int token, ClientConnection origin) { private static void sendRecyclePower(int token, ClientConnection origin) {
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token); RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
@@ -1772,7 +1963,7 @@ public enum PowersManager {
} else { } else {
targetLoc = tl; targetLoc = tl;
try { try {
targetLoc = targetLoc.setY(Terrain.getWorldHeight(targetLoc)); //on ground targetLoc = targetLoc.setY(HeightMap.getWorldHeight(targetLoc)); //on ground
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
targetLoc = tl; targetLoc = tl;
@@ -1974,7 +2165,7 @@ public enum PowersManager {
} else { } else {
targetLoc = tl; targetLoc = tl;
try { try {
targetLoc = targetLoc.setY(Terrain.getWorldHeight(targetLoc)); //on ground targetLoc = targetLoc.setY(HeightMap.getWorldHeight(targetLoc)); //on ground
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} }
@@ -2192,7 +2383,7 @@ public enum PowersManager {
// set player is not casting for regens // set player is not casting for regens
if (pc.isCasting()) { if (pc.isCasting()) {
pc.update(); pc.update(false);
} }
pc.setIsCasting(false); pc.setIsCasting(false);
@@ -2244,28 +2435,26 @@ public enum PowersManager {
defense = 0f; defense = 0f;
// Get hit chance // Get hit chance
if (pc.getDebug(16)) { //if (pc.getDebug(16)) {
String smsg = "ATR: " + atr + ", Defense: " + defense; // String smsg = "ATR: " + atr + ", Defense: " + defense;
ChatManager.chatSystemInfo(pc, smsg); // ChatManager.chatSystemInfo(pc, smsg);
} //}
int chance; //int chance;
if (atr > defense || defense == 0) //if (atr > defense || defense == 0)
chance = 94; // chance = 94;
else { //else {
float dif = atr / defense; // float dif = atr / defense;
if (dif <= 0.8f) // if (dif <= 0.8f)
chance = 4; // chance = 4;
else // else
chance = ((int) (450 * (dif - 0.8f)) + 4); // chance = ((int) (450 * (dif - 0.8f)) + 4);
} //}
// calculate hit/miss // calculate hit/miss
int roll = ThreadLocalRandom.current().nextInt(100);
boolean disable = true; if (CombatManager.LandHit((int)atr,(int)defense)) {
if (roll < chance) {
// Hit, check if dodge kicked in // Hit, check if dodge kicked in
if (awo instanceof AbstractCharacter) { if (awo instanceof AbstractCharacter) {
AbstractCharacter tarAc = (AbstractCharacter) awo; AbstractCharacter tarAc = (AbstractCharacter) awo;
@@ -2277,6 +2466,13 @@ public enum PowersManager {
dodgeMsg.setTargetID(awo.getObjectUUID()); dodgeMsg.setTargetID(awo.getObjectUUID());
sendPowerMsg(pc, 4, dodgeMsg); sendPowerMsg(pc, 4, dodgeMsg);
return true; return true;
} else if (testPassive(pc, tarAc, "Block")) {
// Dodge fired, send dodge message
PerformActionMsg dodgeMsg = new PerformActionMsg(msg);
dodgeMsg.setTargetType(awo.getObjectType().ordinal());
dodgeMsg.setTargetID(awo.getObjectUUID());
sendPowerMsg(pc, 4, dodgeMsg);
return true;
} }
} }
return false; return false;
@@ -2324,7 +2520,12 @@ public enum PowersManager {
if (AbstractWorldObject.IsAbstractCharacter(awo)) { if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter tarAc = (AbstractCharacter) awo; AbstractCharacter tarAc = (AbstractCharacter) awo;
// Handle Dodge passive // Handle Dodge passive
return testPassive(caster, tarAc, "Dodge"); boolean passiveFired = false;
passiveFired = testPassive(caster, tarAc, "Dodge");
if(!passiveFired)
passiveFired = testPassive(caster, tarAc, "Block");
return passiveFired;
} }
return false; return false;
} else } else
@@ -2565,7 +2766,9 @@ public enum PowersManager {
} }
public static void cancelOnStun(AbstractCharacter ac) { public static void cancelOnStun(AbstractCharacter ac) {
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
//PlayerCharacter.GroundPlayer((PlayerCharacter)ac);
}
} }
private static PowersBase getLastPower(AbstractCharacter ac) { private static PowersBase getLastPower(AbstractCharacter ac) {
@@ -2711,6 +2914,126 @@ public enum PowersManager {
} }
} }
public static boolean breakForm(int token) {
switch (token) {
case 429505865:
case 429407561:
case 429492073:
case 429644123:
case 429393769:
case 429545819:
case 429426537:
case 429590377:
case 429508425:
case 429541193:
case 429573961:
case 427924330:
case 429402918:
case 429545688:
case 429005674:
case 429637823:
case 429590426:
case 428066972:
case 429441862:
case 431611756:
case 431578988:
case 429502506:
case 429398191:
case 429447384:
case 428892191:
case 431579167:
case 430977067:
case 429409100:
case 429441868:
case 429594877:
case 427908971:
case 683741153:
case 429770569:
case 429452379:
case 429605055:
case 429086971:
case 429443230:
case 429505400:
case 429492122:
case 429643992:
case 550062236:
case 429498252:
case 429611224:
case 429441834:
case 428918940:
case 429633739:
case 429633579:
case 429568043:
case 429048646:
case 428392639:
case 428425407:
case 429054168:
case 429021400:
case 428955864:
case 429119704:
case 428890328:
case 428923096:
case 429218008:
case 429086936:
case 428988632:
case 428688204:
case 429514603:
case 428924959:
case 429393818:
case 429720966:
case 428982463:
case 427933887:
case 429572287:
case 429501222:
case 430694431:
case 429436131:
case 430006124:
case 429611355:
case 428005600:
case 427935608:
case 428949695:
case 427988218:
case 429414616:
case 429496495:
case 429428796:
case 563795754:
case 428988217:
case 429432716:
case 428955899:
case 429393286:
case 550062220:
case 429495557:
case 429401278:
case 428377478:
case 429409094:
case 428191947:
case 429434474:
case 429403363:
case 429512920:
case 429419611:
case 429645676:
case 429602895:
case 429605071:
case 429592428:
case 429500010:
case 429406602:
case 429426586:
case 429633898:
case 550062212:
case 429994027:
case 430813227:
case 429928491:
case 430026795:
case 429517915:
case 431854842:
case 429767544:
case 429502507:
case 428398816:
case 429446315:
return false;
}
return true;
}
} }
+30 -15
View File
@@ -10,10 +10,7 @@ package engine.gameManager;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.objects.AbstractGameObject; import engine.objects.*;
import engine.objects.City;
import engine.objects.PlayerCharacter;
import engine.objects.Runegate;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.Connection; import java.sql.Connection;
@@ -33,7 +30,7 @@ public enum SimulationManager {
SERVERHEARTBEAT; SERVERHEARTBEAT;
private static final long CITY_PULSE = 2000; private static final long CITY_PULSE = 2000;
private static final long RUNEGATE_PULSE = 3000; private static final long RUNEGATE_PULSE = 1000;
private static final long UPDATE_PULSE = 1000; private static final long UPDATE_PULSE = 1000;
private static final long FlIGHT_PULSE = 100; private static final long FlIGHT_PULSE = 100;
public static Duration executionTime = Duration.ofNanos(1); public static Duration executionTime = Duration.ofNanos(1);
@@ -96,13 +93,10 @@ public enum SimulationManager {
} }
try { try {
if ((_updatePulseTime != 0) if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime))
&& (System.currentTimeMillis() > _updatePulseTime))
pulseUpdate(); pulseUpdate();
} catch (Exception e) { } catch (Exception e) {
Logger.error( Logger.error("Fatal error in Update Pulse: DISABLED");
"Fatal error in Update Pulse: DISABLED");
// _runegatePulseTime = 0;
} }
try { try {
@@ -116,9 +110,18 @@ public enum SimulationManager {
} }
try { try {
if ((_cityPulseTime != 0) if ((_cityPulseTime != 0) && (System.currentTimeMillis() > _cityPulseTime)) {
&& (System.currentTimeMillis() > _cityPulseTime)) try {
pulseCities(); pulseCities();
}catch(Exception e){
}
try {
ArenaManager.pulseArenas();
}catch(Exception e){
}
}
} catch (Exception e) { } catch (Exception e) {
Logger.error( Logger.error(
"Fatal error in City Pulse: DISABLED. Error Message : " "Fatal error in City Pulse: DISABLED. Error Message : "
@@ -154,7 +157,11 @@ public enum SimulationManager {
if (player == null) if (player == null)
continue; continue;
player.update(); try {
player.update(false);
}catch(Exception e){
}
} }
_updatePulseTime = System.currentTimeMillis() + 500; _updatePulseTime = System.currentTimeMillis() + 500;
@@ -203,8 +210,12 @@ public enum SimulationManager {
city = (City) cityObject; city = (City) cityObject;
city.onEnter(); city.onEnter();
} }
for(Mine mine : Mine.getMines()){
if(mine != null && mine.isActive)
mine.onEnter();
}
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE; _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
} }
/* /*
@@ -214,6 +225,10 @@ public enum SimulationManager {
private void pulseRunegates() { private void pulseRunegates() {
for (Runegate runegate : Runegate._runegates.values()) { for (Runegate runegate : Runegate._runegates.values()) {
for(Portal portal : runegate._portals)
if(!portal.isActive())
portal.activate(false);
runegate.collidePortals(); runegate.collidePortals();
} }
@@ -0,0 +1,347 @@
package engine.gameManager;
import engine.Enum;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom;
public class StrongholdManager {
public static void processStrongholds() {
ArrayList<Mine> mines = Mine.getMines();
//process strongholds selecting 3 randomly to become active
int count = 0;
while (count < 3) {
int random = ThreadLocalRandom.current().nextInt(1, mines.size()) - 1;
Mine mine = mines.get(random);
if (mine != null) {
if (!mine.isActive && !mine.isStronghold) {
StartStronghold(mine);
count++;
}
}
}
}
public static void StartStronghold(Mine mine){
//remove buildings
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
if(tower == null)
return;
mine.isStronghold = true;
mine.strongholdMobs = new ArrayList<>();
mine.oldBuildings = new HashMap<>();
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
for(Building building : mineZone.zoneBuildingSet){
mine.oldBuildings.put(building.getObjectUUID(),building.meshUUID);
building.setMeshUUID(407650);
building.setMeshScale(new Vector3f(0,0,0));
InterestManager.setObjectDirty(building);
WorldGrid.updateObject(building);
}
//update tower to become stronghold mesh
tower.setMeshUUID(getStrongholdMeshID(mine.getParentZone()));
tower.setMeshScale(new Vector3f(1,1,1));
InterestManager.setObjectDirty(tower);
WorldGrid.updateObject(tower);
//create elite mobs
for(int i = 0; i < mine.capSize * 2; i++){
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(tower.loc,30);
MobBase guardBase = MobBase.getMobBase(getStrongholdGuardianID(tower.meshUUID));
Mob guard = Mob.createStrongholdMob(guardBase.getLoadID(), loc, Guild.getErrantGuild(),true,mineZone,null,0, guardBase.getFirstName(),65);
if(guard != null){
guard.parentZone = mine.getParentZone();
guard.bindLoc = loc;
guard.setLoc(loc);
guard.StrongholdGuardian = true;
guard.equipmentSetID = getStrongholdMobEquipSetID(guard);
guard.runAfterLoad();
guard.setLevel((short)65);
guard.setResists(new Resists("Elite"));
guard.spawnTime = 1000000000;
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
mine.strongholdMobs.add(guard);
LootManager.GenerateStrongholdLoot(guard,false,false);
guard.healthMax = 12500;
guard.setHealth(guard.healthMax);
guard.maxDamageHandOne = 1550;
guard.minDamageHandOne = 750;
guard.atrHandOne = 1800;
guard.defenseRating = 2200;
guard.setFirstName("Elite Guardian");
InterestManager.setObjectDirty(guard);
WorldGrid.addObject(guard,loc.x,loc.z);
WorldGrid.updateObject(guard);
guard.stronghold = mine;
guard.mobPowers.clear();
guard.mobPowers.put(429399948,20); // find weakness
}
}
//create stronghold commander
Vector3fImmutable loc = tower.loc;
MobBase commanderBase = MobBase.getMobBase(getStrongholdCommanderID(tower.meshUUID));
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc,Guild.getErrantGuild(),true,mineZone,null,0, commanderBase.getFirstName(),75);
if(commander != null){
commander.parentZone = mine.getParentZone();
commander.bindLoc = loc;
commander.setLoc(loc);
commander.StrongholdCommander = true;
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
commander.runAfterLoad();
commander.setLevel((short)75);
commander.setResists(new Resists("Elite"));
commander.spawnTime = 1000000000;
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
commander.mobPowers.clear();
commander.mobPowers.put(429032838, 40); // gravechill
commander.mobPowers.put(429757701,20); // magebolt
commander.mobPowers.put(429121388,20); // blight
commander.mobPowers.put(431566891,20); // lightning bolt
commander.mobPowers.put(428716075,20); // fire bolt
commander.mobPowers.put(429010987,20); // ice bolt
mine.strongholdMobs.add(commander);
LootManager.GenerateStrongholdLoot(commander,true, false);
commander.healthMax = 50000;
commander.setHealth(commander.healthMax);
commander.maxDamageHandOne = 3500;
commander.minDamageHandOne = 1500;
commander.atrHandOne = 3500;
commander.defenseRating = 3500;
commander.setFirstName("Guardian Commander");
InterestManager.setObjectDirty(commander);
WorldGrid.addObject(commander,loc.x,loc.z);
WorldGrid.updateObject(commander);
commander.stronghold = mine;
}
mine.isActive = true;
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
tower.getBounds().setRegions(tower);
InterestManager.setObjectDirty(tower);
WorldGrid.updateObject(tower);
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Begun!");
Logger.info(mine.getZoneName() + "'s Stronghold Has Begun!");
}
public static void EndStronghold(Mine mine){
//restore the buildings
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
if(tower == null)
return;
mine.isStronghold = false;
//get rid of the mobs
for(Mob mob : mine.strongholdMobs) {
mob.despawn();
mob.removeFromCache();
DbManager.MobQueries.DELETE_MOB(mob);
}
//restore the buildings
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
for(Building building : mineZone.zoneBuildingSet){
if(mine.oldBuildings.containsKey(building.getObjectUUID())) {
building.setMeshUUID(mine.oldBuildings.get(building.getObjectUUID()));
building.setMeshScale(new Vector3f(1, 1, 1));
InterestManager.setObjectDirty(building);
WorldGrid.updateObject(building);
}
}
//update tower to become Mine Tower again
tower.setMeshUUID(1500100);
mine.isActive = false;
tower.setProtectionState(Enum.ProtectionState.NPC);
tower.getBounds().setRegions(tower);
InterestManager.setObjectDirty(tower);
WorldGrid.updateObject(tower);
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Concluded!");
Logger.info(mine.getZoneName() + "'s Stronghold Has Concluded!");
}
public static int getStrongholdMeshID(Zone parent){
while(!parent.isMacroZone()){
parent = parent.getParent();
if(parent.getName().equalsIgnoreCase("seafloor")){
return 0;
}
}
switch(parent.getObjectUUID()){
case 197:
case 234:
case 178:
case 122:
return 814000; //Frost Giant Hall (ICE)
case 968:
case 951:
case 313:
case 331:
return 5001500; // Lich Queens Keep (UNDEAD)
case 785:
case 761:
case 717:
case 737:
return 1306600; // Temple of the Dragon (DESERT)
case 353:
case 371:
case 388:
case 532:
return 564600; // Undead Lord's Keep (SWAMP)
case 550:
case 508:
case 475:
case 418:
return 1326600; // elven hall
case 437:
case 491:
case 590:
case 569:
return 602400;
case 824:
case 842:
case 632:
return 1600000; // chaos temple
}
return 456100; // small stockade
}
public static int getStrongholdGuardianID(int ID){
switch(ID){
case 814000:
return 253004; // Mountain Giant Raider Axe
case 5001500:
return 253008; // Vampire Spear Warrior
case 1306600:
return 253007; // Desert Orc Warrior
case 564600:
return 253010; // Kolthoss Warrior
case 1326600:
return 253005; //elven warrior
case 602400:
return 253009; // templar missionary
case 1600000:
return 253006; // scourger
}
return 13434; // human sword and board warrior
}
public static int getStrongholdEpicID(int ID){
switch(ID){
case 814000:
return 253023; // Mountain Giant Raider Axe
case 5001500:
return 253022; // Vampire Spear Warrior
case 1306600:
return 253021; // Desert Orc Warrior
case 564600:
return 253018; // Kolthoss Warrior
case 1326600:
return 253019; //elven warrior
case 602400:
return 253024; // templar missionary
case 1600000:
return 253020; // scourger
}
return 13434; // human sword and board warrior
}
public static int getStrongholdCommanderID(int ID){
switch(ID){
case 814000:
return 253017;
case 5001500:
return 253012;
case 1306600:
return 253016; // Desert Orc Xbow
case 564600:
return 253011; // xbow kolthoss
case 1326600:
return 253013; //elven bow warrior
case 602400:
return 253015; // dune giant with xbow
case 1600000:
return 253014; // barbator
}
return 13433;
}
public static int getStrongholdMobEquipSetID(Mob mob) {
if(mob.StrongholdGuardian){
return 6327;
}else{
return 10790;
}
}
public static void CheckToEndStronghold(Mine mine) {
boolean stillAlive = false;
for (Mob mob : mine.strongholdMobs)
if (mob.isAlive())
stillAlive = true;
if (!stillAlive) {
// Epic encounter
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
if (tower == null)
return;
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
Vector3fImmutable loc = tower.loc;
MobBase commanderBase = MobBase.getMobBase(getStrongholdEpicID(tower.meshUUID));
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc, Guild.getErrantGuild(), true, mineZone, null, 0, commanderBase.getFirstName(), 75);
if (commander != null) {
commander.parentZone = mine.getParentZone();
commander.bindLoc = loc;
commander.setLoc(loc);
commander.StrongholdEpic = true;
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
commander.runAfterLoad();
commander.setLevel((short) 85);
commander.setResists(new Resists("Elite"));
commander.spawnTime = 1000000000;
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
commander.mobPowers.clear();
commander.mobPowers.put(429032838, 40); // gravechill
commander.mobPowers.put(429757701,40); // magebolt
commander.mobPowers.put(429121388,40); // blight
commander.mobPowers.put(431566891,40); // lightning bolt
commander.mobPowers.put(428716075,40); // fire bolt
commander.mobPowers.put(429010987,40); // ice bolt
mine.strongholdMobs.add(commander);
LootManager.GenerateStrongholdLoot(commander, true, true);
commander.healthMax = 250000;
commander.setHealth(commander.healthMax);
commander.maxDamageHandOne = 5000;
commander.minDamageHandOne = 2500;
commander.atrHandOne = 5000;
commander.defenseRating = 3500;
commander.setFirstName("Defender of " + mine.getParentZone().getParent().getName());
InterestManager.setObjectDirty(commander);
WorldGrid.addObject(commander,loc.x,loc.z);
WorldGrid.updateObject(commander);
commander.stronghold = mine;
}
}
}
}
+195
View File
@@ -0,0 +1,195 @@
package engine.gameManager;
import engine.objects.Guild;
public class ZergManager {
public static float getCurrentMultiplier(int count, int maxCount){
switch(maxCount) {
case 3: return getMultiplier3Man(count);
case 5: return getMultiplier5Man(count);
case 10: return getMultiplier10Man(count);
case 20: return getMultiplier20Man(count);
case 30: return getMultiplier30Man(count);
case 40: return getMultiplier40Man(count);
default: return 1.0f; //unlimited
}
}
public static float getMultiplier3Man(int count) {
if(count < 4)
return 1.0f;
if(count > 6)
return 0.0f;
switch(count){
case 4: return 0.63f;
case 5: return 0.40f;
case 6: return 0.25f;
default: return 1.0f;
}
}
public static float getMultiplier5Man(int count) {
if(count < 6)
return 1.0f;
if(count > 10)
return 0.0f;
switch(count){
case 6: return 0.75f;
case 7: return 0.57f;
case 8: return 0.44f;
case 9: return 0.33f;
case 10: return 0.25f;
default: return 1.0f;
}
}
public static float getMultiplier10Man(int count) {
if(count < 11)
return 1.0f;
if(count > 20)
return 0.0f;
switch(count){
case 11: return 0.86f;
case 12: return 0.75f;
case 13: return 0.65f;
case 14: return 0.57f;
case 15: return 0.50f;
case 16: return 0.44f;
case 17: return 0.38f;
case 18: return 0.33f;
case 19: return 0.29f;
case 20: return 0.25f;
default: return 1.0f;
}
}
public static float getMultiplier20Man(int count) {
if(count < 21)
return 1.0f;
if(count > 40)
return 0.0f;
switch (count)
{
case 21: return 0.93f;
case 22: return 0.86f;
case 23: return 0.80f;
case 24: return 0.75f;
case 25: return 0.70f;
case 26: return 0.65f;
case 27: return 0.61f;
case 28: return 0.57f;
case 29: return 0.53f;
case 30: return 0.50f;
case 31: return 0.47f;
case 32: return 0.44f;
case 33: return 0.41f;
case 34: return 0.38f;
case 35: return 0.36f;
case 36: return 0.33f;
case 37: return 0.31f;
case 38: return 0.29f;
case 39: return 0.27f;
case 40: return 0.25f;
default: return 1.0f;
}
}
public static float getMultiplier30Man(int count) {
if(count < 31)
return 1.0f;
if(count > 60)
return 0.0f;
switch (count)
{
case 31: return 0.95f;
case 32: return 0.91f;
case 33: return 0.86f;
case 34: return 0.82f;
case 35: return 0.79f;
case 36: return 0.75f;
case 37: return 0.72f;
case 38: return 0.68f;
case 39: return 0.65f;
case 40: return 0.63f;
case 41: return 0.60f;
case 42: return 0.57f;
case 43: return 0.55f;
case 44: return 0.52f;
case 45: return 0.50f;
case 46: return 0.48f;
case 47: return 0.46f;
case 48: return 0.44f;
case 49: return 0.42f;
case 50: return 0.40f;
case 51: return 0.38f;
case 52: return 0.37f;
case 53: return 0.35f;
case 54: return 0.33f;
case 55: return 0.32f;
case 56: return 0.30f;
case 57: return 0.29f;
case 58: return 0.28f;
case 59: return 0.26f;
case 60: return 0.25f;
default: return 1.0f;
}
}
public static float getMultiplier40Man(int count) {
if(count < 41)
return 1.0f;
if(count > 80)
return 0.0f;
switch (count)
{
case 41: return 0.96f;
case 42: return 0.93f;
case 43: return 0.90f;
case 44: return 0.86f;
case 45: return 0.83f;
case 46: return 0.80f;
case 47: return 0.78f;
case 48: return 0.75f;
case 49: return 0.72f;
case 50: return 0.70f;
case 51: return 0.68f;
case 52: return 0.65f;
case 53: return 0.63f;
case 54: return 0.61f;
case 55: return 0.59f;
case 56: return 0.57f;
case 57: return 0.55f;
case 58: return 0.53f;
case 59: return 0.52f;
case 60: return 0.50f;
case 61: return 0.48f;
case 62: return 0.47f;
case 63: return 0.45f;
case 64: return 0.44f;
case 65: return 0.42f;
case 66: return 0.41f;
case 67: return 0.40f;
case 68: return 0.38f;
case 69: return 0.37f;
case 70: return 0.36f;
case 71: return 0.35f;
case 72: return 0.33f;
case 73: return 0.32f;
case 74: return 0.31f;
case 75: return 0.30f;
case 76: return 0.29f;
case 77: return 0.28f;
case 78: return 0.27f;
case 79: return 0.26f;
case 80: return 0.25f;
default: return 1.0f;
}
}
}
+92 -145
View File
@@ -9,7 +9,8 @@
package engine.gameManager; package engine.gameManager;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.Terrain; import engine.db.archive.CityRecord;
import engine.db.archive.DataWarehouse;
import engine.math.Bounds; import engine.math.Bounds;
import engine.math.Vector2f; import engine.math.Vector2f;
import engine.math.Vector3f; import engine.math.Vector3f;
@@ -17,16 +18,13 @@ import engine.math.Vector3fImmutable;
import engine.objects.Building; import engine.objects.Building;
import engine.objects.City; import engine.objects.City;
import engine.objects.Zone; import engine.objects.Zone;
import engine.objects.ZoneTemplate;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
/* /*
* Class contains methods and structures which * Class contains methods and structures which
@@ -36,8 +34,6 @@ public enum ZoneManager {
ZONEMANAGER; ZONEMANAGER;
public static HashMap<Integer, ZoneTemplate> _zone_templates = new HashMap<>();
public static final Set<Zone> macroZones = Collections.newSetFromMap(new ConcurrentHashMap<>()); public static final Set<Zone> macroZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
private static final ConcurrentHashMap<Integer, Zone> zonesByID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD); private static final ConcurrentHashMap<Integer, Zone> zonesByID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
private static final ConcurrentHashMap<Integer, Zone> zonesByUUID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD); private static final ConcurrentHashMap<Integer, Zone> zonesByUUID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
@@ -47,9 +43,9 @@ public enum ZoneManager {
public static Instant hotZoneLastUpdate; public static Instant hotZoneLastUpdate;
public static Zone hotZone = null; public static Zone hotZone = null;
public static int hotZoneCycle = 0; // Used with HOTZONE_DURATION from config. public static int hotZoneCycle = 0; // Used with HOTZONE_DURATION from config.
public static HashMap<Integer, Vector2f> _zone_size_data = new HashMap<>();
/* Instance variables */ /* Instance variables */
public static Zone seaFloor = null; private static Zone seaFloor = null;
// Find all zones coordinates fit into, starting with Sea Floor // Find all zones coordinates fit into, starting with Sea Floor
@@ -62,8 +58,8 @@ public enum ZoneManager {
if (zone != null) { if (zone != null) {
allIn.add(zone); allIn.add(zone);
while (zone.parent != null) { while (zone.getParent() != null) {
zone = zone.parent; zone = zone.getParent();
allIn.add(zone); allIn.add(zone);
} }
} }
@@ -72,7 +68,7 @@ public enum ZoneManager {
// Find smallest zone coordinates fit into. // Find smallest zone coordinates fit into.
public static Zone findSmallestZone(final Vector3fImmutable loc) { public static final Zone findSmallestZone(final Vector3fImmutable loc) {
Zone zone = ZoneManager.seaFloor; Zone zone = ZoneManager.seaFloor;
@@ -85,13 +81,13 @@ public enum ZoneManager {
childFound = false; childFound = false;
ArrayList<Zone> nodes = zone.nodes; ArrayList<Zone> nodes = zone.getNodes();
// Logger.info("soze", "" + nodes.size()); // Logger.info("soze", "" + nodes.size());
if (nodes != null) if (nodes != null)
for (Zone child : nodes) { for (Zone child : nodes) {
if (Bounds.collide(loc, child.bounds)) { if (Bounds.collide(loc, child.getBounds()) == true) {
zone = child; zone = child;
childFound = true; childFound = true;
break; break;
@@ -101,18 +97,14 @@ public enum ZoneManager {
return zone; return zone;
} }
// Returns the number of available hotZones public static void addZone(final int zoneID, final Zone zone) {
// remaining in this cycle (1am)
public static int availableHotZones() { ZoneManager.zonesByID.put(zoneID, zone);
int count = 0; ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
for (Zone zone : ZoneManager.macroZones) ZoneManager.zonesByName.put(zone.getName().toLowerCase(), zone);
if (ZoneManager.validHotZone(zone))
count = count + 1;
return count;
} }
// Resets the availability of hotZones // Resets the availability of hotZones
@@ -121,8 +113,8 @@ public enum ZoneManager {
public static void resetHotZones() { public static void resetHotZones() {
for (Zone zone : ZoneManager.macroZones) for (Zone zone : ZoneManager.macroZones)
if (zone.wasHotzonw) if (zone.hasBeenHotzone)
zone.wasHotzonw = false; zone.hasBeenHotzone = false;
} }
@@ -139,18 +131,18 @@ public enum ZoneManager {
return ZoneManager.zonesByName.get(zoneName); return ZoneManager.zonesByName.get(zoneName);
} }
public static Collection<Zone> getAllZones() { public static final Collection<Zone> getAllZones() {
return ZoneManager.zonesByUUID.values(); return ZoneManager.zonesByUUID.values();
} }
public static void setHotZone(final Zone zone) { public static final void setHotZone(final Zone zone) {
if (!zone.isMacroZone()) if (!zone.isMacroZone())
return; return;
ZoneManager.hotZone = zone; ZoneManager.hotZone = zone;
ZoneManager.hotZoneCycle = 1; // Used with HOTZONE_DURATION from config. ZoneManager.hotZoneCycle = 1; // Used with HOTZONE_DURATION from config.
zone.wasHotzonw = true; zone.hasBeenHotzone = true;
ZoneManager.hotZoneLastUpdate = LocalDateTime.now().withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant(); ZoneManager.hotZoneLastUpdate = LocalDateTime.now().withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant();
} }
@@ -160,32 +152,37 @@ public enum ZoneManager {
if (ZoneManager.hotZone == null) if (ZoneManager.hotZone == null)
return false; return false;
return (Bounds.collide(loc, ZoneManager.hotZone.bounds)); return (Bounds.collide(loc, ZoneManager.hotZone.getBounds()) == true);
} }
public static void populateZoneCollections(final Zone zone) { public static Zone getSeaFloor() {
return ZoneManager.seaFloor;
}
public static void setSeaFloor(final Zone value) {
ZoneManager.seaFloor = value;
}
public static final void populateWorldZones(final Zone zone) {
int loadNum = zone.getLoadNum();
// Zones are added to separate // Zones are added to separate
// collections for quick access // collections for quick access
// based upon their type. // based upon their type.
ZoneManager.zonesByID.put(zone.templateID, zone);
ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
ZoneManager.zonesByName.put(zone.zoneName.toLowerCase(), zone);
if (zone.isMacroZone()) { if (zone.isMacroZone()) {
addMacroZone(zone); addMacroZone(zone);
return; return;
} }
if (zone.guild_zone) {
ZoneManager.playerCityZones.add(zone); if (zone.isPlayerCity()) {
addPlayerCityZone(zone);
return; return;
} }
if (zone.isNPCCity) if (zone.isNPCCity())
addNPCCityZone(zone); addNPCCityZone(zone);
} }
@@ -195,114 +192,67 @@ public enum ZoneManager {
} }
private static void addNPCCityZone(final Zone zone) { private static void addNPCCityZone(final Zone zone) {
zone.isNPCCity = true; zone.setNPCCity(true);
ZoneManager.npcCityZones.add(zone); ZoneManager.npcCityZones.add(zone);
} }
public static final void generateAndSetRandomHotzone() { public static final void addPlayerCityZone(final Zone zone) {
zone.setPlayerCity(true);
Zone hotZone; ZoneManager.playerCityZones.add(zone);
ArrayList<Integer> zoneArray = new ArrayList<>();
if (ZoneManager.macroZones.isEmpty())
return;
// Reset hotZone availability if none are left.
if (ZoneManager.availableHotZones() == 0)
ZoneManager.resetHotZones();
for (Zone zone : ZoneManager.macroZones)
if (validHotZone(zone))
zoneArray.add(zone.getObjectUUID());
int entryIndex = ThreadLocalRandom.current().nextInt(zoneArray.size());
hotZone = ZoneManager.getZoneByUUID(zoneArray.get(entryIndex));
if (hotZone == null) {
Logger.error("Hotzone is null");
return;
}
ZoneManager.setHotZone(hotZone);
}
public static final boolean validHotZone(Zone zone) {
if (zone.peace_zone == (byte) 1)
return false; // no safe zone hotzones// if (this.hotzone == null)
if (zone.equals(ZoneManager.seaFloor))
return false;
if (zone.nodes.isEmpty())
return false;
//no duplicate hotZones
if (zone.wasHotzonw == true)
return false;
// Enforce min level
if (zone.min_level < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
return false;
if (ZoneManager.hotZone != null)
return ZoneManager.hotZone.getObjectUUID() != zone.getObjectUUID();
return true;
} }
// Converts world coordinates to coordinates local to a given zone. // Converts world coordinates to coordinates local to a given zone.
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector, public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
Zone zone) { Zone serverZone) {
Vector3fImmutable localCoords; Vector3fImmutable localCoords;
localCoords = new Vector3fImmutable(worldVector.x - zone.absX, localCoords = new Vector3fImmutable(worldVector.x - serverZone.absX,
worldVector.y - zone.absY, worldVector.z worldVector.y - serverZone.absY, worldVector.z
- zone.absZ); - serverZone.absZ);
return localCoords; return localCoords;
} }
public static Vector2f worldToZoneOffset(Vector3fImmutable worldLoc, public static Vector2f worldToZoneSpace(Vector3fImmutable worldVector,
Zone zone) { Zone serverZone) {
Vector2f zoneLoc;
zoneLoc = new Vector2f(worldLoc.x, worldLoc.z).subtract(zone.getLoc().x, zone.getLoc().z);
zoneLoc.y *= -1;
return zoneLoc;
}
public static Vector2f worldToTerrainSpace(Vector3fImmutable worldLoc,
Zone zone) {
Vector2f localCoords; Vector2f localCoords;
Vector2f zoneOrigin; Vector2f zoneOrigin;
// Top left corner of zone is calculated in world space by the center and it's extents. // Top left corner of zone is calculated in world space by the center and it's extents.
zoneOrigin = new Vector2f(zone.getLoc().x, zone.getLoc().z); zoneOrigin = new Vector2f(serverZone.getLoc().x, serverZone.getLoc().z);
zoneOrigin = zoneOrigin.subtract(new Vector2f(zone.bounds.getHalfExtents().x, zone.bounds.getHalfExtents().y)); zoneOrigin = zoneOrigin.subtract(new Vector2f(serverZone.getBounds().getHalfExtents().x, serverZone.getBounds().getHalfExtents().y));
// Local coordinate in world space translated to an offset from the calculated zone origin. // Local coordinate in world space translated to an offset from the calculated zone origin.
localCoords = new Vector2f(worldLoc.x, worldLoc.z); localCoords = new Vector2f(worldVector.x, worldVector.z);
localCoords = localCoords.subtract(zoneOrigin); localCoords = localCoords.subtract(zoneOrigin);
localCoords.setY((serverZone.getBounds().getHalfExtents().y * 2) - localCoords.y);
// TODO : Make sure this value does not go outside the zone's bounds.
return localCoords; return localCoords;
} }
// Converts local zone coordinates to world coordinates // Converts local zone coordinates to world coordinates
public static Vector3fImmutable localToWorld(Vector3fImmutable worldVector,
Zone serverZone) {
Vector3fImmutable worldCoords;
worldCoords = new Vector3fImmutable(worldVector.x + serverZone.absX,
worldVector.y + serverZone.absY, worldVector.z
+ serverZone.absZ);
return worldCoords;
}
/** /**
* Converts from local (relative to this building) to world. * Converts from local (relative to this building) to world.
@@ -318,10 +268,9 @@ public enum ZoneManager {
if (building.getBounds().getQuaternion() == null) if (building.getBounds().getQuaternion() == null)
return building.getLoc(); return building.getLoc();
// handle building rotation
Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion()); Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion());
// handle building rotation
// handle building translation // handle building translation
return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z); return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z);
@@ -331,10 +280,12 @@ public enum ZoneManager {
//used for regions, Building bounds not set yet. //used for regions, Building bounds not set yet.
public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) { public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) {
// handle building rotation // convert from SB rotation value to radians
Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion()); Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion());
// handle building rotation
// handle building translation // handle building translation
return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z)); return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z));
@@ -357,11 +308,13 @@ public enum ZoneManager {
public static City getCityAtLocation(Vector3fImmutable worldLoc) { public static City getCityAtLocation(Vector3fImmutable worldLoc) {
Zone currentZone; Zone currentZone;
ArrayList<Zone> zoneList;
City city;
currentZone = ZoneManager.findSmallestZone(worldLoc); currentZone = ZoneManager.findSmallestZone(worldLoc);
if (currentZone.guild_zone) if (currentZone.isPlayerCity())
return City.getCity(currentZone.playerCityUUID); return City.getCity(currentZone.getPlayerCityUUID());
return null; return null;
} }
@@ -384,16 +337,16 @@ public enum ZoneManager {
treeBounds = Bounds.borrow(); treeBounds = Bounds.borrow();
treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.halfExtents, Enum.CityBoundsType.PLACEMENT.halfExtents), 0.0f); treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.extents, Enum.CityBoundsType.PLACEMENT.extents), 0.0f);
zoneList = currentZone.nodes; zoneList = currentZone.getNodes();
for (Zone zone : zoneList) { for (Zone zone : zoneList) {
if (zone.isContinent()) if (zone.isContinent())
continue; continue;
if (Bounds.collide(treeBounds, zone.bounds, 0.0f)) if (Bounds.collide(treeBounds, zone.getBounds(), 0.0f))
validLocation = false; validLocation = false;
} }
@@ -401,36 +354,30 @@ public enum ZoneManager {
return validLocation; return validLocation;
} }
public static float calculateGlobalZoneHeight(Zone zone) { public static void loadCities(Zone zone) {
float worldAltitude = MBServerStatics.SEA_FLOOR_ALTITUDE; ArrayList<City> cities = DbManager.CityQueries.GET_CITIES_BY_ZONE(zone.getObjectUUID());
// Seafloor for (City city : cities) {
if (ZoneManager.seaFloor.equals(zone)) city.setParent(zone);
return worldAltitude; city.setObjectTypeMask(MBServerStatics.MASK_CITY);
city.setLoc(city.getLoc()); // huh?
// Children of seafloor //not player city, must be npc city..
if (ZoneManager.seaFloor.equals(zone.parent)) if (!zone.isPlayerCity())
return worldAltitude + zone.yOffset; zone.setNPCCity(true);
// return height from heightmap engine at zone location if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) {
worldAltitude = Terrain.getWorldHeight(zone.parent, zone.getLoc()); city.setHash();
// Add zone offset to value if (DataWarehouse.recordExists(Enum.DataRecordType.CITY, city.getObjectUUID()) == false) {
CityRecord cityRecord = CityRecord.borrow(city, Enum.RecordEventType.CREATE);
worldAltitude += zone.yOffset; DataWarehouse.pushToWarehouse(cityRecord);
}
return worldAltitude; }
} }
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
float localAltitude = Terrain.getWorldHeight(currentLoc);
Zone zone = findSmallestZone(currentLoc);
return localAltitude < zone.sea_level;
} }
} }
+1 -1
View File
@@ -68,7 +68,7 @@ public abstract class AbstractJob implements Runnable {
this.markStopRunTime(); this.markStopRunTime();
} }
protected abstract void doJob(); public abstract void doJob();
public void executeJob(String threadName) { public void executeJob(String threadName) {
this.workerID.set(threadName); this.workerID.set(threadName);
+1 -1
View File
@@ -17,7 +17,7 @@ public abstract class AbstractScheduleJob extends AbstractJob {
} }
@Override @Override
protected abstract void doJob(); public abstract void doJob();
public void cancelJob() { public void cancelJob() {
JobScheduler.getInstance().cancelScheduledJob(this); JobScheduler.getInstance().cancelScheduledJob(this);
+1 -1
View File
@@ -16,7 +16,7 @@ public class JobContainer implements Comparable<JobContainer> {
final long timeOfExecution; final long timeOfExecution;
final boolean noTimer; final boolean noTimer;
JobContainer(AbstractJob job, long timeOfExecution) { public JobContainer(AbstractJob job, long timeOfExecution) {
if (job == null) { if (job == null) {
throw new IllegalArgumentException("No 'null' jobs allowed."); throw new IllegalArgumentException("No 'null' jobs allowed.");
} }
+75
View File
@@ -0,0 +1,75 @@
package engine.job;
import engine.server.world.WorldServer;
import org.pmw.tinylog.Logger;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
public class JobThread implements Runnable {
private final AbstractJob currentJob;
private final ReentrantLock lock = new ReentrantLock();
private static Long nextThreadPrint;
public JobThread(AbstractJob job){
this.currentJob = job;
}
@Override
public void run() {
try {
if (this.currentJob != null) {
if (lock.tryLock(5, TimeUnit.SECONDS)) { // Timeout to prevent deadlock
try {
this.currentJob.doJob();
} finally {
lock.unlock();
}
} else {
Logger.warn("JobThread could not acquire lock in time, skipping job.");
}
}
} catch (Exception e) {
Logger.error(e);
}
}
public static void startJobThread(AbstractJob job){
JobThread jobThread = new JobThread(job);
Thread thread = new Thread(jobThread);
thread.setName("JOB THREAD: " + job.getWorkerID());
thread.start();
if(JobThread.nextThreadPrint == null){
JobThread.nextThreadPrint = System.currentTimeMillis();
}else{
if(JobThread.nextThreadPrint < System.currentTimeMillis()){
JobThread.tryPrintThreads();
JobThread.nextThreadPrint = System.currentTimeMillis() + 10000L;
}
}
}
public static void tryPrintThreads(){
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
while (rootGroup.getParent() != null) {
rootGroup = rootGroup.getParent();
}
// Estimate the number of threads
int activeThreads = rootGroup.activeCount();
// Create an array to hold the threads
Thread[] threads = new Thread[activeThreads];
// Get the active threads
rootGroup.enumerate(threads, true);
int availableThreads = Runtime.getRuntime().availableProcessors();
// Print the count
if(threads.length > 30)
Logger.info("Total threads in application: " + threads.length + " / " + availableThreads);
}
}
+6 -3
View File
@@ -58,10 +58,13 @@ public class JobWorker extends ControlledRunnable {
} else { } else {
// execute the new job.. // execute the new job..
this.currentJob.executeJob(this.getThreadName()); //this.currentJob.executeJob(this.getThreadName());
this.currentJob = null; if(this.currentJob != null) {
JobThread.startJobThread(this.currentJob);
this.currentJob = null;
}
} }
Thread.yield();
} }
return true; return true;
} }
+2 -2
View File
@@ -45,7 +45,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
} }
@Override @Override
protected abstract void doJob(); public abstract void doJob();
@Override @Override
protected abstract void _cancelJob(); protected abstract void _cancelJob();
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
} }
public void endEffect() { public void endEffect() {
if (this.eb == null) if (this.eb == null || this.power == null)
return; return;
this.eb.endEffect(this.source, this.target, this.trains, this.power, this); this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
} }
+1 -1
View File
@@ -29,7 +29,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
City city; City city;
+1 -1
View File
@@ -27,7 +27,7 @@ public class AttackJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
CombatManager.doCombat(this.source, slot); CombatManager.doCombat(this.source, slot);
} }
+1 -1
View File
@@ -24,7 +24,7 @@ public class BaneDefaultTimeJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
//bane already set. //bane already set.
if (this.bane.getLiveDate() != null) { if (this.bane.getLiveDate() != null) {
+1 -1
View File
@@ -97,7 +97,7 @@ public class BasicScheduledJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (execution == null) { if (execution == null) {
Logger.error("BasicScheduledJob executed with nothing to execute."); Logger.error("BasicScheduledJob executed with nothing to execute.");
return; return;
+1 -1
View File
@@ -22,7 +22,7 @@ public class BonusCalcJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.ac != null) { if (this.ac != null) {
this.ac.applyBonuses(); this.ac.applyBonuses();
+1 -1
View File
@@ -22,7 +22,7 @@ public class CSessionCleanupJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
SessionManager.cSessionCleanup(secKey); SessionManager.cSessionCleanup(secKey);
} }
} }
+1 -1
View File
@@ -27,7 +27,7 @@ public class ChangeAltitudeJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.ac != null) if (this.ac != null)
MovementManager.finishChangeAltitude(ac, targetAlt); MovementManager.finishChangeAltitude(ac, targetAlt);
} }
+1 -1
View File
@@ -36,7 +36,7 @@ public class ChantJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null) if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
return; return;
PlayerBonuses bonuses = null; PlayerBonuses bonuses = null;
+1 -1
View File
@@ -29,7 +29,7 @@ public class CloseGateJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (building == null) { if (building == null) {
Logger.error("Rungate building was null"); Logger.error("Rungate building was null");
+3 -1
View File
@@ -37,7 +37,7 @@ public class DamageOverTimeJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.target.getObjectType().equals(GameObjectType.Building) if (this.target.getObjectType().equals(GameObjectType.Building)
&& ((Building) this.target).isVulnerable() == false) { && ((Building) this.target).isVulnerable() == false) {
_cancelJob(); _cancelJob();
@@ -60,6 +60,8 @@ public class DamageOverTimeJob extends AbstractEffectJob {
if (this.iteration < 0) { if (this.iteration < 0) {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains); PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source))
eb.startEffect((AbstractCharacter) this.source, this.target, this.trains, this);
return; return;
} }
this.skipSendEffect = true; this.skipSendEffect = true;
+1 -1
View File
@@ -28,7 +28,7 @@ public class DatabaseUpdateJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.ago == null) if (this.ago == null)
return; return;
ago.removeDatabaseJob(this.type, false); ago.removeDatabaseJob(this.type, false);
+1 -1
View File
@@ -29,7 +29,7 @@ public class DebugTimerJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.pc == null) { if (this.pc == null) {
return; return;
} }
+1 -1
View File
@@ -37,7 +37,7 @@ public class DeferredPowerJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
//Power ended with no attack, cancel weapon power boost //Power ended with no attack, cancel weapon power boost
if (this.source != null && this.source instanceof PlayerCharacter) { if (this.source != null && this.source instanceof PlayerCharacter) {
((PlayerCharacter) this.source).setWeaponPower(null); ((PlayerCharacter) this.source).setWeaponPower(null);
+1 -1
View File
@@ -22,7 +22,7 @@ public class DisconnectJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.origin != null) { if (this.origin != null) {
this.origin.disconnect(); this.origin.disconnect();
} }
+1 -1
View File
@@ -28,7 +28,7 @@ public class DoorCloseJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
int doorNumber; int doorNumber;
+3 -3
View File
@@ -22,14 +22,14 @@ public class EndFearJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
//cancel fear for mob. //cancel fear for mob.
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).fearedObject = null; ((Mob) this.target).setFearedObject(null);
} }
@Override @Override
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).fearedObject = null; ((Mob) this.target).setFearedObject(null);
} }
} }
+1 -1
View File
@@ -26,7 +26,7 @@ public class FinishCooldownTimeJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
PowersManager.finishCooldownTime(this.msg, this.pc); PowersManager.finishCooldownTime(this.msg, this.pc);
} }
} }
+1 -1
View File
@@ -22,7 +22,7 @@ public class FinishEffectTimeJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains); PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
} }
+1 -1
View File
@@ -26,7 +26,7 @@ public class FinishRecycleTimeJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
PowersManager.finishRecycleTime(this.msg, this.pc, false); PowersManager.finishRecycleTime(this.msg, this.pc, false);
} }
+1 -1
View File
@@ -20,7 +20,7 @@ public class FinishSpireEffectJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
PlayerCharacter pc = (PlayerCharacter) target; PlayerCharacter pc = (PlayerCharacter) target;
+8 -6
View File
@@ -31,7 +31,7 @@ public class FinishSummonsJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.target == null) if (this.target == null)
return; return;
@@ -47,13 +47,13 @@ public class FinishSummonsJob extends AbstractScheduleJob {
return; return;
// cannot summon a player in combat // cannot summon a player in combat
if (this.target.isCombat()) { //if (this.target.isCombat()) {
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat."); // ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
PowersManager.finishRecycleTime(428523680, this.source, false); // PowersManager.finishRecycleTime(428523680, this.source, false);
return; // return;
} //}
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) { if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!"); ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
@@ -61,6 +61,8 @@ public class FinishSummonsJob extends AbstractScheduleJob {
return; return;
} }
if (this.source.region != null)
this.target.setRegion(this.source.region);
//teleport target to source //teleport target to source
target.teleport(source.getLoc()); target.teleport(source.getLoc());
} }
+1 -1
View File
@@ -28,7 +28,7 @@ public class LoadEffectsJob extends AbstractJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
if (this.originToSend == null) { if (this.originToSend == null) {
return; return;
} }
+1 -1
View File
@@ -25,7 +25,7 @@ public class LogoutCharacterJob extends AbstractScheduleJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
server.logoutCharacter(this.pc); server.logoutCharacter(this.pc);
} }
+1 -1
View File
@@ -19,7 +19,7 @@ public class NoTimeJob extends AbstractEffectJob {
} }
@Override @Override
protected void doJob() { public void doJob() {
} }
@Override @Override

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