forked from MagicBane/Server
Compare commits
948 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aad305a499 | |||
| 88ce07df13 | |||
| 251210d166 | |||
| 5841db2a0d | |||
| 6127bbadb4 | |||
| 8e5584f413 | |||
| d5e69446c7 | |||
| b3247160d7 | |||
| 06e31c1243 | |||
| ac5528382c | |||
| 9d8467613a | |||
| 8ff0594333 | |||
| 2e7707fcbe | |||
| 78131ed6f2 | |||
| 9b2a1a271e | |||
| 846d720c2f | |||
| 9ba2f375cf | |||
| 22c975d251 | |||
| 601687133f | |||
| 2c47f593f3 | |||
| 6d004d631c | |||
| 2b4a87777c | |||
| b795db7fbd | |||
| af684c6968 | |||
| 80b1ab709d | |||
| 140ba6ae75 | |||
| c24d779d08 | |||
| 5f169fcfae | |||
| a5e0396dc6 | |||
| c5b2db051b | |||
| b94f8e4b03 | |||
| dbfc33563c | |||
| 57e7c3285f | |||
| c01d47fe21 | |||
| d5eb423db8 | |||
| 69113ee3c4 | |||
| c1aa6e2434 | |||
| 7820743222 | |||
| e6762ef9b5 | |||
| 81b60cd269 | |||
| 755d89ebe0 | |||
| aab28cd68c | |||
| 97b2af52b9 | |||
| 16a0b9c0e3 | |||
| bfd89036b2 | |||
| 9cad140836 | |||
| a9ca96bf96 | |||
| 1ef18490b5 | |||
| 8d739c3dae | |||
| 44f5fb02a3 | |||
| 240198eec6 | |||
| dfe300ba4b | |||
| b48d294eca | |||
| be27262e47 | |||
| d1d51ef791 | |||
| e380c4dddb | |||
| f9a7b91868 | |||
| cb73a81e33 | |||
| 47f1aa8a89 | |||
| ca0738b6ed | |||
| 5fabd31495 | |||
| e90465ee8f | |||
| 1b1c636628 | |||
| 5f28d3ae10 | |||
| d0e93773ad | |||
| 2160719126 | |||
| 0449465af9 | |||
| 891e350362 | |||
| 942c37442e | |||
| 0571d5ded3 | |||
| 1f63df4f08 | |||
| eec07f3a28 | |||
| a199014a98 | |||
| 48f8cf32b7 | |||
| f28b15b95e | |||
| 8e5aec841d | |||
| 9b7bcdc043 | |||
| 2dbaac5bcf | |||
| 2f201151df | |||
| 3d48951184 | |||
| 3d199a9362 | |||
| c8a95cab41 | |||
| 43631af53b | |||
| 89e31fd159 | |||
| ffecdbb06b | |||
| 7331c870c2 | |||
| 4b760baae4 | |||
| 8106b100ec | |||
| 53285ca898 | |||
| 9db7411ee6 | |||
| a12687913e | |||
| 937656a91d | |||
| 5f2034a35b | |||
| 87d39ae29d | |||
| bd95a8d7af | |||
| 1fa9a88ae3 | |||
| 34e3ae20d7 | |||
| 55b6d60141 | |||
| 92d0aec77d | |||
| 1282f58a3c | |||
| 1070d61251 | |||
| f7ab5347ab | |||
| 517e64d613 | |||
| 5ed31c5e2e | |||
| c50bcb0a32 | |||
| 09a6e18d4f | |||
| b0dd7e9b59 | |||
| 92d685c3e3 | |||
| 84a1db1e09 | |||
| d0e3cac4c3 | |||
| 9a5fd53271 | |||
| 8d4fb261b5 | |||
| 4a7a999ed1 | |||
| e69c0f2799 | |||
| 9e36d558bf | |||
| df2271fe2c | |||
| 1f7d2a14bf | |||
| a99047aee8 | |||
| 5dc9e127bb | |||
| bb05bdd87c | |||
| 4c0b480aeb | |||
| 3cf38da567 | |||
| 96731bd9bb | |||
| 9d79afa395 | |||
| 944290f958 | |||
| e6eb753666 | |||
| 4ad7e0f021 | |||
| 8d587538e0 | |||
| 4ae64ab94c | |||
| c5e6205801 | |||
| 5a3f4e690f | |||
| 048474b014 | |||
| 24e01acff4 | |||
| a75670bf0e | |||
| d56d58492a | |||
| 7b33c1392a | |||
| 86c95f0eb5 | |||
| 6ed648d6d4 | |||
| c722450f65 | |||
| c3a7262a7f | |||
| d1c6d9edec | |||
| 1e865eecbc | |||
| 5f735a49c1 | |||
| e609c015b9 | |||
| 5a198669b9 | |||
| fe399664f3 | |||
| 3bc62e9baa | |||
| cf23266f31 | |||
| b097472402 | |||
| 57b18c2d15 | |||
| 040eef576e | |||
| d76403a0c8 | |||
| 8ce1054599 | |||
| 0daf8cfe4c | |||
| 898c4c2fa0 | |||
| ecba693105 | |||
| dbc0da20df | |||
| 354d0ab283 | |||
| c1b66269bb | |||
| 7981acb582 | |||
| 03448397ee | |||
| 685dc572e8 | |||
| 5a161a0808 | |||
| 3e4aad9db9 | |||
| 47981872be | |||
| daea835613 | |||
| 55923559cd | |||
| 9efde874f3 | |||
| 9b2b0073a5 | |||
| 33328f74db | |||
| 41023fb890 | |||
| 54a279c3e6 | |||
| 29aea83217 | |||
| 30d27f8a68 | |||
| 17e54ea4aa | |||
| 86c0bbb065 | |||
| ec4cad5e19 | |||
| b674625f7b | |||
| d57b45ef9c | |||
| 2a38c60a67 | |||
| cd1e38b184 | |||
| 69457d5f7e | |||
| 7728a800d9 | |||
| 8b2c018103 | |||
| 76d39f5cc3 | |||
| 826457fb25 | |||
| 0681d3d116 | |||
| ccdea6f970 | |||
| ab00fd7a85 | |||
| 70d67a2b7f | |||
| f5b27e0c5b | |||
| 3c26df5f86 | |||
| 9ed43b5891 | |||
| 4814404f1c | |||
| b1d41e8e85 | |||
| cc5aa4c140 | |||
| 934c0a98f8 | |||
| 91c2cd47fb | |||
| 22f14fb8f1 | |||
| 93a975dd42 | |||
| 7d1570fdca | |||
| 76db3e1f96 | |||
| afbe23fc03 | |||
| 4e417c8810 | |||
| d79c69658a | |||
| 0d125e2640 | |||
| e4a3405032 | |||
| c391272e5b | |||
| 0d3423d51b | |||
| 549ca25483 | |||
| 603d4ca3a8 | |||
| fababd3e42 | |||
| bec6230a06 | |||
| 773b6253b9 | |||
| 1ffcc1086b | |||
| 992d52a389 | |||
| 61088d0b59 | |||
| 601e97eaca | |||
| eae4675f85 | |||
| 84410114e7 | |||
| 70855acbcf | |||
| 2a8e0dea73 | |||
| 6c4f18218c | |||
| 0b5f469b13 | |||
| 68a43388ff | |||
| 5fe12df436 | |||
| caa0aa5172 | |||
| 37a81ed53e | |||
| 39afb33186 | |||
| 228152596c | |||
| d75a052bd3 | |||
| 81d6a55096 | |||
| 55d9cf6d26 | |||
| 9cf69ec73f | |||
| 4595582def | |||
| 0b2d598261 | |||
| cf342cd1a6 | |||
| 05bb323c0c | |||
| c415bb15e2 | |||
| eac58b086b | |||
| fea39ffa85 | |||
| fb8971ce86 | |||
| e44dd5e2cc | |||
| 3ed303bec4 | |||
| f4267c3c92 | |||
| c5f678ea0e | |||
| 4fe3d92b3f | |||
| 284fc7e37e | |||
| 402d69312c | |||
| 198648d3db | |||
| 3a01dbf5f6 | |||
| 0ec505e37f | |||
| 1e26d7f38c | |||
| 64f9f4d4b9 | |||
| 89c06f714f | |||
| 157d116626 | |||
| de229ddde5 | |||
| 8b456f66ef | |||
| 2e35e35a6e | |||
| cca078f017 | |||
| f658a30132 | |||
| 0a827d2404 | |||
| 806adee3de | |||
| bdd108065b | |||
| 8d41c5475c | |||
| 99ad461a82 | |||
| 9da56b4226 | |||
| beeca529cd | |||
| ebb765ae82 | |||
| 65e391f6f7 | |||
| ab45d92bd1 | |||
| a366c95941 | |||
| f2d9eb003c | |||
| bb1a99912c | |||
| fd30e52741 | |||
| 58a0b6150f | |||
| 9aa053beb6 | |||
| 7eb084efaa | |||
| 1568377725 | |||
| 7b32cfe235 | |||
| 7ef3efafd3 | |||
| ffdd79c497 | |||
| b156da7ded | |||
| 9278954f2f | |||
| 4324ebe855 | |||
| 4a69dca5cc | |||
| 2cc54b4002 | |||
| eac0aebd59 | |||
| 172dcfb6d8 | |||
| d320d83c22 | |||
| af2dd004e4 | |||
| dfbace76db | |||
| 119f762492 | |||
| e586c442c1 | |||
| c01e87ee8b | |||
| af4025d948 | |||
| b7c2b7a0d5 | |||
| f073a93d47 | |||
| 47914838f5 | |||
| 69e2630d77 | |||
| 08148c058c | |||
| a7ee8f553b | |||
| 8395bb80f1 | |||
| becd3cbf65 | |||
| 80ec681a2c | |||
| 96a80ce1b6 | |||
| f18cf5c8a6 | |||
| 4c21159553 | |||
| 475c0a9b09 | |||
| f80ad61179 | |||
| 10ccfb1086 | |||
| 44197fd83c | |||
| 0d9e03f848 | |||
| 810812d06b | |||
| 539d7f6e79 | |||
| 3358d9e943 | |||
| eeffd9b357 | |||
| b33f41200e | |||
| 030d1110b9 | |||
| 09af8084b9 | |||
| 0cff9524c2 | |||
| f6299f5b97 | |||
| b1250ae4e4 | |||
| a9144471b1 | |||
| 9f924da18b | |||
| aac92f1760 | |||
| fdf42bd913 | |||
| ecee2f2e8c | |||
| 1b487fdbb6 | |||
| bb7bd6d71b | |||
| 34178906a3 | |||
| c689722459 | |||
| 8e4ff8c67f | |||
| 4ff22d1d20 | |||
| 5ed7712aed | |||
| a6fcb5ea00 | |||
| 8f402c8c03 | |||
| 5761e313fd | |||
| 441771839a | |||
| ad6700974f | |||
| 499aec2c61 | |||
| ceed4c641a | |||
| 669c0b4cd7 | |||
| 7964de1045 | |||
| 961e2915b4 | |||
| 6c6a64fa98 | |||
| 7a8a751bca | |||
| 69bf6ef8cd | |||
| 05e542215d | |||
| 868eaab5ed | |||
| e7d22717cd | |||
| bbabf814e1 | |||
| 938fcb1352 | |||
| 42a71396cd | |||
| 9ec95b974f | |||
| 49ea9e50cf | |||
| 456edce9fc | |||
| 537512ed5d | |||
| d0efd08a84 | |||
| bb7ba9a6df | |||
| 09695d97db | |||
| 4fe4835c29 | |||
| 86435a3563 | |||
| bc84c7537b | |||
| 29736f9c8f | |||
| 99a9cd297c | |||
| e86749febd | |||
| 4b86fbb12c | |||
| 4c342c9b9a | |||
| d2e0b7b95c | |||
| 53fe763764 | |||
| 86d7233aa4 | |||
| d19ea0968a | |||
| 7eb49446c1 | |||
| 01a88c85a6 | |||
| 5492374f2c | |||
| 9ca00be694 | |||
| 23d9807fe3 | |||
| 8a3e3ae866 | |||
| 117646cda4 | |||
| 6cf502c4bb | |||
| 1bb99127c4 | |||
| 8aeccd35c9 | |||
| c90b94d1ec | |||
| 031fd24842 | |||
| e1c07deb52 | |||
| 5f10c24f03 | |||
| f643caacbe | |||
| cb5ab26924 | |||
| 94c9e92553 | |||
| 507638594d | |||
| e72c4886e8 | |||
| 5ba11a6238 | |||
| 2fc7671051 | |||
| d142097b0f | |||
| 4330bb3ecd | |||
| 2e1dd27332 | |||
| 4f08d7286e | |||
| 7f8fb13552 | |||
| 93e0d119b0 | |||
| a9bc44f19b | |||
| 83bc09f34b | |||
| 4386e1c828 | |||
| 72b2e54331 | |||
| e912c24025 | |||
| c9c1f6ba1c | |||
| abda30fc25 | |||
| 62c188c5c7 | |||
| 67f7b6f3f8 | |||
| f04ccb9403 | |||
| b71bb60669 | |||
| 5eab1ad1c0 | |||
| f96d0caf3c | |||
| 3e6655a199 | |||
| 386cdc8c18 | |||
| 63b40c27a5 | |||
| 6985dffda4 | |||
| 88e16448a8 | |||
| 4cb428e993 | |||
| af9945f9db | |||
| f0594fb1b2 | |||
| a155bc0308 | |||
| dce7444483 | |||
| 76eed79b0a | |||
| f73ed17c05 | |||
| b049d21aff | |||
| f6cce5ee1f | |||
| 8038c2ebe2 | |||
| 9f51b9af57 | |||
| cbc75bf9d7 | |||
| 0ecfa546cd | |||
| b89fb0803d | |||
| 11005d58a7 | |||
| b0c6239314 | |||
| 67f66155e9 | |||
| 7fbae12e99 | |||
| 65580c0a47 | |||
| 236afe4cc6 | |||
| c23a6af28f | |||
| 2535106d2c | |||
| d8379ae5a9 | |||
| 9f13f5fc5d | |||
| 884cb30ebd | |||
| 30488e5da6 | |||
| b7e798a950 | |||
| e999ca3f68 | |||
| 039638c0d8 | |||
| f282504896 | |||
| 0062936ac6 | |||
| 19c41daa86 | |||
| d860b16cfd | |||
| e3b42a8ad9 | |||
| 20bd7a82af | |||
| e607eb8220 | |||
| 38ca49d1a5 | |||
| a21bdfe031 | |||
| f95832b87c | |||
| feff9b3540 | |||
| 78118aa08c | |||
| 3539372437 | |||
| 7c498625bd | |||
| e379016123 | |||
| afa68b840c | |||
| 1926deb7f9 | |||
| 25c1f34c23 | |||
| d0e04e53ad | |||
| e475fb5cc9 | |||
| f72f632cd8 | |||
| 02ea27fc6f | |||
| 5d338bb87c | |||
| f9f08c2886 | |||
| dcc139043d | |||
| 520219404c | |||
| f97991f00d | |||
| 7b7e1c5337 | |||
| 6e66659940 | |||
| 3d83baed78 | |||
| 049b27da96 | |||
| 6bcbe0f633 | |||
| 8c44e39275 | |||
| e36ab1f5d2 | |||
| 865c775f41 | |||
| 198778ba2d | |||
| 215aabdc5f | |||
| 8d92c8be37 | |||
| 93b3ce07f0 | |||
| f9b7c8b851 | |||
| b3cf72abdc | |||
| 65fddd06a9 | |||
| 41f4a8ff58 | |||
| a13d5018b9 | |||
| 2ac3ce5bc8 | |||
| 85514987e7 | |||
| c9eb07b5ba | |||
| 7201b61498 | |||
| 55b3161900 | |||
| 9d5c4424a1 | |||
| d507ba2339 | |||
| 4ec5103454 | |||
| 3e09cd415e | |||
| 1098265145 | |||
| df7a106237 | |||
| 00b38970a1 | |||
| c1004e5817 | |||
| 13e9738345 | |||
| 1a7c1e2544 | |||
| ff082487b5 | |||
| 14cac0d892 | |||
| a8347e0b53 | |||
| a73c3453ea | |||
| a64932b2c9 | |||
| 685297171c | |||
| 2e3e403165 | |||
| fbd910ef50 | |||
| 30129d161f | |||
| a6510af56d | |||
| 9830920635 | |||
| 93025b72cd | |||
| 22639baa4c | |||
| 1aba8dfb11 | |||
| 8b4eb96262 | |||
| cafe6cd2fe | |||
| da6140f6f4 | |||
| 3fc68ce2ff | |||
| 5e8927245b | |||
| 75de1b3ae8 | |||
| 6743114d19 | |||
| 28cca67cb3 | |||
| bad7c6e798 | |||
| ecd3b38d3a | |||
| 8f09f16603 | |||
| 80812cb402 | |||
| 66fbf7aee6 | |||
| a92c603ab2 | |||
| 365438370d | |||
| a40b8fc915 | |||
| 5d92c1c86d | |||
| c526fd8847 | |||
| cd767dc68c | |||
| e21ebc75ee | |||
| 931eaaae4a | |||
| 4d487e6bf0 | |||
| 6c45a6573a | |||
| 45b0dda7d9 | |||
| caf3bc7470 | |||
| 5259b801f7 | |||
| 77e6d0db75 | |||
| b2d7e5ec1e | |||
| 15bc99d216 | |||
| 63c6e2abd7 | |||
| 8ab97a1b36 | |||
| d1aa581879 | |||
| 5f56143c5e | |||
| 1a2b558ac3 | |||
| 4f4ff74bf1 | |||
| ded3b08080 | |||
| 14a29c8612 | |||
| e66e430d30 | |||
| c833f560c1 | |||
| 454c721842 | |||
| 26eda324dc | |||
| 16951d36a2 | |||
| e1d36125d2 | |||
| 7a3c259d2f | |||
| aa5fb2a2c5 | |||
| a92cc6506c | |||
| 3971548142 | |||
| d94de771bf | |||
| c5f47ffcd4 | |||
| b336235ad7 | |||
| eea07309aa | |||
| 5529170036 | |||
| 3d745e93b6 | |||
| 019082bec7 | |||
| 855cceea70 | |||
| 487eae85e1 | |||
| 5d188e61c0 | |||
| 546c335198 | |||
| aaecc5eda2 | |||
| d13e939ddd | |||
| afea79474e | |||
| 05f555b5b5 | |||
| 85931b6dc2 | |||
| 9f0c7f6a76 | |||
| 022c06c803 | |||
| 1b72e7d6b7 | |||
| 666ac6df5b | |||
| 36481a53d9 | |||
| 5a9901d775 | |||
| b3a24d0158 | |||
| 8890826070 | |||
| daa84a1fef | |||
| a4bd47f001 | |||
| d031f1be01 | |||
| a48abc59ce | |||
| 878f05c323 | |||
| d462711d25 | |||
| 40a0120a28 | |||
| ac812eaeae | |||
| 9965223d9b | |||
| 08b99d0d3a | |||
| 519a6a2b1e | |||
| 524f5d470b | |||
| 6631c6a5d7 | |||
| 10f95fb0d9 | |||
| a315366026 | |||
| 1901c9a679 | |||
| 415ad5402f | |||
| 9a40e12dbc | |||
| a1af663796 | |||
| 78b7ddb32a | |||
| 5e5ee4fed1 | |||
| 84c022a39b | |||
| 300741b05a | |||
| dc685a01c6 | |||
| 752f897a34 | |||
| 722cb6b1fd | |||
| 50c095cd09 | |||
| c23546eb46 | |||
| 36340c4e52 | |||
| a7ab38f40c | |||
| 0901c03b74 | |||
| 50817352c1 | |||
| ee4a7447bc | |||
| a6d3c827ad | |||
| d4ea31b91f | |||
| 210faaec6d | |||
| 16be9b9dae | |||
| 2b8f709182 | |||
| aec22d8563 | |||
| 1996d042f0 | |||
| 27b6665717 | |||
| ce20045611 | |||
| 277f8bfd69 | |||
| 1da2db856f | |||
| 33dfe1389c | |||
| 013b69405a | |||
| ca07a53835 | |||
| bbdb6ae1f6 | |||
| 4a63222318 | |||
| 1a1c552964 | |||
| 3587dc2d75 | |||
| 96eb9a3ad0 | |||
| eaa70f43c0 | |||
| a426b773d3 | |||
| 84841edda9 | |||
| d416dbe47b | |||
| 7052da7e54 | |||
| 8f2a2f0ba6 | |||
| d575ba663d | |||
| 964fe7f335 | |||
| d3e92d6576 | |||
| 9dbd6069f1 | |||
| 7ae25c9a1b | |||
| 689969a005 | |||
| b270e1ac8d | |||
| 95d38cea44 | |||
| 3ed0765fe5 | |||
| 0c90164c24 | |||
| a45fa39afc | |||
| 8959f5e1c5 | |||
| df338ab00e | |||
| ac7a2452d6 | |||
| 80104e6d07 | |||
| 8f394cd01d | |||
| e5a32c83c5 | |||
| 8dce20e69f | |||
| 3428a06bb8 | |||
| 177f9a1ff6 | |||
| 9d93944dd1 | |||
| a4cba1a352 | |||
| 17b4232d80 | |||
| 2eb58eb719 | |||
| db5a4195ad | |||
| 3fb29f8e2b | |||
| dacdb2cf35 | |||
| c8473cbe03 | |||
| e9edf8a7ea | |||
| 5a73aa3d90 | |||
| 04101c1c3e | |||
| 0c9343f24d | |||
| b71710871c | |||
| f6df6db17b | |||
| 3f8b3bc6cb | |||
| 383ef27128 | |||
| d8189768ae | |||
| a5eb2fce75 | |||
| 1fe242a284 | |||
| a4b83ca9a0 | |||
| 2365b26c1c | |||
| 8fb044f71b | |||
| 5ce42475c4 | |||
| 57b9d31fff | |||
| 7671586cb0 | |||
| a1997e31a8 | |||
| f5478e9f64 | |||
| 06abea3576 | |||
| ae6b584a5f | |||
| 9e27c69906 | |||
| 00afe27900 | |||
| 4e5c1a32d3 | |||
| d4f5043a25 | |||
| 03a5a55974 | |||
| dbab4c1212 | |||
| d186a96796 | |||
| 6880d014c3 | |||
| 6542dec358 | |||
| 1a2738c3a9 | |||
| 12118ff125 | |||
| c3a00186ff | |||
| fafa777e98 | |||
| d4da99f61c | |||
| bb293c0c02 | |||
| 1e29971b3c | |||
| 25d70cca4f | |||
| 362832a196 | |||
| ed150a5ccd | |||
| d2247b66f1 | |||
| 3b58ea716c | |||
| 368e548e46 | |||
| 6f3612d196 | |||
| 0f38146fcc | |||
| 1a13f3f096 | |||
| 9cc102ca2a | |||
| 50ff4b89bf | |||
| 9b898825ab | |||
| 5be9033c40 | |||
| 67e55ab0a0 | |||
| 227549bf22 | |||
| 19707d10a3 | |||
| 91565ced89 | |||
| 2383b00c8c | |||
| 405063f036 | |||
| d2f3c6a879 | |||
| 4f759c1bd2 | |||
| 9d7f9ce7b3 | |||
| 56f3dfce92 | |||
| 9a66f18edb | |||
| d7270ffb84 | |||
| dd834a3104 | |||
| e28ed1b882 | |||
| 2370123c72 | |||
| 8a5133f04b | |||
| a0f874b319 | |||
| 415d11ae33 | |||
| f93b1ce30e | |||
| 9fb2e4ff1b | |||
| 601d0f4324 | |||
| cbf7db3347 | |||
| 217be1d234 | |||
| 7fabd6554d | |||
| d673819796 | |||
| a963a331a2 | |||
| eda5b8995f | |||
| d5e95eedf3 | |||
| 032e703704 | |||
| ad1444f5ba | |||
| a4b30b8620 | |||
| 9c002c7bff | |||
| 90495a27d9 | |||
| 1246fa699a | |||
| 511d37f5e0 | |||
| 7a03a0eaa9 | |||
| 2f57cb613e | |||
| e386c3078a | |||
| 3802889834 | |||
| f825b2baba | |||
| 6c92abd083 | |||
| c652379a5f | |||
| 61d34ab4ad | |||
| d511641410 | |||
| c8430625bf | |||
| a418224bbb | |||
| 9e3c13dea3 | |||
| 335850f7ff | |||
| f6baf8fe83 | |||
| 4c9b82b649 | |||
| f2570992e5 | |||
| 6911d6314d | |||
| eaeea9730c | |||
| fb0790a733 | |||
| 3230cd53e1 | |||
| edbce067b8 | |||
| 83877e5107 | |||
| 3a67540212 | |||
| 1a5db96023 | |||
| ef82f9ab5b | |||
| bf7e5c6333 | |||
| 443f0f5450 | |||
| cb1dccd630 | |||
| 2e558acbee | |||
| 74162ea54c | |||
| ccbe4fba04 | |||
| 5aeddb6166 | |||
| 49df5203ae | |||
| 0cfe801d18 | |||
| 89c01e8244 | |||
| 6605e4dd61 | |||
| d6239de6fd | |||
| 99ad6f3712 | |||
| f3041e7549 | |||
| 1269031be3 | |||
| ce96274f28 | |||
| a9a9bd0a3d | |||
| 33789adadc | |||
| 15b50a75c4 | |||
| ead34dbb1f | |||
| a9b1356efa | |||
| 33e105bc7b | |||
| e5041147f4 | |||
| 576e627ad1 | |||
| 4059664354 | |||
| 974c0ca7e8 | |||
| 8e7a7b8b6d | |||
| 1e3b1db905 | |||
| 51c98746c4 | |||
| 4c21439847 | |||
| 31385ee533 | |||
| bd4e34e0e1 | |||
| 9f591b166b | |||
| 7e457fa17b | |||
| 926b9d2bae | |||
| c5822b5acf | |||
| 516b66a50a | |||
| 39305d63c7 | |||
| c0cb856961 | |||
| 2fb97a676f | |||
| cbff151dc3 | |||
| eed75fd2fd | |||
| 6374390b34 | |||
| 2185d3ef7c | |||
| 4aaa96e36c | |||
| bf86680547 | |||
| 960307e262 | |||
| eedf96cc31 | |||
| 6fb5fce4d3 | |||
| 7688d21fe6 | |||
| 23e60b36b4 | |||
| ab8fc8e0a0 | |||
| b30f04046d | |||
| 9bd03c7d43 | |||
| 78118a1ac1 | |||
| 1f863d0cce | |||
| c49204aeeb | |||
| b1de3755fd | |||
| 83a1cc5aba | |||
| 9b0b15c31e | |||
| 802651d2d4 | |||
| 52a48e5618 | |||
| 14fe248e19 | |||
| 5b81be371e | |||
| 82d67f2850 | |||
| 1c342bd566 | |||
| bb8ad3c971 | |||
| e9fef85b72 | |||
| c0d1a4f274 | |||
| 94be3335a0 | |||
| 7d03f78546 | |||
| 023f933d0b | |||
| 9995cc01b7 | |||
| fd03b263d1 | |||
| 6a09a3fd44 | |||
| 1322f8610c | |||
| 90ab6175b5 | |||
| 2e3e9ee882 | |||
| 5158329785 | |||
| b8e0165da2 | |||
| 0fa6ebc136 | |||
| 4e5e362197 | |||
| 61514fef2b | |||
| 59e593ab0d | |||
| 2c6ea98ef9 | |||
| bd3ea16b57 | |||
| 45165332f6 | |||
| d764a66e55 | |||
| ac41e64429 | |||
| 462beb30b3 | |||
| 3a89e9c087 | |||
| e71863cbd2 | |||
| 5ec0ff0598 | |||
| 2ca9b77cfb | |||
| 4f535ef5fe | |||
| a46ad71bb0 | |||
| 90d6911d41 | |||
| e13ebae0df | |||
| 3e15fc8206 | |||
| 6a400467dd | |||
| 488188e9c3 | |||
| 0d31bc4280 | |||
| 6375b4431c | |||
| 683422f8a4 | |||
| e4dbad2669 | |||
| 34721fdee8 | |||
| f27668552c | |||
| 306fdf4235 | |||
| 553b09d827 | |||
| 8ee17f0c64 | |||
| 7e5ad644d3 | |||
| 846b8a7cde | |||
| f27a4f174b | |||
| c6d4375aa8 | |||
| b9ec54c76a | |||
| b351d7c1ae | |||
| 729ebe7cd0 | |||
| f51c28e708 | |||
| 9fbf55127d | |||
| f9fd61dc6b | |||
| 4f198e1f53 | |||
| 24c85a5140 | |||
| 3e1a5f4ccd | |||
| 34e5a3878c | |||
| 663e285091 | |||
| d87c03bb79 | |||
| abc57688d3 | |||
| 29671d56fc | |||
| e8cf6a722b | |||
| 2793ec331b | |||
| 1a0b91b068 | |||
| bec6cbe6e6 | |||
| f7ab10ff07 | |||
| 9671cbdc1a | |||
| e0af1f5932 | |||
| 8cb52c6142 | |||
| e5133211a9 | |||
| 8548612a80 | |||
| 41c3193275 | |||
| 15771d2802 | |||
| b4a62e5f3e | |||
| fc7e6735a1 | |||
| aeb21c328e | |||
| 9a34b13c2e | |||
| 231feef7fe | |||
| 0e6b68139f | |||
| ef62c2bb39 | |||
| 8f68997f3c | |||
| aebe2698c3 | |||
| 54e7a8fc7f | |||
| 8b4d37c53c | |||
| fbfca46d2f | |||
| 3228f473de | |||
| 17fcf0ee40 | |||
| 395fe31e02 | |||
| e98f9cf1f7 | |||
| fe0c0f97a5 | |||
| 7e27838818 | |||
| bc8094c20c | |||
| 3649c629b7 | |||
| 1c31070fc8 |
@@ -0,0 +1,150 @@
|
||||
package engine.Dungeons;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Dungeon {
|
||||
|
||||
public static int NoFlyEffectID = -1733819072;
|
||||
public static int NoTeleportEffectID = -1971545187;
|
||||
public static int NoSummonEffectID = 2122002462;
|
||||
public ArrayList<PlayerCharacter> participants;
|
||||
public int maxPerGuild;
|
||||
public Vector3fImmutable entrance;
|
||||
public ArrayList<Mob> dungeon_mobs;
|
||||
public Long respawnTime = 0L;
|
||||
|
||||
public Dungeon(Vector3fImmutable entrance, int maxCount){
|
||||
this.participants = new ArrayList<>();
|
||||
this.entrance = entrance;
|
||||
this.dungeon_mobs = new ArrayList<>();
|
||||
this.maxPerGuild = maxCount;
|
||||
}
|
||||
public void applyDungeonEffects(PlayerCharacter player){
|
||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
||||
|
||||
if(noFly != null)
|
||||
player.addEffectNoTimer(noFly.getName(),noFly,40,true);
|
||||
|
||||
if(noTele != null)
|
||||
player.addEffectNoTimer(noTele.getName(),noTele,40,true);
|
||||
|
||||
if(noSum != null)
|
||||
player.addEffectNoTimer(noSum.getName(),noSum,40,true);
|
||||
}
|
||||
|
||||
public void removeDungeonEffects(PlayerCharacter player) {
|
||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
||||
for (Effect eff : player.effects.values()) {
|
||||
if (noFly != null && eff.getEffectsBase().equals(noFly))
|
||||
eff.endEffect();
|
||||
|
||||
if (noTele != null && eff.getEffectsBase().equals(noTele))
|
||||
eff.endEffect();
|
||||
|
||||
if (noSum != null && eff.getEffectsBase().equals(noSum))
|
||||
eff.endEffect();
|
||||
}
|
||||
}
|
||||
|
||||
public static void serializeForClientMsgTeleport(ByteBufferWriter writer) {
|
||||
Guild rulingGuild = Guild.getErrantGuild();
|
||||
Guild rulingNation = Guild.getErrantGuild();
|
||||
|
||||
Zone zone = ZoneManager.getZoneByUUID(994);
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(Enum.GameObjectType.Zone.ordinal());
|
||||
writer.putInt(994);
|
||||
writer.putString("Whitehorn Citadel");
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString("Whitehorn Militants"); // guild name
|
||||
writer.putString("In the Citadel, We Fight!"); // motto
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
// If tree is abandoned blank out the name
|
||||
// to allow them a rename.
|
||||
|
||||
writer.putString("Kol'roth The Destroyer");//sovreign
|
||||
|
||||
writer.putInt(rulingGuild.getCharter());
|
||||
writer.putInt(0); // always 00000000
|
||||
|
||||
writer.put((byte)1);//set safehold
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
|
||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
||||
|
||||
writer.putInt(0);// TODO Implement description text
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 1);
|
||||
|
||||
// Begin serializing nation guild info
|
||||
|
||||
if (rulingNation.isEmptyGuild()) {
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
||||
writer.putInt(rulingNation.getObjectUUID());
|
||||
}
|
||||
|
||||
|
||||
// Serialize nation name
|
||||
|
||||
writer.putString("Whitehorn Militants"); //nation name
|
||||
|
||||
writer.putInt(-1);//city rank, -1 puts it at top of list always
|
||||
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putString("Kol'roth The Destroyer");//nation ruler
|
||||
|
||||
writer.putLocalDateTime(LocalDateTime.now());
|
||||
|
||||
//location
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
||||
|
||||
writer.putFloat(loc.x);
|
||||
writer.putFloat(loc.y);
|
||||
writer.putFloat(loc.z);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package engine.Dungeons;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class DungeonManager {
|
||||
public static ArrayList<Dungeon> dungeons;
|
||||
|
||||
private static final float dungeonAiRange = 64f;
|
||||
private static final float maxTravel = 64f;
|
||||
|
||||
public static void joinDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
if(requestEnter(pc,dungeon)) {
|
||||
dungeon.participants.add(pc);
|
||||
dungeon.applyDungeonEffects(pc);
|
||||
translocateToDungeon(pc, dungeon);
|
||||
}
|
||||
}
|
||||
|
||||
public static void leaveDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
dungeon.participants.remove(pc);
|
||||
dungeon.removeDungeonEffects(pc);
|
||||
translocateOutOfDungeon(pc);
|
||||
}
|
||||
|
||||
public static boolean requestEnter(PlayerCharacter pc, Dungeon dungeon){
|
||||
int current = 0;
|
||||
Guild nation = pc.guild.getNation();
|
||||
|
||||
if(nation == null)
|
||||
return false;
|
||||
|
||||
for(PlayerCharacter participant : dungeon.participants){
|
||||
if(participant.guild.getNation().equals(nation)){
|
||||
current ++;
|
||||
}
|
||||
}
|
||||
|
||||
if(current >= dungeon.maxPerGuild)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void translocateToDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
pc.teleport(dungeon.entrance);
|
||||
pc.setSafeMode();
|
||||
}
|
||||
|
||||
public static void translocateOutOfDungeon(PlayerCharacter pc){
|
||||
pc.teleport(pc.bindLoc);
|
||||
pc.setSafeMode();
|
||||
}
|
||||
|
||||
public static void pulse_dungeons(){
|
||||
for(Dungeon dungeon : dungeons){
|
||||
|
||||
//early exit, if no players present don't waste resources
|
||||
if(dungeon.participants.isEmpty())
|
||||
continue;
|
||||
|
||||
if(dungeon.respawnTime > 0 && System.currentTimeMillis() > dungeon.respawnTime){
|
||||
respawnMobs(dungeon);
|
||||
}
|
||||
|
||||
//remove any players that have left
|
||||
HashSet<AbstractWorldObject> obj = WorldGrid.getObjectsInRangePartial(dungeon.entrance,4096f,MBServerStatics.MASK_PLAYER);
|
||||
for(PlayerCharacter player : dungeon.participants)
|
||||
if(!obj.contains(player))
|
||||
leaveDungeon(player,dungeon);
|
||||
|
||||
//cycle dungeon mob AI
|
||||
for(Mob mob : dungeon.dungeon_mobs)
|
||||
dungeonMobAI(mob);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dungeonMobAI(Mob mob){
|
||||
|
||||
}
|
||||
|
||||
public static void respawnMobs(Dungeon dungeon){
|
||||
for(Mob mob : dungeon.dungeon_mobs){
|
||||
|
||||
if(!mob.isAlive() && mob.despawned)
|
||||
mob.respawn();
|
||||
|
||||
if(!mob.isAlive() && !mob.despawned){
|
||||
mob.despawn();
|
||||
mob.respawn();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+36
-51
@@ -9,15 +9,13 @@
|
||||
package engine;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.Shrine;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -153,8 +151,7 @@ public class Enum {
|
||||
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);
|
||||
SAETOR(1999,MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE,1);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
||||
@@ -210,9 +207,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.499500105f, 14.6685f, 4.2199998f, 14.6685f, 6.3299999f, 18.379999f, 6.5f);
|
||||
private float walkStandard;
|
||||
private float walkCombat;
|
||||
private float runStandard;
|
||||
@@ -472,11 +468,14 @@ public class Enum {
|
||||
|
||||
// 14001 does not have a banestone to bind at
|
||||
|
||||
if (ruinZone.getLoadNum() == 14001)
|
||||
if (ruinZone.getLoadNum() == 14001) {
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
else
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
}else {
|
||||
//spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
//.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -779,6 +778,7 @@ public class Enum {
|
||||
Combat,
|
||||
Spires,
|
||||
Snare,
|
||||
Snared,
|
||||
Stun,
|
||||
Blind,
|
||||
Root,
|
||||
@@ -881,6 +881,7 @@ public class Enum {
|
||||
Siege,
|
||||
Slash,
|
||||
Snare,
|
||||
Snared,
|
||||
Sorcery,
|
||||
Spear,
|
||||
SpearMastery,
|
||||
@@ -960,20 +961,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) {
|
||||
@@ -1029,6 +1031,7 @@ public class Enum {
|
||||
Silence,
|
||||
Slash,
|
||||
Snare,
|
||||
Snared,
|
||||
Stance,
|
||||
Stun,
|
||||
Summon,
|
||||
@@ -1153,6 +1156,7 @@ public class Enum {
|
||||
SkillDebuff,
|
||||
SlashResistanceDebuff,
|
||||
Snare,
|
||||
Snared,
|
||||
StackableAttrCONBuff,
|
||||
StackableAttrDEXBuff,
|
||||
StackableAttrSTRBuff,
|
||||
@@ -1665,24 +1669,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 +2323,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 +2839,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 +2864,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 +2874,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 +2897,6 @@ public class Enum {
|
||||
MOBILE,
|
||||
PET,
|
||||
CHARMED,
|
||||
|
||||
SIEGEENGINE,
|
||||
GUARD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,9 @@ import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.BoxTracker;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -110,7 +106,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 +207,7 @@ public enum InterestManager implements Runnable {
|
||||
if (origin == null)
|
||||
continue;
|
||||
|
||||
if (!playerCharacter.enteredWorld)
|
||||
if (!playerCharacter.isEnteredWorld())
|
||||
continue;
|
||||
|
||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||
@@ -468,7 +464,7 @@ public enum InterestManager implements Runnable {
|
||||
if (awonpc.despawned == true)
|
||||
continue;
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||
|
||||
@@ -481,7 +477,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);
|
||||
@@ -515,6 +511,18 @@ public enum InterestManager implements Runnable {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.equals(player)){
|
||||
try{
|
||||
WorldGrid.RemoveWorldObject(player);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClientConnection origin = player.getClientConnection();
|
||||
|
||||
if (origin == null)
|
||||
@@ -522,11 +530,10 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
// Update loaded upbjects lists
|
||||
|
||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
BoxTracker.addPlayer(origin.machineID,player);
|
||||
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package engine.ZergMehcanics;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ZergManager;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class MineAntiZerg {
|
||||
|
||||
public static HashMap<Mine,HashMap<PlayerCharacter,Long>> leaveTimers = new HashMap<>();
|
||||
public static HashMap<Mine,ArrayList<PlayerCharacter>> currentPlayers = new HashMap<>();
|
||||
|
||||
public static void runMines(){
|
||||
for(Mine mine : Mine.getMines()){
|
||||
|
||||
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||
|
||||
if(tower == null)
|
||||
continue;
|
||||
|
||||
if(!mine.isActive)
|
||||
continue;
|
||||
|
||||
logPlayersPresent(tower,mine);
|
||||
|
||||
auditPlayersPresent(tower,mine);
|
||||
|
||||
auditPlayers(mine);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logPlayersPresent(Building tower, Mine mine){
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
||||
|
||||
ArrayList<PlayerCharacter> playersPresent = new ArrayList<>();
|
||||
for(AbstractWorldObject player : loadedPlayers){
|
||||
playersPresent.add((PlayerCharacter)player);
|
||||
}
|
||||
|
||||
currentPlayers.put(mine,playersPresent);
|
||||
}
|
||||
|
||||
public static void auditPlayersPresent(Building tower, Mine mine){
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
||||
|
||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
||||
|
||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
||||
if(!loadedPlayers.contains(player)){
|
||||
toRemove.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
currentPlayers.get(mine).removeAll(toRemove);
|
||||
|
||||
for(PlayerCharacter player : toRemove){
|
||||
if(leaveTimers.containsKey(mine)){
|
||||
leaveTimers.get(mine).put(player,System.currentTimeMillis());
|
||||
}else{
|
||||
HashMap<PlayerCharacter,Long> leaveTime = new HashMap<>();
|
||||
leaveTime.put(player,System.currentTimeMillis());
|
||||
leaveTimers.put(mine,leaveTime);
|
||||
}
|
||||
}
|
||||
|
||||
toRemove.clear();
|
||||
|
||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
||||
long timeGone = System.currentTimeMillis() - leaveTimers.get(mine).get(player);
|
||||
if(timeGone > 180000L) {//3 minutes
|
||||
toRemove.add(player);
|
||||
player.ZergMultiplier = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for(PlayerCharacter player : toRemove) {
|
||||
leaveTimers.get(mine).remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void auditPlayers(Mine mine){
|
||||
|
||||
HashMap<Guild,ArrayList<PlayerCharacter>> playersByNation = new HashMap<>();
|
||||
|
||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
||||
if(playersByNation.containsKey(player.guild.getNation())){
|
||||
playersByNation.get(player.guild.getNation()).add(player);
|
||||
}else{
|
||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
||||
players.add(player);
|
||||
playersByNation.put(player.guild.getNation(),players);
|
||||
}
|
||||
}
|
||||
|
||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
||||
if(playersByNation.containsKey(player.guild.getNation())){
|
||||
playersByNation.get(player.guild.getNation()).add(player);
|
||||
}else{
|
||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
||||
players.add(player);
|
||||
playersByNation.put(player.guild.getNation(),players);
|
||||
}
|
||||
}
|
||||
|
||||
for(Guild nation : playersByNation.keySet()){
|
||||
for(PlayerCharacter player : playersByNation.get(nation)){
|
||||
player.ZergMultiplier = ZergManager.getCurrentMultiplier(playersByNation.get(nation).size(), mine.capSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,13 @@ import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class dbAccountHandler extends dbHandlerBase {
|
||||
@@ -77,18 +76,24 @@ public class dbAccountHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void SET_TRASH(String machineID) {
|
||||
|
||||
public void SET_TRASH(String machineID, String type) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO dyn_trash(`machineID`, `count`)"
|
||||
+ " VALUES (?, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"INSERT INTO dyn_trash(`machineID`, `count`, `type`)"
|
||||
+ " VALUES (?, 1, ?) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
||||
|
||||
preparedStatement.setString(1, machineID);
|
||||
preparedStatement.setString(2, type);
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, "Account: " + machineID + " has been kicked from game for cheating");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
|
||||
public ArrayList<String> GET_TRASH_LIST() {
|
||||
@@ -270,4 +275,21 @@ public class dbAccountHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void TRASH_CHEATERS() {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{CALL BanAccountsWithMachineID()}")) {
|
||||
|
||||
boolean hasResultSet = callableStatement.execute();
|
||||
|
||||
if (!hasResultSet && callableStatement.getUpdateCount() > 0) {
|
||||
Logger.info("TRASHED CHEATERS");
|
||||
} else {
|
||||
Logger.warn("No cheaters to trash.");
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error("Error trashing cheaters: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,17 +10,13 @@
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
|
||||
public class dbBaneHandler extends dbHandlerBase {
|
||||
|
||||
@@ -89,6 +85,139 @@ public class dbBaneHandler extends dbHandlerBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean SET_BANE_TIME_NEW(int hour, int cityUUID) {
|
||||
hour += 12; // Adjust hour
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `time_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
// Retrieve placementDate and liveDate
|
||||
getStatement.setInt(1, cityUUID);
|
||||
try (ResultSet rs = getStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
|
||||
// Explicitly check if liveDate is null
|
||||
DateTime toSet;
|
||||
if (liveDateTimestamp == null) {
|
||||
// If liveDate is null, default to placementDate
|
||||
toSet = placementDate;
|
||||
} else {
|
||||
// If liveDate is not null, use it
|
||||
DateTime liveDate = new DateTime(liveDateTimestamp.getTime());
|
||||
toSet = liveDate;
|
||||
}
|
||||
|
||||
// Adjust the time
|
||||
toSet = toSet.withHourOfDay(hour).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
|
||||
|
||||
// Update liveDate and time_set flag
|
||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
||||
updateStatement.setInt(2, 1); // time_set flag
|
||||
updateStatement.setInt(3, cityUUID);
|
||||
|
||||
updateStatement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean SET_BANE_DAY_NEW(int dayOffset, int cityUUID) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `day_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
// Retrieve placementDate and liveDate
|
||||
getStatement.setInt(1, cityUUID);
|
||||
try (ResultSet rs = getStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
|
||||
// Explicitly check if liveDate is null
|
||||
DateTime liveDate;
|
||||
if (liveDateTimestamp == null) {
|
||||
// If liveDate is null, default to placementDate
|
||||
liveDate = placementDate;
|
||||
} else {
|
||||
// If liveDate is not null, use it
|
||||
liveDate = new DateTime(liveDateTimestamp.getTime());
|
||||
}
|
||||
|
||||
// Calculate the new liveDate while preserving the time component
|
||||
DateTime updatedDate = placementDate.plusDays(dayOffset)
|
||||
.withHourOfDay(liveDate.getHourOfDay())
|
||||
.withMinuteOfHour(liveDate.getMinuteOfHour())
|
||||
.withSecondOfMinute(liveDate.getSecondOfMinute())
|
||||
.withMillisOfSecond(liveDate.getMillisOfSecond());
|
||||
|
||||
// Update liveDate and day_set flag
|
||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(updatedDate.getMillis()));
|
||||
updateStatement.setInt(2, 1); // day_set flag
|
||||
updateStatement.setInt(3, cityUUID);
|
||||
|
||||
updateStatement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean SET_BANE_CAP_NEW(int count, int cityUUID) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, count);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, 1);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, count);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean REMOVE_BANE(Bane bane) {
|
||||
|
||||
if (bane == null)
|
||||
@@ -107,4 +236,25 @@ public class dbBaneHandler extends dbHandlerBase {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public DateTime getLiveDate(int cityUUID) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
|
||||
|
||||
statement.setInt(1, cityUUID);
|
||||
|
||||
try (ResultSet rs = statement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
if (liveDateTimestamp != null) {
|
||||
return new DateTime(liveDateTimestamp.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return null; // Return null if liveDate is not found or an error occurs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -98,32 +98,54 @@ public class dbContractHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||
if(!contract.getName().contains("Sage")) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||
|
||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
while (rs.next()) {
|
||||
|
||||
int type = rs.getInt("type");
|
||||
int value = rs.getInt("value");
|
||||
int type = rs.getInt("type");
|
||||
int value = rs.getInt("value");
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
contract.getBuyItemType().add(value);
|
||||
break;
|
||||
case 2:
|
||||
contract.getBuySkillToken().add(value);
|
||||
break;
|
||||
case 3:
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
break;
|
||||
switch (type) {
|
||||
case 1:
|
||||
contract.getBuyItemType().add(value);
|
||||
break;
|
||||
case 2:
|
||||
contract.getBuySkillToken().add(value);
|
||||
break;
|
||||
case 3:
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}else{
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
int value = rs.getInt("value");
|
||||
if(!contract.getBuySkillToken().contains(value))
|
||||
contract.getBuySkillToken().add(value);
|
||||
|
||||
if(!contract.getBuyItemType().contains(value))
|
||||
contract.getBuyItemType().add(value);
|
||||
|
||||
if(!contract.getBuyUnknownToken().contains(value))
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
@@ -57,10 +56,23 @@ public abstract class dbHandlerBase {
|
||||
while (rs.next()) {
|
||||
|
||||
int id = rs.getInt(1);
|
||||
try {
|
||||
if (rs.getInt("capSize") == 0) {
|
||||
continue;
|
||||
}
|
||||
}catch(Exception e){
|
||||
//not a mine
|
||||
}
|
||||
|
||||
if (DbManager.inCache(localObjectType, id)) {
|
||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||
} else {
|
||||
try{
|
||||
if(rs.getInt("mineLiveHour") == 1)
|
||||
continue;
|
||||
}catch(Exception e){
|
||||
//not a mine
|
||||
}
|
||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||
DbManager.addToCache(toAdd);
|
||||
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
||||
|
||||
@@ -22,73 +22,17 @@ import java.util.HashMap;
|
||||
|
||||
public class dbItemBaseHandler extends dbHandlerBase {
|
||||
|
||||
public static final HashMap<Integer,Float> dexReductions = new HashMap<>();
|
||||
public dbItemBaseHandler() {
|
||||
|
||||
}
|
||||
|
||||
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
|
||||
|
||||
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()) {
|
||||
@@ -102,6 +46,14 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
||||
if(dexReductions.containsKey(itemBase.getUUID())){
|
||||
itemBase.dexReduction = dexReductions.get(itemBase.getUUID());
|
||||
}else{
|
||||
itemBase.dexReduction = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
||||
|
||||
ArrayList<Integer> tempList = new ArrayList<>();
|
||||
@@ -144,20 +96,28 @@ 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());
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
// Check if a result was found
|
||||
if (rs.next()) {
|
||||
int ID = rs.getInt("ID");
|
||||
float factor = rs.getInt("item_bulk_factor");
|
||||
dexReductions.put(ID,factor);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||
|
||||
@@ -134,13 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
if (rs.next()) {
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
}catch(Exception e){
|
||||
return true;
|
||||
worked = false;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
@@ -354,11 +354,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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -131,6 +131,32 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
return npc;
|
||||
}
|
||||
|
||||
public int BANE_COMMANDER_EXISTS(final int objectUUID) {
|
||||
|
||||
int uid = 0;
|
||||
|
||||
String query = "SELECT `UID` FROM `obj_npc` WHERE `npc_buildingID` = ? LIMIT 1;";
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
||||
|
||||
preparedStatement.setInt(1, objectUUID);
|
||||
|
||||
try (ResultSet rs = preparedStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
// Retrieve the UID column value
|
||||
uid = rs.getInt("UID");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
|
||||
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
||||
|
||||
int rowCount;
|
||||
@@ -176,6 +202,18 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void updateSpecialPricing(final NPC npc){
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
||||
preparedStatement.setInt(1, npc.getSpecialPrice());
|
||||
preparedStatement.setInt(2, npc.getDBID());
|
||||
|
||||
preparedStatement.executeUpdate();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
public void updateDatabase(final NPC npc) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,64 +9,46 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Dungeons.DungeonManager;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class setProfit extends AbstractDevCmd {
|
||||
public class DungenonCmd extends AbstractDevCmd {
|
||||
|
||||
public setProfit() {
|
||||
super("setprofit");
|
||||
public DungenonCmd() {
|
||||
super("dungeon");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
if (words.length < 2) {
|
||||
this.sendUsage(pc);
|
||||
Zone parent = ZoneManager.findSmallestZone(pc.loc);
|
||||
if(parent == null)
|
||||
return;
|
||||
}
|
||||
float updateValue;
|
||||
try {
|
||||
updateValue = Float.parseFloat(words[1]);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc,
|
||||
"Failed to parse supplied contractID or level to an Integer.");
|
||||
return; // NaN
|
||||
}
|
||||
if(target.getObjectType().equals(GameObjectType.NPC) == false){
|
||||
|
||||
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;
|
||||
}
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
||||
pc.teleport(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets profit margin of targeted NPC";
|
||||
return "indicate mob or building followed by an id and a level";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setprofit buy/sell VALUE(1.0)'";
|
||||
return "'/dungeon mob 2001 10'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FlashMsgCmd extends AbstractDevCmd {
|
||||
this.sendUsage(pcSender);
|
||||
return;
|
||||
}
|
||||
ChatManager.chatSystemFlash(String.join(" ", args));
|
||||
ChatManager.chatSystemFlash(args[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ItemContainerType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.Enum.OwnerType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class GimmeCmd extends AbstractDevCmd {
|
||||
|
||||
public GimmeCmd() {
|
||||
super("gimme");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
int amt = 0;
|
||||
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
|
||||
amt = 10000000 - currentGold;
|
||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
||||
throwbackError(pc, "Failed to add gold to inventory");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||
|
||||
if(pc.level < 75) {
|
||||
pc.setLevel((short) 75);
|
||||
ChatManager.chatSayInfo(pc, "Level set to 75");
|
||||
}
|
||||
pc.getCharItemManager().updateInventory();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Round up current gold in inventory to 10,000,000";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./gimme";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,9 +15,13 @@ import engine.Enum.GameObjectType;
|
||||
import engine.Enum.TargetColor;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -280,7 +284,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;
|
||||
@@ -331,14 +335,18 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "Movement State: " + targetPC.getMovementState().name();
|
||||
output += newline;
|
||||
output += "Movement Speed: " + targetPC.getSpeed();
|
||||
|
||||
output += newline;
|
||||
output += "Altitude : " + targetPC.getLoc().y;
|
||||
|
||||
output += newline;
|
||||
output += "Swimming : " + targetPC.isSwimming();
|
||||
output += newline;
|
||||
output += "isMoving : " + targetPC.isMoving() + newline;
|
||||
output += "Zerg Multiplier: " + targetPC.ZergMultiplier + newline;
|
||||
output += "isBoxed: " + targetPC.isBoxed + newline;
|
||||
output += "isMoving : " + targetPC.isMoving();
|
||||
output += newline;
|
||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier + newline;
|
||||
output += "Hidden : " + targetPC.getHidden() + newline;
|
||||
output += "Target Loc: " + targetPC.loc + newline;
|
||||
output += "Player Loc: " + pc.loc + newline;
|
||||
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc);
|
||||
break;
|
||||
|
||||
case NPC:
|
||||
@@ -441,9 +449,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;
|
||||
@@ -495,13 +501,16 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += newline;
|
||||
output += "No building found." + newline;
|
||||
}
|
||||
int max = (int)(4.882 * targetMob.level + 121.0);
|
||||
if(max > 321){
|
||||
max = 321;
|
||||
|
||||
output += "Damage: " + targetMob.mobBase.getDamageMin() + " - " + targetMob.mobBase.getDamageMax() + newline;
|
||||
output += "ATR: " + targetMob.mobBase.getAttackRating() + newline;
|
||||
output += "DEF: " + targetMob.defenseRating + newline;
|
||||
output += "RANGE: " + targetMob.getRange() + newline;
|
||||
output += "Effects:" + newline;
|
||||
for(MobBaseEffects mbe : targetMob.mobBase.mobbaseEffects){
|
||||
EffectsBase eb = PowersManager.getEffectByToken(mbe.getToken());
|
||||
output += eb.getName() + newline;
|
||||
}
|
||||
int min = (int)(4.469 * targetMob.level - 3.469);
|
||||
output += "Min Loot Roll = " + min;
|
||||
output += "Max Loot Roll = " + max;
|
||||
break;
|
||||
case Item: //intentional passthrough
|
||||
case MobLoot:
|
||||
@@ -526,12 +535,19 @@ 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;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Corpse:
|
||||
Corpse corpse = (Corpse)target;
|
||||
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
|
||||
output += "Despawn in: " + timeLeft;
|
||||
output += newline;
|
||||
break;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, output);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -49,6 +49,8 @@ public class PrintSkillsCmd extends AbstractDevCmd {
|
||||
+ skill.getModifiedAmount() + '('
|
||||
+ skill.getTotalSkillPercet() + " )");
|
||||
}
|
||||
//throwbackInfo(pc, "= = = = = NEW CALCULATIONS = = = = =");
|
||||
// PlayerCombatStats.PrintSkillsToClient(pc);
|
||||
} else
|
||||
throwbackInfo(pc, "Skills not found for player");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -56,30 +57,43 @@ 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;
|
||||
out += "Stats Base (Modified)" + newline;
|
||||
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||
throwbackInfo(pc, out);
|
||||
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
|
||||
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
|
||||
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
|
||||
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||
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 += "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;
|
||||
|
||||
throwbackInfo(pc, out);
|
||||
String newOut = "Server stats for Player " + tar.getFirstName() + newline;
|
||||
newOut += "HEALTH: " + tar.getHealth() + " / " + tar.getHealthMax() + newline;
|
||||
newOut += "MANA: " + tar.getMana() + " / " + tar.getManaMax() + newline;
|
||||
newOut += "STAMINA: " + tar.getStamina() + " / " + tar.getStaminaMax() + newline;
|
||||
newOut += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||
newOut += "Stats Base (Modified)" + newline;
|
||||
newOut += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||
newOut += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||
newOut += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||
newOut += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||
newOut += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||
newOut += "Move Speed: " + tar.getSpeed() + newline;
|
||||
newOut += "Health Regen: " + tar.combatStats.healthRegen + newline;
|
||||
newOut += "Mana Regen: " + tar.combatStats.manaRegen + newline;
|
||||
newOut += "Stamina Regen: " + tar.combatStats.staminaRegen + newline;
|
||||
newOut += "DEFENSE: " + tar.combatStats.defense + newline;
|
||||
newOut += "HAND ONE" + newline;
|
||||
newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
|
||||
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
|
||||
newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
|
||||
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
|
||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
|
||||
newOut += "HAND TWO" + newline;
|
||||
newOut += "ATR: " + tar.combatStats.atrHandTwo + newline;
|
||||
newOut += "MIN: " + tar.combatStats.minDamageHandTwo + newline;
|
||||
newOut += "MAX: " + tar.combatStats.maxDamageHandTwo + newline;
|
||||
newOut += "RANGE: " + tar.combatStats.rangeHandTwo + newline;
|
||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandTwo + newline;
|
||||
newOut += "=== POWERS ===" + newline;
|
||||
for(CharacterPower power : pc.getPowers().values()){
|
||||
if(power.getPower().requiresHitRoll) {
|
||||
newOut += power.getPower().name + " ATR: " + Math.round(PlayerCombatStats.getSpellAtr(pc,power.getPower())) + newline;
|
||||
}
|
||||
}
|
||||
throwbackInfo(pc, newOut);
|
||||
}
|
||||
|
||||
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -6,12 +6,13 @@ 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");
|
||||
}
|
||||
@@ -26,11 +27,62 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
String newline = "\r\n ";
|
||||
|
||||
String output;
|
||||
if(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
int ATR = Integer.parseInt(words[0]);
|
||||
int DEF = Integer.parseInt(words[1]);
|
||||
int attacks = Integer.parseInt(words[2]);
|
||||
|
||||
output = "Booty Simulation:" + newline;
|
||||
if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){
|
||||
return;//ugh what?
|
||||
int hits = 0;
|
||||
int misses = 0;
|
||||
int defaultHits = 0;
|
||||
int defualtMisses = 0;
|
||||
|
||||
float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
|
||||
float convertedChance = chance * 100;
|
||||
output = "" + newline;
|
||||
output += "DEF VS ATR SIMULATION: " + attacks + " ATTACKS SIMULATED" + newline;
|
||||
output += "DEF = " + DEF + newline;
|
||||
output += "ATR = " + ATR + newline;
|
||||
output += "CHANCE TO LAND HIT: " + convertedChance + "%" + newline;
|
||||
if(convertedChance < 5){
|
||||
output += "CHANCE ADJUSTED TO 5.0%" + newline;
|
||||
convertedChance = 5.0f;
|
||||
}
|
||||
if(convertedChance > 95){
|
||||
output += "CHANCE ADJUSTED TO 95.0%" + newline;
|
||||
convertedChance = 95.0f;
|
||||
}
|
||||
for(int i = 0; i < attacks; i++){
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
if(roll <= convertedChance){
|
||||
hits += 1;
|
||||
}else{
|
||||
misses += 1;
|
||||
}
|
||||
}
|
||||
|
||||
float totalHits = defaultHits + hits;
|
||||
float totalMisses = defualtMisses + misses;
|
||||
float hitPercent = Math.round(totalHits / attacks * 100);
|
||||
float missPercent = Math.round(totalMisses / attacks * 100);
|
||||
|
||||
output += "HITS LANDED: " + (defaultHits + hits) + "(" + Math.round(hitPercent) + "%)" + newline;
|
||||
output += "HITS MISSED: " + (defualtMisses + misses) + "(" + Math.round(missPercent) + "%)";
|
||||
|
||||
throwbackInfo(playerCharacter,output);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
simCount = Integer.parseInt(words[0]);
|
||||
}catch(Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
output = "Booty Simulation: Rolls:" + simCount + newline;
|
||||
|
||||
Mob mob = (Mob) target;
|
||||
output += "Name: " + mob.getName() + newline;
|
||||
output += "Special Loot:" + newline;
|
||||
@@ -48,6 +100,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
ArrayList<Item> Resources = new ArrayList<Item>();
|
||||
ArrayList<Item> Runes = new ArrayList<Item>();
|
||||
ArrayList<Item> Contracts = new ArrayList<Item>();
|
||||
ArrayList<Item> GuardContracts = new ArrayList<Item>();
|
||||
ArrayList<Item> Offerings = new ArrayList<Item>();
|
||||
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
||||
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
||||
@@ -55,14 +108,17 @@ 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();
|
||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
||||
switch (lootItem.getItemBase().getType()) {
|
||||
case CONTRACT: //CONTRACT
|
||||
Contracts.add(lootItem);
|
||||
if(lootItem.getName().contains("Captain"))
|
||||
GuardContracts.add(lootItem);
|
||||
else
|
||||
Contracts.add(lootItem);
|
||||
break;
|
||||
case OFFERING: //OFFERING
|
||||
Offerings.add(lootItem);
|
||||
@@ -83,19 +139,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()) {
|
||||
@@ -141,18 +190,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
}
|
||||
}
|
||||
|
||||
int baseBound = 100000;
|
||||
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
|
||||
int totalRange = baseBound + levelPenalty;
|
||||
if(mob.level >= 50){
|
||||
totalRange = baseBound;
|
||||
}
|
||||
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
|
||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||
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 += "GUARD CONTRACTS DROPS: " + GuardContracts.size() + newline;
|
||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class ArenaManager {
|
||||
private static final List<Arena> activeArenas = new ArrayList<>();
|
||||
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
|
||||
public static Long pulseDelay = 180000L;
|
||||
public static Long lastExecution = 0L;
|
||||
|
||||
public static void pulseArenas() {
|
||||
if(lastExecution == 0L){
|
||||
lastExecution = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if(activeArenas.isEmpty() && playerQueue.isEmpty())
|
||||
return;
|
||||
|
||||
Iterator<Arena> iterator = activeArenas.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Arena arena = iterator.next();
|
||||
if (arena.checkToComplete()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(lastExecution + pulseDelay > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
lastExecution = System.currentTimeMillis();
|
||||
|
||||
while (playerQueue.size() > 1) {
|
||||
createArena();
|
||||
}
|
||||
}
|
||||
|
||||
public static void joinQueue(PlayerCharacter player) {
|
||||
if (!playerQueue.contains(player)) {
|
||||
playerQueue.add(player);
|
||||
}
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void leaveQueue(PlayerCharacter player) {
|
||||
playerQueue.remove(player);
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void createArena() {
|
||||
if (playerQueue.size() > 1) {
|
||||
|
||||
Collections.shuffle(playerQueue);
|
||||
Arena newArena = new Arena();
|
||||
|
||||
//set starting time
|
||||
newArena.startTime = System.currentTimeMillis();
|
||||
|
||||
//decide an arena location
|
||||
newArena.loc = selectRandomArenaLocation();
|
||||
|
||||
// Assign players to the arena
|
||||
newArena.player1 = playerQueue.remove(0);
|
||||
newArena.player2 = playerQueue.remove(0);
|
||||
|
||||
// Teleport players to the arena location
|
||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||
|
||||
// Add the new arena to the active arenas list
|
||||
activeArenas.add(newArena);
|
||||
}
|
||||
}
|
||||
|
||||
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
|
||||
if (winner != null && loser != null) {
|
||||
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
|
||||
arena.player1.getName(), arena.player2.getName(), winner.getName());
|
||||
} else {
|
||||
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
|
||||
arena.player1.getName(), arena.player2.getName());
|
||||
}
|
||||
// Teleport players to the arena location
|
||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||
|
||||
|
||||
|
||||
activeArenas.remove(arena);
|
||||
|
||||
if(winner != null){
|
||||
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
|
||||
//handle prize distribution
|
||||
//ItemBase specialLoot = ItemBase.getItemBase(866);
|
||||
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
|
||||
//promoted.setNumOfItems(21235);
|
||||
//promoted.setName("Special Banker(21235)");
|
||||
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
|
||||
//winner.getCharItemManager().addItemToInventory(promoted);
|
||||
//winner.getCharItemManager().updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3fImmutable selectRandomArenaLocation() {
|
||||
boolean locSet = false;
|
||||
Vector3fImmutable loc = Vector3fImmutable.ZERO;
|
||||
|
||||
while (!locSet) {
|
||||
try {
|
||||
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
|
||||
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
|
||||
float y = 0; // Y coordinate is always 0
|
||||
|
||||
loc = new Vector3fImmutable(x, y, z * -1);
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
|
||||
if(inRange.isEmpty() && !isUnderWater(loc))
|
||||
locSet = true;
|
||||
//}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
||||
public static boolean isUnderWater(Vector3fImmutable loc) {
|
||||
|
||||
try {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(loc);
|
||||
|
||||
if (zone.getSeaLevel() != 0) {
|
||||
|
||||
float localAltitude = loc.y;
|
||||
if (localAltitude < zone.getSeaLevel())
|
||||
return true;
|
||||
} else {
|
||||
if (loc.y < 0)
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -438,6 +438,18 @@ public enum BuildingManager {
|
||||
|
||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||
|
||||
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BANESTONE))
|
||||
{
|
||||
Guild playerNation = player.guild.getNation();
|
||||
City banedCity = ZoneManager.getCityAtLocation(building.loc);
|
||||
if(banedCity != null){
|
||||
if(banedCity.getGuild().getNation().equals(playerNation)){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Nation Members and Guild members are not hostile.
|
||||
// if (building.getGuild() != null){
|
||||
// if (pc.getGuild() != null)
|
||||
@@ -520,10 +532,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 +570,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 +582,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 +594,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;
|
||||
|
||||
@@ -27,6 +27,7 @@ import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.session.Session;
|
||||
import engine.util.KeyCloneAudit;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -84,6 +85,10 @@ public enum ChatManager {
|
||||
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
|
||||
isFlood = true;
|
||||
|
||||
if(KeyCloneAudit.auditChatMsg(pc,msg.getMessage())){
|
||||
return;
|
||||
}
|
||||
|
||||
switch (protocolMsg) {
|
||||
case CHATSAY:
|
||||
ChatManager.chatSay(pc, msg.getMessage(), isFlood);
|
||||
|
||||
@@ -26,7 +26,6 @@ import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -301,6 +300,20 @@ public enum CombatManager {
|
||||
if (target == null)
|
||||
return 0;
|
||||
|
||||
//pet to assist in attacking target
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter attacker = (PlayerCharacter)abstractCharacter;
|
||||
if(attacker.combatStats == null){
|
||||
attacker.combatStats = new PlayerCombatStats(attacker);
|
||||
}
|
||||
if(attacker.getPet() != null){
|
||||
Mob pet = attacker.getPet();
|
||||
if(pet.combatTarget == null && pet.assist)
|
||||
pet.setCombatTarget(attacker.combatTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//target must be valid type
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
@@ -316,10 +329,13 @@ public enum CombatManager {
|
||||
else if (!tar.isActive())
|
||||
return 0;
|
||||
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null)
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null) {
|
||||
if(((PlayerCharacter)target).combatStats == null){
|
||||
((PlayerCharacter)target).combatStats = new PlayerCombatStats(((PlayerCharacter)target));
|
||||
}
|
||||
if (!((PlayerCharacter) abstractCharacter).canSee((PlayerCharacter) target))
|
||||
return 0;
|
||||
|
||||
}
|
||||
//must not be immune to all or immune to attack
|
||||
|
||||
Resists res = tar.getResists();
|
||||
@@ -452,6 +468,17 @@ public enum CombatManager {
|
||||
|
||||
//Range check.
|
||||
|
||||
if(abstractCharacter.isMoving()){
|
||||
range += (abstractCharacter.getSpeed() * 0.1f);
|
||||
}
|
||||
|
||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
if(tarAc != null && tarAc.isMoving()){
|
||||
range += (tarAc.getSpeed() * 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
if (NotInRange(abstractCharacter, target, range)) {
|
||||
|
||||
//target is in stealth and can't be seen by source
|
||||
@@ -483,16 +510,24 @@ public enum CombatManager {
|
||||
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
|
||||
else {
|
||||
int wepSpeed = (int) (wb.getSpeed());
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
||||
if(slot == 1){
|
||||
wepSpeed = (int) pc.combatStats.attackSpeedHandOne;
|
||||
}else{
|
||||
wepSpeed = (int) pc.combatStats.attackSpeedHandTwo;
|
||||
}
|
||||
}else {
|
||||
|
||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
||||
|
||||
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
||||
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
||||
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
}
|
||||
createTimer(abstractCharacter, slot, wepSpeed, true);
|
||||
}
|
||||
|
||||
@@ -528,7 +563,7 @@ public enum CombatManager {
|
||||
float atr;
|
||||
int minDamage, maxDamage;
|
||||
int errorTrack = 0;
|
||||
int subTrack = 0;
|
||||
|
||||
try {
|
||||
|
||||
if (ac == null)
|
||||
@@ -537,14 +572,32 @@ public enum CombatManager {
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (mainHand) {
|
||||
atr = ac.getAtrHandOne();
|
||||
minDamage = ac.getMinDamageHandOne();
|
||||
maxDamage = ac.getMaxDamageHandOne();
|
||||
} else {
|
||||
atr = ac.getAtrHandTwo();
|
||||
minDamage = ac.getMinDamageHandTwo();
|
||||
maxDamage = ac.getMaxDamageHandTwo();
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter) ac;
|
||||
if( pc.combatStats == null){
|
||||
pc.combatStats = new PlayerCombatStats(pc);
|
||||
}
|
||||
pc.combatStats.calculateATR(true);
|
||||
pc.combatStats.calculateATR(false);
|
||||
if (mainHand) {
|
||||
atr = pc.combatStats.atrHandOne;
|
||||
minDamage = pc.combatStats.minDamageHandOne;
|
||||
maxDamage = pc.combatStats.maxDamageHandOne;
|
||||
} else {
|
||||
atr = pc.combatStats.atrHandTwo;
|
||||
minDamage = pc.combatStats.minDamageHandTwo;
|
||||
maxDamage = pc.combatStats.maxDamageHandTwo;
|
||||
}
|
||||
}else {
|
||||
if (mainHand) {
|
||||
atr = ac.getAtrHandOne();
|
||||
minDamage = ac.getMinDamageHandOne();
|
||||
maxDamage = ac.getMaxDamageHandOne();
|
||||
} else {
|
||||
atr = ac.getAtrHandTwo();
|
||||
minDamage = ac.getMinDamageHandTwo();
|
||||
maxDamage = ac.getMaxDamageHandTwo();
|
||||
}
|
||||
}
|
||||
|
||||
boolean tarIsRat = false;
|
||||
@@ -638,34 +691,40 @@ public enum CombatManager {
|
||||
}
|
||||
} else {
|
||||
AbstractCharacter tar = (AbstractCharacter) target;
|
||||
defense = tar.getDefenseRating();
|
||||
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
if(((PlayerCharacter)tar).combatStats == null){
|
||||
((PlayerCharacter)tar).combatStats = new PlayerCombatStats((PlayerCharacter)tar);
|
||||
}
|
||||
((PlayerCharacter)tar).combatStats.calculateDefense();
|
||||
defense = ((PlayerCharacter)tar).combatStats.defense;
|
||||
}else {
|
||||
defense = tar.getDefenseRating();
|
||||
}
|
||||
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||
}
|
||||
|
||||
errorTrack = 4;
|
||||
|
||||
//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) {
|
||||
boolean hitLanded = LandHit((int)atr,(int)defense);
|
||||
if (hitLanded) {
|
||||
|
||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||
@@ -694,7 +753,25 @@ public enum CombatManager {
|
||||
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
float attackRange = getWeaponRange(wb, bonus);
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if(ac.isMoving()){
|
||||
attackRange += (ac.getSpeed() * 0.1f);
|
||||
}
|
||||
|
||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
//AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
if(tarAc != null && tarAc.isMoving()){
|
||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
||||
if(hitLanded) {
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
}else{
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) ac).setWeaponPower(dpj);
|
||||
@@ -709,7 +786,25 @@ public enum CombatManager {
|
||||
|
||||
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
||||
float attackRange = getWeaponRange(wb, bonuses);
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if(ac.isMoving()){
|
||||
attackRange += (ac.getSpeed() * 0.1f);
|
||||
}
|
||||
|
||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
//AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
if(tarAc != null && tarAc.isMoving()){
|
||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
||||
if(hitLanded) {
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
}else{
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,7 +906,27 @@ 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);
|
||||
|
||||
if(weapon != null && weapon.effects != null){
|
||||
float armorPierce = 0;
|
||||
for(Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(ModType.ArmorPiercing)){
|
||||
armorPierce += mod.getPercentMod() + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(armorPierce > 0){
|
||||
damage *= 1 + (armorPierce * 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
//Resists.handleFortitude(tarAc,damageType,damage);
|
||||
|
||||
float d = 0f;
|
||||
|
||||
errorTrack = 12;
|
||||
@@ -819,41 +934,29 @@ 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);
|
||||
|
||||
tarAc.cancelOnTakeDamage();
|
||||
|
||||
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;
|
||||
@@ -878,27 +981,18 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null && tarAc != null && tarAc.isAlive()) {
|
||||
|
||||
ConcurrentHashMap<String, Effect> effects = weapon.getEffects();
|
||||
|
||||
for (Effect eff : effects.values()) {
|
||||
if (eff == null)
|
||||
continue;
|
||||
|
||||
HashSet<AbstractEffectModifier> aems = eff.getEffectModifiers();
|
||||
|
||||
if (aems != null) {
|
||||
for (AbstractEffectModifier aem : aems) {
|
||||
|
||||
if (!tarAc.isAlive())
|
||||
break;
|
||||
|
||||
if (aem instanceof WeaponProcEffectModifier) {
|
||||
|
||||
if(weapon.effects != null){
|
||||
for (Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(ModType.WeaponProc)){
|
||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||
|
||||
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||
|
||||
if (procChance < MBServerStatics.PROC_CHANCE) {
|
||||
try {
|
||||
((WeaponProcEffectModifier) mod).applyProc(ac, target);
|
||||
}catch(Exception e){
|
||||
Logger.error(eff.getName() + " Failed To Cast Proc");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -912,6 +1006,16 @@ public enum CombatManager {
|
||||
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||
handleDamageShields(ac, tarAc, damage);
|
||||
|
||||
//handle mob hate values
|
||||
if(target.getObjectType().equals(GameObjectType.Mob) && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
Mob mobTarget = (Mob)target;
|
||||
if(mobTarget.hate_values.containsKey((PlayerCharacter) ac)){
|
||||
mobTarget.hate_values.put((PlayerCharacter) ac,mobTarget.hate_values.get((PlayerCharacter) ac) + damage);
|
||||
}else{
|
||||
mobTarget.hate_values.put((PlayerCharacter) ac, damage);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Apply Weapon power effect if any.
|
||||
@@ -927,7 +1031,26 @@ public enum CombatManager {
|
||||
if (wp.requiresHitRoll() == false) {
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
float attackRange = getWeaponRange(wb, bonus);
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if(ac.isMoving()){
|
||||
attackRange += (ac.getSpeed() * 0.1f);
|
||||
}
|
||||
|
||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
if(tarAc != null && tarAc.isMoving()){
|
||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
||||
if(hitLanded) {
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
}else{
|
||||
dpj.attack(target, attackRange);
|
||||
}
|
||||
} else
|
||||
((PlayerCharacter) ac).setWeaponPower(null);
|
||||
}
|
||||
@@ -954,8 +1077,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,6 +1099,12 @@ public enum CombatManager {
|
||||
Item tarMain = tarItem.getItemFromEquipped(1);
|
||||
Item tarOff = tarItem.getItemFromEquipped(2);
|
||||
|
||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
if(pc.getRaceID() == 1999 && !isRanged(acMain) && !isRanged(acOff))
|
||||
return true;
|
||||
}
|
||||
|
||||
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
||||
}
|
||||
|
||||
@@ -1034,13 +1162,13 @@ 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
|
||||
return damage;
|
||||
damage = resists.getResistedDamage(source, target, damageType, damage, 0);
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||
@@ -1069,6 +1197,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);
|
||||
}
|
||||
@@ -1190,6 +1322,14 @@ public enum CombatManager {
|
||||
|
||||
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
|
||||
|
||||
if(target.getBonuses() != null)
|
||||
if(target.getBonuses().getBool(ModType.Stunned, SourceType.None))
|
||||
return false;
|
||||
|
||||
if(source.getBonuses() != null)
|
||||
if(source.getBonuses().getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
||||
return false;
|
||||
|
||||
float chance = target.getPassiveChance(type, source.getLevel(), true);
|
||||
|
||||
if (chance == 0f)
|
||||
@@ -1200,7 +1340,7 @@ public enum CombatManager {
|
||||
if (chance > 75f)
|
||||
chance = 75f;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||
int roll = ThreadLocalRandom.current().nextInt(1,100);
|
||||
|
||||
return roll < chance;
|
||||
|
||||
@@ -1252,14 +1392,17 @@ public enum CombatManager {
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
private static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
pc.setSit(toggle);
|
||||
if(pc.isFlying())
|
||||
pc.setSit(false);
|
||||
else
|
||||
pc.setSit(toggle);
|
||||
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(pc);
|
||||
@@ -1275,13 +1418,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;
|
||||
@@ -1344,6 +1480,13 @@ public enum CombatManager {
|
||||
return;
|
||||
|
||||
retaliater.setCombatTarget(ac);
|
||||
if(retaliater.isPlayerGuard && (retaliater.BehaviourType.equals(MobBehaviourType.GuardMinion) || retaliater.BehaviourType.equals(MobBehaviourType.GuardCaptain))){
|
||||
for(Mob guard : retaliater.guardedCity.getParent().zoneMobSet){
|
||||
if(guard.isPlayerGuard && guard.combatTarget == null){
|
||||
guard.setCombatTarget(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1375,9 +1518,9 @@ public enum CombatManager {
|
||||
|
||||
Resists resists = ac.getResists();
|
||||
|
||||
if (resists != null)
|
||||
if (resists != null) {
|
||||
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
|
||||
|
||||
}
|
||||
total += amount;
|
||||
}
|
||||
|
||||
@@ -1460,4 +1603,31 @@ public enum CombatManager {
|
||||
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
||||
}
|
||||
|
||||
public static boolean LandHit(int ATR, int DEF){
|
||||
|
||||
//float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
|
||||
//float convertedChance = chance * 100;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
//if(roll <= 5)//always 5% chance to miss
|
||||
// return false;
|
||||
|
||||
//if(roll >= 95)//always 5% chance to hit
|
||||
// return true;
|
||||
|
||||
float chance = PlayerCombatStats.getHitChance(ATR,DEF);
|
||||
return chance >= roll;
|
||||
}
|
||||
|
||||
public static boolean specialCaseHitRoll(int powerID){
|
||||
switch(powerID) {
|
||||
case 563200808: // Naargal's Bite
|
||||
case 563205337: // Naargal's Dart
|
||||
case 563205930: // Sword of Saint Malorn
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,430 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.AttackJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AttackCmdMsg;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.DamageShield;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class CombatSystem {
|
||||
|
||||
public static void attemptCombat(AbstractCharacter source, AbstractWorldObject target, boolean mainhand){
|
||||
|
||||
//1. source or target doesn't exist, early exit
|
||||
if(source == null || target == null)
|
||||
return;
|
||||
|
||||
//2. source or target is dead, early exit
|
||||
if(!source.isAlive() || !target.isAlive())
|
||||
return;
|
||||
|
||||
//3. make sure if target is a building to ensure that it is damageable
|
||||
if(target.getObjectType().equals(Enum.GameObjectType.Building)){
|
||||
Building building = (Building)target;
|
||||
if(building.assetIsProtected() || building.getProtectionState().equals(Enum.ProtectionState.NPC))
|
||||
return;
|
||||
}
|
||||
|
||||
//after thought: make sure target is in range of source
|
||||
if(!inRange(source,target,mainhand))
|
||||
return;
|
||||
|
||||
//4. apply any weapon powers and then clear the weapon power memory for the player
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.getWeaponPower() != null){
|
||||
pc.getWeaponPower().attack(target,pc.getRange());
|
||||
pc.setWeaponPower(null);
|
||||
}
|
||||
}
|
||||
|
||||
//5. make sure if target is AbstractCharacter to check for defense trigger and passive trigger
|
||||
if(AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
int atr;
|
||||
int def;
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.combatStats == null)
|
||||
pc.combatStats = new PlayerCombatStats(pc);
|
||||
atr = (int) pc.combatStats.atrHandOne;
|
||||
if(!mainhand)
|
||||
atr =(int) pc.combatStats.atrHandTwo;
|
||||
|
||||
def = pc.combatStats.defense;
|
||||
} else {
|
||||
atr = (int) ((source.getAtrHandOne() + source.getAtrHandTwo()) * 0.5f);
|
||||
def = source.defenseRating;
|
||||
}
|
||||
|
||||
if(!LandHit(atr,def)) {
|
||||
createTimer(source,mainhand);
|
||||
return;
|
||||
}
|
||||
|
||||
if(source.getBonuses() != null)
|
||||
if(!source.getBonuses().getBool(Enum.ModType.IgnorePassiveDefense, Enum.SourceType.None))
|
||||
if(triggerPassive(source,target)) {
|
||||
createTimer(source,mainhand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//commence actual combat management
|
||||
|
||||
//6. check for any procs
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.getCharItemManager() != null && pc.getCharItemManager().getEquipped() != null){
|
||||
Item weapon = pc.getCharItemManager().getEquipped(1);
|
||||
if(!mainhand)
|
||||
weapon = pc.getCharItemManager().getEquipped(2);
|
||||
if(weapon != null){
|
||||
if(weapon.effects != null){
|
||||
for (Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.WeaponProc)){
|
||||
int procChance = ThreadLocalRandom.current().nextInt(0,101);
|
||||
if (procChance <= MBServerStatics.PROC_CHANCE) {
|
||||
try {
|
||||
((WeaponProcEffectModifier) mod).applyProc(source, target);
|
||||
}catch(Exception e){
|
||||
Logger.error(eff.getName() + " Failed To Cast Proc");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//7. configure damage amounts and type
|
||||
Enum.DamageType damageType = Enum.DamageType.Crush;
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) source;
|
||||
if(mainhand){
|
||||
min = pc.combatStats.minDamageHandOne;
|
||||
max = pc.combatStats.maxDamageHandOne;
|
||||
}else{
|
||||
min = pc.combatStats.minDamageHandTwo;
|
||||
max = pc.combatStats.maxDamageHandTwo;
|
||||
}
|
||||
}else if (source.getObjectType().equals(Enum.GameObjectType.Mob)) {
|
||||
Mob mob = (Mob) source;
|
||||
min = (int) mob.mobBase.getDamageMin();
|
||||
max = (int) mob.mobBase.getDamageMax();
|
||||
}
|
||||
|
||||
int damage = ThreadLocalRandom.current().nextInt(min,max + 1);
|
||||
|
||||
if(source.getBonuses() != null){
|
||||
damage *= 1 + source.getBonuses().getFloatPercentAll(Enum.ModType.MeleeDamageModifier, Enum.SourceType.None);
|
||||
}
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) source;
|
||||
damage *= pc.ZergMultiplier;
|
||||
}
|
||||
|
||||
//8. configure the attack message to be sent to the clients
|
||||
int animation = 0;
|
||||
ItemBase wb = null;
|
||||
if(source.getCharItemManager() != null && source.getCharItemManager().getEquipped() != null) {
|
||||
Item weapon = source.getCharItemManager().getEquipped(1);
|
||||
if (!mainhand)
|
||||
weapon = source.getCharItemManager().getEquipped(2);
|
||||
|
||||
if(weapon != null && weapon.getItemBase().getAnimations() != null && !weapon.getItemBase().getAnimations().isEmpty()){
|
||||
animation = weapon.getItemBase().getAnimations().get(0);
|
||||
wb = weapon.getItemBase();
|
||||
damageType = wb.getDamageType();
|
||||
}
|
||||
}
|
||||
|
||||
//9. reduce damage from resists and apply damage shields
|
||||
if(AbstractCharacter.IsAbstractCharacter(target)){
|
||||
AbstractCharacter abs = (AbstractCharacter) target;
|
||||
damage = (int) abs.getResists().getResistedDamage(source, abs,damageType,damage,1);
|
||||
handleDamageShields(source,abs,damage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
sendCombatMessage(source, target, 0f, wb, null, mainhand, animation);
|
||||
|
||||
//if attacker is player, set last attack timestamp
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
updateAttackTimers((PlayerCharacter) source, target);
|
||||
|
||||
//10. cancel all effects that cancel on attack
|
||||
source.cancelOnAttack();
|
||||
}
|
||||
|
||||
public static boolean LandHit(int ATR, int DEF){
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
float chance = PlayerCombatStats.getHitChance(ATR,DEF);
|
||||
return chance >= roll;
|
||||
}
|
||||
|
||||
private static void sendCombatMessage(AbstractCharacter source, AbstractWorldObject target, float damage, ItemBase wb, DeferredPowerJob dpj, boolean mainHand, int swingAnimation) {
|
||||
|
||||
if (dpj != null)
|
||||
if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
|
||||
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
|
||||
|
||||
if (source.getObjectType() == Enum.GameObjectType.PlayerCharacter)
|
||||
for (Effect eff : source.getEffects().values())
|
||||
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
|
||||
swingAnimation = 0;
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
private static void updateAttackTimers(PlayerCharacter pc, AbstractWorldObject target) {
|
||||
|
||||
//Set Attack Timers
|
||||
|
||||
if (target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
pc.setLastPlayerAttackTime();
|
||||
}
|
||||
|
||||
public static void handleDamageShields(AbstractCharacter ac, AbstractCharacter target, float damage) {
|
||||
|
||||
if (ac == null || target == null)
|
||||
return;
|
||||
|
||||
PlayerBonuses bonuses = target.getBonuses();
|
||||
|
||||
if (bonuses != null) {
|
||||
|
||||
ConcurrentHashMap<AbstractEffectModifier, DamageShield> damageShields = bonuses.getDamageShields();
|
||||
float total = 0;
|
||||
|
||||
for (DamageShield ds : damageShields.values()) {
|
||||
|
||||
//get amount to damage back
|
||||
|
||||
float amount;
|
||||
|
||||
if (ds.usePercent())
|
||||
amount = damage * ds.getAmount() / 100;
|
||||
else
|
||||
amount = ds.getAmount();
|
||||
|
||||
//get resisted damage for damagetype
|
||||
|
||||
Resists resists = ac.getResists();
|
||||
|
||||
if (resists != null) {
|
||||
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
|
||||
}
|
||||
total += amount;
|
||||
}
|
||||
|
||||
if (total > 0) {
|
||||
|
||||
//apply Damage back
|
||||
|
||||
ac.modifyHealth(-total, target, true);
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(ac, ac, total, 0);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inRange(AbstractCharacter source, AbstractWorldObject target, boolean mainhand){
|
||||
|
||||
if(source == null || target == null)
|
||||
return false;
|
||||
|
||||
float distanceSquared = source.loc.distanceSquared(target.loc);
|
||||
|
||||
float rangeSquared = 16.0f;
|
||||
|
||||
if(source.getCharItemManager() != null && source.getCharItemManager().getEquipped() != null){
|
||||
Item weapon = source.getCharItemManager().getEquipped(1);
|
||||
if(!mainhand)
|
||||
weapon = source.getCharItemManager().getEquipped(2);
|
||||
if(weapon != null)
|
||||
rangeSquared = weapon.getItemBase().getRange() * weapon.getItemBase().getRange();
|
||||
}
|
||||
|
||||
if(source.getBonuses() != null){
|
||||
rangeSquared *= 1 + source.getBonuses().getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.None);
|
||||
}
|
||||
|
||||
return distanceSquared <= rangeSquared;
|
||||
}
|
||||
|
||||
public static boolean triggerPassive(AbstractCharacter source, AbstractWorldObject target) {
|
||||
boolean passiveFired = false;
|
||||
|
||||
if (!AbstractCharacter.IsAbstractCharacter(target))
|
||||
return false;
|
||||
|
||||
AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
//Handle Block passive
|
||||
if (testPassive(source, tarAc, "Block")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Handle Parry passive
|
||||
if (testPassive(source, tarAc, "Parry")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Handle Dodge passive
|
||||
if (testPassive(source, tarAc, "Dodge")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||
|
||||
int swingAnimation = 75;
|
||||
|
||||
if (dpj != null)
|
||||
if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
|
||||
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(source, swingAnimation, target, passiveType);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
|
||||
|
||||
if(target.getBonuses() != null)
|
||||
if(target.getBonuses().getBool(Enum.ModType.Stunned, Enum.SourceType.None))
|
||||
return false;
|
||||
|
||||
float chance = target.getPassiveChance(type, source.getLevel(), true);
|
||||
|
||||
if (chance == 0f)
|
||||
return false;
|
||||
|
||||
//max 75% chance of passive to fire
|
||||
|
||||
if (chance > 75f)
|
||||
chance = 75f;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(1,100);
|
||||
|
||||
return roll < chance;
|
||||
|
||||
}
|
||||
|
||||
private static void createTimer(AbstractCharacter source, boolean mainhand) {
|
||||
|
||||
ConcurrentHashMap<String, JobContainer> timers = source.getTimers();
|
||||
int slot = 1;
|
||||
if(!mainhand)
|
||||
slot = 2;
|
||||
|
||||
int time = 3000;
|
||||
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(mainhand){
|
||||
time = (int) pc.combatStats.attackSpeedHandOne;
|
||||
}else{
|
||||
time = (int) pc.combatStats.attackSpeedHandTwo;
|
||||
}
|
||||
}
|
||||
|
||||
if (timers != null) {
|
||||
AttackJob aj = new AttackJob(source, slot, true);
|
||||
JobContainer job;
|
||||
job = JobScheduler.getInstance().scheduleJob(aj, (time * 100));
|
||||
timers.put("Attack" + slot, job);
|
||||
} else {
|
||||
Logger.error("Unable to find Timers for Character " + source.getObjectUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
|
||||
PlayerCharacter player;
|
||||
int targetType;
|
||||
AbstractWorldObject target;
|
||||
|
||||
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
||||
return;
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
//source must match player this account belongs to
|
||||
|
||||
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
|
||||
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
targetType = msg.getTargetType();
|
||||
|
||||
if (targetType == Enum.GameObjectType.PlayerCharacter.ordinal()) {
|
||||
target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||
} else if (targetType == Enum.GameObjectType.Building.ordinal()) {
|
||||
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||
} else if (targetType == Enum.GameObjectType.Mob.ordinal()) {
|
||||
target = Mob.getFromCache(msg.getTargetID());
|
||||
} else {
|
||||
player.setCombatTarget(null);
|
||||
return; //not valid type to attack
|
||||
}
|
||||
|
||||
// quit of the combat target is already the current combat target
|
||||
// or there is no combat target
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//set sources target
|
||||
|
||||
player.setCombatTarget(target);
|
||||
|
||||
boolean hasMain = false;
|
||||
boolean hasOff = false;
|
||||
if(player.getCharItemManager() != null && player.getCharItemManager().getEquipped() != null){
|
||||
if(player.getCharItemManager().getEquipped(1) != null)
|
||||
hasMain = true;
|
||||
if(player.getCharItemManager().getEquipped(2) != null && !player.getCharItemManager().getEquipped(2).getItemBase().isShield())
|
||||
hasOff = true;
|
||||
}
|
||||
|
||||
if(hasMain){
|
||||
createTimer(player,true);
|
||||
}
|
||||
|
||||
if(hasOff){
|
||||
createTimer(player,false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public enum ConfigManager {
|
||||
MB_WORLD_MAINTENANCE,
|
||||
MB_WORLD_GREETING,
|
||||
MB_WORLD_KEYCLONE_MAX,
|
||||
MB_WORLD_TESTMODE,
|
||||
MB_USE_RUINS,
|
||||
|
||||
// Mobile AI modifiers
|
||||
@@ -97,7 +98,8 @@ public enum ConfigManager {
|
||||
MB_MAGICBOT_FORTOFIX,
|
||||
MB_MAGICBOT_RECRUIT,
|
||||
MB_MAGICBOT_MAGICBOX,
|
||||
MB_MAGICBOT_ADMINLOG;
|
||||
MB_MAGICBOT_ADMINLOG,
|
||||
MB_WORLD_BOXLIMIT;
|
||||
|
||||
// Map to hold our config pulled in from the environment
|
||||
// We also use the config to point to the current message pump
|
||||
|
||||
@@ -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,13 +79,13 @@ 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());
|
||||
DevCmdManager.registerDevCmd(new AddBuildingCmd());
|
||||
DevCmdManager.registerDevCmd(new AddNPCCmd());
|
||||
DevCmdManager.registerDevCmd(new AddMobCmd());
|
||||
DevCmdManager.registerDevCmd(new DungenonCmd());
|
||||
DevCmdManager.registerDevCmd(new RemoveObjectCmd());
|
||||
DevCmdManager.registerDevCmd(new RotateCmd());
|
||||
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
||||
@@ -105,6 +103,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 +120,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());
|
||||
@@ -180,19 +178,44 @@ public enum DevCmdManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!pcSender.getTimestamps().containsKey("DEVCOMMAND"))
|
||||
pcSender.getTimestamps().put("DEVCOMMAND",System.currentTimeMillis() - 1500L);
|
||||
else if(System.currentTimeMillis() - pcSender.getTimestamps().get("DEVCOMMAND") < 1000L)
|
||||
return false;
|
||||
|
||||
//kill any commands not available to everyone on production server
|
||||
//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) {
|
||||
boolean playerAllowed = false;
|
||||
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
||||
switch (adc.getMainCmdString()) {
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
case "gimme":
|
||||
case "goto":
|
||||
case "teleportmode":
|
||||
case "printbonuses":
|
||||
playerAllowed = true;
|
||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
switch (adc.getMainCmdString()) {
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
case "printbonuses":
|
||||
//case "gimme":
|
||||
playerAllowed = true;
|
||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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 +239,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
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,12 +67,13 @@ public enum MovementManager {
|
||||
return;
|
||||
|
||||
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));
|
||||
if (((PlayerCharacter) toMove).isCasting()) {
|
||||
((PlayerCharacter) toMove).updateLocation();
|
||||
((PlayerCharacter) toMove).updateMovementState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
toMove.setIsCasting(false);
|
||||
toMove.setItemCasting(false);
|
||||
|
||||
@@ -97,7 +98,7 @@ public enum MovementManager {
|
||||
if (!toMove.isMoving())
|
||||
toMove.resetLastSetLocUpdate();
|
||||
else
|
||||
toMove.update();
|
||||
toMove.update(false);
|
||||
|
||||
// Update movement for the player
|
||||
|
||||
@@ -352,7 +353,7 @@ public enum MovementManager {
|
||||
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
||||
|
||||
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
||||
ac.update();
|
||||
ac.update(false);
|
||||
ac.stopMovement(ac.getLoc());
|
||||
if (ac.isAlive())
|
||||
MovementManager.sendRWSSMsg(ac);
|
||||
@@ -409,7 +410,9 @@ public enum MovementManager {
|
||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||
continue;
|
||||
|
||||
member.update();
|
||||
//member.update(false);
|
||||
member.updateLocation();
|
||||
member.updateMovementState();
|
||||
|
||||
|
||||
// All checks passed, let's move the player
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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!
|
||||
@@ -102,13 +93,10 @@ public enum SimulationManager {
|
||||
}
|
||||
try {
|
||||
|
||||
if ((_updatePulseTime != 0)
|
||||
&& (System.currentTimeMillis() > _updatePulseTime))
|
||||
if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime))
|
||||
pulseUpdate();
|
||||
} catch (Exception e) {
|
||||
Logger.error(
|
||||
"Fatal error in Update Pulse: DISABLED");
|
||||
// _runegatePulseTime = 0;
|
||||
Logger.error("Fatal error in Update Pulse: DISABLED");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -122,9 +110,18 @@ public enum SimulationManager {
|
||||
}
|
||||
|
||||
try {
|
||||
if ((_cityPulseTime != 0)
|
||||
&& (System.currentTimeMillis() > _cityPulseTime))
|
||||
pulseCities();
|
||||
if ((_cityPulseTime != 0) && (System.currentTimeMillis() > _cityPulseTime)) {
|
||||
try {
|
||||
pulseCities();
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try {
|
||||
ArenaManager.pulseArenas();
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(
|
||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||
@@ -132,17 +129,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)
|
||||
@@ -170,7 +157,11 @@ public enum SimulationManager {
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
player.update();
|
||||
try {
|
||||
player.update(false);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_updatePulseTime = System.currentTimeMillis() + 500;
|
||||
@@ -219,7 +210,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 +225,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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,195 @@
|
||||
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:
|
||||
return getMultiplier3Man(count);
|
||||
case 5:
|
||||
return getMultiplier5Man(count);
|
||||
case 10:
|
||||
return getMultiplier10Man(count);
|
||||
case 20:
|
||||
return getMultiplier20Man(count);
|
||||
default:
|
||||
return getMultiplier40Man(count);
|
||||
case 3: return getMultiplier3Man(count);
|
||||
case 5: return getMultiplier5Man(count);
|
||||
case 10: return getMultiplier10Man(count);
|
||||
case 20: return getMultiplier20Man(count);
|
||||
case 30: return getMultiplier30Man(count);
|
||||
case 40: return getMultiplier40Man(count);
|
||||
default: return 1.0f; //unlimited
|
||||
}
|
||||
}
|
||||
public static float 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.63f;
|
||||
case 5: return 0.40f;
|
||||
case 6: return 0.25f;
|
||||
default: 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.57f;
|
||||
case 8: return 0.44f;
|
||||
case 9: return 0.33f;
|
||||
case 10: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
public static float getMultiplier10Man(int count) {
|
||||
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.86f;
|
||||
case 12: return 0.75f;
|
||||
case 13: return 0.65f;
|
||||
case 14: return 0.57f;
|
||||
case 15: return 0.50f;
|
||||
case 16: return 0.44f;
|
||||
case 17: return 0.38f;
|
||||
case 18: return 0.33f;
|
||||
case 19: return 0.29f;
|
||||
case 20: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
public static float getMultiplier20Man(int count) {
|
||||
return getMultiplier10Man(count * 2);
|
||||
}
|
||||
if(count < 21)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 40)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 21: return 0.93f;
|
||||
case 22: return 0.86f;
|
||||
case 23: return 0.80f;
|
||||
case 24: return 0.75f;
|
||||
case 25: return 0.70f;
|
||||
case 26: return 0.65f;
|
||||
case 27: return 0.61f;
|
||||
case 28: return 0.57f;
|
||||
case 29: return 0.53f;
|
||||
case 30: return 0.50f;
|
||||
case 31: return 0.47f;
|
||||
case 32: return 0.44f;
|
||||
case 33: return 0.41f;
|
||||
case 34: return 0.38f;
|
||||
case 35: return 0.36f;
|
||||
case 36: return 0.33f;
|
||||
case 37: return 0.31f;
|
||||
case 38: return 0.29f;
|
||||
case 39: return 0.27f;
|
||||
case 40: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
|
||||
public static float getMultiplier40Man(int count) {
|
||||
return getMultiplier10Man(count * 4);
|
||||
}
|
||||
}
|
||||
public static float getMultiplier30Man(int count) {
|
||||
if(count < 31)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 60)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 31: return 0.95f;
|
||||
case 32: return 0.91f;
|
||||
case 33: return 0.86f;
|
||||
case 34: return 0.82f;
|
||||
case 35: return 0.79f;
|
||||
case 36: return 0.75f;
|
||||
case 37: return 0.72f;
|
||||
case 38: return 0.68f;
|
||||
case 39: return 0.65f;
|
||||
case 40: return 0.63f;
|
||||
case 41: return 0.60f;
|
||||
case 42: return 0.57f;
|
||||
case 43: return 0.55f;
|
||||
case 44: return 0.52f;
|
||||
case 45: return 0.50f;
|
||||
case 46: return 0.48f;
|
||||
case 47: return 0.46f;
|
||||
case 48: return 0.44f;
|
||||
case 49: return 0.42f;
|
||||
case 50: return 0.40f;
|
||||
case 51: return 0.38f;
|
||||
case 52: return 0.37f;
|
||||
case 53: return 0.35f;
|
||||
case 54: return 0.33f;
|
||||
case 55: return 0.32f;
|
||||
case 56: return 0.30f;
|
||||
case 57: return 0.29f;
|
||||
case 58: return 0.28f;
|
||||
case 59: return 0.26f;
|
||||
case 60: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
public static float getMultiplier40Man(int count) {
|
||||
if(count < 41)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 80)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 41: return 0.96f;
|
||||
case 42: return 0.93f;
|
||||
case 43: return 0.90f;
|
||||
case 44: return 0.86f;
|
||||
case 45: return 0.83f;
|
||||
case 46: return 0.80f;
|
||||
case 47: return 0.78f;
|
||||
case 48: return 0.75f;
|
||||
case 49: return 0.72f;
|
||||
case 50: return 0.70f;
|
||||
case 51: return 0.68f;
|
||||
case 52: return 0.65f;
|
||||
case 53: return 0.63f;
|
||||
case 54: return 0.61f;
|
||||
case 55: return 0.59f;
|
||||
case 56: return 0.57f;
|
||||
case 57: return 0.55f;
|
||||
case 58: return 0.53f;
|
||||
case 59: return 0.52f;
|
||||
case 60: return 0.50f;
|
||||
case 61: return 0.48f;
|
||||
case 62: return 0.47f;
|
||||
case 63: return 0.45f;
|
||||
case 64: return 0.44f;
|
||||
case 65: return 0.42f;
|
||||
case 66: return 0.41f;
|
||||
case 67: return 0.40f;
|
||||
case 68: return 0.38f;
|
||||
case 69: return 0.37f;
|
||||
case 70: return 0.36f;
|
||||
case 71: return 0.35f;
|
||||
case 72: return 0.33f;
|
||||
case 73: return 0.32f;
|
||||
case 74: return 0.31f;
|
||||
case 75: return 0.30f;
|
||||
case 76: return 0.29f;
|
||||
case 77: return 0.28f;
|
||||
case 78: return 0.27f;
|
||||
case 79: return 0.26f;
|
||||
case 80: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class AbstractJob implements Runnable {
|
||||
this.markStopRunTime();
|
||||
}
|
||||
|
||||
protected abstract void doJob();
|
||||
public abstract void doJob();
|
||||
|
||||
public void executeJob(String threadName) {
|
||||
this.workerID.set(threadName);
|
||||
|
||||
@@ -17,7 +17,7 @@ public abstract class AbstractScheduleJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected abstract void doJob();
|
||||
public abstract void doJob();
|
||||
|
||||
public void cancelJob() {
|
||||
JobScheduler.getInstance().cancelScheduledJob(this);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class JobContainer implements Comparable<JobContainer> {
|
||||
final long timeOfExecution;
|
||||
final boolean noTimer;
|
||||
|
||||
JobContainer(AbstractJob job, long timeOfExecution) {
|
||||
public JobContainer(AbstractJob job, long timeOfExecution) {
|
||||
if (job == null) {
|
||||
throw new IllegalArgumentException("No 'null' jobs allowed.");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package engine.job;
|
||||
|
||||
import engine.server.world.WorldServer;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class JobThread implements Runnable {
|
||||
private final AbstractJob currentJob;
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
private static Long nextThreadPrint;
|
||||
|
||||
public JobThread(AbstractJob job){
|
||||
this.currentJob = job;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (this.currentJob != null) {
|
||||
if (lock.tryLock(5, TimeUnit.SECONDS)) { // Timeout to prevent deadlock
|
||||
try {
|
||||
this.currentJob.doJob();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
} else {
|
||||
Logger.warn("JobThread could not acquire lock in time, skipping job.");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void startJobThread(AbstractJob job){
|
||||
JobThread jobThread = new JobThread(job);
|
||||
Thread thread = new Thread(jobThread);
|
||||
thread.setName("JOB THREAD: " + job.getWorkerID());
|
||||
thread.start();
|
||||
|
||||
if(JobThread.nextThreadPrint == null){
|
||||
JobThread.nextThreadPrint = System.currentTimeMillis();
|
||||
}else{
|
||||
if(JobThread.nextThreadPrint < System.currentTimeMillis()){
|
||||
JobThread.tryPrintThreads();
|
||||
JobThread.nextThreadPrint = System.currentTimeMillis() + 10000L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tryPrintThreads(){
|
||||
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
|
||||
while (rootGroup.getParent() != null) {
|
||||
rootGroup = rootGroup.getParent();
|
||||
}
|
||||
|
||||
// Estimate the number of threads
|
||||
int activeThreads = rootGroup.activeCount();
|
||||
|
||||
// Create an array to hold the threads
|
||||
Thread[] threads = new Thread[activeThreads];
|
||||
|
||||
// Get the active threads
|
||||
rootGroup.enumerate(threads, true);
|
||||
|
||||
int availableThreads = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
// Print the count
|
||||
if(threads.length > 30)
|
||||
Logger.info("Total threads in application: " + threads.length + " / " + availableThreads);
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,13 @@ public class JobWorker extends ControlledRunnable {
|
||||
} else {
|
||||
|
||||
// execute the new job..
|
||||
this.currentJob.executeJob(this.getThreadName());
|
||||
this.currentJob = null;
|
||||
//this.currentJob.executeJob(this.getThreadName());
|
||||
if(this.currentJob != null) {
|
||||
JobThread.startJobThread(this.currentJob);
|
||||
this.currentJob = null;
|
||||
}
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected abstract void doJob();
|
||||
public abstract void doJob();
|
||||
|
||||
@Override
|
||||
protected abstract void _cancelJob();
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
public void endEffect() {
|
||||
if (this.eb == null)
|
||||
if (this.eb == null || this.power == null)
|
||||
return;
|
||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -33,7 +29,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
City city;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -29,11 +27,8 @@ public class AttackJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public 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() {
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BaneDefaultTimeJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
//bane already set.
|
||||
if (this.bane.getLiveDate() != null) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class BasicScheduledJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (execution == null) {
|
||||
Logger.error("BasicScheduledJob executed with nothing to execute.");
|
||||
return;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class BonusCalcJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.ac != null) {
|
||||
this.ac.applyBonuses();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CSessionCleanupJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
SessionManager.cSessionCleanup(secKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ChangeAltitudeJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.ac != null)
|
||||
MovementManager.finishChangeAltitude(ac, targetAlt);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ChantJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
PlayerBonuses bonuses = null;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CloseGateJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (building == null) {
|
||||
Logger.error("Rungate building was null");
|
||||
|
||||
@@ -37,7 +37,7 @@ public class DamageOverTimeJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.target.getObjectType().equals(GameObjectType.Building)
|
||||
&& ((Building) this.target).isVulnerable() == false) {
|
||||
_cancelJob();
|
||||
@@ -60,6 +60,8 @@ public class DamageOverTimeJob extends AbstractEffectJob {
|
||||
|
||||
if (this.iteration < 0) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
||||
eb.startEffect((AbstractCharacter) this.source, this.target, this.trains, this);
|
||||
return;
|
||||
}
|
||||
this.skipSendEffect = true;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DatabaseUpdateJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.ago == null)
|
||||
return;
|
||||
ago.removeDatabaseJob(this.type, false);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DebugTimerJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.pc == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class DeferredPowerJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
//Power ended with no attack, cancel weapon power boost
|
||||
if (this.source != null && this.source instanceof PlayerCharacter) {
|
||||
((PlayerCharacter) this.source).setWeaponPower(null);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DisconnectJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.origin != null) {
|
||||
this.origin.disconnect();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DoorCloseJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
int doorNumber;
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
//cancel fear for mob.
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class FinishCooldownTimeJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
PowersManager.finishCooldownTime(this.msg, this.pc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class FinishEffectTimeJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class FinishRecycleTimeJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
PowersManager.finishRecycleTime(this.msg, this.pc, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FinishSpireEffectJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.target == null)
|
||||
return;
|
||||
@@ -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!");
|
||||
|
||||
@@ -28,7 +28,7 @@ public class LoadEffectsJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.originToSend == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class LogoutCharacterJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
server.logoutCharacter(this.pc);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class NoTimeJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PersistentAoeJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.aej == null || this.source == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||
return;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RefreshGroupJob extends AbstractJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.pc == null || this.origin == null || grp == null) {
|
||||
return;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RemoveCorpseJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.corpse != null)
|
||||
Corpse.removeCorpse(corpse, true);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SiegeSpireWithdrawlJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (spire == null)
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class StuckJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
Vector3fImmutable stuckLoc;
|
||||
Building building = null;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SummonSendJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.source == null)
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TeleportJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.pc == null || this.npc == null || this.origin == null)
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TrackJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
|
||||
if (this.tpa == null || this.target == null || this.action == null || this.source == null || this.eb == null || !(this.source instanceof PlayerCharacter))
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TransferStatOTJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
public void doJob() {
|
||||
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null || this.action == null || this.power == null)
|
||||
return;
|
||||
if (!this.target.isAlive()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user