Compare commits

..

349 Commits

Author SHA1 Message Date
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
153 changed files with 5895 additions and 5392 deletions
+25 -43
View File
@@ -152,9 +152,7 @@ public class Enum {
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
SAETOR(1999, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 0.80000001f),
LIZARDMAN(1998, MonsterType.Reptile, RunSpeed.STANDARD, CharacterSex.MALE, 1.05f);
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
@SuppressWarnings("unchecked")
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
@@ -174,6 +172,8 @@ public class Enum {
}
public static RaceType getRaceTypebyRuneID(int runeID) {
if(runeID == 1999)
return _raceTypeByID.get(2017);
return _raceTypeByID.get(runeID);
}
@@ -210,8 +210,8 @@ public class Enum {
SENTINEL(0, 0, 0, 0, 0, 0, 0),
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),
IREKEI(6.35f, 15.25f, 4.2199998f, 14.5f, 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.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f);
private float walkStandard;
private float walkCombat;
@@ -960,20 +960,21 @@ public class Enum {
Wizardry;
public static SourceType GetSourceType(String modName) {
SourceType returnMod;
if (modName.isEmpty())
return SourceType.None;
switch(modName) {
case "Piercing":
modName = "Pierce";
switch(modName){
case "Slashing":
modName = "Slash";
break;
case "Crushing":
modName = "Crush";
break;
case "Slashing":
modName = "Slash";
case "Piercing":
modName = "Pierce";
break;
}
SourceType returnMod;
if (modName.isEmpty())
return SourceType.None;
try {
returnMod = SourceType.valueOf(modName.replace(",", ""));
} catch (Exception e) {
@@ -1665,24 +1666,6 @@ public class Enum {
return extents;
}
public boolean isTrainerBuilding(){
switch(this){
case AMAZONHALL:
case CATHEDRAL:
case GREATHALL:
case KEEP:
case THIEFHALL:
case TEMPLEHALL:
case WIZARDHALL:
case ELVENHALL:
case ELVENSANCTUM:
case IREKEIHALL:
case FORESTHALL:
return true;
}
return false;
}
}
public enum UpdateType {
@@ -2337,9 +2320,9 @@ public class Enum {
public enum CityBoundsType {
GRID(640),
ZONE(680),
PLACEMENT(681);
GRID(544),
ZONE(672),
PLACEMENT(673);
public final float extents;
@@ -2853,6 +2836,7 @@ public class Enum {
public enum MobBehaviourType {
None(null, false, false, false, false, false),
//Power
Power(null, false, true, true, true, false),
PowerHelpee(Power, false, true, true, false, true),
PowerHelpeeWimpy(Power, true, false, true, false, false),
@@ -2877,7 +2861,6 @@ public class Enum {
//Independent Types
SimpleStandingGuard(null, false, false, false, false, false),
Pet1(null, false, false, true, false, false),
SiegeEngine(null, false, false, false, false, false),
Simple(null, false, false, true, false, false),
Helpee(null, false, true, true, false, true),
HelpeeWimpy(null, true, false, true, false, false),
@@ -2888,12 +2871,13 @@ public class Enum {
HamletGuard(null, false, true, false, false, false),
AggroWanderer(null, false, false, true, false, false);
public final MobBehaviourType BehaviourHelperType;
public final boolean isWimpy;
public final boolean isAgressive;
public final boolean canRoam;
public final boolean callsForHelp;
public final boolean respondsToCallForHelp;
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
public MobBehaviourType BehaviourHelperType;
public boolean isWimpy;
public boolean isAgressive;
public boolean canRoam;
public boolean callsForHelp;
public boolean respondsToCallForHelp;
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
this.BehaviourHelperType = helpeebehaviourType;
@@ -2910,8 +2894,6 @@ public class Enum {
MOBILE,
PET,
CHARMED,
SIEGEENGINE,
GUARD;
}
}
@@ -25,7 +25,6 @@ import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg;
import engine.objects.*;
import engine.server.MBServerStatics;
import engine.util.BoxTracker;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@@ -110,7 +109,7 @@ public enum InterestManager implements Runnable {
origin.sendMsg(moveMsg);
}
public static void reloadCharacter(AbstractCharacter absChar, boolean sendToSelf) {
public static void reloadCharacter(AbstractCharacter absChar) {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(absChar);
@@ -211,7 +210,7 @@ public enum InterestManager implements Runnable {
if (origin == null)
continue;
if (!playerCharacter.enteredWorld)
if (!playerCharacter.isEnteredWorld())
continue;
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
@@ -468,7 +467,7 @@ public enum InterestManager implements Runnable {
if (awonpc.despawned == true)
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -481,7 +480,7 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive())
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
((Mob) awonpc).setCombatTarget(null);
@@ -522,11 +521,15 @@ public enum InterestManager implements Runnable {
// Update loaded upbjects lists
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
player.setDirtyLoad(true);
updateStaticList(player, origin);
updateMobileList(player, origin);
BoxTracker.addPlayer(origin.machineID,player);
if(player.level < 10) {
player.setLevel((short) 10);
player.getCharItemManager().addGoldToInventory(1000,false);
player.getCharItemManager().addItemToInventory(new MobLoot(player,ItemBase.getItemBase(980066),1,false).promoteToItem(player));
}
}
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
@@ -73,14 +73,6 @@ public class dbBlueprintHandler extends dbHandlerBase {
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(3), thisBlueprint);
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(7), thisBlueprint);
if(thisBlueprint.getName().contains("Vampire Shrine")){
Blueprint saetorShrine = new Blueprint(rs);
saetorShrine.setBlueprintUUID(1720000);
saetorShrine.rank1UUID = 1720000;
saetorShrine.rank3UUID = 1720000;
saetorShrine.rank7UUID = 1720000;
}
}
} catch (SQLException e) {
@@ -14,7 +14,6 @@ import engine.gameManager.DbManager;
import engine.objects.AbstractCharacter;
import engine.objects.CharacterSkill;
import engine.objects.PlayerCharacter;
import engine.objects.SkillsBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
+10 -4
View File
@@ -11,10 +11,7 @@ package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.Zone;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.sql.*;
@@ -95,7 +92,16 @@ public class dbCityHandler extends dbHandlerBase {
return objectList;
}
public Integer GET_CAPITAL_CITY_COUNT() {
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<>();
+6 -1
View File
@@ -32,7 +32,6 @@ public abstract class dbHandlerBase {
try {
if (rs.next()) {
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(abstractGameObject);
}
} catch (Exception e) {
@@ -61,6 +60,12 @@ public abstract class dbHandlerBase {
if (DbManager.inCache(localObjectType, id)) {
objectList.add((T) DbManager.getFromCache(localObjectType, id));
} else {
try{
if(rs.getInt("mineLiveHour") == 1)
continue;
}catch(Exception e){
//not a mine
}
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
DbManager.addToCache(toAdd);
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
+2 -66
View File
@@ -28,67 +28,10 @@ public class dbItemBaseHandler extends dbHandlerBase {
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
int itemBaseID = itemBase.getUUID();
switch(itemBaseID){
case 27550://bow
case 27560://dagger
case 27570://hammer
case 27580://axe
case 27590://sword
//return new String[]{"PRE-010","SUF-260"};
itemBaseID = 8000000;
break;
case 27600://staff
//return new String[]{"PRE-334","PRE-315"};
itemBaseID = 8000010;
break;
case 188500://HA chest
case 188510://HA arms
case 188520://HA legs
case 188530://HA gloves
case 188550://HA helm
case 188720://CC hood
case 188900://MA chest
case 188910://MA Sleeves
case 188920://MA Legs
case 188930://MA gloves
case 188950://MA helm
case 189100://la chest
case 189110://la arms
case 189120://la legs
case 189130://la gloves
case 189150://la helm
case 189550://CC gloves
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
itemBaseID = 8000020;
break;
case 188540://HA boots
case 188940://MA boots
case 189140://LA boots
case 189560://CC boots
//return new String[]{"PRE-133", "PRE-230", "PRE-210", "PRE-220", "SUF-003","SUF-150"};
itemBaseID = 8000030;
break;
case 188700://CC robe
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222","SUF-317","SUF-317","SUF-317"};
itemBaseID = 8000040;
break;
case 189500://MA shield
case 189510://HA shield
//return new String[]{"PRE-125","PRE-125","PRE-125", "PRE-230", "PRE-210", "PRE-220"};
itemBaseID = 8000050;
}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
preparedStatement.setInt(1, itemBaseID);
preparedStatement.setInt(1, itemBase.getUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
@@ -144,19 +87,12 @@ public class dbItemBaseHandler extends dbHandlerBase {
recordsRead++;
itemBase = new ItemBase(rs);
ItemBase.addToCache(itemBase);
//copy the vampire shrine for saetor and change uuid and name
if(itemBase.getName().contains("Vampire Shrine")){
ItemBase saetorShrine = new ItemBase(rs);
saetorShrine.setUUID(1035);
saetorShrine.setName(saetorShrine.getName().replace("Vampire","Saetor"));
ItemBase.addToCache(saetorShrine);
}
}
} catch (SQLException e) {
Logger.error(e);
}
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
}
+2 -10
View File
@@ -135,11 +135,7 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
try {
worked = rs.getBoolean("result");
}catch(Exception e){
return true;
}
worked = rs.getBoolean("result");
} catch (SQLException e) {
Logger.error(e);
@@ -354,11 +350,7 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
try {
worked = rs.getBoolean("result");
} catch(Exception e){
worked = true;
}
worked = rs.getBoolean("result");
} catch (SQLException e) {
Logger.error(e);
+4 -36
View File
@@ -9,14 +9,12 @@
package engine.db.handlers;
import engine.Enum;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.objects.Mine;
import engine.objects.MineProduction;
import engine.objects.Resource;
import org.pmw.tinylog.Logger;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -34,24 +32,8 @@ public class dbMineHandler extends dbHandlerBase {
if (id == 0)
return null;
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
//preparedStatement.setInt(1, id);
ResultSet rs = preparedStatement.executeQuery();
while(rs.next()){
if(rs.getInt("UID") == id){
int towerUID = rs.getInt("mine_buildingUID");
mine = Mine.getMineFromTower(towerUID);
}
}
} catch (SQLException e) {
Logger.error(e);
}
if (mine != null)
return mine;
@@ -74,27 +56,13 @@ public class dbMineHandler extends dbHandlerBase {
ArrayList<Mine> mines = new ArrayList<>();
//try (Connection connection = DbManager.getConnection();
// PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
// ResultSet rs = preparedStatement.executeQuery();
// mines = getObjectsFromRs(rs, 1000);
// } catch (SQLException e) {
// Logger.error(e);
//}
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
ResultSet rs = preparedStatement.executeQuery();
while(rs.next()){
if(BuildingManager.getBuildingFromCache(rs.getInt("mine_buildingUID")) == null)
continue;
mines = getObjectsFromRs(rs, 1000);
mines.add(new Mine(rs));
}
} catch (SQLException | UnknownHostException e) {
} catch (SQLException e) {
Logger.error(e);
}
return mines;
@@ -21,7 +21,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class dbMobBaseHandler extends dbHandlerBase {
@@ -113,25 +112,6 @@ public class dbMobBaseHandler extends dbHandlerBase {
return mobBaseStats;
}
public void LOAD_ALL_MOBBASE_RACES() {
MobBase.mobbase_race_types = new HashMap<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase`;")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int id = rs.getInt("loadID");
if(MobBase.mobbase_race_types.containsKey(id) == false){
MobBase.mobbase_race_types.put(id,rs.getString("raceType"));
}
}
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_ALL_MOBBASE_SPEEDS(MobBase mobBase) {
if (mobBase.getLoadID() == 0)
+22 -17
View File
@@ -28,26 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Mob PERSIST(Mob toAdd) {
public Mob ADD_MOB(Mob toAdd) {
Mob mobile = null;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
preparedStatement.setLong(1, toAdd.parentZoneUUID);
preparedStatement.setInt(2, toAdd.loadID);
preparedStatement.setInt(3, toAdd.guildUUID);
preparedStatement.setFloat(4, toAdd.bindLoc.x);
preparedStatement.setFloat(5, toAdd.bindLoc.y);
preparedStatement.setFloat(6, toAdd.bindLoc.z);
preparedStatement.setLong(1, toAdd.getParentZoneID());
preparedStatement.setInt(2, toAdd.getMobBaseID());
preparedStatement.setInt(3, toAdd.getGuildUUID());
preparedStatement.setFloat(4, toAdd.getSpawnX());
preparedStatement.setFloat(5, toAdd.getSpawnY());
preparedStatement.setFloat(6, toAdd.getSpawnZ());
preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius);
preparedStatement.setInt(9, toAdd.spawnTime);
preparedStatement.setInt(10, toAdd.contractUUID);
preparedStatement.setInt(11, toAdd.buildingUUID);
preparedStatement.setInt(12, toAdd.level);
preparedStatement.setString(13, toAdd.firstName);
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
if (toAdd.getContract() != null)
preparedStatement.setInt(10, toAdd.getContract().getContractID());
else
preparedStatement.setInt(10, 0);
preparedStatement.setInt(11, toAdd.getBuildingID());
preparedStatement.setInt(12, toAdd.getLevel());
preparedStatement.setString(13, toAdd.getFirstName());
ResultSet rs = preparedStatement.executeQuery();
@@ -101,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
return row_count;
}
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
public void LOAD_PATROL_POINTS(Mob captain) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
preparedStatement.setInt(1, captain.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String minionName = rs.getString("name");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
String name = rs.getString("name");
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
if (toCreate == null)
return;
@@ -23,25 +23,7 @@ public class dbResistHandler extends dbHandlerBase {
public dbResistHandler() {
}
public void LOAD_RESISTS_FOR_MOBS() {
Resists resists = null;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists`;")) {
ResultSet rs = preparedStatement.executeQuery();
while(rs.next()){
resists = new Resists(rs);
if(!Resists.mobResists.containsKey(rs.getInt("ID")))
Resists.mobResists.put(rs.getInt("ID"),resists);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public Resists GET_RESISTS_FOR_MOB(int resistID) {
Resists resists = null;
@@ -59,43 +59,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
rb.setLevelRequired(rs.getInt("requiredRuneID"));
break;
}
int id = rs.getInt("runeID");
switch(id) {
case 3001:
case 3002:
case 3003:
case 3004:
case 3007:
case 3008:
case 3009:
case 3013:
case 3014:
case 3016:
case 3017:
case 3018:
case 3019:
case 3020:
case 3021:
case 3026:
case 3030:
case 3031:
case 3033:
case 3037:
case 3040:
case 3045:
case 3046:
case 3047:
case 3048:
case 2514:
rb.getRace().put(1999, true);
break;
case 3035:
rb.getBaseClass().put(2501,true);
break;
case 3049:
rb.getRace().clear();
}
}
} catch (SQLException e) {
@@ -143,13 +143,6 @@ public class dbSkillBaseHandler extends dbHandlerBase {
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
}
//add saetor skills
HashMap<Integer, Integer> skills = new HashMap<>();
skills.put(71438003,15); // staff
skills.put(-61022283,10); // staff mastery
skills.put(95961104,10); // parry
SkillsBase.runeSkillsCache.put(1999,skills);
} catch (SQLException e) {
Logger.error(e);
+2 -2
View File
@@ -43,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1);
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
@@ -84,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1);
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
-8
View File
@@ -32,7 +32,6 @@ public class AddNPCCmd extends AbstractDevCmd {
int contractID;
String name = "";
int level = 0;
if (words.length < 2) {
this.sendUsage(pc);
return;
@@ -40,33 +39,26 @@ public class AddNPCCmd extends AbstractDevCmd {
try {
contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]);
for (int i = 2; i < words.length; i++) {
name += words[i];
if (i + 1 < words.length)
name += "";
}
} catch (NumberFormatException e) {
throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer.");
return; // NaN
}
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if (contract == null || level < 1 || level > 75) {
throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level");
return; // NaN
}
// Pick a random name
if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Failed to find zone to place npc in.");
return;
+15 -4
View File
@@ -11,7 +11,6 @@ package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.*;
import engine.powers.EffectsBase;
public class EnchantCmd extends AbstractDevCmd {
@@ -56,9 +55,21 @@ public class EnchantCmd extends AbstractDevCmd {
this.setResult(String.valueOf(item.getObjectUUID()));
} else {
int cnt = words.length;
String enchant = words[1];
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase());
item.addPermanentEnchantmentForDev(enchant, 0);
for (int i = 1; i < cnt; i++) {
String enchant = words[i];
boolean valid = true;
for (Effect eff : item.getEffects().values()) {
if (eff.getEffectsBase().getIDString().equals(enchant)) {
throwbackError(pc, "This item already has that enchantment");
return;
}
}
if (valid) {
item.addPermanentEnchantmentForDev(enchant, rank);
this.setResult(String.valueOf(item.getObjectUUID()));
} else
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
}
cim.updateInventory();
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ public class FlashMsgCmd extends AbstractDevCmd {
this.sendUsage(pcSender);
return;
}
ChatManager.chatSystemFlash(String.join(" ", args));
ChatManager.chatSystemFlash(args[0]);
}
/**
@@ -9,64 +9,55 @@
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import engine.powers.EffectsBase;
import java.util.ArrayList;
/**
* @author Eighty
*/
public class setProfit extends AbstractDevCmd {
public class GimmeCmd extends AbstractDevCmd {
public setProfit() {
super("setprofit");
public GimmeCmd() {
super("gimme");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int amt = 0;
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
amt = 10000000 - currentGold;
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
if (words.length < 2) {
this.sendUsage(pc);
return;
}
float updateValue;
try {
updateValue = Float.parseFloat(words[1]);
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
} catch (NumberFormatException e) {
throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer.");
return; // NaN
if(pc.level < 75) {
pc.setLevel((short) 75);
ChatManager.chatSayInfo(pc, "Level set to 75");
}
if(target.getObjectType().equals(GameObjectType.NPC) == false){
pc.getCharItemManager().updateInventory();
return;
}
NPC npc = (NPC)target;
if(words[0].toLowerCase().equals("buy")){
npc.buyPercent = updateValue;
npc.updateDatabase();
return;
}
if(words[0].toLowerCase().equals("sell")){
npc.sellPercent = updateValue;
npc.updateDatabase();
return;
}
}
@Override
protected String _getHelpString() {
return "Sets profit margin of targeted NPC";
return "Round up current gold in inventory to 10,000,000";
}
@Override
protected String _getUsageString() {
return "' /setprofit buy/sell VALUE(1.0)'";
return "'./gimme";
}
}
-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.getName() + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
}
if (input.equalsIgnoreCase("random")) {
ZoneManager.generateAndSetRandomHotzone();
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\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]";
}
}
+6 -8
View File
@@ -280,7 +280,7 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
output += newline;
output += "Max Inventory Weight:" + targetPC.getInventoryCapacity();
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
output += newline;
output += "ALTITUDE :" + targetPC.getAltitude();
output += newline;
@@ -336,9 +336,9 @@ public class InfoCmd extends AbstractDevCmd {
output += "Swimming : " + targetPC.isSwimming();
output += newline;
output += "isMoving : " + targetPC.isMoving() + newline;
output += "Zerg Multiplier: " + targetPC.ZergMultiplier + newline;
output += "isBoxed: " + targetPC.isBoxed + newline;
output += "isMoving : " + targetPC.isMoving();
output += newline;
output += "Zerg Multiplier : " + targetPC.ZergMultiplier;
break;
case NPC:
@@ -441,9 +441,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "isSummonedPet: true";
else
output += "isSummonedPet: false";
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
PlayerCharacter owner = targetMob.getOwner();
if (owner != null)
output += " owner: " + owner.getObjectUUID();
output += newline;
@@ -526,7 +524,7 @@ public class InfoCmd extends AbstractDevCmd {
ConcurrentHashMap<String, Effect> effects = item.getEffects();
for (String name : effects.keySet()) {
Effect eff = effects.get(name);
output += eff.getEffectsBase().getIDString() + " Static:" + eff.isStatic();
output += eff.getEffectsBase().getIDString();
output += newline;
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
}
-8
View File
@@ -65,10 +65,6 @@ public class MakeItemCmd extends AbstractDevCmd {
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
if(item == null)
throwbackError(pc, "Item Null");
else
throwbackError(pc, "Worked = false");
return;
}
@@ -226,10 +222,6 @@ public class MakeItemCmd extends AbstractDevCmd {
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
if(item == null)
throwbackError(pc, "Item Null");
else
throwbackError(pc, "Worked = false");
return;
}
+4 -2
View File
@@ -16,6 +16,8 @@ import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
import engine.workthreads.HalfHourlyJobThread;
import engine.workthreads.HourlyJobThread;
/**
*
@@ -40,10 +42,10 @@ public class MineActiveCmd extends AbstractDevCmd {
String trigger = args[0];
switch (trigger) {
case "true":
Mine.mineWindowOpen(mine);
HalfHourlyJobThread.mineWindowOpen(mine);
break;
case "false":
Mine.mineWindowClose(mine);
HalfHourlyJobThread.mineWindowClose(mine);
break;
default:
this.sendUsage(pcSender);
@@ -39,9 +39,6 @@ public class PrintResistsCmd extends AbstractDevCmd {
if (mb != null)
name = mb.getFirstName();
type = "Mob";
throwbackInfo(pc, "Server resists for " + type + ' ' + name);
tar.getResists().printResistsToClient(pc);
return;
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
+2 -4
View File
@@ -56,7 +56,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
}
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
tar.calculateMaxHealthManaStamina();
String newline = "\r\n ";
String out = "Server stats for Player " + tar.getFirstName() + newline;
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
@@ -74,11 +73,10 @@ public class PrintStatsCmd extends AbstractDevCmd {
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
out += "Move Speed: " + tar.getSpeed() + newline;
out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline;
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline;
out += "Zerg Multiplier: " + tar.ZergMultiplier + newline;
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
throwbackInfo(pc, out);
}
+2 -2
View File
@@ -59,7 +59,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -151,7 +151,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
+2 -2
View File
@@ -154,7 +154,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
mobA = (Mob) ac;
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -209,7 +209,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
if (npc.building != null)
npc.building.getHirelings().remove(npc);
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
+1 -1
View File
@@ -62,7 +62,7 @@ public class SetAdminRuneCmd extends AbstractDevCmd {
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender,false);
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
+1 -1
View File
@@ -47,7 +47,7 @@ public class SetBaseClassCmd extends AbstractDevCmd {
this.setTarget(pc); //for logging
ChatManager.chatSayInfo(pc,
"BaseClass changed to " + classID);
InterestManager.reloadCharacter(pc,false);
InterestManager.reloadCharacter(pc);
}
+3 -4
View File
@@ -14,7 +14,6 @@ import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
public class SetLevelCmd extends AbstractDevCmd {
@@ -47,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
this.sendUsage(pc);
return;
}
if (level < 1 || level > MBServerStatics.LEVELCAP) {
if (level < 1 || level > 80) {
this.sendHelp(pc);
return;
}
@@ -58,12 +57,12 @@ public class SetLevelCmd extends AbstractDevCmd {
tar.setLevel((short) level);
this.setTarget(tar); //for logging
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
InterestManager.reloadCharacter(tar,false);
InterestManager.reloadCharacter(tar);
}
@Override
protected String _getHelpString() {
return "Sets your character's level to 'amount'. 'amount' must be between 1-" + MBServerStatics.LEVELCAP;
return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
}
@Override
@@ -42,7 +42,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
pc.setPromotionClass(classID);
ChatManager.chatSayInfo(pc,
"PromotionClass changed to " + classID);
InterestManager.reloadCharacter(pc,false);
InterestManager.reloadCharacter(pc);
this.setTarget(pc); //for logging
+1 -1
View File
@@ -57,7 +57,7 @@ public class SetRuneCmd extends AbstractDevCmd {
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender,false);
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
+13 -23
View File
@@ -1,17 +1,17 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.LootManager;
import engine.gameManager.ZoneManager;
import engine.loot.BootySetEntry;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
public class SimulateBootyCmd extends AbstractDevCmd {
public int simCount = 250;
public SimulateBootyCmd() {
super("bootysim");
}
@@ -27,10 +27,16 @@ public class SimulateBootyCmd extends AbstractDevCmd {
String output;
output = "Booty Simulation:" + newline;
if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){
return;//ugh what?
try
{
simCount = Integer.parseInt(words[0]);
}catch(Exception e)
{
}
output = "Booty Simulation: Rolls:" + simCount + newline;
Mob mob = (Mob) target;
output += "Name: " + mob.getName() + newline;
output += "Special Loot:" + newline;
@@ -55,7 +61,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
int failures = 0;
int goldAmount = 0;
for (int i = 0; i < 10000; ++i) {
for (int i = 0; i < simCount; ++i) {
try {
mob.loadInventory();
@@ -83,19 +89,12 @@ public class SimulateBootyCmd extends AbstractDevCmd {
goldAmount += lootItem.getNumOfItems();
break;
default:
if(Warehouse.maxResources.containsKey(lootItem.getItemBaseID())){
Resources.add(lootItem);
} else {
OtherDrops.add(lootItem);
}
OtherDrops.add(lootItem);
break;
}
}
} catch (Exception ex) {
failures++;
//throwbackError(playerCharacter,ex.getLocalizedMessage());
//Logger.error(ex.fillInStackTrace());
//return;
}
if (mob.getEquip() != null) {
for (MobEquipment me : mob.getEquip().values()) {
@@ -142,17 +141,8 @@ public class SimulateBootyCmd extends AbstractDevCmd {
}
output += "GLASS DROPS: " + GlassItems.size() + newline;
for(Item glass : GlassItems){
output += " " + glass.getName() + newline;
}
output += "RUNE DROPS: " + Runes.size() + newline;
for(Item rune : Runes){
output += " " + rune.getName() + newline;
}
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
for(Item contract : Contracts){
output += " " + contract.getName() + newline;
}
output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
+1 -1
View File
@@ -71,7 +71,7 @@ public class SlotTestCmd extends AbstractDevCmd {
outString += "Hirelings List:";
for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + "(" + hireling.getObjectUUID() + ") slot : " + building.getHirelings().get(hireling);
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
}
+1 -1
View File
@@ -110,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, serverZone, null, null, "", 1);
null, true, serverZone, null, 0, "", 1);
if (mobile != null) {
mobile.updateDatabase();
+15 -26
View File
@@ -11,10 +11,8 @@ package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.objects.AbstractGameObject;
import engine.objects.Mob;
import engine.objects.MobBase;
import engine.objects.PlayerCharacter;
import java.util.Map;
@@ -58,47 +56,38 @@ public class aiInfoCmd extends AbstractDevCmd {
Mob mob = (Mob) target;
output = "Mob AI Information:" + newline;
output += mob.getName() + 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;
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 {
output += "Behaviour Helper Type: NULL" + newline;
}
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline;
}
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
}
if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else
output += "Current Target: NULL" + newline;
if (mob.guardedCity != null)
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
output += "Powers:" + newline;
for (int token : mob.mobPowers.keySet())
output += PowersManager.getPowerByToken(token).getName() + newline;
output += token + newline;
output += "Race type: " + MobBase.mobbase_race_types.get(mob.getMobBaseID());
throwbackInfo(playerCharacter, output);
throwbackInfo(playerCharacter, "Race Types: " + MobBase.mobbase_race_types.size());
}
@Override
+28 -6
View File
@@ -520,10 +520,32 @@ public enum BuildingManager {
if (building.getBlueprintUUID() == 0)
return false;
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
Logger.error("failed at addHireling with contract: " + contract.getContractID());
return false;
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;
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
if (item.getChargesRemaining() > 0)
@@ -536,7 +558,7 @@ public enum BuildingManager {
if (NPC.ISWallArcher(contract)) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null)
return false;
@@ -548,7 +570,7 @@ public enum BuildingManager {
if (NPC.ISGuardCaptain(contract.getContractID())) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null)
return false;
@@ -560,7 +582,7 @@ public enum BuildingManager {
if (contract.getContractID() == 910) {
//guard dog
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null)
return false;
+51 -53
View File
@@ -528,7 +528,7 @@ public enum CombatManager {
float atr;
int minDamage, maxDamage;
int errorTrack = 0;
int subTrack = 0;
try {
if (ac == null)
@@ -645,27 +645,26 @@ public enum CombatManager {
errorTrack = 4;
//Get hit chance
float constant = (atr+defense)*0.315f;
float atrChance = atr - constant;
float defChance = defense - constant + atrChance;
float smallChance = atrChance/defChance;
int chance = (int)(smallChance * 100);
//int chance;
float dif = atr - defense;
//if (dif > 100)
// chance = 94;
//else if (dif < -100)
// chance = 4;
//else
// chance = (int) ((0.45 * dif) + 49);
errorTrack = 5;
if(chance < 5){
chance = 5;
}
if(chance > 95){
chance = 95;
}
//calculate hit/miss
int roll = ThreadLocalRandom.current().nextInt(1,101);
DeferredPowerJob dpj = null;
if (roll < chance) {
if (LandHit((int)atr,(int)defense)) {
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
updateAttackTimers((PlayerCharacter) ac, target, true);
@@ -811,7 +810,11 @@ public enum CombatManager {
float damage;
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
if (wb != null)
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
else
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
float d = 0f;
errorTrack = 12;
@@ -819,41 +822,27 @@ public enum CombatManager {
//Subtract Damage from target's health
if (tarAc != null) {
if (tarAc.isSit())
damage *= 2.5f; //increase damage if sitting
if (tarAc.isSit())
damage *= 2.5f; //increase damage if sitting
subTrack = 1;
if (tarAc.getObjectType() == GameObjectType.Mob) {
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
((Mob) tarAc).handleDirectAggro(ac);
}
if (tarAc.getHealth() > 0)
d = tarAc.modifyHealth(-damage, ac, false);
if (tarAc.getObjectType() == GameObjectType.Mob) {
Mob mobTarget = (Mob) tarAc;
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) {
subTrack = 2;
if (mobTarget.playerAgroMap.containsKey(ac.getObjectUUID())) {
subTrack = 3;
float hateValue = damage + mobTarget.playerAgroMap.get(ac.getObjectUUID());
mobTarget.playerAgroMap.put(ac.getObjectUUID(), hateValue);
} else {
mobTarget.playerAgroMap.put(ac.getObjectUUID(), damage);
}
subTrack = 4;
}
mobTarget.handleDirectAggro(ac);
}
if (tarAc.getHealth() > 0)
d = tarAc.modifyHealth(-damage, ac, false);
subTrack = 5;
} else if (target.getObjectType().equals(GameObjectType.Building)) {
subTrack = 6;
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
ac.setCombatTarget(null);
subTrack = 7;
return;
}
subTrack = 8;
if (target.getHealth() > 0)
d = ((Building) target).modifyHealth(-damage, ac);
subTrack = 9;
}
errorTrack = 13;
@@ -954,8 +943,7 @@ public enum CombatManager {
ac.cancelOnAttack();
} catch (Exception e) {
Logger.error(ac.getName() + ' ' + "ErrorTrack: " + errorTrack + " ErrorSubTrack = " + subTrack + e);
Logger.error(e.getMessage());
Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e);
}
}
@@ -1034,9 +1022,7 @@ public enum CombatManager {
damage += minDamage;
//calculate resists in if any
if(source.getObjectType().equals(GameObjectType.PlayerCharacter)){
damage *= ((PlayerCharacter)source).ZergMultiplier;
}
if (resists != null)
return resists.getResistedDamage(source, target, damageType, damage, 0);
else
@@ -1069,6 +1055,10 @@ public enum CombatManager {
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
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);
DispatchMessage.sendToAllInRange(target, cmm);
}
@@ -1275,13 +1265,6 @@ public enum CombatManager {
range += (calcHitBox(ac) + calcHitBox(target));
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
range += ((PlayerCharacter)ac).getCharacterHeight() * 0.5f;
if(ac.isMoving()){
range += ((PlayerCharacter) ac).getCharacterHeight();
}
}
float magnitudeSquared = tl.distanceSquared(sl);
return magnitudeSquared > range * range;
@@ -1460,4 +1443,19 @@ public enum CombatManager {
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
}
public static boolean LandHit(int atr, int defense){
int roll = ThreadLocalRandom.current().nextInt(101);
float chance = (float)((atr-((atr+defense)*0.315))/((defense-((atr+defense)*0.315))+(atr-((atr+defense)*0.315))));
int connvertedChance = (int)(chance * 100);
if(connvertedChance < 5)
connvertedChance = 5;
if(connvertedChance > 95)
connvertedChance = 95;
return connvertedChance > roll;
}
}
+13 -19
View File
@@ -11,8 +11,6 @@ package engine.gameManager;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.devcmd.cmds.*;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.AbstractGameObject;
import engine.objects.Account;
import engine.objects.PlayerCharacter;
@@ -81,7 +79,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new AddGoldCmd());
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
DevCmdManager.registerDevCmd(new HotzoneCmd());
DevCmdManager.registerDevCmd(new MineActiveCmd());
// Dev
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
@@ -105,6 +102,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
DevCmdManager.registerDevCmd(new SetInvulCmd());
DevCmdManager.registerDevCmd(new MakeItemCmd());
DevCmdManager.registerDevCmd(new GimmeCmd());
DevCmdManager.registerDevCmd(new EnchantCmd());
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
// Admin
@@ -121,7 +119,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
DevCmdManager.registerDevCmd(new SplatMobCmd());
DevCmdManager.registerDevCmd(new SlotNpcCmd());
DevCmdManager.registerDevCmd(new setProfit());
DevCmdManager.registerDevCmd(new GateInfoCmd());
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
DevCmdManager.registerDevCmd(new RealmInfoCmd());
@@ -182,17 +179,19 @@ public enum DevCmdManager {
//kill any commands not available to everyone on production server
//only admin level can run dev commands on production
if((cmd.toLowerCase().equals("printstats") || cmd.toLowerCase().equals("printresists")) && target.equals(pcSender)){
// execute command;
try {
adc.doCmd(pcSender, argString, target);
} catch (Exception e) {
}
return true;
boolean playerAllowed = false;
switch(adc.getMainCmdString()){
case "printresists":
case "printstats":
case "printskills":
case "printpowers":
case "gimme":
playerAllowed = true;
if(!a.status.equals(Enum.AccountStatus.ADMIN))
target = pcSender;
break;
}
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false) {
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
return false;
}
@@ -216,11 +215,6 @@ public enum DevCmdManager {
e.printStackTrace();
}
ChatSystemMsg chatMsg = new ChatSystemMsg(null, pcName + " from account: " + accName + " has used Dev Command: " + cmd);
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
return true;
}
File diff suppressed because it is too large Load Diff
+203 -182
View File
@@ -5,206 +5,227 @@
// · · ·
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.gameManager;
// Defines static methods which comprise the magicbane
// building maintenance system.
import engine.Enum;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public enum MaintenanceManager {
MAINTENANCEMANAGER;
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
building.maintDateTime = maintDate;
building.maintDateTime = maintDate.withHour(1).withMinute(0).withSecond(0);
DbManager.BuildingQueries.updateMaintDate(building);
}
public static void processBuildingMaintenance() {
ArrayList<AbstractGameObject> buildingList;
ArrayList<Building> maintList;
ArrayList<Building> derankList = new ArrayList<>();
Logger.info("Starting Maintenance on Player Buildings");
// Build list of buildings to apply maintenance on.
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building));
maintList = buildMaintList(buildingList);
// Deduct upkeep and build list of buildings
// which did not have funds available
for (Building building : maintList) {
if (chargeUpkeep(building) == false)
derankList.add(building);
else
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
}
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());
}
// Iterate over all buildings in game and apply exclusion rules
// returning a list of building for which maintenance is due.
private static ArrayList<Building> buildMaintList(ArrayList<AbstractGameObject> buildingList) {
ArrayList<Building> maintList = new ArrayList<>();
for (AbstractGameObject gameObject : buildingList) {
Building building = (Building) gameObject;
// No maintenance on NPC owned buildings (Cache loaded)
if (building.getProtectionState() == Enum.ProtectionState.NPC)
continue;
// No maintenance on constructing meshes
if (building.getRank() < 1)
continue;
// No Maintenance on furniture
if (building.parentBuildingID != 0)
continue;
// No Blueprint?
if (building.getBlueprint() == null) {
Logger.error("Blueprint missing for uuid: " + building.getObjectUUID());
continue;
}
//only ToL pays maintenance
if(building.getBlueprint().getBuildingGroup() != null && !building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
continue;
// No maintenance on banestones omfg
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
continue;
// no maintenance on Mines omfg
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.MINE))
continue;
// Null Maintenance date?
if (building.maintDateTime == null) {
Logger.error("Null maint date for building UUID: " + building.getObjectUUID());
continue;
}
// Maintenance date is in the future
if (building.maintDateTime.isAfter(LocalDateTime.now()))
continue;
//no maintenance if day of week doesnt match
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
continue;
}
// Add building to maintenance queue
maintList.add(building);
}
return maintList;
}
// Method removes the appropriate amount of gold/resources from
// a building according to it's maintenance schedule. True/False
// is returned indicating if the building had enough funds to cover.
public static boolean chargeUpkeep(Building building) {
City city = null;
Warehouse warehouse = null;
int maintCost = 0;
int overDraft = 0;
boolean hasFunds = false;
boolean hasResources = false;
int resourceValue = 0;
city = building.getCity();
if (city != null)
warehouse = city.getWarehouse();
// Cache maintenance cost value
maintCost = building.getMaintCost();
// Something went wrong. Missing buildinggroup from switch?
if (maintCost == 0) {
Logger.error("chargeUpkeep", "Error retrieving rankcost for " + building.getName() + " uuid:" + building.getObjectUUID() + "buildinggroup:" + building.getBlueprint().getBuildingGroup().name());
// check if there is enough gold on the building
return true;
}
if (building.getStrongboxValue() >= maintCost)
hasFunds = true;
// If we cannot cover with just the strongbox
// see if there is a warehouse that will cover
// the overdraft for us.
if (hasFunds == false && (building.assetIsProtected() || building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.WAREHOUSE)) {
overDraft = maintCost - building.getStrongboxValue();
}
if ((overDraft > 0))
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
(warehouse != null) && building.assetIsProtected() == true &&
(warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
hasFunds = true;
}
// If this is an R8 tree, validate that we can
// cover the resources required
if (hasFunds == false) {
return false; // Early exit for having failed to meet maintenance
}
// Remove cash and resources
// withdraw what we can from the building
building.setStrongboxValue(building.getStrongboxValue() - (maintCost - overDraft));
// withdraw overdraft from the whorehouse
if (overDraft > 0) {
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
} else {
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true;
}
}
return true;
}
public static void dailyMaintenance() {
Logger.info("Maintenance has started");
// Run maintenance on player buildings
if (ConfigManager.MB_WORLD_MAINTENANCE.getValue().equalsIgnoreCase("true"))
processMaintenance();
processBuildingMaintenance();
else
Logger.info("Maintenance Costings: DISABLED");
Logger.info("Maintenance has completed!");
}
public static void processMaintenance() {
//create list of all cities
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(Enum.GameObjectType.City);
//loop all cities
for (AbstractGameObject ago : worldCities.values()) {
if (ago.getObjectType().equals(Enum.GameObjectType.City)) {
City city = (City) ago;
if(city == null || !city.getParent().isPlayerCity())
continue;
Building tol = city.getTOL();
if(tol == null)
continue;
LocalDateTime maintenanceDueDate = tol.maintDateTime.withHour(1).withMinute(0).withSecond(0);
LocalDateTime now = LocalDateTime.now();
if(now.isAfter(maintenanceDueDate))
processTolMaintenance(tol, city.getWarehouse());
}
}
}
public static void processTolMaintenance(Building tol, Warehouse warehouse){
if(tol == null)
return;
if(tol.getRank() == 8)
handleR8(tol,warehouse);
else
handleNormal(tol,warehouse);
}
public static void handleNormal(Building tol, Warehouse warehouse){
//handle r7 and lower ToL maintenance
int goldDue = 3000000;
//enough on strongbox alone to pay
if (tol.getStrongboxValue() >= goldDue) {
tol.maintDateTime = LocalDateTime.now().plusDays(7);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.setStrongboxValue(tol.getStrongboxValue() - goldDue);
}
return;
}
int newStrongboxValue = tol.getStrongboxValue();
int newWarehouseGold = 0;
if(warehouse != null && warehouse.getResources().get(ItemBase.getItemBase(7)) != null) {
newWarehouseGold = warehouse.getResources().get(ItemBase.getItemBase(7));
} else{
//wasnt enough on strongbox and gold in warehouse is empty
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
//some on strongbox to pay
if (tol.getStrongboxValue() > 0) {
newStrongboxValue = 0;
goldDue -= tol.getStrongboxValue();
}
if(newWarehouseGold < goldDue){
//not enough gold to pay, you miss maintenance
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
newWarehouseGold -= goldDue;
tol.maintDateTime = LocalDateTime.now().plusDays(7);
if(DbManager.BuildingQueries.updateMaintDate(tol) && DbManager.WarehouseQueries.updateGold(warehouse,newWarehouseGold)) {
warehouse.getResources().put(ItemBase.getItemBase(7), newWarehouseGold);
tol.setStrongboxValue(newStrongboxValue);
}
}
public static void handleR8(Building tol, Warehouse warehouse){
//handle r8 ToL maintenance
//cannot pay r8 maintenance without a warehouse
if(warehouse == null && DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
tol.maintDateTime = LocalDateTime.now().plusDays(1);
return;
}
//handle resource processing
int goldDue = 3000000;
int galvorDue = 5;
int wormwoodDue = 5;
int stoneDue = 5000;
int lumberDue = 5000;
int goldStrongBox = tol.getStrongboxValue();
int goldWarehouse = 0;
int galvorWarehouse;
int wormwoodWarehouse;
int stoneWarehouse;
int lumberWarehouse;
if(warehouse.getResources().get(Warehouse.galvorIB) != null) {
galvorWarehouse = warehouse.getResources().get(Warehouse.galvorIB);
}else {
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
if(warehouse.getResources().get(Warehouse.stoneIB) != null) {
stoneWarehouse = warehouse.getResources().get(Warehouse.stoneIB);
}else {
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
if(warehouse.getResources().get(Warehouse.wormwoodIB) != null) {
wormwoodWarehouse = warehouse.getResources().get(Warehouse.wormwoodIB);
}else {
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
if(warehouse.getResources().get(Warehouse.lumberIB) != null) {
lumberWarehouse = warehouse.getResources().get(Warehouse.lumberIB);
}else {
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
boolean canPay = true;
if(goldStrongBox >= goldDue){
goldStrongBox -= goldDue;
goldDue = 0;
}
if (tol.getStrongboxValue() > 0) {
goldStrongBox = 0;
goldDue -= tol.getStrongboxValue();
}
if(warehouse.getResources().get(Warehouse.goldIB) != null) {
goldWarehouse = warehouse.getResources().get(Warehouse.goldIB);
}else if(goldDue > 0){
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
if(wormwoodDue > wormwoodWarehouse)
canPay = false;
if(galvorDue > galvorWarehouse)
canPay = false;
if(lumberDue > lumberWarehouse)
canPay = false;
if(stoneDue > stoneWarehouse)
canPay = false;
if(goldDue > goldWarehouse)
canPay = false;
if(!canPay){
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
tol.destroyOrDerank(null);
}
return;
}
tol.setStrongboxValue(goldStrongBox);
if(DbManager.WarehouseQueries.updateGold(warehouse,goldWarehouse - goldDue)){
if(DbManager.WarehouseQueries.updateStone(warehouse,stoneWarehouse - stoneDue)){
if(DbManager.WarehouseQueries.updateLumber(warehouse,lumberWarehouse - lumberDue)){
if(DbManager.WarehouseQueries.updateGalvor(warehouse,galvorWarehouse - galvorDue)){
if(DbManager.WarehouseQueries.updateWormwood(warehouse,wormwoodWarehouse - wormwoodDue)){
tol.maintDateTime = LocalDateTime.now().plusDays(1);
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
return;
}
}
}
}
}
}
}
}
}
+1 -2
View File
@@ -69,10 +69,9 @@ public enum MovementManager {
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
if (((PlayerCharacter) toMove).isCasting())
((PlayerCharacter) toMove).update();
if(((PlayerCharacter) toMove).isFlying() && toMove.getEffects().containsKey("MoveBuff"))
PlayerCharacter.GroundPlayer(((PlayerCharacter) toMove));
}
toMove.setIsCasting(false);
toMove.setItemCasting(false);
+15 -69
View File
@@ -23,6 +23,14 @@ public enum NPCManager {
NPC_MANAGER;
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
@@ -119,12 +127,10 @@ public enum NPCManager {
DbManager.removeFromCache(necroPet);
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
PlayerCharacter petOwner = necroPet.getOwner();
if (petOwner != null) {
necroPet.guardCaptain = null;
necroPet.setOwner(null);
petOwner.setPet(null);
if (updateOwner == false)
@@ -222,14 +228,12 @@ public enum NPCManager {
WorldGrid.removeObject(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -336,19 +340,10 @@ public enum NPCManager {
else
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)) {
Mob siegeMobile = (Mob) abstractCharacter;
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.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.getHirelings().put(abstractCharacter, buildingSlot);
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
// Override bind and location for this npc derived
// from BuildingManager slot location data.
@@ -375,53 +370,4 @@ public enum NPCManager {
return buildingSlot;
}
public static int getMaxMinions(Mob guardCaptain) {
int maxSlots;
switch (guardCaptain.getRank()) {
case 3:
maxSlots = 2;
break;
case 4:
case 5:
maxSlots = 3;
break;
case 6:
maxSlots = 4;
break;
case 7:
maxSlots = 5;
break;
case 1:
case 2:
default:
maxSlots = 1;
}
return maxSlots;
}
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.loc = newPatrolPoint;
mob.endLoc = newPatrolPoint;
}
}
}
}
+220 -236
View File
@@ -8,6 +8,7 @@
package engine.gameManager;
import com.sun.corba.se.spi.orbutil.fsm.ActionBase;
import engine.Enum.*;
import engine.InterestManagement.HeightMap;
import engine.InterestManagement.WorldGrid;
@@ -27,7 +28,7 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.objects.*;
import engine.powers.*;
import engine.powers.effectmodifiers.SeeInvisibleEffectModifier;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.powers.poweractions.AbstractPowerAction;
import engine.powers.poweractions.TrackPowerAction;
import engine.server.MBServerStatics;
@@ -57,22 +58,6 @@ public enum PowersManager {
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
private static JobScheduler js;
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
public static ArrayList<PowerQueObject> static_power_que = new ArrayList<>();
public static class PowerQueObject{
public PowerQueObject(PerformActionMsg inmsg,ClientConnection inorigin,boolean insendCastToSelf){
this.msg = inmsg;
this.origin = inorigin;
this.sendCastToSelf = insendCastToSelf;
}
public PerformActionMsg msg;
public ClientConnection origin;
public boolean sendCastToSelf;
}
private PowersManager() {
}
@@ -182,9 +167,11 @@ public enum PowersManager {
if (usePowerA(msg, origin, sendCastToSelf)) {
// Cast failed for some reason, reset timer
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
// Send Fail to cast message
PlayerCharacter pc = SessionManager
.getPlayerCharacter(origin);
@@ -218,10 +205,43 @@ public enum PowersManager {
if (playerCharacter == null)
return false;
boolean skipCheck = 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)
return false;
}
if (MBServerStatics.POWERS_DEBUG) {
ChatManager.chatSayInfo(
@@ -232,67 +252,10 @@ public enum PowersManager {
+ Integer.toHexString(msg.getPowerUsedID()) + " ("
+ msg.getPowerUsedID() + ')');
}
Boolean earlyExit = false;
//Sending recycle message to player if died while casting.
if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor
earlyExit = true;
}
if(msg.getPowerUsedID() == 430628895){ // group teleport
Boolean activeBane = false;
if(ZoneManager.getCityAtLocation(playerCharacter.loc) != null && ZoneManager.getCityAtLocation(playerCharacter.loc).getBane() != null)
activeBane = ZoneManager.getCityAtLocation(playerCharacter.loc).getBane().getSiegePhase().equals(SiegePhase.WAR);
Zone currentZone = ZoneManager.findSmallestZone(playerCharacter.loc);
if(currentZone == null)
earlyExit = true;
if(currentZone.isPlayerCity() && !activeBane)
earlyExit = true;
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
for (Building building : currentZone.zoneBuildingSet) {
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
if (currentMine.isActive == false) {
earlyExit = true;
}
}
}
}
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getTargetX(),msg.getTargetY(),msg.getTargetZ());
currentZone = ZoneManager.findSmallestZone(endLoc);
if(currentZone == null)
earlyExit = true;
if(currentZone.isPlayerCity() && !activeBane)
earlyExit = true;
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
for (Building building : currentZone.zoneBuildingSet) {
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
if (currentMine.isActive == false) {
earlyExit = true;
}
}
}
}
}
// get power
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
if(pb.description.equals("Personal Movement Buff") && playerCharacter.isFlying()) {
ChatManager.chatSystemInfo(playerCharacter, "You cannot use movement speed buffs while flying");
earlyExit = true;
}
if (earlyExit) {
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
@@ -300,6 +263,7 @@ public enum PowersManager {
return false;
}
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
// sendPowerMsg(pc, 10, msg);
// return false;
@@ -312,6 +276,9 @@ public enum PowersManager {
return false;
}
// get power
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
if (pb == null) {
ChatManager.chatSayInfo(playerCharacter,
"This power is not implemented yet.");
@@ -322,18 +289,44 @@ public enum PowersManager {
return true;
// 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)
return true;
//Check if Power Target is allowed to cast.
// Check powers for normal users
if(msg.getPowerUsedID() == 429399948)
for(CharacterRune cr : playerCharacter.getRunes())
if(cr.getRuneBaseID() == 3029)
skipCheck = true;
if (!skipCheck && (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID())))
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
if (!playerCharacter.isCSR()) {
if (!MBServerStatics.POWERS_DEBUG) {
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
@@ -346,31 +339,24 @@ public enum PowersManager {
// get numTrains for power
int trains = msg.getNumTrains();
int token = pb.token;
int overrideTrains = 0;
int overrideRecycle = 0;
if(token == 429420458){
overrideTrains = 40;
overrideRecycle = 300000;
}
// can't go over the max trains for the power, unless CSR
if (trains > pb.getMaxTrains() && !playerCharacter.isCSR()) {
trains = pb.getMaxTrains();
msg.setNumTrains(trains);
}
switch(pb.token){
case 429420458: // BH eyes
msg.setNumTrains(msg.getNumTrains() * 2);
break;
}
// can't go over total trains by player
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
if (cp != null) {
int tot = cp.getTotalTrains();
switch(token){
case 430596127:
if(playerCharacter.getPromotionClass().getName().equals("Wizard"))
tot = 40; //single teleport granted at 40 for wizard
break;
}
if (tot == 0 && !playerCharacter.isCSR())
return false;
if (trains != tot && !playerCharacter.isCSR()) {
@@ -379,19 +365,27 @@ public enum PowersManager {
}
}
}
if(overrideTrains > 0)
msg.setNumTrains(overrideTrains);
// get recycle time in ms
int time = pb.getRecycleTime(trains);
if(overrideRecycle > 0)
time = overrideRecycle;
// verify player is in correct mode (combat/nonCombat)
if (playerCharacter.isCombat()) {
if (!pb.allowedInCombat())
// ChatManager.chatPowerError(pc,
// "This power is not allowed in combat mode.");
return true;
} else if (!pb.allowedOutOfCombat())
// ChatManager.chatPowerError(pc,
// "You must be in combat mode to use this power.");
return true;
// verify player is not stunned or prohibited from casting
PlayerBonuses bonus = playerCharacter.getBonuses();
SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
return true;
// if moving make sure spell valid for movement
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
@@ -417,58 +411,58 @@ public enum PowersManager {
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
if (pb.isAOE()) {
if (!pb.usePointBlank()) {
AbstractWorldObject target;
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
target = pet;
}else{
target = getTarget(msg);
}
AbstractWorldObject target = getTarget(msg);
if (target != null && target.getObjectType() == GameObjectType.Building && !pb.targetBuilding()) {
PowersManager.sendPowerMsg(playerCharacter, 9, new PerformActionMsg(msg));
return true;
}
if (target == null) {
if (playerCharacter.getLoc().distanceSquared2D(msg.getTargetLoc()) > sqr(pb
.getRange()))
return true;
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange())) {
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange()))
// pc.getLoc().distance(target.getLoc()) >
// pb.getRange())
return true;
}
}
} else {
// get target
AbstractWorldObject target;
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
target = pet;
}else{
target = getTarget(msg);
}
if (target == null) {
AbstractWorldObject target = getTarget(msg);
if (target == null)
return true;
}
if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216)
return true;
float range = pb.getRange();
// 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))
targetLiveCounter = ((AbstractCharacter) target).getLiveCounter();
}
// verify regular player can cast spell, otherwise authenticate
if (!pb.regularPlayerCanCast()) {
Account a = SessionManager.getAccount(playerCharacter);
@@ -478,6 +472,7 @@ public enum PowersManager {
return true;
}
}
// verify player has proper effects applied to use power
if (pb.getEffectPrereqs().size() > 0 && playerCharacter.getEffects() != null) {
@@ -491,9 +486,11 @@ public enum PowersManager {
break;
}
}
if (!passed)
return true;
}
//verify player has proper equipment to use power
if (pb.getEquipPrereqs().size() > 0) {
@@ -568,7 +565,6 @@ public enum PowersManager {
// Validity checks passed, move on to casting spell
//get caster's live counter
int casterLiveCounter = playerCharacter.getLiveCounter();
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
if (time > 0) {
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
@@ -603,7 +599,9 @@ public enum PowersManager {
}
// update cast (use skill) fail condition
playerCharacter.cancelOnCast();
if(pb.token != 429396028) {
playerCharacter.cancelOnCast();
}
// update castSpell (use spell) fail condition if spell
if (pb.isSpell())
@@ -612,13 +610,6 @@ public enum PowersManager {
// get cast time in ms.
time = pb.getCastTime(trains);
if(pb.token == 430596127)
time = 5000;
if(pb.name.equals("Summon") && playerCharacter.getRace().getName().contains("Vampire"))
time = 60000;
// set player is casting for regens
@@ -629,11 +620,6 @@ public enum PowersManager {
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
if(msg.getPowerUsedID() == 429495514 && playerCharacter.getRace().getName().contains("Shade")){
copyMsg.setPowerUsedID(429397210);//intercept shade using hide and cast sneak instead
}
// run timer job to end cast
if (time < 1) // run immediately
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
@@ -699,13 +685,7 @@ public enum PowersManager {
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
if (pb.isAOE()) {
if (!pb.usePointBlank()) {
AbstractWorldObject target;
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
target = pet;
}else{
target = getTarget(msg);
}
AbstractWorldObject target = getTarget(msg);
if (target == null) {
@@ -720,13 +700,7 @@ public enum PowersManager {
}
} else {
// get target
AbstractWorldObject target;
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
target = pet;
}else{
target = getTarget(msg);
}
AbstractWorldObject target = getTarget(msg);
if (target == null)
return true;
@@ -810,6 +784,13 @@ public enum PowersManager {
if (playerCharacter == null || msg == null)
return;
if((msg.getPowerUsedID() == 429495514 || msg.getPowerUsedID() == 429407306) && playerCharacter.getRace().getName().toLowerCase().contains("shade")){
//msg.setPowerUsedID(407015607);
applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
}
if(msg.getPowerUsedID() == 429494441) {//wildkins chase
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
}
if (playerCharacter.isCasting()) {
playerCharacter.update();
playerCharacter.updateStamRegen(-100);
@@ -913,15 +894,16 @@ public enum PowersManager {
}
float range = pb.getRange() + speedRange;
if(pb.token != 429396028) {
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
sendPowerMsg(playerCharacter, 8, msg);
return;
sendPowerMsg(playerCharacter, 8, msg);
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
}
@@ -943,6 +925,8 @@ public enum PowersManager {
return;
}
playerCharacter.setHateValue(pb.getHateValue(trains));
//Send Cast Message.
// PerformActionMsg castMsg = new PerformActionMsg(msg);
// castMsg.setNumTrains(9999);
@@ -993,6 +977,8 @@ public enum PowersManager {
//Power is aiding a target, handle aggro if combat target is a Mob.
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target;
if (!pb.isHarmful())
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
}
// update target of used power timer
@@ -1331,8 +1317,9 @@ public enum PowersManager {
if (pc == null)
return;
PlayerCharacter target = SessionManager.getPlayerCharacterByLowerCaseName(msg.getTargetName());
if (target == null || target.equals(pc) || target.isCombat() || target.getGuild().getNation().equals(pc.getGuild().getNation()) == false) {
PlayerCharacter target = SessionManager
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
if (target == null || target.equals(pc)) {
if (target == null) // Player not found. Send not found message
ChatManager.chatInfoError(pc,
@@ -1341,10 +1328,7 @@ public enum PowersManager {
ChatManager.chatInfoError(pc,
"Cannot summon player in combat.");
// else trying to summon self, just fail
if(target != null && target.getGuild().getNation().equals(pc.getGuild().getNation()) == false){
ChatManager.chatInfoError(pc,
"Cannot summon outside of nation.");
}
// recycle summon
sendRecyclePower(msg.getPowerToken(), origin);
@@ -1376,7 +1360,7 @@ public enum PowersManager {
if (source == null)
return;
long tooLate = pc.getSummoner(source.getObjectUUID()) + 45000;
long tooLate = pc.getSummoner(source.getObjectUUID());
if (tooLate < System.currentTimeMillis()) {
ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
pc.removeSummoner(source.getObjectUUID());
@@ -1438,16 +1422,18 @@ public enum PowersManager {
duration = 15000; // Healer Summons, 15 seconds
else
duration = 45000; // Belgosh Summons, 45 seconds
if(pc.inSafeZone() == false) {
for (AbstractWorldObject absChar : WorldGrid.getObjectsInRangePartial(pc.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)) {
PlayerCharacter player = (PlayerCharacter) absChar;
if (player.guild.getNation().equals(pc.guild.getNation()) == false) {
duration += 60000;
break;
}
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
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
JobContainer jc = JobScheduler.getInstance().scheduleJob(fsj,
@@ -1572,44 +1558,18 @@ public enum PowersManager {
}
// create list of characters
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
allTargets, playerCharacter, maxTargets);
trackChars = new HashSet<>();
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
//ArrayList<Guild> nationsInRange = new ArrayList<>();
ArrayList<AbstractWorldObject> purgeList = new ArrayList<>();
for(AbstractWorldObject trackChar : allInRange) {
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
purgeList.add(trackChar);
HashSet<AbstractCharacter> trackChars;
switch(msg.getPowerToken()){
case 431511776:
case 429578587:
case 429503360:
trackChars = getTrackList(playerCharacter);
break;
default:
trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
break;
}
allInRange.removeAll(purgeList);
//first round to add players in range
for(AbstractWorldObject trackChar : allInRange){
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
continue;
if(allInRange.contains(trackChar)) {
trackChars.add((AbstractCharacter)trackChar);
}
}
//track full range for chaining nation members
ArrayList<Guild> nationsInRange = new ArrayList<>();
for(AbstractCharacter pc : trackChars){
if(nationsInRange.contains(pc.guild.getNation()) == false)
nationsInRange.add(pc.guild.getNation());
}
HashSet<AbstractWorldObject> fullRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,1024,MBServerStatics.MASK_PLAYER);
for(AbstractWorldObject trackChar : fullRange) {
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
continue;
if(nationsInRange.contains(((PlayerCharacter) trackChar).guild.getNation()) && trackChars.contains(trackChar) == false)
trackChars.add((AbstractCharacter)trackChar);
}
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
// send track window
@@ -1621,6 +1581,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) {
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
@@ -1785,8 +1769,7 @@ public enum PowersManager {
ac.setItemCasting(false);
if (ac == null || target == null || pb == null)
return;
if(pb.targetSelf)
target = ac;
ac.clearTimer(Integer.toString(pb.getToken()));
if (liveCounter == ac.getLiveCounter())
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
@@ -2367,9 +2350,9 @@ public enum PowersManager {
int type = msg.getTargetType();
int UUID = msg.getTargetID();
if (type == -1 || type == 0 || UUID == -1 || UUID == 0) {
if (type == -1 || type == 0 || UUID == -1 || UUID == 0)
return null;
}
return (AbstractWorldObject) DbManager.getObject(GameObjectType.values()[type], UUID);
}
@@ -2387,22 +2370,26 @@ public enum PowersManager {
defense = 0f;
// Get hit chance
if (pc.getDebug(16)) {
String smsg = "ATR: " + atr + ", Defense: " + defense;
ChatManager.chatSystemInfo(pc, smsg);
}
//if (pc.getDebug(16)) {
// String smsg = "ATR: " + atr + ", Defense: " + defense;
// ChatManager.chatSystemInfo(pc, smsg);
//}
float constant = (atr+defense)*0.315f;
float atrChance = atr - constant;
float defChance = defense - constant + atrChance;
float smallChance = atrChance/defChance;
int chance = (int)(smallChance * 100);
//int chance;
//if (atr > defense || defense == 0)
// chance = 94;
//else {
// float dif = atr / defense;
// if (dif <= 0.8f)
// chance = 4;
// else
// chance = ((int) (450 * (dif - 0.8f)) + 4);
//}
// calculate hit/miss
int roll = ThreadLocalRandom.current().nextInt(100);
boolean disable = true;
if (roll < chance) {
if (CombatManager.LandHit((int)atr,(int)defense)) {
// Hit, check if dodge kicked in
if (awo instanceof AbstractCharacter) {
AbstractCharacter tarAc = (AbstractCharacter) awo;
@@ -2604,11 +2591,11 @@ public enum PowersManager {
ChatManager.chatSystemInfo(pc, outmsg);
return false; // can't target player, stop here
} // target is mob
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == false)
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0)
return pb.targetMob();
// target is pet
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == true)
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_PET) != 0)
return pb.targetPet();
// target is Building
@@ -2687,7 +2674,7 @@ public enum PowersManager {
PowersBase power = getLastPower(ac);
if (power != null && power.cancelOnTakeDamage() && power.getName().equals("Translocate") == false)
if (power != null && power.cancelOnTakeDamage())
cancelPower(ac, true);
cancelItems(ac, false, true);
ac.cancelTimer("Stuck");
@@ -2702,7 +2689,9 @@ public enum PowersManager {
}
public static void cancelOnStun(AbstractCharacter ac) {
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter.GroundPlayer((PlayerCharacter)ac);
}
}
private static PowersBase getLastPower(AbstractCharacter ac) {
@@ -2847,12 +2836,7 @@ public enum PowersManager {
}
}
}
public static void applyZergBuff(AbstractGameObject obj){
}
public static void removeZergBuff(HashSet<Integer> playersIDs){
}
}
+10 -20
View File
@@ -10,11 +10,6 @@ package engine.gameManager;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid;
import engine.db.archive.DataWarehouse;
import engine.db.archive.MineRecord;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.*;
import org.pmw.tinylog.Logger;
@@ -24,7 +19,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Collection;
/*
@@ -36,14 +30,13 @@ public enum SimulationManager {
SERVERHEARTBEAT;
private static final long CITY_PULSE = 2000;
private static final long RUNEGATE_PULSE = 500;
private static final long RUNEGATE_PULSE = 1000;
private static final long UPDATE_PULSE = 1000;
private static final long FlIGHT_PULSE = 100;
public static Duration executionTime = Duration.ofNanos(1);
public static Duration executionMax = Duration.ofNanos(1);
private static SimulationManager instance = null;
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
private long _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
private long _runegatePulseTime = System.currentTimeMillis()
+ RUNEGATE_PULSE;
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
@@ -73,8 +66,6 @@ public enum SimulationManager {
return popString;
}
/*
* Update the simulation. *** Important: Whatever you do in here, do it damn
* quick!
@@ -132,17 +123,7 @@ public enum SimulationManager {
e.printStackTrace();
}
//try {
// if ((_minePulseTime != 0)
// && (System.currentTimeMillis() > _minePulseTime))
// pulseMines();
//} catch (Exception e) {
// Logger.error(
// "Fatal error in Mine Pulse: DISABLED. Error Message : "
// + e.getMessage());
// e.printStackTrace();
//}
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
if (executionTime.compareTo(executionMax) > 0)
@@ -219,7 +200,12 @@ public enum SimulationManager {
city = (City) cityObject;
city.onEnter();
}
for(Mine mine : Mine.getMines()){
if(mine != null && mine.isActive)
mine.onEnter();
}
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
}
/*
@@ -229,6 +215,10 @@ public enum SimulationManager {
private void pulseRunegates() {
for (Runegate runegate : Runegate._runegates.values()) {
for(Portal portal : runegate._portals)
if(!portal.isActive())
portal.activate(false);
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;
}
}
}
}
+68 -34
View File
@@ -1,18 +1,7 @@
package engine.gameManager;
import engine.objects.Guild;
public class ZergManager {
public static int getBaneCap(Guild guild) {
if(guild.getOwnedCity() == null || guild.getOwnedCity().getTOL() == null)
return 0;
int cityRank = guild.getOwnedCity().getTOL().getRank();
return (cityRank == 8) ? 20 : ((guild.getNation().getSubGuildList().size() + 1 <= 4) ? 10 : 20);
}
public static float getCurrentMultiplier(int count, int maxCount){
switch(maxCount) {
case 3:
@@ -21,38 +10,83 @@ public class ZergManager {
return getMultiplier5Man(count);
case 10:
return getMultiplier10Man(count);
case 20:
return getMultiplier20Man(count);
default:
return getMultiplier40Man(count);
return getMultiplier20Man(count);
}
}
public static float getMultiplier(int count, int maxCount, float[] thresholds) {
if (count <= maxCount) return 1.0f;
if (count > thresholds.length) return 0.0f;
return 1.0f - thresholds[count - maxCount - 1];
}
public static float getMultiplier3Man(int count) {
float[] thresholds = {0.37f, 0.60f, 0.75f};
return getMultiplier(count, 3, thresholds);
}
if(count < 4)
return 1.0f;
if(count > 6)
return 0.0f;
switch(count){
case 4:
return 0.75f;
case 5:
return 0.60f;
case 6:
return 0.37f;
}
return 1.0f;
}
public static float getMultiplier5Man(int count) {
float[] thresholds = {0.25f, 0.43f, 0.56f, 0.67f, 0.75f};
return getMultiplier(count, 5, thresholds);
}
if(count < 6)
return 1.0f;
if(count > 10)
return 0.0f;
switch(count){
case 6:
return 0.75f;
case 7:
return 0.67f;
case 8:
return 0.56f;
case 9:
return 0.43f;
case 10:
return 0.25f;
}
return 1.0f;
}
public static float getMultiplier10Man(int count) {
float[] thresholds = {0.14f, 0.25f, 0.35f, 0.43f, 0.50f, 0.56f, 0.62f, 0.67f, 0.71f, 0.75f};
return getMultiplier(count, 10, thresholds);
}
if(count < 11)
return 1.0f;
if(count > 20)
return 0.0f;
switch(count){
case 11:
return 0.75f;
case 12:
return 0.71f;
case 13:
return 0.67f;
case 14:
return 0.62f;
case 15:
return 0.56f;
case 16:
return 0.50f;
case 17:
return 0.43f;
case 18:
return 0.35f;
case 19:
return 0.25f;
case 20:
return 0.14f;
}
return 1.0f;
}
public static float getMultiplier20Man(int count) {
return getMultiplier10Man(count * 2);
}
public static float getMultiplier40Man(int count) {
return getMultiplier10Man(count * 4);
}
}
}
-73
View File
@@ -19,14 +19,12 @@ import engine.objects.Building;
import engine.objects.City;
import engine.objects.Zone;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
/*
* Class contains methods and structures which
@@ -109,20 +107,6 @@ public enum ZoneManager {
}
// Returns the number of available hotZones
// remaining in this cycle (1am)
public static int availableHotZones() {
int count = 0;
for (Zone zone : ZoneManager.macroZones)
if (ZoneManager.validHotZone(zone))
count = count + 1;
return count;
}
// Resets the availability of hotZones
// for this cycle
@@ -217,63 +201,6 @@ public enum ZoneManager {
ZoneManager.playerCityZones.add(zone);
}
public static final void generateAndSetRandomHotzone() {
Zone hotZone;
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.getSafeZone() == (byte) 1)
return false; // no safe zone hotzones// if (this.hotzone == null)
if (zone.getNodes().isEmpty())
return false;
if (zone.equals(ZoneManager.seaFloor))
return false;
//no duplicate hotZones
if (zone.hasBeenHotzone == true)
return false;
// Enforce min level
if (zone.minLvl < 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.
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
-8
View File
@@ -15,13 +15,9 @@ import engine.gameManager.DbManager;
import engine.job.AbstractScheduleJob;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.Bane;
import engine.objects.City;
import engine.workthreads.ZergMechanicThread;
import org.pmw.tinylog.Logger;
import static engine.workthreads.ZergMechanicThread.startZergThreadBane;
public class ActivateBaneJob extends AbstractScheduleJob {
private final int cityUUID;
@@ -71,10 +67,6 @@ public class ActivateBaneJob extends AbstractScheduleJob {
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(msg);
if(city.getBane() != null) {
startZergThreadBane(city.getBane());
}
}
@Override
-5
View File
@@ -9,11 +9,9 @@
package engine.jobs;
import engine.Enum;
import engine.gameManager.CombatManager;
import engine.job.AbstractJob;
import engine.objects.AbstractCharacter;
import engine.objects.PlayerCharacter;
public class AttackJob extends AbstractJob {
@@ -31,9 +29,6 @@ public class AttackJob extends AbstractJob {
@Override
protected void doJob() {
CombatManager.doCombat(this.source, slot);
if(this.source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
if(((PlayerCharacter)this.source).getHidden() > 0)
this.source.removeEffectBySource(Enum.EffectSourceType.Invisibility,41,true);
}
public boolean success() {
+2 -2
View File
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).fearedObject = null;
((Mob) this.target).setFearedObject(null);
}
@Override
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).fearedObject = null;
((Mob) this.target).setFearedObject(null);
}
}
+5 -5
View File
@@ -47,13 +47,13 @@ public class FinishSummonsJob extends AbstractScheduleJob {
return;
// 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);
return;
}
// PowersManager.finishRecycleTime(428523680, this.source, false);
// return;
//}
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
+19 -5
View File
@@ -9,10 +9,12 @@
package engine.loot;
import engine.gameManager.LootManager;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public class ItemTableEntry {
public int minRoll;
@@ -35,11 +37,23 @@ public class ItemTableEntry {
List<ItemTableEntry> itemTableEntryList;
itemTableEntryList = LootManager._itemTables.get(itemTable);
for (ItemTableEntry iteration : itemTableEntryList)
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
itemTableEntry = iteration;
if(itemTableEntryList != null) {
for (ItemTableEntry iteration : itemTableEntryList)
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
itemTableEntry = iteration;
}
return itemTableEntry;
}
public static Integer getRandomItem(int itemTable) {
int id = 0;
List<ItemTableEntry> itemTableEntryList;
itemTableEntryList = LootManager._itemTables.get(itemTable);
if(itemTableEntryList != null && itemTableEntryList.size() > 1){
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0,itemTableEntryList.size() - 1)).cacheID;
}
return id;
}
}
+4 -9
View File
@@ -33,15 +33,10 @@ public class ModTableEntry {
List<ModTableEntry> itemTableEntryList;
itemTableEntryList = LootManager._modTables.get(modTablwe);
if(itemTableEntryList == null)
return null;
for (ModTableEntry iteration : itemTableEntryList) {
if (iteration == null)
continue;
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
modTableEntry = iteration;
if(itemTableEntryList != null) {
for (ModTableEntry iteration : itemTableEntryList)
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
modTableEntry = iteration;
}
return modTableEntry;
}
+1 -1
View File
@@ -220,7 +220,7 @@ public class Bounds {
//player is inside building region, skip collision check. we only do collision from the outside.
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
continue;
if (building.getBounds() == null || building.getBounds().colliders == null)
if (building.getBounds().colliders == null)
continue;
for (Colliders collider : building.getBounds().colliders) {
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -13,7 +13,7 @@ public class MobAIThread implements Runnable{
public static int AI_DROP_AGGRO_RANGE = 60;
public static int AI_PULSE_MOB_THRESHOLD = 200;
public static int AI_PATROL_DIVISOR = 15;
public static float AI_CAST_FREQUENCY = 1.0f;
public static float AI_CAST_FREQUENCY;
// Thread constructor
public MobAIThread() {
@@ -12,20 +12,13 @@ package engine.mobileAI.utilities;
import engine.Enum.*;
import engine.gameManager.ChatManager;
import engine.gameManager.CombatManager;
import engine.gameManager.PowersManager;
import engine.math.Vector3fImmutable;
import engine.mobileAI.MobAI;
import engine.mobileAI.Threads.MobAIThread;
import engine.net.DispatchMessage;
import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.TargetedActionMsg;
import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
import static engine.math.FastMath.sqr;
@@ -55,7 +48,7 @@ public class CombatUtilities {
}
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
}
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
@@ -146,37 +139,22 @@ public class CombatUtilities {
}
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
int defenseScore = 0;
int attackScore = agent.getAtrHandOne();
int defense = 0;
int atr = agent.getAtrHandOne();
switch (target.getObjectType()) {
case PlayerCharacter:
defenseScore = ((AbstractCharacter) target).getDefenseRating();
defense = ((AbstractCharacter) target).getDefenseRating();
break;
case Mob:
Mob mob = (Mob) target;
if (mob.isSiege())
defenseScore = attackScore;
defense = atr;
break;
case Building:
return false;
}
int hitChance;
if (attackScore > defenseScore || defenseScore == 0)
hitChance = 94;
else if (attackScore == defenseScore && target.getObjectType() == GameObjectType.Mob)
hitChance = 10;
else {
float dif = attackScore / defenseScore;
if (dif <= 0.8f)
hitChance = 4;
else
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
if (target.getObjectType() == GameObjectType.Building)
hitChance = 100;
}
return ThreadLocalRandom.current().nextInt(100) > hitChance;
return CombatManager.LandHit(atr,defense);
}
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
@@ -311,6 +289,7 @@ public class CombatUtilities {
if (targetMob.isSiege())
return;
}
}
public static float determineDamage(Mob agent) {
@@ -486,9 +465,8 @@ public class CombatUtilities {
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
}
}
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
}
return agent.getMinDamageHandOne();
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
}
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
@@ -514,214 +492,8 @@ public class CombatUtilities {
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
}
return agent.getMaxDamageHandOne();
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
}
public static boolean MobCast(Mob mob) {
try {
// Method picks a random spell from a mobile's list of powers
// and casts it on the current target (or itself). Validation
// (including empty lists) is done previously within canCast();
ArrayList<Integer> powerTokens;
ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp)
MobAI.MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile.
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
purgeTokens = new ArrayList<>();
// If player has this effect on them currently then remove
// this token from our list.
for (int powerToken : powerTokens) {
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
for (ActionsBase actionBase : powerBase.getActions()) {
String stackType = actionBase.stackType;
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
purgeTokens.add(powerToken);
}
}
powerTokens.removeAll(purgeTokens);
// Sanity check
if (powerTokens.isEmpty())
return false;
// Pick random spell from our list of powers
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
int powerRank = mob.mobPowers.get(powerToken);
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
//check for hit-roll
if (mobPower.requiresHitRoll)
if (triggerDefense(mob, mob.getCombatTarget()))
return false;
// Cast the spell
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
PerformActionMsg msg;
if (!mobPower.isHarmful() || mobPower.targetSelf) {
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
} else {
PowersManager.useMobPower(mob, target, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
}
msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0);
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
return true;
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
}
return false;
}
public static boolean GuardCast(Mob mob) {
try {
// Method picks a random spell from a mobile's list of powers
// and casts it on the current target (or itself). Validation
// (including empty lists) is done previously within canCast();
ArrayList<Integer> powerTokens;
ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp)
MobAI.MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile.
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
purgeTokens = new ArrayList<>();
// If player has this effect on them currently then remove
// this token from our list.
for (int powerToken : powerTokens) {
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
for (ActionsBase actionBase : powerBase.getActions()) {
String stackType = actionBase.stackType;
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
purgeTokens.add(powerToken);
}
}
powerTokens.removeAll(purgeTokens);
// Sanity check
if (powerTokens.isEmpty())
return false;
int powerToken;
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
if (nukeRoll < 55) {
//use direct damage spell
powerToken = powerTokens.get(powerTokens.size() - 1);
} else {
//use random spell
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
}
int powerRank = 1;
switch(mob.getRank()){
case 1:
powerRank = 10;
break;
case 2:
powerRank = 15;
break;
case 3:
powerRank = 20;
break;
case 4:
powerRank = 25;
break;
case 5:
powerRank = 30;
break;
case 6:
powerRank = 35;
break;
case 7:
powerRank = 40;
break;
}
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
//check for hit-roll
if (mobPower.requiresHitRoll)
if (triggerDefense(mob, mob.getCombatTarget()))
return false;
// Cast the spell
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
PerformActionMsg msg;
if (!mobPower.isHarmful() || mobPower.targetSelf) {
if (mobPower.category.equals("DISPEL")) {
PowersManager.useMobPower(mob, target, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
} else {
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
}
} else {
PowersManager.useMobPower(mob, target, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
}
msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0);
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
return true;
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
}
return false;
}
}
@@ -13,10 +13,10 @@ import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.mobileAI.Threads.MobAIThread;
import engine.exception.MsgSendException;
import engine.gameManager.MovementManager;
import engine.math.Vector3fImmutable;
import engine.mobileAI.Threads.MobAIThread;
import engine.net.client.msg.MoveToPointMsg;
import engine.objects.*;
import org.pmw.tinylog.Logger;
@@ -38,7 +38,7 @@ public class MovementUtilities {
if (agent.getContract() != null)
guardCaptain = agent;
else
guardCaptain = (Mob) agent.guardCaptain;
guardCaptain = (Mob) agent.npcOwner;
if (guardCaptain != null) {
Building barracks = guardCaptain.building;
@@ -115,8 +115,39 @@ public class MovementUtilities {
}
public static Vector3fImmutable GetMoveLocation(Mob aiAgent, AbstractCharacter aggroTarget) {
// Player isnt moving and neither is mob. Just return
// the mobile's current location. Ain't goin nowhere!
// *** Refactor: Check to ensure methods calling us
// all don't sent move messages when not moving.
if ((aggroTarget.isMoving() == false))
return aggroTarget.getLoc();
if (aggroTarget.getEndLoc().x != 0) {
float aggroTargetDistanceSquared = aggroTarget.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
float aiAgentDistanceSquared = aiAgent.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
if (aiAgentDistanceSquared >= aggroTargetDistanceSquared)
return aggroTarget.getEndLoc();
else {
float distanceToMove = sqrt(aggroTargetDistanceSquared + aiAgentDistanceSquared) * .5f;
return aggroTarget.getFaceDir().scaleAdd(distanceToMove, aggroTarget.getLoc());
}
}
// One of us is moving so let's calculate our destination loc for this
// simulation frame. We will simply project our position onto the
// character's movement vector and return the closest point.
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
}
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset) {
agent.resetLastSetLocUpdate();
try {
//don't move farther than 30 units from player.
@@ -141,8 +172,32 @@ public class MovementUtilities {
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
}
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
//Determing where I want to move.
return new Vector3fImmutable((center.x - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius),
center.y,
(center.z - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius));
}
public static Long estimateMovementTime(Mob agent) {
if (agent.getEndLoc().x == 0 && agent.getEndLoc().y == 0)
return 0L;
return (long) ((agent.getLoc().distance2D(agent.getEndLoc()) * 1000) / agent.getSpeed());
}
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
//update our walk/run state.
if (isWalking && !agent.isWalk()) {
agent.setWalkMode(true);
MovementManager.sendRWSSMsg(agent);
} else if (!isWalking && agent.isWalk()) {
agent.setWalkMode(false);
MovementManager.sendRWSSMsg(agent);
}
MoveToPointMsg msg = new MoveToPointMsg();
@@ -218,4 +273,23 @@ public class MovementUtilities {
return character.getLoc();
}
public static boolean updateMovementToCharacter(Mob aiAgent, AbstractCharacter aggroTarget) {
if (aiAgent.destination.equals(Vector3fImmutable.ZERO))
return true;
if (!aiAgent.isMoving())
return true;
if (aggroTarget.isMoving()) {
return !aiAgent.destination.equals(aggroTarget.getEndLoc()) && !aiAgent.destination.equals(aggroTarget.getLoc());
} else {
if (aiAgent.destination.equals(aggroTarget.getLoc()))
return false;
}
return false;
}
}
+4 -4
View File
@@ -13,6 +13,8 @@ import engine.exception.FactoryBuildException;
import engine.gameManager.ChatManager;
import engine.net.client.ClientConnection;
import engine.net.client.Protocol;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.PlaceAssetMsg;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import org.joda.time.DateTime;
@@ -94,11 +96,9 @@ public class NetMsgFactory {
if (origin instanceof ClientConnection) {
PlayerCharacter player = ((ClientConnection) origin).getPlayerCharacter();
if (player != null) {
// if (MBServerStatics.worldServerName.equals("Grief"))
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
} else
Logger.error("PROTOCOL ERROR: Player: " + ((ClientConnection) origin).getPlayerCharacter().getName() + " Account: " + ((ClientConnection) origin).getPlayerCharacter().getAccount().getUname() + "Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Please Report What You Just Did. Ref Code: " + opcode);
}
}
return null;
+67 -58
View File
@@ -9,7 +9,6 @@
package engine.net.client;
import engine.Enum;
import engine.Enum.*;
import engine.InterestManagement.WorldGrid;
import engine.exception.MsgSendException;
@@ -123,7 +122,6 @@ public class ClientMessagePump implements NetMsgHandler {
if (pc.isSit()) {
pc.setCombat(false);
pc.cancelOnSit();
pc.stopMovement(pc.loc);
}
UpdateStateMsg rwss = new UpdateStateMsg();
@@ -224,11 +222,6 @@ public class ClientMessagePump implements NetMsgHandler {
return;
}
if(msg.getSlotNumber() == 11 && pc.getRaceID() == 1999){
forceTransferFromEquipToInventory(msg, origin, "Saetor cannot wear shoes.");
return;
}
int uuid = msg.getUUID();
int slot = msg.getSlotNumber();
//System.out.println("loading to slot: " + slot);
@@ -561,28 +554,32 @@ public class ClientMessagePump implements NetMsgHandler {
if (i == null)
return;
if(i.getItemBaseID() == 7)
return; //cant delete gold
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID()))
return;
if (!itemManager.inventoryContains(i))
return;
if(i.getItemBaseID() == 980066)
//cannot delete gold
if(i.getItemBaseID() == 7)
return;
if (i.canDestroy) {
int value = i.getItemBase().value;
if(i.getItemBase().isRune())
value = 500000;
if(sourcePlayer.getCharItemManager().getGoldInventory().getNumOfItems() + value > 10000000){
if (i.isCanDestroy()) {
int goldValue = i.getBaseValue();
if (i.getItemBase().isRune())
goldValue = 500000;
if (i.getItemBaseID() == 980066)
goldValue = 0;
if(itemManager.getGoldInventory().getNumOfItems() + goldValue > 10000000)
return;
}
if (itemManager.delete(i) == true) {
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
sourcePlayer.getCharItemManager().updateInventory();
if (itemManager.delete(i)) {
if (goldValue > 0)
itemManager.addGoldToInventory(goldValue, false);
itemManager.updateInventory();
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
@@ -675,6 +672,8 @@ public class ClientMessagePump implements NetMsgHandler {
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
}
private static void lootWindowRequest(LootWindowRequestMsg msg, ClientConnection origin) throws MsgSendException {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
@@ -1264,6 +1263,8 @@ public class ClientMessagePump implements NetMsgHandler {
cost = sell.getBaseValue();
if(sell.getItemBaseID() == 980066)
cost = 0;
//apply damaged value reduction
float durabilityCurrent = sell.getDurabilityCurrent();
@@ -1368,6 +1369,8 @@ public class ClientMessagePump implements NetMsgHandler {
return;
// test within talking range
if(npc.isInSafeZone())
npc.sellPercent = 0;
if (sourcePlayer.getLoc().distanceSquared2D(npc.getLoc()) > MBServerStatics.NPC_TALK_RANGE * MBServerStatics.NPC_TALK_RANGE) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 14);
@@ -1399,6 +1402,12 @@ public class ClientMessagePump implements NetMsgHandler {
Item buy = null;
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
//if(npc.contract.getObjectUUID() == 890){ // default steward
// sellInventory = npc.getSellInventorySteward();
//}
//if(npc.contract.getObjectUUID() == 889){ // default builder
// sellInventory = npc.getSellInventoryBuilder();
//}
if (sellInventory == null) {
return;
}
@@ -1412,19 +1421,33 @@ public class ClientMessagePump implements NetMsgHandler {
if (!itemMan.hasRoomInventory(ib.getWeight())) {
return;
}
int cost = me.magicValue;
if(npc.getContractID() == 1201 && me.getItemBase().getName().equals("Prospector"))
cost = 50;
int cost = me.getMagicValue();
float bargain = sourcePlayer.getBargain();
float profit = npc.getSellPercent(sourcePlayer) - bargain;
if(me.getItemBase().getType().equals(ItemType.POTION))
profit -= 1.0f;
if (profit < 1)
profit = 1;
if(npc.getContractID() == 900){
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
switch(npc.getContractID()){
case 1201:
cost = ItemBase.getDiscPrice(ib.getUUID());
bargain = 0;
break;
case 1202:
cost = ItemBase.getStatPrice(ib.getUUID());
bargain = 0;
break;
case 900:
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
bargain = 0;
break;
}
cost *= profit;
float profit;
if(npc.isInSafeZone())
profit = 0;
else
profit = npc.getSellPercent(sourcePlayer) - bargain;
if(profit > 0)
cost *= profit;
if (gold.getNumOfItems() - cost < 0) {
//dont' have enough goldItem exit!
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
@@ -1437,16 +1460,17 @@ public class ClientMessagePump implements NetMsgHandler {
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
return;
}
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
}if(npc.getContractID() == 1502041){
me.fromNoob = true;
} else if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
return;
}
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
handleResourcePurchase(me,itemMan,npc,buy,sourcePlayer,ib);
handleResourcePurchase(me,itemMan,sourcePlayer,ib);
}else {
buy = Item.createItemForPlayer(sourcePlayer, ib);
buy = Item.createItemForPlayer(sourcePlayer, ib, me.fromNoob);
if (buy != null) {
me.transferEnchants(buy);
itemMan.addItemToInventory(buy);
@@ -1560,7 +1584,7 @@ public class ClientMessagePump implements NetMsgHandler {
}
}
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, NPC npc, Item buy, PlayerCharacter sourcePlayer, ItemBase ib){
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, PlayerCharacter sourcePlayer, ItemBase ib){
boolean stacked = false;
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
for(Item item : itemMan.getInventory()){
@@ -1580,7 +1604,7 @@ public class ClientMessagePump implements NetMsgHandler {
}
}
if(!stacked){
buy = Item.createItemForPlayer(sourcePlayer, ib);
Item buy = Item.createItemForPlayer(sourcePlayer, ib, false);
if (buy != null) {
me.transferEnchants(buy);
itemMan.addItemToInventory(buy);
@@ -1590,6 +1614,7 @@ public class ClientMessagePump implements NetMsgHandler {
}
itemMan.updateInventory();
}
private static void Repair(RepairMsg msg, ClientConnection origin) {
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
@@ -1632,8 +1657,8 @@ public class ClientMessagePump implements NetMsgHandler {
if (toRepair == null)
return;
//if (toRepair.getItemBase().isGlass())
// return;
if (toRepair.getItemBase().isGlass())
return;
//make sure item is in player's inventory or equipment
if (!itemMan.inventoryContains(toRepair) && !itemMan.equippedContains(toRepair))
@@ -1647,19 +1672,16 @@ public class ClientMessagePump implements NetMsgHandler {
max *= (1 + (durMod * 0.01f));
if (dur >= max || dur < 1) {
//redundancy message to clear item from window in client
if (!DbManager.ItemQueries.SET_DURABILITY(toRepair, dur))
return;
toRepair.setDurabilityCurrent(max);
msg.setupRepairAck(max - dur);
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return;
}
//TODO get cost to repair
int cost = (int) ((max - dur) * 80.1);
//glass costs 3x as much to repair
if (toRepair.getItemBase().isGlass()){
cost *= 3;
}
int cost = (int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getRepairCost() * npc.buyPercent));
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
@@ -1895,22 +1917,9 @@ public class ClientMessagePump implements NetMsgHandler {
break;
case LEAVEREQUEST:
origin.disconnect();
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
if(origin.machineID.equals(pc.getClientConnection().machineID))
sameMachine.add(pc);
}
if(sameMachine.isEmpty() == false){
if(sameMachine.get(0) != null) {
sameMachine.get(0).isBoxed = false;
sameMachine.get(0).removeEffectBySource(EffectSourceType.DeathShroud,41,true);
ChatManager.chatSystemInfo(sameMachine.get(0), "You Are No Longer Flagged 'Boxed'");
}
}
break;
case POWER:
PowersManager.usePower((PerformActionMsg) msg, origin, false);
//PowersManager.static_power_que.add(new PowersManager.PowerQueObject((PerformActionMsg) msg, origin, false));
break;
case REQUESTMELEEATTACK:
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
@@ -57,21 +57,6 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
if (contract.canSlotinBuilding(building))
ItemLists.add(hirelings);
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
if(contract.getContractID() == 899)//alchemist
ItemLists.add(hirelings);
if(contract.getContractID() == 866)//banker
ItemLists.add(hirelings);
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
}
}
@@ -93,20 +78,13 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false;
}
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
return false;
Item contractItem = Item.getFromCache(msg.getContractItem());
if (contractItem == null)
return false;
if (msg.getContractItem() == 850) {//runemaster
for (AbstractCharacter abs : building.getHirelings().keySet()) {
NPC npc = (NPC) abs;
if (npc.contract.getContractID() == 850)
return false; //can only have 1 runemaster
}
}
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
@@ -126,33 +104,10 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false;
// Check if contract can be slotted in this building
//Logger.error("inserting contract: " + contract.getContractID());
if (contract.canSlotinBuilding(building) == false) {
boolean override = false;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
if (contract.getContractID() == 899)//alchemist
override = true;
if (contract.getContractID() == 866)//banker
override = true;
if (contract.canSlotinBuilding(building) == false)
return false;
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
if(contract.getContractID() == 865)//siege engineer
override = true;
}
if(override == false) {
Logger.error("failed at override with contract: " + contract.getContractID());
return false;
}
}
//Logger.error("override successful: " + contract.getContractID());
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
return false;
@@ -53,7 +53,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
GroupManager.RefreshOthersGroupList(player);
}
player.enteredWorld = true;
player.setEnteredWorld(true);
// Set player active
player.resetRegenUpdateTime();
player.setActive(true);
@@ -66,9 +66,6 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
// Send Guild, Nation and IC MOTD
GuildManager.enterWorldMOTD(player);
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
ChatManager.sendSystemMessage(player, "Gold Drop Rate: " + ConfigManager.MB_NORMAL_GOLD_RATE.getValue());
ChatManager.sendSystemMessage(player, "Loot Drop Rate: " + ConfigManager.MB_NORMAL_DROP_RATE.getValue());
ChatManager.sendSystemMessage(player, "Experience Rate: " + ConfigManager.MB_NORMAL_EXP_RATE.getValue());
// Send branch string if available from ConfigManager.
@@ -11,6 +11,7 @@ import engine.objects.GuildStatusController;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
import engine.objects.Resource;
import org.pmw.tinylog.Logger;
/*
* @Author:
@@ -35,26 +36,28 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
//TODO verify this against the warehouse?
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus()) == false) // is this only GL?
if (!GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus())) // is this only GL?
return true;
Mine mine = Mine.getMine(changeProductionMsg.getMineID());
if (mine == null)
if (mine == null) {
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Mine was Null");
return true;
}
//make sure mine belongs to guild
if (mine.getOwningGuild().isEmptyGuild() ||
mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
if (mine.getOwningGuild().isEmptyGuild() || mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
return true;
//make sure valid resource
Resource resource = Resource.resourceByHash.get(changeProductionMsg.getResourceHash());
if (resource == null)
if (resource == null) {
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Resource was Null");
return true;
}
//update resource
@@ -14,17 +14,18 @@ import engine.Enum.GuildHistoryType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.group.GroupUpdateMsg;
import engine.net.client.msg.guild.BanishUnbanishMsg;
import engine.net.client.msg.guild.GuildListMsg;
import engine.objects.*;
import engine.objects.Guild;
import engine.objects.GuildHistory;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
import org.joda.time.DateTime;
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
@@ -115,20 +116,6 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
GuildListMsg guildListMsg = new GuildListMsg(guild);
dispatch = Dispatch.borrow(source, guildListMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
if(GroupManager.getGroup(target) != null) {
Group group = GroupManager.getGroup(target);
group.removeGroupMember(PlayerCharacter.getPlayerCharacter(target));
GroupManager.removeFromGroups(PlayerCharacter.getPlayerCharacter(target));
GroupUpdateMsg gim;
gim = new GroupUpdateMsg();
gim.setGroup(group);
gim.setMessageType(3);
gim.setPlayer(PlayerCharacter.getPlayerCharacter(target));
group.sendUpdate(gim);
String text = PlayerCharacter.getPlayerCharacter(target).getFirstName() + " has left your group.";
ChatManager.chatGroupInfo(source, text);
}
} else {
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
}
@@ -61,6 +61,15 @@ public class CityDataHandler extends AbstractClientMsgHandler {
dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
// If the hotZone has changed then update the client's map accordingly.
if (playerCharacter.getTimestamps().containsKey("hotzoneupdate") && playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
}
// Serialize the realms for this map
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
if (city != null)
bane = city.getBane();
if (bane != null) {
if (bane != null){// && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
ErrorPopupMsg.sendErrorPopup(pc, 171);
return true;
}
@@ -71,12 +71,9 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
return true;
// destorying a shrine will yield a rubble pile for looting
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) {
building.modifyHealth(-building.getHealth(), origin.getPlayerCharacter());
building.destroyOrDerank(origin.getPlayerCharacter());
// Can't destroy a shrine
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
return true;
}
// Cannot destroy mines outside of normal mine mechanics
@@ -21,7 +21,6 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.group.GroupInviteMsg;
import engine.net.client.msg.group.GroupUpdateMsg;
import engine.objects.Group;
import engine.objects.Guild;
import engine.objects.PlayerCharacter;
public class GroupInviteHandler extends AbstractClientMsgHandler {
@@ -104,12 +103,6 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
if (target.isIgnoringPlayer(source))
return false;
if(source.getGuild().getNation().equals(target.getGuild().getNation()) == false)
return false; // cannot group outside of nation
if(source.getGuild().getNation().equals(target.getGuild().getNation()) && source.getGuild().getNation().equals(Guild.getErrantGuild()))
if(source.getGuild().equals(target.getGuild()) == false)
return false; // cannot group as an errant guild with other errant guilds
// dont block invites to people already in a group and
// dont check for pending invites, the client does it
@@ -102,7 +102,7 @@ public class GroupInviteResponseHandler extends AbstractClientMsgHandler {
// Run Keyclone Audit
KEYCLONEAUDIT.audit(player, group);
//KEYCLONEAUDIT.audit(player, group);
return true;
}
@@ -25,8 +25,6 @@ import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
import static engine.objects.Bane.getBaneByAttackerGuild;
public class InviteToSubHandler extends AbstractClientMsgHandler {
public InviteToSubHandler() {
@@ -97,25 +95,6 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
if (sourceGuild.equals(targetGuild))
return true;
if(sourceGuild.getNation().getOwnedCity().getBane() != null)
return true; // cannot invite guilds to sub if you are baned
if(sourceGuild.getNation().getSubGuildList() != null){
for(Guild subGuild : sourceGuild.getNation().getSubGuildList()){
if(subGuild.getOwnedCity() != null)
if(subGuild.getOwnedCity().getBane() != null)
return true;//cannot invite guilds to sub if any tree in your nation has a bane on it
}
}
if(targetGuild.getOwnedCity() != null)
if(targetGuild.getOwnedCity().getBane() != null)
return true; // cannot be subbed if you have a bane placed on you
if(getBaneByAttackerGuild(targetGuild) != null)
return true; // cannot sub to a nation if they have a bane placed
//target must be GL or IC
if (GuildStatusController.isInnerCouncil(target.getGuildStatus()) == false && GuildStatusController.isGuildLeader(target.getGuildStatus()) == false) {
@@ -360,6 +360,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
targetItem.recycle(vendor);
vendor.removeItemFromForge(targetItem);
//refund the gold for cancelled item
if(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue() < 15000000){
vendor.building.setStrongboxValue(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue());
}
// Refresh vendor's inventory to client
outMsg = new ManageNPCMsg(vendor);
@@ -12,15 +12,16 @@ package engine.net.client.handlers;
import engine.Enum.GuildHistoryType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.group.GroupUpdateMsg;
import engine.net.client.msg.guild.LeaveGuildMsg;
import engine.objects.*;
import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
public class LeaveGuildHandler extends AbstractClientMsgHandler {
@@ -60,21 +61,6 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
return true;
}
if(GroupManager.getGroup(playerCharacter) != null) {
Group group = GroupManager.getGroup(playerCharacter);
group.removeGroupMember(playerCharacter);
GroupManager.removeFromGroups(playerCharacter);
GroupUpdateMsg gim;
gim = new GroupUpdateMsg();
gim.setGroup(group);
gim.setMessageType(3);
gim.setPlayer(playerCharacter);
group.sendUpdate(gim);
String text = playerCharacter.getFirstName() + " has left your group.";
ChatManager.chatGroupInfo(playerCharacter, text);
}
// Send left guild message to rest of guild
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
@@ -62,16 +62,23 @@ public class MOTDEditHandler extends AbstractClientMsgHandler {
return true;
}
if (type == 1) // Guild MOTD
if (type == 1) { // Guild MOTD
msg.setMessage(guild.getMOTD());
else if (type == 3) // IC MOTD
guild.updateDatabase();
}else if (type == 3) { // IC MOTD
msg.setMessage(guild.getICMOTD());
else if (type == 0) { // Nation MOTD
guild.updateDatabase();
}else if (type == 0) { // Nation MOTD
Guild nation = guild.getNation();
if (nation == null || !nation.isNation()) {
ErrorPopupMsg.sendErrorMsg(playerCharacter, "You do not have such authority!");
return true;
}
nation.setNMOTD(msg.getMessage());
nation.updateDatabase();
for(Guild sub : nation.getSubGuildList()){
sub.setNMOTD(nation.getNMOTD());
}
msg.setMessage(nation.getMOTD());
}
dispatch = Dispatch.borrow(playerCharacter, msg);
@@ -5,7 +5,6 @@ import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType;
import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
import engine.gameManager.ZoneManager;
import engine.math.Bounds;
@@ -63,6 +62,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
Building building;
msg = (ManageCityAssetsMsg) baseMsg;
player = SessionManager.getPlayerCharacter(origin);
if (player == null)
@@ -72,21 +72,34 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
if (building == null) {
if (msg.actionType == 14) {
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
if (!zone.isPlayerCity()) {
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
return true;
}
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
if (city == null || !city.getGuild().equals(player.getGuild()) ||
(!GuildStatusController.isInnerCouncil(player.getGuildStatus()) &&
!GuildStatusController.isGuildLeader(player.getGuildStatus()))) {
if (city == null) {
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
return true;
}
if (!city.getGuild().equals(player.getGuild())) {
ErrorPopupMsg.sendErrorMsg(player, "You are not in the correct guild to command this city.");
return true;
}
if (!GuildStatusController.isInnerCouncil(player.getGuildStatus()) && !GuildStatusController.isGuildLeader(player.getGuildStatus())) {
ErrorPopupMsg.sendErrorMsg(player, "You must be an Inner Council or Guild leader to access city commands.");
return true;
}
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
mca.actionType = 15;
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
Dispatch dispatch = Dispatch.borrow(player, mca);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
return true;
}
@@ -98,126 +111,181 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setAssetName(building.getName());
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
Dispatch dispatch = Dispatch.borrow(player, outMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
switch (msg.actionType) {
case 2:
case 22:
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
outMsg.actionType = 18;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
} else if (BuildingManager.playerCanManage(player, building)) {
configWindowState(player, building, outMsg);
outMsg.actionType = 3;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setTargetType3(building.getObjectType().ordinal());
outMsg.setTargetID3(building.getObjectUUID());
outMsg.setUnknown54(1);
} else {
// Handle other cases
if (building.getRank() == -1) {
if (!Bounds.collide(player.getLoc(), building)) {
ErrorPopupMsg.sendErrorPopup(player, 64);
return true;
}
switch (building.getBlueprint().getBuildingGroup()) {
case SHRINE:
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
if (shrine == null || shrine.getFavors() == 0) {
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
return true;
}
//loot elan stones
MobLoot elanStones = new MobLoot(player,ItemBase.getItemBase(1705032),1,false);
Item promotedItem = elanStones.promoteToItem(player);
promotedItem.setNumOfItems(shrine.getFavors());
player.getCharItemManager().addItemToInventory(promotedItem);
DbManager.ItemQueries.UPDATE_NUM_ITEMS(promotedItem,promotedItem.getNumOfItems());
player.getCharItemManager().updateInventory();
shrine.setFavors(0);
break;
case WAREHOUSE:
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
if (warehouse == null || warehouse.isEmpty()) {
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
return true;
}
break;
}
}
AbstractCharacter owner = building.getOwner();
if (owner == null) {
msg.actionType = 4;
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, msg), DispatchChannel.SECONDARY);
} else {
outMsg.actionType = 4;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setAssetName(building.getName());
}
}
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
return true;
case 13:
outMsg.actionType = 13;
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
return true;
case 5:
building.setName(msg.getAssetName());
if (msg.actionType == 2 || msg.actionType == 22) {
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
outMsg.actionType = 18;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
} else if (BuildingManager.playerCanManage(player, building)) { //TODO allow Friends list.
configWindowState(player, building, outMsg);
outMsg.actionType = 3;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setTargetType3(GameObjectType.Building.ordinal());
outMsg.setTargetType3(building.getObjectType().ordinal());
outMsg.setTargetID3(building.getObjectUUID());
outMsg.setAssetName1(building.getName());
outMsg.setUnknown54(1);
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
return true;
case 14:
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
mca.actionType = 15;
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
return true;
case 20:
// Handle case 20
return handleCase20(player, outMsg, building, msg, origin);
default:
return true;
}
}
private boolean handleCase20(PlayerCharacter player, ManageCityAssetsMsg outMsg, Building building, ManageCityAssetsMsg msg, ClientConnection origin) throws MsgSendException {
Zone baneZone = building.getParentZone();
if (baneZone == null)
return true;
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
if (banedCity == null)
return true;
Bane bane = banedCity.getBane();
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
return true;
int baneHour = msg.getBaneHour();
if (baneHour < 16 || baneHour > 24) {
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
} else {
if (building.getBlueprintUUID() != 0)
switch (building.getBlueprint().getBuildingGroup()) {
case SHRINE:
if (building.getRank() == -1) {
if (!Bounds.collide(player.getLoc(), building)) {
ErrorPopupMsg.sendErrorPopup(player, 64);
return true;
}
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
if (shrine == null)
return true;
if (shrine.getFavors() == 0) {
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
return true;
}
BuildingManager.lootBuilding(player, building);
return true;
}
break;
case WAREHOUSE:
//TODO check
if (building.getRank() == -1) {
if (!Bounds.collide(player.getLoc(), building)) {
ErrorPopupMsg.sendErrorPopup(player, 64);
return true;
}
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
if (warehouse == null)
return true;
if (warehouse.isEmpty()) {
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
return true;
}
BuildingManager.lootBuilding(player, building);
return true;
}
}
if (building.getRank() == -1)
return true;
AbstractCharacter owner = building.getOwner();
//no owner, send building info
if (owner == null) {
msg.actionType = 4;
Dispatch dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
outMsg.actionType = 4;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setAssetName(building.getName());
}
Dispatch dispatch = Dispatch.borrow(player, outMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
if (msg.actionType == 13) {
outMsg.actionType = 13;
Dispatch dispatch = Dispatch.borrow(player, outMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
//Rename Building.
if (msg.actionType == 5) {
//TODO we need to check names before allowing
building.setName(msg.getAssetName());
configWindowState(player, building, outMsg);
outMsg.actionType = 3;
outMsg.setTargetType(building.getObjectType().ordinal());
outMsg.setTargetID(building.getObjectUUID());
outMsg.setTargetType3(GameObjectType.Building.ordinal());
outMsg.setTargetID3(building.getObjectUUID());
outMsg.setAssetName1(building.getName());
outMsg.setUnknown54(1);
Dispatch dispatch = Dispatch.borrow(player, outMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
//TOL, update city name also
//TODO update city and zone in database
//TODO update city map data in game server
}
if (msg.actionType == 14) {
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
mca.actionType = 15;
Dispatch dispatch = Dispatch.borrow(player, mca);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
if (msg.actionType == 20) {
Zone baneZone = building.getParentZone();
if (baneZone == null)
return true;
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
if (banedCity == null)
return true;
Bane bane = banedCity.getBane();
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
return true;
int baneHour = msg.getBaneHour();
if (baneHour < 16 || baneHour > 24) {
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return true;
}
DateTime baneLive = new DateTime(bane.getPlacementDate());
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
baneLive = baneLive.minuteOfHour().setCopy(0);
baneLive = baneLive.secondOfMinute().setCopy(1);
bane.setLiveDate(baneLive);
outMsg.actionType = 18;
Dispatch dispatch = Dispatch.borrow(player, outMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
DateTime baneLive = new DateTime(bane.getPlacementDate());
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
baneLive = baneLive.minuteOfHour().setCopy(0);
baneLive = baneLive.secondOfMinute().setCopy(1);
bane.setLiveDate(baneLive);
outMsg.actionType = 18;
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
return true;
}
public void configWindowState(PlayerCharacter player, Building building, ManageCityAssetsMsg manageCityAssetsMsg) {
// Tests to turn on upgrade button if a building is not
@@ -226,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
// Owner is obviously allowed to upgrade his own buildings
if (building.getOwner() != null && building.getOwner().equals(player)) {
if (building.getOwner().equals(player)) {
// Players cannot destroy or transfer a TOL.
@@ -17,6 +17,7 @@ import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import java.util.ArrayList;
import java.util.Objects;
/*
* @Author:
@@ -105,7 +106,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
// Validate player can obtain blessing
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
return;
}
@@ -126,12 +127,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
realm = RealmMap.getRealmForCity(city);
if (realm.getCanBeClaimed() == false) {
if (!realm.getCanBeClaimed()) {
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
return;
}
if (realm.isRuled() == true) {
if (realm.isRuled()) {
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
return;
}
@@ -142,12 +143,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
}
private static void requestBoon(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
private static void requestBoon(PlayerCharacter player, NPC npc) {
Building shrineBuilding;
Shrine shrine;
if (npc.getGuild().getNation() != player.getGuild().getNation())
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
return;
shrineBuilding = npc.getBuilding();
@@ -155,7 +156,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
if (shrineBuilding == null)
return;
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE)
if (shrineBuilding.getBlueprint() != null && !shrineBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.SHRINE))
return;
if (shrineBuilding.getRank() == -1)
@@ -171,12 +172,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
return;
}
//already haz boon.
//if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
// ErrorPopupMsg.sendErrorPopup(player, 199);
// return;
//}
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
//remove old boon to apply new one, allows boon refreshing
player.effects.remove(PowersManager.getPowerByToken(shrine.getShrineType().getPowerToken()).name);
}
if (!Shrine.canTakeFavor(player, shrine))
return;
@@ -191,14 +190,31 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
return;
}
if(shrinePower.getName().equals("Boon: Nephilim"))
shrinePower.name = "Boon: Chaos";
int trains = 0;
switch(npc.getRank()){
case 1:
trains = 10;
break;
case 2:
trains = 15;
break;
case 3:
trains = 20;
break;
case 4:
trains = 25;
break;
case 5:
trains = 30;
break;
case 6:
trains = 35;
break;
case 7:
trains = 40;
break;
}
int trains = 5 * npc.getRank() + 5;//40 - (rank * 10);
if (trains < 0)
trains = 0;
//System.out.println(trains);
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false);
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor.");
shrineBuilding.addEffectBit(1000000 << 2);
@@ -258,60 +274,85 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
}
}
if (targetCity == null)
return;
//verify level required to teleport or repledge
Guild toGuild = targetCity.getGuild();
if (toGuild != null)
if (isTeleport) {
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
return;
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
if (targetCity == null){
Mine mineTele = null;
for(Mine mine : Mine.getMinesToTeleportTo(player)){
if(mine.getObjectUUID() == msg.getCityID()){
mineTele = mine;
}
}
if(mineTele == null){
return;
}else {
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
msg.setTeleportTime(time);
Building tower = Mine.getTower(mineTele);
if (tower == null)
return;
Vector3fImmutable teleportLoc = Vector3fImmutable.getRandomPointOnCircle(tower.getLoc(), 10);
ChatManager.chatSystemInfo(player, "You Will Teleport To " + mineTele.getParentZone().getParent().getName() + "'s Mine In " + time + " Seconds.");
if (time > 0) {
//TODO add timer to teleport
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
}
}
}else{
//finish porting to a city
//verify level required to teleport or repledge
boolean joinedGuild = false;
Guild toGuild = targetCity.getGuild();
//if repledge, reguild the player
if (toGuild != null)
if (isTeleport) {
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
return;
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
return;
if (!isTeleport)
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
boolean joinedGuild = false;
int time;
//if repledge, reguild the player
if (!isTeleport) //repledge
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
else
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
if (!isTeleport)
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
//resend message
msg.setTeleportTime(time);
int time;
if ((!isTeleport && joinedGuild) || (isTeleport)) {
if (!isTeleport) //repledge
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
else
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
//resend message
msg.setTeleportTime(time);
if ((!isTeleport && joinedGuild) || (isTeleport)) {
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
}
//teleport player to city
Vector3fImmutable teleportLoc;
if (targetCity.getTOL().getRank() == 8)
teleportLoc = targetCity.getTOL().getStuckLocation();
else
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
if (time > 0) {
//TODO add timer to teleport
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
} else if (joinedGuild) {
player.teleport(teleportLoc);
player.setSafeMode();
}
}
//teleport player to city
Vector3fImmutable teleportLoc;
if (targetCity.getTOL().getRank() == 8)
teleportLoc = targetCity.getTOL().getStuckLocation();
else
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
if (time > 0) {
//TODO add timer to teleport
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
} else if (joinedGuild) {
player.teleport(teleportLoc);
player.setSafeMode();
}
}
private static PowersBase getPowerforHermit(NPC npc) {
@@ -418,7 +459,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
if (isHermit(npc))
requestHermitBlessing(msg, origin, player, npc);
else
requestBoon(msg, origin, player, npc);
requestBoon(player, npc);
break;
case 15:
LeaderboardMessage lbm = new LeaderboardMessage();
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@@ -41,6 +42,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (player == null)
return true;
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
@@ -61,10 +63,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
if (!npc.siegeMinionMap.containsKey(toRemove))
if (!npc.getSiegeMinionMap().containsKey(toRemove))
return true;
npc.siegeMinionMap.remove(toRemove);
npc.getSiegeMinionMap().remove(toRemove);
WorldGrid.RemoveWorldObject(toRemove);
@@ -72,18 +74,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
if (petOwner != null) {
petOwner.setPet(null);
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
// we Found the move to remove, lets break the for loop so it doesnt look for more.
@@ -117,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (npc.getContractID() == 842)
maxSlots = 1;
if (npc.siegeMinionMap.size() == maxSlots)
if (npc.getSiegeMinionMap().size() == maxSlots)
return true;
int mobBase;
@@ -148,10 +146,42 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (mobBase == 0)
return true;
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
if (siegeMob == null)
return true;
if (siegeMob != null) {
siegeMob.setSpawnTime(60 * 15);
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
siegeMob.building = building;
siegeMob.parentZone = zone;
// Slot siege minion
// Can be either corner tower or bulwark.
int slot;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
slot = 2;
else
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
// Rotate slot position by the building rotation
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
zone.zoneMobSet.add(siegeMob);
siegeMob.setLoc(siegeMob.bindLoc);
}
}
ManageNPCMsg mnm = new ManageNPCMsg(npc);
@@ -198,14 +228,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
@@ -271,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
String pirateName = NPCManager.getPirateName(mobBase);
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
if (toCreate == null)
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
return true;
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
if (toCreate == null)
return true;
if (toCreate != null) {
@@ -195,9 +195,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
}
hPMod = (building.getMaxHitPoints() * Realm.getRealmHealthMod(city));
float percentOfHealth = building.getCurrentHitpoints() / building.getHealthMax();
building.setMaxHitPoints(building.getMaxHitPoints() + hPMod);
building.setCurrentHitPoints(building.getMaxHitPoints() * percentOfHealth);
}
}
@@ -423,33 +421,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
itemMan.consume(item);
}
break;
//ANNIVERSERY GIFT
case 31:
// *** Disabled for now: Needs bootyset created
//if (ib.getUUID() == 971012) {
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
// int annyID = ItemBase.AnniverseryGifts.get(random);
// ItemBase annyIB = ItemBase.getItemBase(annyID);
// if (annyIB != null) {
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
// if (gift != null) {
// itemMan.addItemToInventory(gift);
// itemMan.consume(item);
// }
// }
// break;
//}
int i = 0;
if(i != 0) {
LootManager.peddleFate(player, item);
}
LootManager.peddleFate(player,item);
break;
case 30: //water bucket
case 8: //potions, tears of saedron
case 5: //runes, petition, warrant, scrolls
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
@@ -466,7 +443,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
itemMan.consume(item);
}
break;
} else if (uuid > 252122 && uuid < 252128) { //mastery runes
} else if (uuid > 252122 && uuid < 252137) { //blood runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
break;
} else if (uuid > 252128 && uuid < 252128) { //mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
@@ -532,7 +514,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
}
// Send piss bucket animation
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
vum.configure();
DispatchMessage.sendToAllInRange(player, vum);
@@ -542,16 +523,14 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, ib.getUseID(), ib.getUseAmount(), true);
itemMan.consume(item);
} else if(ib.getUUID() > 252128 && ib.getUUID() < 252568){
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
}else //just remove the item at this point
} else //just remove the item at this point
itemMan.consume(item);
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
player.cancelOnSpell();
if(!item.getItemBase().getType().equals(ItemType.POTION)) {
player.cancelOnSpell();
}
break;
default: //shouldn't be here, consume item
dispatch = Dispatch.borrow(player, msg);
@@ -44,13 +44,6 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
return true;
msg = (OpenFriendsCondemnListMsg) baseMsg;
sourceBuilding = BuildingManager.getBuildingFromCache(msg.getBuildingID());
if(sourceBuilding != null && sourceBuilding.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
return true;
}
openFriendsCondemnListMsg = new OpenFriendsCondemnListMsg(msg);
friendListType = Enum.FriendListType.getListTypeByID(msg.getMessageType());
@@ -212,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
return;
}
for (AbstractCharacter guard : building.getHirelings().keySet()) {
if (guard.getObjectType() == GameObjectType.Mob)
((Mob) guard).setPatrolPointIndex(0);
}
} else if (building.getPatrolPoints() != null)
ClearPatrolPoints(building.getObjectUUID());
@@ -219,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
} else if (building.getSentryPoints() != null)
ClearSentryPoints(building.getObjectUUID());
// Dispatch dispatch = Dispatch.borrow(pc, msg);
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
@@ -533,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
if (mob == null)
return true;
@@ -412,9 +412,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
break;
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
break;
if(contract.getItemBaseID() == 1035){//saetor shrine override
msg.getFirstPlacementInfo().setBlueprintUUID(1720000);
}
buildingCreated = placeShrine(playerCharacter, origin, msg);
break;
case BARRACK:
@@ -803,7 +800,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
treeObject.setParentZone(zoneObject);
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(14));
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
// Update guild binds and tags
//load the new city on the clients
@@ -970,7 +967,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
// Create the shrine
return createShrine((PlayerCharacter) cityObject.getTOL().getOwner(), msg.getFirstPlacementInfo(), serverZone);
}
@@ -1213,7 +1210,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
private boolean createShrine(PlayerCharacter player, PlacementInfo buildingInfo, Zone currentZone) {
Blueprint blueprint;
Building newMesh = null;
Building newMesh;
Shrine newShrine;
City city;
ShrineType shrineType;
@@ -1274,10 +1271,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
break;
}
}
if(blueprint.getName().equals("Nephilim Shrine ") && newMesh != null){
newMesh.setName("Chaos Shrine");
}
return true;
}
@@ -57,7 +57,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
return true;
}
player.enteredWorld = false;
player.setEnteredWorld(false);
Account acc = SessionManager.getAccount(origin);
@@ -4,7 +4,6 @@ import engine.Enum;
import engine.InterestManagement.RealmMap;
import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@@ -132,15 +131,15 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
TaxCityMsg msg;
player = origin.getPlayerCharacter();
ChatManager.chatSystemInfo(player,"Taxing has been disabled");
return false;
//msg = (TaxCityMsg) baseMsg;
msg = (TaxCityMsg) baseMsg;
//realm taxing disabled
//ViewTaxes(msg, player);
//return true;
return true;
}
@@ -66,8 +66,6 @@ public class UpgradeAssetMsgHandler extends AbstractClientMsgHandler {
Logger.error("Attempt to upgrade null building by " + player.getName());
return true;
}
if(buildingToRank.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
return true;
// Early exit for building that is already ranking
+69 -51
View File
@@ -71,10 +71,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
}
public static boolean applyRune(int runeID, ClientConnection origin, PlayerCharacter playerCharacter) {
RuneBase rb = RuneBase.getRuneBase(runeID);
Dispatch dispatch;
if (playerCharacter == null || origin == null || rb == null) {
return false;
}
@@ -83,7 +81,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
if(runeID != 3007 && runeID != 3014) {//bounty hunter and huntsman
if (races.size() > 0) {
boolean valid = false;
for (int validID : races.keySet()) {
if (validID == raceID) {
@@ -94,20 +91,42 @@ public class ApplyRuneMsg extends ClientNetMsg {
if(runeID == 3040)
valid = true;
if(runeID == 2514 && raceID == 1999)
valid = true;
if(runeID == 3036 && raceID == 1999)
valid = true;
if(runeID == 3033 && raceID == 1999)
if(runeID == 3049)
valid = true;
if(raceID == 1999){
switch(runeID){
case 2514:
case 3036:
case 3033:
case 3001:
case 3002:
case 3003:
case 3004:
case 3008:
case 3009:
case 3013:
case 3016:
case 3017:
case 3018:
case 3020:
case 3021:
case 3030:
case 3031:
case 3037:
case 3045:
case 3046:
case 3047:
case 3048:
case 3049:
valid = true;
break;
}
}
if (!valid) {
return false;
}
}
//Check base class is met
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
if (baseClasses.size() > 0) {
@@ -119,24 +138,18 @@ public class ApplyRuneMsg extends ClientNetMsg {
break;
}
}
if(runeID == 3040)
valid = true;
if(runeID == 3036 && raceID == 1999)
valid = true;
if(runeID == 3033 && raceID == 1999)
valid = true;
if(runeID == 3035 && baseClassID == 2501)
valid = true;
if (!valid) {
return false;
}
}
//Check promotion class is met
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
if (promotionClasses.size() > 0) {
@@ -148,19 +161,16 @@ public class ApplyRuneMsg extends ClientNetMsg {
break;
}
}
if(runeID == 3040)
valid = true;
if(runeID == 3004 && (playerCharacter.getPromotionClassID() == 2505 || playerCharacter.getPromotionClassID() == 2510))
valid = true;
if(runeID == 3036 && raceID == 1999)
valid = true;
if(runeID == 3033 && raceID == 1999)
valid = true;
if(runeID == 3028 && (raceID == 2013 || raceID == 2014) && playerCharacter.getBaseClassID() == 2501)
valid = true;
if (!valid) {
return false;
}
@@ -183,7 +193,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
}
}
}
int discCount = 0;
for (CharacterRune cr : runes) {
int runeBaseID = cr.getRuneBaseID();
@@ -196,22 +205,18 @@ public class ApplyRuneMsg extends ClientNetMsg {
return false;
}
}
//Check level is met
if (playerCharacter.getLevel() < rb.getLevelRequired()) {
return false;
}
int strTotal = 0;
int dexTotal = 0;
int conTotal = 0;
int intTotal = 0;
int spiTotal = 0;
int cost = 0;
//Check any attributes are met
ArrayList<RuneBaseAttribute> attrs = rb.getAttrs();
if (rb.getAttrs() != null)
for (RuneBaseAttribute rba : attrs) {
int attrID = rba.getAttributeID();
@@ -224,10 +229,12 @@ public class ApplyRuneMsg extends ClientNetMsg {
case "Born of the Gwendannen":
case "Born of the Invorri":
case "Born of the Irydnu":
case "Scion of the Dar Khelegeur":
case "Scion of the Gwaridorn":
case "Scion of the Twathedilion":
mod = 0;
}
if (mod > playerCharacter.getUnusedStatPoints()) {
return false;
}
cost = mod;
@@ -279,12 +286,11 @@ public class ApplyRuneMsg extends ClientNetMsg {
break;
}
}
//Check if max number runes already reached
if (runes.size() > 12) {
ChatManager.chatSystemInfo(playerCharacter,"You Have Too Many Runes Applied");
return false;
}
switch (rb.getName()) {
case "Born of the Ethyri":
case "Born of the Taripontor":
@@ -303,22 +309,41 @@ public class ApplyRuneMsg extends ClientNetMsg {
return false;
}
}
break;
case "Scion of the Dar Khelegeur":
case "Scion of the Gwaridorn":
case "Scion of the Twathedilion":
for (CharacterRune charRune : playerCharacter.getRunes()) {
RuneBase rb2 = charRune.getRuneBase();
switch (rb2.getName()) {
case "Scion of the Dar Khelegeur":
case "Scion of the Gwaridorn":
case "Scion of the Twathedilion":
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
return false;
}
}
break;
}
//if discipline, check number applied
if (isDiscipline(runeID)) {
//if(playerCharacter.getLevel() == 80)
discCount -= 1; // level 80 characters get an extra disc rune
if (playerCharacter.getLevel() < 70) {
if (discCount > 2) {
return false;
}
} else {
if (discCount > 3) {
return false;
}
switch(playerCharacter.getRank()){
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
if(discCount > 3)
return false;
break;
case 7:
case 8:
if(discCount > 5)
return false;
break;
}
}
//Everything succeeded. Let's apply the rune
//Attempt add rune to database
CharacterRune runeWithoutID = new CharacterRune(rb, playerCharacter.getObjectUUID());
@@ -332,7 +357,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
if (cr == null) {
return false;
}
//remove any overridden runes from player
ArrayList<Integer> overwrite = rb.getOverwrite();
CharacterRune toRemove = null;
@@ -341,13 +365,10 @@ public class ApplyRuneMsg extends ClientNetMsg {
toRemove = playerCharacter.removeRune(overwriteID);
}
}
//add rune to player
playerCharacter.addRune(cr);
// recalculate all bonuses/formulas/skills/powers
playerCharacter.recalculate();
//if overwriting a stat rune, add any amount granted from previous rune.
if (toRemove != null) {
RuneBase rbs = toRemove.getRuneBase();
@@ -373,7 +394,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
if (dif > 0 && spiTotal < (int) playerCharacter.statSpiMax) {
playerCharacter.addSpi(dif);
}
// recalculate all bonuses/formulas/skills/powers
playerCharacter.recalculate();
}
@@ -384,6 +404,9 @@ public class ApplyRuneMsg extends ClientNetMsg {
case "Born of the Gwendannen":
case "Born of the Invorri":
case "Born of the Irydnu":
case "Scion of the Dar Khelegeur":
case "Scion of the Gwaridorn":
case "Scion of the Twathedilion":
cost = 0;
break;
}
@@ -392,19 +415,14 @@ public class ApplyRuneMsg extends ClientNetMsg {
dispatch = Dispatch.borrow(playerCharacter, msm);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
}
//send apply rune message to client
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID, cr.getObjectType().ordinal(), cr.getObjectUUID(), false);
dispatch = Dispatch.borrow(playerCharacter, arm);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
//alert them of success
ErrorPopupMsg.sendErrorPopup(playerCharacter, 160);
//reapply bonuses
playerCharacter.applyBonuses();
return true;
}
@@ -112,6 +112,12 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
if (contract != null)
sellInventory = contract.getSellInventory();
//if(npc.contract.getObjectUUID() == 890){ // default steward
// sellInventory = npc.getSellInventorySteward();
// }
//if(npc.contract.getObjectUUID() == 889){ // default builder
// sellInventory = npc.getSellInventoryBuilder();
// }
}
if (man != null)
+9 -9
View File
@@ -87,11 +87,7 @@ public class CityDataMsg extends ClientNetMsg {
temp.putInt(cityList.size());
for (City city : cityList)
try {
City.serializeForClientMsg(city, temp);
}catch(Exception e){
continue;
}
City.serializeForClientMsg(city, temp);
temp.put((byte) 0); // PAD
// Serialize runegates
@@ -108,8 +104,10 @@ public class CityDataMsg extends ClientNetMsg {
}
temp.putInt(mineList.size());
for (Mine mine : mineList)
Mine.serializeForClientMsg(mine, temp);
for (Mine mine : mineList) {
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
Mine.serializeForClientMsg(mine, temp);
}
temp.put((byte) 0); // PAD
}
@@ -182,8 +180,10 @@ public class CityDataMsg extends ClientNetMsg {
}
writer.putInt(mineList.size());
for (Mine mine : mineList)
Mine.serializeForClientMsg(mine, writer);
for (Mine mine : mineList) {
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
Mine.serializeForClientMsg(mine, writer);
}
} else
writer.putInt(0);
} catch (Exception e) {
+2 -3
View File
@@ -9,7 +9,6 @@
package engine.net.client.msg;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
@@ -43,8 +42,8 @@ public class CityZoneMsg extends ClientNetMsg {
this.locY = locY;
this.locZ = locZ;
this.name = name;
this.radiusX = Enum.CityBoundsType.ZONE.extents;
this.radiusZ = Enum.CityBoundsType.ZONE.extents;
this.radiusX = radiusX;
this.radiusZ = radiusZ;
this.unknown01 = 0;
}
@@ -9,7 +9,6 @@
package engine.net.client.msg;
import engine.Enum;
import engine.Enum.*;
import engine.gameManager.BuildingManager;
import engine.gameManager.ZoneManager;
@@ -276,7 +275,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
writer.putString(npcHire.getName());
writer.putInt(1);
writer.putInt(Blueprint.getNpcMaintCost(npcHire.getRank()));
writer.putInt(0);
if (npcHire.getObjectType() == GameObjectType.NPC)
writer.putInt(((NPC) npcHire).getContract().getIconID()); // Was 60
else if (npcHire.getObjectType() == GameObjectType.Mob) {
@@ -486,36 +485,19 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
writer.putInt(building.getRank());
// Maintenance costs include resource if
// this structure is an R8 tree
if (building.getRank() == 8)
writer.putInt(5); // Resources included
else
writer.putInt(1); // Gold only
writer.putInt(1); // Gold only
writer.putInt(2308551); //Gold
if (building.getBlueprint() == null)
writer.putInt(0);
else
writer.putInt(building.getBlueprint().getMaintCost(building.getRank())); // maint cost
if (building.getRank() == 8) {
writer.putInt(74856115); // Stone
writer.putInt(1500); // maint cost
writer.putInt(-1603256692); // Lumber
writer.putInt(1500); // maint cost
writer.putInt(-1596311545); // Galvor
writer.putInt(5); // maint cost
writer.putInt(1532478436); // Wormwood
writer.putInt(5); // maint cost
}
writer.putInt(building.getBlueprint().getMaintCost()); // maint cost
LocalDateTime maintDate = building.maintDateTime;
if (maintDate == null)
maintDate = LocalDateTime.now();
writer.putLocalDateTime(LocalDateTime.now()); // current time
writer.putLocalDateTime(maintDate); // current time
// utc offset?
writer.putInt((int) java.time.Duration.between(LocalDateTime.now(), maintDate).getSeconds()); // Seconds to maint date
@@ -532,10 +514,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
else if (building.getRank() == building.getBlueprint().getMaxRank())
this.upgradeCost = Integer.MAX_VALUE;
else
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
this.upgradeCost = Integer.MAX_VALUE;
else
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
writer.putInt(this.upgradeCost);
} else
+4 -4
View File
@@ -343,7 +343,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(0); //runemaster list
//artillery captain list
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
writer.putInt(1 + siegeMinions.size());
serializeBulwarkList(writer, 1); //Trebuchet
//serializeBulwarkList(writer, 2); //Ballista
@@ -366,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) {
if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime);
@@ -557,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
mobA = Mob.getMob(this.targetID);
mobA = Mob.getFromCacheDBID(this.targetID);
if (mobA == null) {
Logger.error("Missing Mob of ID " + this.targetID);
@@ -689,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) {
if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime);
@@ -601,9 +601,6 @@ public class PlaceAssetMsg extends ClientNetMsg {
public int getBlueprintUUID() {
return this.blueprintUUID;
}
public void setBlueprintUUID(int id) {
this.blueprintUUID = id;
}
public Vector3fImmutable getLoc() {
return this.loc;
@@ -95,7 +95,7 @@ public class RefinerScreenMsg extends ClientNetMsg {
return this.unknown02;
}
public void setUnknown02(float value) {
public void setUnknown02(int value) {
this.unknown02 = value;
}
+40 -12
View File
@@ -11,6 +11,7 @@ package engine.net.client.msg;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
@@ -53,18 +54,45 @@ public class ServerInfoMsg extends ClientNetMsg {
writer.putInt(WorldServer.worldMapID);
writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
if (LoginServer.population < MBServerStatics.LOW_POPULATION)
writer.putInt(0); //Land Rush
else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION)
writer.putInt(1); //Low pop
else if (LoginServer.population < MBServerStatics.HIGH_POPULATION)
writer.putInt(2); //Normal pop
else if (LoginServer.population < MBServerStatics.VERY_OVERPOPULATED_POPULATION)
writer.putInt(3); //High Pop
else if (LoginServer.population < MBServerStatics.FULL_POPULATION)
writer.putInt(4); //Very overpopulated pop
else
writer.putInt(5); //Full pop
int TotalTrees = 21;
int currentR8Trees = DbManager.CityQueries.GET_CAPITAL_CITY_COUNT();
switch(currentR8Trees){
case 0:
case 1:
case 2:
case 3:
case 4:
writer.putInt(0); //Land Rush
break;
case 5:
case 6:
case 7:
case 8:
writer.putInt(1); //Low pop
break;
case 9:
case 10:
case 11:
case 12:
writer.putInt(2); //Normal pop
break;
case 13:
case 14:
case 15:
case 16:
writer.putInt(3); //High Pop
break;
case 17:
case 18:
case 19:
case 20:
writer.putInt(4); //Very overpopulated pop
break;
default:
writer.putInt(5); //Full pop
break;
}
}
/**
@@ -16,7 +16,9 @@ import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.objects.City;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@@ -24,6 +26,7 @@ import java.util.ArrayList;
public class TeleportRepledgeListMsg extends ClientNetMsg {
ArrayList<City> cities;
ArrayList<Mine> mines;
private PlayerCharacter player;
private boolean isTeleport;
@@ -77,10 +80,19 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
public void configure() {
if (isTeleport)
if (isTeleport) {
cities = City.getCitiesToTeleportTo(player);
else
try {
mines = Mine.getMinesToTeleportTo(player);
if(mines == null)
mines = new ArrayList<>();
}catch(Exception e){
Logger.error("Unable To Load Mines For Teleport: " + e.getMessage());
}
}else {
cities = City.getCitiesToRepledgeTo(player);
mines = new ArrayList<>();
}
}
/**
@@ -96,10 +108,14 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
for (int i = 0; i < 3; i++)
writer.putInt(0);
writer.putInt(cities.size());
writer.putInt(cities.size() + mines.size());
for (City city : cities)
City.serializeForClientMsg(city, writer);
for(Mine mine : mines)
Mine.serializeForClientMsgTeleport(mine, writer);
}
public PlayerCharacter getPlayer() {
+1
View File
@@ -94,6 +94,7 @@ public class TrainMsg extends ClientNetMsg {
if (sk == null)
return;
if (sk.getSkillsBase().getToken() == 40661438) {
int maxValue = 15;
+43 -42
View File
@@ -9,19 +9,19 @@
package engine.net.client.msg;
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.Enum.GuildHistoryType;
import engine.InterestManagement.InterestManager;
import engine.exception.MsgSendException;
import engine.gameManager.*;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.net.*;
import engine.net.client.ClientConnection;
import engine.net.client.Protocol;
import engine.objects.*;
import engine.server.MBServerStatics;
import engine.util.BoxTracker;
import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
@@ -96,6 +96,11 @@ public class VendorDialogMsg extends ClientNetMsg {
return;
}
if(npc.contractUUID == 1502040){ //enrollment officer
PlayerCharacter.unboxPlayer(playerCharacter);
}
// Restrict disc trainers to only characters who have
// tht disc applied.
@@ -137,29 +142,6 @@ public class VendorDialogMsg extends ClientNetMsg {
msg.updateMessage(3, vd);
}
if(contract.getObjectUUID() == 1502040){
if(!playerCharacter.getTimestamps().containsKey("lastBoxChange"))
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis() - 1000);
if(playerCharacter.getTimeStamp("lastBoxChange") + 30000L > System.currentTimeMillis()) {
ChatManager.chatSystemInfo(playerCharacter, "You Must Wait To Promote Again.");
return;
}
if(playerCharacter.isBoxed == false) {
ChatManager.chatSystemInfo(playerCharacter, "You Are Already The Active Character.");
return;
}
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis());
for(PlayerCharacter newlyBoxed : BoxTracker.getPlayers(playerCharacter.getClientConnection().machineID)){
newlyBoxed.isBoxed = true;
}
playerCharacter.isBoxed = false;
InterestManager.setObjectDirty(playerCharacter);
playerCharacter.removeEffectBySource(Enum.EffectSourceType.DeathShroud,50,true);
}
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
@@ -571,12 +553,33 @@ public class VendorDialogMsg extends ClientNetMsg {
// verify race valid for profession
Race race = pc.getRace();
if(race.getRaceRuneID() == 1999 && (promoID == 2512 || promoID == 2511)) {
if(race.getRaceRuneID() == 1999) {
boolean valid = false;
switch(promoID){
case 2504:
case 2505:
case 2506:
case 2507:
case 2510:
case 2511:
case 2512:
case 2514:
case 2515:
case 2517:
case 2518:
case 2519:
case 2520:
case 2521:
valid = true;
break;
}
} else if(promo.getName().equals("Ranger")&& race.getName().equals("Saetor"))
{
if(!valid)
return;
}
else {
}else {
if (race == null || !promo.isAllowedRune(race.getToken())) {
// TODO send client promotion error
return;
@@ -584,26 +587,24 @@ public class VendorDialogMsg extends ClientNetMsg {
}
// verify baseclass valid for profession
BaseClass bc = pc.getBaseClass();
if(promo.getName().equals("Druid") && (bc.getName().equals("Rogue") || bc.getName().equals("Mage"))) { //allow rogue and mage druids
if (bc == null) {
// TODO send client promotion error
return;
}
else {
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
// TODO send client promotion error
if(!promo.isAllowedRune(bc.getToken())){
if(!bc.getName().equals("Rogue") && !promo.getName().equals("Druid"))
return;
}
}
// verify gender
if(race.getName().equals("Saetor") == false) { //saetors can promote to huntress and fury
if(race.getRaceRuneID() != 1999) {
// verify gender
if (promoID == 2511 && pc.isMale()) // Fury
return;
if (promoID == 2512 && pc.isMale()) // Huntress
return;
if (promoID == 2517 && !pc.isMale()) // Warlock
return;
}
if (promoID == 2517 && !pc.isMale()) // Warlock
return;
// Everything valid. Let's promote
pc.setPromotionClass(promo.getObjectUUID());
@@ -15,7 +15,6 @@ import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
import engine.objects.Race;
public class CommitNewCharacterMsg extends ClientNetMsg {
@@ -176,7 +175,7 @@ public class CommitNewCharacterMsg extends ClientNetMsg {
public int getRace() {
for (int i = 0; i < 23; i++)
if(Race.getRace(this.runes[i]) != null)
if (this.runes[i] > 1999 && this.runes[i] < 2030)
return this.runes[i];
return 0;
}
+101 -54
View File
@@ -31,6 +31,7 @@ import engine.net.ByteBufferWriter;
import engine.net.DispatchMessage;
import engine.net.client.msg.UpdateStateMsg;
import engine.powers.EffectsBase;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
@@ -52,8 +53,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public int contractUUID;
public Contract contract;
public String firstName;
public String lastName;
protected String firstName;
protected String lastName;
protected short statStrCurrent;
protected short statDexCurrent;
protected short statConCurrent;
@@ -88,20 +89,20 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected AtomicFloat mana = new AtomicFloat();
protected float manaMax; // Health/Mana/Stamina
protected AtomicBoolean isAlive = new AtomicBoolean(true);
protected Resists resists = null;
protected Resists resists = new Resists("Genric");
protected ConcurrentHashMap<String, JobContainer> timers;
protected ConcurrentHashMap<String, Long> timestamps;
protected int atrHandOne;
public int atrHandOne;
protected int atrHandTwo;
protected int minDamageHandOne;
protected int maxDamageHandOne;
public int minDamageHandOne;
public int maxDamageHandOne;
protected int minDamageHandTwo;
protected int maxDamageHandTwo;
protected float rangeHandOne;
protected float rangeHandTwo;
protected float speedHandOne;
protected float speedHandTwo;
protected int defenseRating;
public int defenseRating;
protected boolean isActive; // <-Do not use this for deleting character!
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
protected ConcurrentHashMap<Integer, JobContainer> recycleTimers;
@@ -117,33 +118,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected boolean movingUp = false;
private float desiredAltitude = 0;
private long takeOffTime = 0;
private float hateValue = 0;
private long lastHateUpdate = 0;
private boolean collided = false;
private byte aoecntr = 0;
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public AbstractCharacter() {
super();
this.firstName = "";
this.lastName = "";
this.statStrCurrent = (short) 0;
this.statDexCurrent = (short) 0;
this.statConCurrent = (short) 0;
this.statIntCurrent = (short) 0;
this.statSpiCurrent = (short) 0;
this.unusedStatPoints = (short) 0;
this.level = (short) 0; // TODO get this from MobsBase later
this.exp = 1;
this.walkMode = true;
this.bindLoc = Vector3fImmutable.ZERO;
this.faceDir = Vector3fImmutable.ZERO;
this.runningTrains = (byte) 0;
this.skills = new ConcurrentHashMap<>();
this.powers = new ConcurrentHashMap<>();
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.initializeCharacter();
}
@@ -231,6 +215,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -273,6 +259,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -304,6 +292,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -353,6 +343,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
public static int getBankCapacity() {
@@ -504,8 +497,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
boolean canFly = false;
PlayerBonuses bonus = flyer.getBonuses();
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive())
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive()) {
canFly = true;
}
if(flyer.effects.containsKey("MoveBuff")){
canFly = false;
}
return canFly;
@@ -678,22 +676,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
public final Resists getResists() {
if(this.getObjectType().equals(GameObjectType.Mob)){
return ((Mob)this).mobResists;
}else {
if (this.resists == null)
return Resists.getResists(0);
return this.resists;
}
if (this.resists == null)
return Resists.getResists(0);
return this.resists;
}
public final void setResists(final Resists value) {
if(this.getObjectType().equals(GameObjectType.Mob))
return;
this.resists = value;
}
@@ -1004,7 +992,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (this.takeOffTime != 0)
return super.getLoc();
return super.getLoc().moveTowards(this.endLoc, this.getSpeed() * ((System.currentTimeMillis() - this.lastSetLocUpdate) * .001f));
return super.getLoc().moveTowards(this.endLoc, this.getSpeed() * ((System.currentTimeMillis() - lastSetLocUpdate) * .001f));
}
@@ -1114,6 +1102,23 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
public final void setCombatTarget(final AbstractWorldObject value) {
if(this.getObjectTypeMask() == 2050) {//MOB?
if (value == null) {
if (this.isCombat()) {
this.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}else {
if (!this.isCombat()) {
this.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}
}
this.combatTarget = value;
}
@@ -1188,9 +1193,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
}
public final float modifyHealth(float value,final AbstractCharacter attacker,final boolean fromCost) {
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
value *= ((PlayerCharacter)attacker).ZergMultiplier;
public final float modifyHealth(float value, final AbstractCharacter attacker, final boolean fromCost) {
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
value *= ((PlayerCharacter)attacker).ZergMultiplier;
} // Health modifications are modified by the ZergMechanic
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
value *= ((Mob)attacker).getOwner().ZergMultiplier;
}// Health modifications from pets are modified by the owner's ZergMechanic
try {
try {
@@ -1246,20 +1258,26 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
public final float modifyMana(
float value,
final float value,
final AbstractCharacter attacker
) {
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
value *= ((PlayerCharacter)attacker).ZergMultiplier;
return this.modifyMana(value, attacker, false);
}
public final float modifyMana(
final float value,
float value,
final AbstractCharacter attacker,
final boolean fromCost
) {
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
value *= ((PlayerCharacter)attacker).ZergMultiplier;
} // Health modifications are modified by the ZergMechanic
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
value *= ((Mob)attacker).getOwner().ZergMultiplier;
}// Health modifications from pets are modified by the owner's ZergMechanic
if (!this.isAlive()) {
return 0f;
}
@@ -1287,20 +1305,26 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
*/
public final float modifyStamina(
float value,
final float value,
final AbstractCharacter attacker
) {
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
value *= ((PlayerCharacter)attacker).ZergMultiplier;
return this.modifyStamina(value, attacker, false);
}
public final float modifyStamina(
final float value,
float value,
final AbstractCharacter attacker,
final boolean fromCost
) {
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
value *= ((PlayerCharacter)attacker).ZergMultiplier;
} // Health modifications are modified by the ZergMechanic
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
value *= ((Mob)attacker).getOwner().ZergMultiplier;
}// Health modifications from pets are modified by the owner's ZergMechanic
if (!this.isAlive()) {
return 0f;
}
@@ -1761,6 +1785,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.inBuildingID = inBuildingID;
}
public float getHateValue() {
if (this.hateValue <= 0) {
this.hateValue = 0;
return hateValue;
}
if (this.lastHateUpdate == 0) {
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
long duration = System.currentTimeMillis() - this.lastHateUpdate;
//convert duration to seconds and multiply Hate Delimiter.
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
this.hateValue -= modAmount;
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
public void setHateValue(float hateValue) {
this.lastHateUpdate = System.currentTimeMillis();
this.hateValue = hateValue;
}
public int getInFloorID() {
return inFloorID;
}
@@ -9,13 +9,11 @@
package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.mobileAI.Threads.MobAIThread;
@@ -33,20 +31,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
protected Vector3fImmutable lastBindLoc;
public boolean assist = false;
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
public boolean isPlayerGuard = false;
public AbstractCharacter guardCaptain;
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
;
public Enum.MobBehaviourType behaviourType;
public ArrayList<Vector3fImmutable> patrolPoints;
public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0;
public City guardedCity;
public AbstractIntelligenceAgent() {
super();
}
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
super(rs);
@@ -102,8 +87,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
this.agentType = Enum.AIAgentType.CHARMED;
if (this.getObjectType().equals(GameObjectType.Mob)) {
((Mob) this).guardCaptain = owner;
((Mob) this).setOwner(owner);
}
}
@@ -126,6 +110,14 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
return 0;
}
public PlayerCharacter getOwner() {
if (this.getObjectType().equals(GameObjectType.Mob))
return this.getOwner();
return null;
}
public boolean getSafeZone() {
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
@@ -154,7 +146,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
if ((this.agentType.equals(Enum.AIAgentType.PET))) { //delete summoned pet
WorldGrid.RemoveWorldObject(this);
DbManager.removeFromCache(this);
if (this.getObjectType() == GameObjectType.Mob)
if (((Mob) this).getParentZone() != null)
@@ -167,7 +158,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
//clear owner
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
PlayerCharacter owner = this.getOwner();
//close pet window
@@ -183,7 +174,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
owner.setPet(null);
if (this.getObjectType().equals(GameObjectType.Mob))
((Mob) this).guardCaptain = null;
((Mob) this).setOwner(null);
}
+2 -4
View File
@@ -245,7 +245,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
}
JobContainer jc = new JobContainer(ntj);
Effect eff = new Effect(jc, eb, trains,true);
Effect eff = new Effect(jc, eb, trains);
if (isStatic)
eff.setIsStatic(isStatic);
this.effects.put(name, eff);
@@ -357,9 +357,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
Mob mob = (Mob) this;
if (mob.isSiege()) {
if (mob.isPet()) {
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
PlayerCharacter petOwner = mob.getOwner();
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
petOwner.dismissPet();
return;
+10 -45
View File
@@ -17,7 +17,10 @@ import engine.InterestManagement.HeightMap;
import engine.InterestManagement.WorldGrid;
import engine.db.archive.BaneRecord;
import engine.db.archive.DataWarehouse;
import engine.gameManager.*;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.job.JobScheduler;
import engine.jobs.ActivateBaneJob;
import engine.jobs.BaneDefaultTimeJob;
@@ -32,8 +35,6 @@ import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;
@@ -51,8 +52,6 @@ public final class Bane {
// Internal cache for banes
private ActivateBaneJob activateBaneJob;
public int capSize;
/**
* ResultSet Constructor
*/
@@ -107,17 +106,10 @@ public final class Bane {
if (this.liveDate == null)
setDefaultTime();
this.capSize = ZergManager.getBaneCap(this.getCity().getGuild());
}
public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) {
//if(LocalDateTime.now().getDayOfWeek().equals(DayOfWeek.WEDNESDAY) == false && LocalDateTime.now().getDayOfWeek().equals(DayOfWeek.THURSDAY) == false){
// ChatManager.chatSystemError(player, "You can only place banes on Wednesdays and Thursdays.");
// return false;
//}
Guild baningGuild;
Zone cityZone;
City targetCity;
@@ -211,28 +203,18 @@ public final class Bane {
return false;
}
for(Guild subGuild : baningGuild.getNation().getSubGuildList()) {
if (getBaneByAttackerGuild(subGuild) != null) {
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Your Nation Already Has a Bane Placed");
return false;
}
}
if(targetCity.getGuild().getNation().getSubGuildList() != null) {
for (Guild subGuild : targetCity.getGuild().getNation().getSubGuildList()) {
if (getBaneByAttackerGuild(subGuild) != null) {
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "This Nation Already Has a Bane Placed On It");
return false;
}
}
}
Blueprint blueprint = Blueprint.getBlueprint(24300); // Banestone
//Let's drop a banestone!
Vector3fImmutable localLocation = ZoneManager.worldToLocal(player.getLoc(), cityZone);
if (localLocation == null) {
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
Logger.info("Failed to Convert World coordinates to local zone coordinates");
return false;
}
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
cityZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
@@ -243,7 +225,6 @@ public final class Bane {
return false;
}
stone.addEffectBit((1 << 19));
stone.setMaxHitPoints(stone.getBlueprint().getMaxHealth(stone.getRank()));
stone.setCurrentHitPoints(stone.getMaxHitPoints());
@@ -285,12 +266,6 @@ public final class Bane {
BaneRecord baneRecord = BaneRecord.borrow(bane, Enum.RecordEventType.PENDING);
DataWarehouse.pushToWarehouse(baneRecord);
if(bane.getCity().getTOL().getRank() == 8)
bane.capSize = 40;
else
bane.capSize = 20;
bane.getCity().setSiegesWithstood(bane.capSize);
return true;
}
@@ -367,12 +342,6 @@ public final class Bane {
newBane = DbManager.BaneQueries.LOAD_BANE(city.getObjectUUID());
if(newBane.getCity().getTOL().getRank() == 8)
newBane.capSize = 40;
else
newBane.capSize = 20;
newBane.getCity().setSiegesWithstood(newBane.capSize);
return newBane;
}
@@ -607,10 +576,6 @@ public final class Bane {
DispatchMessage.dispatchMsgToAll(msg);
}
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(this.getCity().loc,1500,MBServerStatics.MASK_BUILDING)){
Building building = (Building)awo;
if(building.setOwner(this.getOwner()));
}
break;
case DESTROY:

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