forked from MagicBane/Server
Compare commits
846 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7c3662463 | |||
| 909e04b8d1 | |||
| a7d1dc5fd0 | |||
| 2f87fd9812 | |||
| c696bd368e | |||
| 7716d82adb | |||
| 66804d5704 | |||
| 02aafc9274 | |||
| 2ef0d4305c | |||
| 972c99a146 | |||
| ad9d27c6ee | |||
| e1d11d5d94 | |||
| ca78a3b581 | |||
| bcaa5d42ff | |||
| 6dad14ae57 | |||
| 6e465248b1 | |||
| 7c106d5d34 | |||
| 8135ef8e9c | |||
| db2d6a4bf3 | |||
| bb0a3b8b5b | |||
| 0145a7264d | |||
| 6eec56adb4 | |||
| 01662aae07 | |||
| 72d73883a4 | |||
| 9c64dbb70c | |||
| 9408602c9c | |||
| 58cf778ce4 | |||
| 885b612bd6 | |||
| bf69045b0b | |||
| 8b03fbc15b | |||
| 3c23a070df | |||
| c14cc98ca2 | |||
| c326008112 | |||
| 90facabc7b | |||
| 6e26a8cfcf | |||
| 4b1ab35a36 | |||
| d733afef58 | |||
| f30a02a6d5 | |||
| b255b1c9f4 | |||
| 6151a9e650 | |||
| 0f7ef9f56b | |||
| 6d68d048b0 | |||
| 8ccdbf8cc9 | |||
| 1798a8f170 | |||
| 737da1bf14 | |||
| 45eb0776d6 | |||
| f4346b97f7 | |||
| cf6f684f5e | |||
| a8e3cfa8f7 | |||
| 0028b7be69 | |||
| 3f11996b40 | |||
| 779f5bbb5b | |||
| 37c89e6073 | |||
| 83499816eb | |||
| 0eb8da855d | |||
| 36fb3f12b1 | |||
| ba642e049e | |||
| 98835cad90 | |||
| 4d9600a8bf | |||
| 4089f72d8f | |||
| ead86efcf6 | |||
| ae01a421de | |||
| 469662f732 | |||
| 8b9bc474b4 | |||
| 3815f9df8e | |||
| 6313182c4f | |||
| 40bff54838 | |||
| 2b1299ec4a | |||
| 0955dff7aa | |||
| 2b18765781 | |||
| c55f67a977 | |||
| 730467828c | |||
| ad05f0d7bc | |||
| c922d9c532 | |||
| ed4d186b10 | |||
| de1bc375ca | |||
| 1c48b28d4e | |||
| 0318459ff1 | |||
| 4bdc207c37 | |||
| ba537d7b00 | |||
| a0164d5abb | |||
| eec5861944 | |||
| 094a7a9498 | |||
| d93892df6c | |||
| 81150642f0 | |||
| 7fb5ccf4f1 | |||
| ab1e69a6ef | |||
| 2d2832caf9 | |||
| 5dee08d3ce | |||
| 75b68c0a8c | |||
| a9f006936b | |||
| 917fddceeb | |||
| a2da8f3861 | |||
| b1b2912092 | |||
| 3bcda38bb7 | |||
| 918a797f34 | |||
| ba9238a49a | |||
| bd5061a7e8 | |||
| 270301c35b | |||
| ffcaf0e063 | |||
| 6e7633828f | |||
| 3aac2410b0 | |||
| c90378e3f0 | |||
| 4734f23805 | |||
| 47503de748 | |||
| 8ab2805e39 | |||
| 1d703b08a2 | |||
| a660457883 | |||
| 4ca81b019b | |||
| 5f16b40092 | |||
| 0d7beb5a5a | |||
| b66e1c1f93 | |||
| f1e8384af0 | |||
| c9dcb82c45 | |||
| c2c946165c | |||
| ffd65b3641 | |||
| ba2084ceb0 | |||
| 34ec123702 | |||
| 7c36325905 | |||
| 915f182d79 | |||
| fb1d6a3248 | |||
| 6d16eccc24 | |||
| fa5cdae17e | |||
| b46eb8639d | |||
| 58916c35c7 | |||
| f80d50f95e | |||
| 77f2e413c9 | |||
| 5e84ee8b11 | |||
| b6a9a0c813 | |||
| f7e6307d66 | |||
| 1359417b40 | |||
| 85077a5e56 | |||
| 366815f1f9 | |||
| 2ca51d6a83 | |||
| b7ebb728e2 | |||
| 023057668a | |||
| a11b590573 | |||
| 353d211a04 | |||
| c792e49fdc | |||
| f8e99a84b1 | |||
| b28c157a5c | |||
| 85717a1880 | |||
| 0ac7a1a7fa | |||
| 7745ef6949 | |||
| 40078df067 | |||
| bb28d38735 | |||
| 7bd6e3a149 | |||
| 72faafedfe | |||
| e560c07aba | |||
| 742232166e | |||
| 910a5d9e3c | |||
| a943a5a51d | |||
| e3a278e090 | |||
| 5959209081 | |||
| e222cb3543 | |||
| a4efe199c6 | |||
| fa5ac4fea3 | |||
| f28c887b92 | |||
| c1331efe38 | |||
| b113b55703 | |||
| 560466e3ef | |||
| 0457287905 | |||
| db7e9276b1 | |||
| a14057b9df | |||
| 0a3624e503 | |||
| 45048b2b4e | |||
| 27550293d6 | |||
| 422cf10eea | |||
| c412336257 | |||
| c8bea0d1ce | |||
| e66a8459c0 | |||
| 817067d242 | |||
| 942288cee2 | |||
| 8d633adbb3 | |||
| a821f7f7e4 | |||
| 0581cab5cb | |||
| 6ee1c02e08 | |||
| 8379b48332 | |||
| e2ae758e36 | |||
| 8f1855fb3f | |||
| e15164bcb2 | |||
| 836fa4f8dc | |||
| fe7f4dc3ca | |||
| 19402bf06f | |||
| bed49c0230 | |||
| 9c79dca2c5 | |||
| 3820d179c6 | |||
| 6e1db9489a | |||
| 8227db92c8 | |||
| 06309daae6 | |||
| 49e5be959f | |||
| 74a22d4cf5 | |||
| 3f827cebd8 | |||
| ae734cbb0a | |||
| bde3e54fd4 | |||
| fa5144c932 | |||
| de08d0d210 | |||
| 79a9bfd606 | |||
| 491519216c | |||
| 048c4dfb1b | |||
| d14144cdf3 | |||
| d610bccdee | |||
| 39f7be99b0 | |||
| 01aa226c62 | |||
| 87bd67b0f5 | |||
| 70edd4c19c | |||
| 6c86da0719 | |||
| 84cc435a2b | |||
| 5e61ef26e1 | |||
| 9e85c1e361 | |||
| 3d80a03e1e | |||
| 15136518a3 | |||
| b8abe94a8c | |||
| f2e4e8062e | |||
| feaa38ee98 | |||
| 6f453ab5c4 | |||
| af839c108c | |||
| 8bac27f0fc | |||
| bfb257c410 | |||
| 3be694275d | |||
| f885560e52 | |||
| a8a9cdb0f1 | |||
| 210cc94dac | |||
| bf503c0be0 | |||
| 24c16e6cf1 | |||
| a6fb7ec0a0 | |||
| cb9197013e | |||
| e1584161c9 | |||
| 0c85c1d289 | |||
| ead9683b98 | |||
| c29d6f548e | |||
| 5822cb1ab4 | |||
| 371d077320 | |||
| 984c4d205a | |||
| 8cc92e9792 | |||
| c1ea68aa41 | |||
| 324851a8ab | |||
| cd512100a2 | |||
| a0e78d8add | |||
| f02d79c65e | |||
| cfffb0c16a | |||
| 8804a3ecd4 | |||
| 16c84f2b30 | |||
| 5858aabc83 | |||
| 4b81a5c435 | |||
| c1107ae98d | |||
| c5f2464d55 | |||
| e0beab2dc5 | |||
| bcbeacd60e | |||
| e39c7bebb5 | |||
| 4e6e56350c | |||
| a33d650738 | |||
| 12b44e216c | |||
| a202a0544e | |||
| 8156f261fc | |||
| 283ae37919 | |||
| 3e30c7a01e | |||
| a5570e4bb5 | |||
| 290aec79ba | |||
| 1378bc8030 | |||
| bd536961e2 | |||
| 17aee68575 | |||
| a97f4e6da6 | |||
| 2274a9e16e | |||
| 1caa704b6a | |||
| 1bb4e17ead | |||
| d84b214fd3 | |||
| 4440ed1f0d | |||
| f0ad1b730c | |||
| d968c4eca4 | |||
| 38816f25bb | |||
| 58f5bf05e0 | |||
| 78d9e3d6fc | |||
| d1c07e88fc | |||
| dcd108e3ac | |||
| 2c2a2464ee | |||
| ee5c254de4 | |||
| efa4ce91fa | |||
| cd45f49b07 | |||
| 116c9bfdfb | |||
| 4ec7c3c4bd | |||
| 281dde533a | |||
| 55b6f95696 | |||
| e120ae6e18 | |||
| 9e44c9475a | |||
| 4d8cb339c3 | |||
| b1dfd9a40d | |||
| cff6714160 | |||
| 16a9d4e5c9 | |||
| 3189d64031 | |||
| 5cd94234e9 | |||
| b45b325cad | |||
| b731291e6c | |||
| c207bd14b6 | |||
| 4924133416 | |||
| 6769286c4a | |||
| d21bf0185b | |||
| 3312ea292f | |||
| c7604d0f2c | |||
| 1206441ab3 | |||
| 679346383a | |||
| e8df9ef0ea | |||
| 3d683fc9a3 | |||
| fbeda13a48 | |||
| d598887f61 | |||
| 40372e1b35 | |||
| 4476c3863d | |||
| 08f94226ba | |||
| 7eb9eca7d0 | |||
| c43c3de18a | |||
| 9e0fa541a2 | |||
| 58035d0f93 | |||
| 92460d455b | |||
| 3c5f510969 | |||
| e3c8be6102 | |||
| 5f0eb266c2 | |||
| c721d6d4a8 | |||
| d0b716eb41 | |||
| a4a375e13b | |||
| c56702bd75 | |||
| 5c023b4c4d | |||
| 4b67cbef38 | |||
| 6cf2705013 | |||
| 66bc73a2b6 | |||
| 77cfa02bea | |||
| 93773a7784 | |||
| 42dd2b4e68 | |||
| 2aed3ef922 | |||
| fb6a3706cd | |||
| 48e126823f | |||
| b3de192f0b | |||
| 58d5c1969c | |||
| 950108be87 | |||
| a9746b9a2b | |||
| eaa287e176 | |||
| 67cdf0e98a | |||
| 83e2b29635 | |||
| c99a361ca7 | |||
| f53c2c5cb0 | |||
| 6680651801 | |||
| 66fbbada48 | |||
| ba1cb22662 | |||
| bf9be1f7f9 | |||
| bb4c1d48a4 | |||
| b33f451285 | |||
| f865f94806 | |||
| baf28519c2 | |||
| 4a2ef92d33 | |||
| c16ea8f3dd | |||
| 882ed17b3a | |||
| d06c298b09 | |||
| e4bad5f418 | |||
| 54c0b3d7ce | |||
| 9d59bde22e | |||
| 47243dd48d | |||
| bb6828ec8e | |||
| 5d0973c2bc | |||
| 4f216364a9 | |||
| c1d193ee45 | |||
| 9879c1b18f | |||
| 928845a220 | |||
| 3378272a19 | |||
| e4c4643678 | |||
| 3c1a217ac6 | |||
| 1567b22fe4 | |||
| 2067bbc6e1 | |||
| 9790423139 | |||
| d8a8c1a9a0 | |||
| 60ab4a846e | |||
| 58f250fa64 | |||
| a160df02c4 | |||
| 1fa7cbed12 | |||
| d16a56a582 | |||
| 69aca2c728 | |||
| 159960d521 | |||
| b9871a2729 | |||
| 18f6822cb4 | |||
| 18731839f7 | |||
| 1d2e4d5608 | |||
| ef49d0cbe0 | |||
| 9604ee4399 | |||
| e708bb02f5 | |||
| 73c1f97051 | |||
| 7a445db673 | |||
| b3d65ef700 | |||
| 7a7559dee5 | |||
| a902ff720a | |||
| 98cb307e09 | |||
| 0dca6c4662 | |||
| c8310ec5ba | |||
| 961258f67a | |||
| 2854472ae0 | |||
| b81f088a3a | |||
| be4cbd3f6f | |||
| 7eb6deb1e9 | |||
| d04cad0484 | |||
| a8a21e9e40 | |||
| 0d5ff59cb7 | |||
| cdeebda6f8 | |||
| 3065f9f7eb | |||
| e2cca6201f | |||
| 1f7ea89d66 | |||
| ce3eacda48 | |||
| 8a3a4645af | |||
| f074fe1825 | |||
| e47430e61b | |||
| b2718779f8 | |||
| 189d0624e7 | |||
| a6cfe2fb76 | |||
| fa37e1bcca | |||
| 7497526bd9 | |||
| b9c38d9d2b | |||
| c8ec0fe191 | |||
| 1378ddcaef | |||
| 78f8331582 | |||
| c197a385c5 | |||
| 2c0899982c | |||
| 72bc753724 | |||
| c43f70128a | |||
| 95b23a35fc | |||
| 86d0254c2f | |||
| d09240d11a | |||
| 5da4b66f81 | |||
| 5247bf77fe | |||
| f8a584d000 | |||
| 7c2915928d | |||
| 8308ac97e3 | |||
| 75ea9092e2 | |||
| d60532c23f | |||
| d8f1cf2087 | |||
| 379dbe668c | |||
| 52a0c95002 | |||
| 360a393a0f | |||
| 345f4e799b | |||
| ef70d7b8ed | |||
| f98f54139a | |||
| 7e3e337de0 | |||
| 74f8f0640f | |||
| 13babb630d | |||
| cd87927241 | |||
| e3377d26b1 | |||
| e02dbd3632 | |||
| 0d7c2cd288 | |||
| 60ba6d5b28 | |||
| 52c3f563a2 | |||
| 5655aef57a | |||
| 487e557ef9 | |||
| f95dd7f6f2 | |||
| 4f56cacaea | |||
| 36f42770c8 | |||
| 1dfac59b8c | |||
| d22b10e9ef | |||
| 5cdab459bc | |||
| f62d44d631 | |||
| 5ee3438e42 | |||
| 6b07058dd4 | |||
| 1f700cda4c | |||
| c5f5c33329 | |||
| f3b00a6249 | |||
| 9da4b85dd1 | |||
| 76da1d0cbf | |||
| dc5b05e5b5 | |||
| 8414fb0039 | |||
| 8cdd4910ca | |||
| ed7e7be3e8 | |||
| 642103b5a2 | |||
| 1f95abf0b2 | |||
| 434e64d7ba | |||
| 665bc25126 | |||
| 8b01f80231 | |||
| 7fee52c861 | |||
| f8cf531136 | |||
| 936f151a72 | |||
| 4707bb11f0 | |||
| 4de40d054b | |||
| af3eb1d85f | |||
| 2990396778 | |||
| 7f8652b477 | |||
| afae0e63ba | |||
| 850d2dfea0 | |||
| dcc92fd89d | |||
| 1346f490c9 | |||
| 0c1b3d1460 | |||
| d96f10b41e | |||
| 595d0ba9ba | |||
| 505f8fdd90 | |||
| bd098fcb24 | |||
| dae20d5591 | |||
| d33de60869 | |||
| 38c9612eb6 | |||
| 4035f45c4f | |||
| 39b235963a | |||
| b142cded72 | |||
| 0e7281fe6a | |||
| fe39454113 | |||
| 74cf9d16c5 | |||
| 4b2563e4a1 | |||
| 1e19e10755 | |||
| 0c3e072e0e | |||
| aa10a4c9ac | |||
| 75947db6e5 | |||
| 9d28601761 | |||
| e8ca4863d5 | |||
| a8bfcd08cc | |||
| 8ae4ded83b | |||
| 5023d6bb73 | |||
| ca47022d88 | |||
| c304a59d95 | |||
| 7dfc1dea0f | |||
| 77fda6a18c | |||
| b343f4d6d7 | |||
| 77e9a4d9bf | |||
| 512aba5cd9 | |||
| 2d93e408c3 | |||
| edd7be8734 | |||
| 8c6637663d | |||
| 4cb0f28e57 | |||
| 4d21fc0353 | |||
| 4d28cd2b25 | |||
| 1be6884ab0 | |||
| 74eff825b0 | |||
| 1ae1deabdc | |||
| 54b7bcf907 | |||
| a8c768931e | |||
| 71687e39c8 | |||
| 678e45ce6b | |||
| 5bfeafe8bf | |||
| a492e833e8 | |||
| 92436be3f9 | |||
| 8890e02981 | |||
| 6fe8b80c87 | |||
| c2e0979dc3 | |||
| 6023022077 | |||
| 9a570de54c | |||
| d58d8ee67c | |||
| 132addc0a9 | |||
| 8bfba1b3a5 | |||
| 0d45bb5bc1 | |||
| 6ea4717263 | |||
| 7153216f09 | |||
| 114ccfee9d | |||
| 23e0a0dcc7 | |||
| b2a3eb3e6e | |||
| 13a4ba6e0e | |||
| eaa8828a24 | |||
| 6bbe9317ac | |||
| 0c56631b92 | |||
| a81810d751 | |||
| 9c75e7defe | |||
| 6aba5be67a | |||
| 9c867ee281 | |||
| afc91e22e5 | |||
| 6dac5c7ec8 | |||
| c6c4a128a2 | |||
| 28fa81962d | |||
| 0759c56b14 | |||
| 64e6e035c1 | |||
| 31bf62a678 | |||
| a924e4c876 | |||
| 38e6bdf92d | |||
| 69dd7bcc37 | |||
| f26e8e4559 | |||
| 16e8df3daf | |||
| c98c64262b | |||
| a6cf68ef07 | |||
| 3b179a5703 | |||
| 0638028a59 | |||
| 912ebd4742 | |||
| c1440f8f9e | |||
| 8d32927241 | |||
| d058e7506a | |||
| dd548acfe1 | |||
| acc0c1dc46 | |||
| d0c74e0641 | |||
| 095a26e1d9 | |||
| 1cb0848690 | |||
| 60a7b395e5 | |||
| 09e57852f4 | |||
| c2fe156680 | |||
| b9545dbf76 | |||
| 8ce7c09000 | |||
| 9107540212 | |||
| 24bc0097be | |||
| 7175f79bfe | |||
| 230a7460cd | |||
| e172d3f2d0 | |||
| 2e78f44640 | |||
| 5c46af3c52 | |||
| b9ec8fd540 | |||
| d3bf19426c | |||
| 734b46d816 | |||
| 11310a5b64 | |||
| 067f8f8d89 | |||
| afa9ddf89e | |||
| a6cee850a6 | |||
| 5f5616fd2d | |||
| dcd37bce13 | |||
| d438440556 | |||
| 9f58e211a8 | |||
| f52e67e80c | |||
| c520263179 | |||
| c9f246afec | |||
| cdf7fcc54d | |||
| 3553291d1d | |||
| 67ce60124f | |||
| 0e6ee13926 | |||
| 5b0ba790b3 | |||
| b53f2c2824 | |||
| b9a87ba407 | |||
| e3ed34a04b | |||
| 6915e30eb2 | |||
| e9c7cc8e04 | |||
| 90feaea89e | |||
| 174bceb49e | |||
| e3ec8d7737 | |||
| c44a7eafab | |||
| 879b52c7c7 | |||
| 1fe3f7dfb1 | |||
| 2c8517a1e4 | |||
| 4eff71f288 | |||
| 349b88f142 | |||
| 6b8d1e6f71 | |||
| 79022f0e3e | |||
| 523eb8529f | |||
| 5684fb6ce1 | |||
| feb23e63fe | |||
| ab5943e4b2 | |||
| 02d22f0881 | |||
| 9b555c0259 | |||
| 6a4e0e32cc | |||
| 5713dab8cf | |||
| 71b7fd5c1b | |||
| 39e6917ae8 | |||
| 86c33c195c | |||
| ad6fca61ed | |||
| f2b91f875f | |||
| ab2b7092fd | |||
| d39137d900 | |||
| d906d49e51 | |||
| 54c48d398b | |||
| 98fe77b148 | |||
| 9ee3b9d7bb | |||
| d6dd61e9c5 | |||
| d92e5d4a45 | |||
| d065e9ffc8 | |||
| 2b63ed08b8 | |||
| 50fb0d39c5 | |||
| bb91502cb4 | |||
| 8f6e13102d | |||
| 0679ffcaec | |||
| 9ab286166e | |||
| 0d4e8f3c9a | |||
| 02a78d538c | |||
| 9e74954422 | |||
| a267382481 | |||
| 0910b7184c | |||
| 297fe8c7a2 | |||
| 76405cb968 | |||
| a38e5b478a | |||
| 4540e5c770 | |||
| aef12b2bb4 | |||
| a562af57e9 | |||
| 03470c699d | |||
| f777f480ad | |||
| ce542ce319 | |||
| 7ff879ea64 | |||
| e4274994ff | |||
| 547d222a2d | |||
| 5159afc704 | |||
| 3a771ac585 | |||
| 97fcbd8608 | |||
| 39aec46220 | |||
| 1db30e3c6b | |||
| 34cb943595 | |||
| bef49fc720 | |||
| 2bbdeb89ff | |||
| 2f4287783e | |||
| 802d46d66e | |||
| de3f1cf004 | |||
| 90e85d3e46 | |||
| 2e104741ba | |||
| 6461efa1a2 | |||
| 320ea7e81c | |||
| 05eb8cd961 | |||
| 9909216e27 | |||
| 33a369821a | |||
| 6e93e40454 | |||
| c14fd84d96 | |||
| 56c16fc06e | |||
| 71274d25d0 | |||
| 9d75116790 | |||
| 629fce8cff | |||
| 7fefd53be2 | |||
| 8aab20caf4 | |||
| 14ad0b7599 | |||
| 267549ce15 | |||
| 6e14f723da | |||
| 46a9dad407 | |||
| e89e2f51b7 | |||
| 40290bdf97 | |||
| a37e30c550 | |||
| 0440aabd1e | |||
| fbc408f617 | |||
| 0f7410f55f | |||
| f82a19f243 | |||
| c9428d2b56 | |||
| c4bd766156 | |||
| 44cd8d0013 | |||
| 84a75f6b83 | |||
| be902cf09c | |||
| 0289b5087d | |||
| b5f36b60f7 | |||
| 43409d2e4b | |||
| 547de5033b | |||
| 2c7baaf2ac | |||
| 351437b46b | |||
| 1e9f1685da | |||
| d9a03ebf93 | |||
| 666e3d5479 | |||
| 7efd276d52 | |||
| 46826163be | |||
| e70b52d88c | |||
| 106dd87216 | |||
| c964115c1e | |||
| 8c022596a7 | |||
| 2de240dd60 | |||
| 8e8876587c | |||
| 8f0e19a10c | |||
| 2222a335a1 | |||
| a7bc1d5a6a | |||
| 0e61f0e7b8 | |||
| 0d256c17b5 | |||
| 571ad4b466 | |||
| 9e7a8bef4a | |||
| 669db7f021 | |||
| 13513bcf2a | |||
| 149630ef5a | |||
| 257d864132 | |||
| 6247332f83 | |||
| e5d606fe8a | |||
| dc1720b38b | |||
| 7b5de5f3f5 | |||
| 7de9bdbbe4 | |||
| 88123ad99a | |||
| 0437f10bf9 | |||
| e93f09c184 | |||
| ee60f88e62 | |||
| 2d4d0f79f8 | |||
| 664eb04658 | |||
| 1fc9e6251e | |||
| 7eba9501a6 | |||
| 0eb67c83a3 | |||
| 6668c01185 | |||
| 76b89d898a | |||
| 6a28574471 | |||
| 11faa98503 | |||
| a32ba5e262 | |||
| 558b645274 | |||
| a1115e728c | |||
| 409f8aa847 | |||
| 78cf95d290 | |||
| 2c78e0728a | |||
| 31e56b4da6 | |||
| ba3fd7215b | |||
| c08a93e85d | |||
| b63a5fa1c1 | |||
| c7494e8a9d | |||
| f69fde8a3a | |||
| 05dace9194 | |||
| ae975b7591 | |||
| 02f376f418 | |||
| 3c2d3782c2 | |||
| daaa1d9ece | |||
| 747056bc8c | |||
| b6760d0775 | |||
| ba4ab458a0 | |||
| c04fd62e71 | |||
| 97c063661a | |||
| 62205150a7 | |||
| 9f5bdce571 | |||
| 22a0cb2474 | |||
| 96c1e34a08 | |||
| 3dc7f7c9ed | |||
| cd1b15834a | |||
| 8a0303e0f5 | |||
| aa0e993038 | |||
| 3ef3a0c37c | |||
| a6a2629fd5 | |||
| e414304e94 | |||
| f5b08c1868 | |||
| 0bdcfe7b51 | |||
| c640caeb54 | |||
| 3d33a16d06 | |||
| f4778d4f48 | |||
| c8246ff317 | |||
| 7a3a9c6254 | |||
| 545796e297 | |||
| 6b4eff4d4c | |||
| 457ed4f4e6 | |||
| 8f2847a527 | |||
| 7f5df22a14 | |||
| 4fd737e3ec | |||
| e891d353ba | |||
| c5376d24a5 | |||
| 85bf30cbdd | |||
| 775410b00a | |||
| a8275c7cc7 | |||
| 03025e7f00 | |||
| 1b7be0365a | |||
| de772237c9 | |||
| e60c635c39 | |||
| 6db9f115b1 | |||
| 3f303e1c9e | |||
| c0ec747e43 | |||
| b583034b4e | |||
| 3360a034b2 | |||
| 668df83e33 | |||
| fa3234d0f5 | |||
| e8973ecb6d | |||
| 134aecf4d7 | |||
| 08cb49f641 | |||
| 2a06015a0e | |||
| 4559519512 | |||
| 42b2f886d5 | |||
| 0ce7f64d94 | |||
| 5fbd5ebb5c | |||
| 8fed2d3506 | |||
| e119f62049 | |||
| 228b0c74a9 | |||
| c73688de4d | |||
| 71288d0203 | |||
| db229dcf74 | |||
| 2e4bf0823c | |||
| d70f9f6dc3 | |||
| a9ecf76585 | |||
| ea3c571485 | |||
| 5840de216d | |||
| c7d26f9dcc | |||
| 5287b993fa | |||
| 33bd1a0906 | |||
| 5cd86bc033 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
+40
-10
@@ -139,8 +139,8 @@ public class Enum {
|
|||||||
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
||||||
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
|
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
|
||||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
|
||||||
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
||||||
@@ -152,7 +152,9 @@ public class Enum {
|
|||||||
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||||
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
|
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
|
||||||
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 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);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
||||||
@@ -208,6 +210,7 @@ public class Enum {
|
|||||||
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
||||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
|
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);
|
||||||
|
|
||||||
private float walkStandard;
|
private float walkStandard;
|
||||||
@@ -960,7 +963,17 @@ public class Enum {
|
|||||||
SourceType returnMod;
|
SourceType returnMod;
|
||||||
if (modName.isEmpty())
|
if (modName.isEmpty())
|
||||||
return SourceType.None;
|
return SourceType.None;
|
||||||
|
switch(modName) {
|
||||||
|
case "Piercing":
|
||||||
|
modName = "Pierce";
|
||||||
|
break;
|
||||||
|
case "Crushing":
|
||||||
|
modName = "Crush";
|
||||||
|
break;
|
||||||
|
case "Slashing":
|
||||||
|
modName = "Slash";
|
||||||
|
break;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
returnMod = SourceType.valueOf(modName.replace(",", ""));
|
returnMod = SourceType.valueOf(modName.replace(",", ""));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1652,6 +1665,24 @@ public class Enum {
|
|||||||
return extents;
|
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 {
|
public enum UpdateType {
|
||||||
@@ -2307,8 +2338,8 @@ public class Enum {
|
|||||||
public enum CityBoundsType {
|
public enum CityBoundsType {
|
||||||
|
|
||||||
GRID(640),
|
GRID(640),
|
||||||
ZONE(875),
|
ZONE(680),
|
||||||
PLACEMENT(876);
|
PLACEMENT(681);
|
||||||
|
|
||||||
public final float extents;
|
public final float extents;
|
||||||
|
|
||||||
@@ -2877,11 +2908,10 @@ public class Enum {
|
|||||||
|
|
||||||
public enum AIAgentType {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
GUARDCAPTAIN,
|
|
||||||
GUARDMINION,
|
|
||||||
GUARDWALLARCHER,
|
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
SIEGEENGINE;
|
|
||||||
|
SIEGEENGINE,
|
||||||
|
GUARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
import engine.util.MapLoader;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -30,7 +32,6 @@ public class HeightMap {
|
|||||||
|
|
||||||
// Class variables
|
// Class variables
|
||||||
|
|
||||||
public static float SCALEVALUE = 1.0f / 256;
|
|
||||||
// Heightmap data for all zones.
|
// Heightmap data for all zones.
|
||||||
|
|
||||||
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
||||||
@@ -44,17 +45,17 @@ public class HeightMap {
|
|||||||
|
|
||||||
public BufferedImage heightmapImage;
|
public BufferedImage heightmapImage;
|
||||||
|
|
||||||
private final int heightMapID;
|
private int heightMapID;
|
||||||
private final int maxHeight;
|
private int maxHeight;
|
||||||
private final int fullExtentsX;
|
private int fullExtentsX;
|
||||||
private final int fullExtentsY;
|
private int fullExtentsY;
|
||||||
|
|
||||||
private float bucketWidthX;
|
private float bucketWidthX;
|
||||||
private float bucketWidthY;
|
private float bucketWidthY;
|
||||||
private final int zoneLoadID;
|
private int zoneLoadID;
|
||||||
private float seaLevel = 0;
|
private float seaLevel = 0;
|
||||||
private final float outsetX;
|
private float outsetX;
|
||||||
private final float outsetZ;
|
private float outsetZ;
|
||||||
private int[][] pixelColorValues;
|
private int[][] pixelColorValues;
|
||||||
|
|
||||||
public HeightMap(ResultSet rs) throws SQLException {
|
public HeightMap(ResultSet rs) throws SQLException {
|
||||||
@@ -87,12 +88,12 @@ public class HeightMap {
|
|||||||
try {
|
try {
|
||||||
this.heightmapImage = ImageIO.read(imageFile);
|
this.heightmapImage = ImageIO.read(imageFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e);
|
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
// this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ public class HeightMap {
|
|||||||
|
|
||||||
// Generate pixel array from image data
|
// Generate pixel array from image data
|
||||||
|
|
||||||
generatePixelData(this);
|
generatePixelData();
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
|
|
||||||
@@ -122,26 +123,35 @@ public class HeightMap {
|
|||||||
this.outsetX = 128;
|
this.outsetX = 128;
|
||||||
this.outsetZ = 128;
|
this.outsetZ = 128;
|
||||||
|
|
||||||
|
|
||||||
// Cache the full extents to avoid the calculation
|
// Cache the full extents to avoid the calculation
|
||||||
|
|
||||||
this.fullExtentsX = halfExtentsX * 2;
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// load the heightmap image.
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
this.heightmapImage = null;
|
this.heightmapImage = null;
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
this.bucketWidthX = halfExtentsX;
|
this.bucketWidthX = 1;
|
||||||
this.bucketWidthY = halfExtentsY;
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX][this.fullExtentsY];
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
for (int y = 0; y < this.fullExtentsY; y++) {
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
for (int x = 0; x < this.fullExtentsX; x++) {
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
pixelColorValues[x][y] = 255;
|
pixelColorValues[x][y] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeightMap(Zone zone) {
|
public HeightMap(Zone zone) {
|
||||||
@@ -160,21 +170,26 @@ public class HeightMap {
|
|||||||
this.fullExtentsX = halfExtentsX * 2;
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
this.heightmapImage = null;
|
this.heightmapImage = null;
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
this.bucketWidthX = halfExtentsX;
|
this.bucketWidthX = 1;
|
||||||
this.bucketWidthY = halfExtentsY;
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX][this.fullExtentsY];
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
for (int y = 0; y < this.fullExtentsY; y++) {
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
for (int x = 0; x < this.fullExtentsX; x++) {
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
pixelColorValues[x][y] = 0;
|
pixelColorValues[x][y] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GeneratePlayerCityHeightMap() {
|
public static void GeneratePlayerCityHeightMap() {
|
||||||
@@ -207,33 +222,31 @@ public class HeightMap {
|
|||||||
return nextZone;
|
return nextZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getWorldHeight(Zone currentZone, Vector3fImmutable worldLoc) {
|
public static float getWorldHeight(AbstractWorldObject worldObject) {
|
||||||
|
|
||||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(worldObject.getLoc());
|
||||||
|
|
||||||
if (currentZone == null)
|
if (currentZone == null)
|
||||||
return 0;
|
return worldObject.getAltitude();
|
||||||
|
|
||||||
currentZone = getNextZoneWithTerrain(currentZone);
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
if (currentZone == ZoneManager.getSeaFloor())
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
return currentZone.getAbsY();
|
return currentZone.getAbsY() + worldObject.getAltitude();
|
||||||
|
|
||||||
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
HeightMap heightMap = currentZone.getHeightMap();
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), currentZone);
|
||||||
return currentZone.getAbsY();
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldObject.getLoc(), currentZone);
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
|
||||||
|
|
||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
parentLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), parentZone);
|
||||||
|
|
||||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
float worldAltitude = currentZone.worldAltitude;
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
float realWorldAltitude = interaltitude + worldAltitude;
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
@@ -250,6 +263,18 @@ public class HeightMap {
|
|||||||
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX <= 0.40000001)
|
||||||
|
bucketScaleX = heightMap.outsetZ / parentXRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX > 0.40000001)
|
||||||
|
bucketScaleX = 0.40000001f;
|
||||||
|
|
||||||
|
if (bucketScaleZ <= 0.40000001)
|
||||||
|
bucketScaleZ = heightMap.outsetX / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleZ > 0.40000001)
|
||||||
|
bucketScaleZ = 0.40000001f;
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
float weight;
|
float weight;
|
||||||
@@ -273,7 +298,7 @@ public class HeightMap {
|
|||||||
float secondScale = parentCenterAltitude * scaleChild;
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
float outsetALt = firstScale + secondScale;
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().worldAltitude;
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
realWorldAltitude = outsetALt;
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
@@ -292,7 +317,7 @@ public class HeightMap {
|
|||||||
float secondScale = parentCenterAltitude * scaleChild;
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
float outsetALt = firstScale + secondScale;
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().worldAltitude;
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
realWorldAltitude = outsetALt;
|
realWorldAltitude = outsetALt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,11 +327,181 @@ public class HeightMap {
|
|||||||
|
|
||||||
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
||||||
|
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|
||||||
if (currentZone == null)
|
if (currentZone == null)
|
||||||
return 0;
|
return 0;
|
||||||
return getWorldHeight(currentZone, worldLoc);
|
|
||||||
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
|
||||||
|
if (parentZone != null) {
|
||||||
|
|
||||||
|
// if (currentZone.getHeightMap() != null && parentZone.getHeightMap() != null && parentZone.getParent() != null && parentZone.getParent().getHeightMap() != null)
|
||||||
|
// return realWorldAltitude;
|
||||||
|
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return realWorldAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
||||||
|
|
||||||
|
Vector2f parentLoc;
|
||||||
|
float outsetALt = 0;
|
||||||
|
|
||||||
|
if (zone.getParent() == null || zone.getParent().getHeightMap() == null)
|
||||||
|
return interpolatedAltitude + zone.getWorldAltitude();
|
||||||
|
|
||||||
|
if (zone.getParent() != null && zone.getParent().getHeightMap() != null) {
|
||||||
|
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent());
|
||||||
|
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone);
|
||||||
|
|
||||||
|
float parentXRadius = zone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = zone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
|
||||||
|
float weight;
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent()));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return outsetALt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||||
|
|
||||||
|
int floorX = (int) gridSquare.x;
|
||||||
|
int floorY = (int) gridSquare.y;
|
||||||
|
|
||||||
|
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +515,7 @@ public class HeightMap {
|
|||||||
|
|
||||||
HeightMap.GeneratePlayerCityHeightMap();
|
HeightMap.GeneratePlayerCityHeightMap();
|
||||||
|
|
||||||
|
|
||||||
// Clear all heightmap image data as it's no longer needed.
|
// Clear all heightmap image data as it's no longer needed.
|
||||||
|
|
||||||
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
||||||
@@ -334,25 +530,10 @@ public class HeightMap {
|
|||||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||||
|
|
||||||
return localAltitude < zone.getSeaLevel();
|
if (localAltitude < zone.getSeaLevel())
|
||||||
}
|
return true;
|
||||||
|
|
||||||
private static void generatePixelData(HeightMap heightMap) {
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
// Generate altitude lookup table for this heightmap
|
|
||||||
|
|
||||||
heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()];
|
|
||||||
|
|
||||||
for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
|
|
||||||
for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
|
|
||||||
|
|
||||||
color = new Color(heightMap.heightmapImage.getRGB(x, y));
|
|
||||||
heightMap.pixelColorValues[x][y] = color.getRed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||||
@@ -360,18 +541,14 @@ public class HeightMap {
|
|||||||
if (zoneLoc.x < 0)
|
if (zoneLoc.x < 0)
|
||||||
zoneLoc.setX(0);
|
zoneLoc.setX(0);
|
||||||
|
|
||||||
if (zoneLoc.x >= this.fullExtentsX)
|
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||||
zoneLoc.setX(this.fullExtentsX);
|
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||||
|
|
||||||
if (zoneLoc.y < 0)
|
if (zoneLoc.y < 0)
|
||||||
zoneLoc.setY(0);
|
zoneLoc.setY(0);
|
||||||
|
|
||||||
if (zoneLoc.y > this.fullExtentsY)
|
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||||
zoneLoc.setY(this.fullExtentsY);
|
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||||
|
|
||||||
// Flip Y coordinates
|
|
||||||
|
|
||||||
zoneLoc.setY(this.fullExtentsY - zoneLoc.y);
|
|
||||||
|
|
||||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||||
@@ -392,10 +569,13 @@ public class HeightMap {
|
|||||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
int gridX = (int) gridSquare.x;
|
||||||
int gridY = (int) gridSquare.y;
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
if (gridX > maxX)
|
if (gridX > maxX)
|
||||||
gridX = maxX;
|
gridX = maxX;
|
||||||
@@ -433,11 +613,76 @@ public class HeightMap {
|
|||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight * SCALEVALUE; // Scale height
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
return interpolatedHeight;
|
return interpolatedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||||
|
|
||||||
|
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||||
|
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||||
|
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generatePixelData() {
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
// Generate altitude lookup table for this heightmap
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
||||||
|
|
||||||
|
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
||||||
|
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
||||||
|
|
||||||
|
color = new Color(this.heightmapImage.getRGB(x, y));
|
||||||
|
pixelColorValues[x][y] = color.getRed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScaledHeightForColor(float color) {
|
||||||
|
|
||||||
|
return (color / 256) * this.maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public float getBucketWidthX() {
|
public float getBucketWidthX() {
|
||||||
return bucketWidthX;
|
return bucketWidthX;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import engine.net.client.msg.MoveToPointMsg;
|
|||||||
import engine.net.client.msg.UnloadObjectsMsg;
|
import engine.net.client.msg.UnloadObjectsMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import engine.util.BoxTracker;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -109,7 +110,7 @@ public enum InterestManager implements Runnable {
|
|||||||
origin.sendMsg(moveMsg);
|
origin.sendMsg(moveMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reloadCharacter(AbstractCharacter absChar) {
|
public static void reloadCharacter(AbstractCharacter absChar, boolean sendToSelf) {
|
||||||
|
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
uom.addObject(absChar);
|
uom.addObject(absChar);
|
||||||
@@ -140,7 +141,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
if (!cc.sendMsg(uom)) {
|
||||||
@@ -210,7 +211,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (origin == null)
|
if (origin == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!playerCharacter.isEnteredWorld())
|
if (!playerCharacter.enteredWorld)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||||
@@ -340,7 +341,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (loadedPlayer.safemodeInvis())
|
if (loadedPlayer.safemodeInvis())
|
||||||
@@ -372,7 +373,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
else if (loadedPlayer.safemodeInvis())
|
else if (loadedPlayer.safemodeInvis())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
@@ -437,7 +438,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// dont load if invis
|
// dont load if invis
|
||||||
|
|
||||||
if (player.getSeeInvis() < awopc.hidden)
|
if (player.getSeeInvis() < awopc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -524,6 +525,7 @@ public enum InterestManager implements Runnable {
|
|||||||
player.setDirtyLoad(true);
|
player.setDirtyLoad(true);
|
||||||
updateStaticList(player, origin);
|
updateStaticList(player, origin);
|
||||||
updateMobileList(player, origin);
|
updateMobileList(player, origin);
|
||||||
|
BoxTracker.addPlayer(origin.machineID,player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ public class dbBlueprintHandler extends dbHandlerBase {
|
|||||||
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(3), thisBlueprint);
|
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(3), thisBlueprint);
|
||||||
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(7), 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) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterSkill;
|
import engine.objects.CharacterSkill;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.SkillsBase;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public abstract class dbHandlerBase {
|
|||||||
} else {
|
} else {
|
||||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||||
DbManager.addToCache(toAdd);
|
DbManager.addToCache(toAdd);
|
||||||
|
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
objectList.add((T) toAdd);
|
objectList.add((T) toAdd);
|
||||||
|
|
||||||
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
||||||
|
|||||||
@@ -28,10 +28,67 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
|
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();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, itemBase.getUUID());
|
preparedStatement.setInt(1, itemBaseID);
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
@@ -87,12 +144,19 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
recordsRead++;
|
recordsRead++;
|
||||||
itemBase = new ItemBase(rs);
|
itemBase = new ItemBase(rs);
|
||||||
ItemBase.addToCache(itemBase);
|
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) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
|
try {
|
||||||
worked = rs.getBoolean("result");
|
worked = rs.getBoolean("result");
|
||||||
|
}catch(Exception e){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -350,7 +354,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
|
try {
|
||||||
worked = rs.getBoolean("result");
|
worked = rs.getBoolean("result");
|
||||||
|
} catch(Exception e){
|
||||||
|
worked = true;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -496,4 +504,18 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
||||||
|
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
||||||
|
return false;
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
||||||
|
preparedStatement.setInt(1, newValue);
|
||||||
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,14 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.MineProduction;
|
import engine.objects.MineProduction;
|
||||||
import engine.objects.Resource;
|
import engine.objects.Resource;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -32,8 +34,24 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
|
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)
|
if (mine != null)
|
||||||
return mine;
|
return mine;
|
||||||
@@ -56,13 +74,27 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ArrayList<Mine> mines = new ArrayList<>();
|
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();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
mines = getObjectsFromRs(rs, 1000);
|
while(rs.next()){
|
||||||
|
if(BuildingManager.getBuildingFromCache(rs.getInt("mine_buildingUID")) == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
} catch (SQLException e) {
|
mines.add(new Mine(rs));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException | UnknownHostException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
return mines;
|
return mines;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class dbMobBaseHandler extends dbHandlerBase {
|
public class dbMobBaseHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -112,6 +113,25 @@ public class dbMobBaseHandler extends dbHandlerBase {
|
|||||||
return mobBaseStats;
|
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) {
|
public void LOAD_ALL_MOBBASE_SPEEDS(MobBase mobBase) {
|
||||||
|
|
||||||
if (mobBase.getLoadID() == 0)
|
if (mobBase.getLoadID() == 0)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
Mob mobile = null;
|
Mob mobile = null;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||||
preparedStatement.setInt(2, toAdd.loadID);
|
preparedStatement.setInt(2, toAdd.loadID);
|
||||||
@@ -48,7 +48,6 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||||
preparedStatement.setInt(12, toAdd.level);
|
preparedStatement.setInt(12, toAdd.level);
|
||||||
preparedStatement.setString(13, toAdd.firstName);
|
preparedStatement.setString(13, toAdd.firstName);
|
||||||
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String minionName = rs.getString("minionName");
|
String minionName = rs.getString("name");
|
||||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
@@ -127,13 +126,15 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setString(3, name);
|
||||||
|
preparedStatement.setInt(4, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -143,13 +144,14 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setInt(3, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -159,20 +161,6 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_ALL_MINIONS(final long captainUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,15 @@ import engine.gameManager.PowersManager;
|
|||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PreparedStatementShared;
|
import engine.objects.PreparedStatementShared;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
import engine.powers.MobPowerEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class dbPowerHandler extends dbHandlerBase {
|
public class dbPowerHandler extends dbHandlerBase {
|
||||||
@@ -80,4 +86,43 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
|
||||||
|
MobPowerEntry mobPowerEntry;
|
||||||
|
|
||||||
|
int mobbaseID;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
mobbaseID = rs.getInt("mobbaseUUID");
|
||||||
|
mobPowerEntry = new MobPowerEntry(rs);
|
||||||
|
|
||||||
|
if (mobPowers.get(mobbaseID) == null) {
|
||||||
|
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
} else {
|
||||||
|
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,25 @@ public class dbResistHandler extends dbHandlerBase {
|
|||||||
public dbResistHandler() {
|
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) {
|
public Resists GET_RESISTS_FOR_MOB(int resistID) {
|
||||||
|
|
||||||
Resists resists = null;
|
Resists resists = null;
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
import engine.powers.RunePowerEntry;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -29,84 +27,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
|
|
||||||
RunePowerEntry runePowerEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runePowerEntry = new RunePowerEntry(rs);
|
|
||||||
|
|
||||||
if (mobPowers.get(rune_id) == null) {
|
|
||||||
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
|
|
||||||
runePowerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, runePowerList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
|
|
||||||
powerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
|
|
||||||
RuneSkillAdjustEntry runeSkillAdjustEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
|
|
||||||
|
|
||||||
if (runeSkillAdjusts.get(rune_id) == null) {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
|
|
||||||
skillAdjustList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, skillAdjustList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
|
|
||||||
powerList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GET_RUNE_REQS(final RuneBase rb) {
|
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
@@ -139,6 +59,43 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
rb.setLevelRequired(rs.getInt("requiredRuneID"));
|
rb.setLevelRequired(rs.getInt("requiredRuneID"));
|
||||||
break;
|
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) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -143,6 +143,13 @@ public class dbSkillBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
|
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) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
@@ -44,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
MobBase mb = (MobBase) mobbaseAGO;
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
int loadID = mb.getObjectUUID();
|
int loadID = mb.getObjectUUID();
|
||||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, zone, null, null, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
@@ -85,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, zone, null, null, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -70,28 +71,30 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
throwbackError(pc, "Failed to find zone to place npc in.");
|
throwbackError(pc, "Failed to find zone to place npc in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Building building = null;
|
||||||
if (target != null)
|
if (target != null)
|
||||||
if (target.getObjectType() == GameObjectType.Building) {
|
if (target.getObjectType() == GameObjectType.Building) {
|
||||||
Building parentBuilding = (Building) target;
|
building = (Building)target;
|
||||||
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
NPC created;
|
||||||
NPC npc = NPC.createNPC(name, contractID,
|
Guild guild = null;
|
||||||
pc.getLoc(), null, zone, (short) level, null);
|
Vector3fImmutable loc;
|
||||||
|
if(building != null){
|
||||||
if (npc != null) {
|
guild = building.getGuild();
|
||||||
WorldGrid.addObject(npc, pc);
|
loc = building.loc;
|
||||||
ChatManager.chatSayInfo(pc,
|
|
||||||
"NPC with ID " + npc.getDBID() + " added");
|
|
||||||
this.setResult(String.valueOf(npc.getDBID()));
|
|
||||||
} else{
|
} else{
|
||||||
throwbackError(pc, "Failed to create npc of contract type "
|
loc = pc.loc;
|
||||||
+ contractID);
|
|
||||||
Logger.error(
|
|
||||||
"Failed to create npc of contract type " + contractID);
|
|
||||||
}
|
}
|
||||||
|
created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
|
||||||
|
created.bindLoc = loc;
|
||||||
|
if(building != null) {
|
||||||
|
created.buildingUUID = building.getObjectUUID();
|
||||||
|
created.building = building;
|
||||||
|
NPCManager.slotCharacterInBuilding(created);
|
||||||
|
}
|
||||||
|
created.setLoc(created.bindLoc);
|
||||||
|
created.updateDatabase();
|
||||||
|
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
|
||||||
|
public class AuditHeightMapCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public AuditHeightMapCmd() {
|
||||||
|
super("auditheightmap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
int count = Integer.parseInt(words[0]);
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
|
||||||
|
|
||||||
|
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
||||||
|
|
||||||
|
if (currentZone != null && currentZone.getHeightMap() != null) {
|
||||||
|
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long delta = end - start;
|
||||||
|
|
||||||
|
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /auditmobs [zone.UUID]'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Audits all the mobs in a zone.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
public class EnchantCmd extends AbstractDevCmd {
|
public class EnchantCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -55,21 +56,9 @@ public class EnchantCmd extends AbstractDevCmd {
|
|||||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||||
} else {
|
} else {
|
||||||
int cnt = words.length;
|
int cnt = words.length;
|
||||||
for (int i = 1; i < cnt; i++) {
|
String enchant = words[1];
|
||||||
String enchant = words[i];
|
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase());
|
||||||
boolean valid = true;
|
item.addPermanentEnchantmentForDev(enchant, 0);
|
||||||
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();
|
cim.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class FlashMsgCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatManager.chatSystemFlash(args[0]);
|
ChatManager.chatSystemFlash(String.join(" ", args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import engine.InterestManagement.HeightMap;
|
|||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -21,58 +22,205 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public GetHeightCmd() {
|
public GetHeightCmd() {
|
||||||
super("getHeight");
|
super("getHeight");
|
||||||
|
this.addCmdString("height");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
Zone currentZone;
|
boolean end = true;
|
||||||
Zone parentZone;
|
|
||||||
Zone heightmapZone;
|
|
||||||
|
|
||||||
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
float height = HeightMap.getWorldHeight(pc);
|
||||||
heightmapZone = HeightMap.getNextZoneWithTerrain(currentZone);
|
|
||||||
parentZone = HeightMap.getNextZoneWithTerrain(currentZone.getParent());
|
|
||||||
|
|
||||||
float currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc());
|
this.throwbackInfo(pc, "Altitude : " + height);
|
||||||
float parentHeight = HeightMap.getWorldHeight(parentZone, playerCharacter.getLoc());
|
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), heightmapZone);
|
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
|
||||||
Vector2f gridSquare = heightmapZone.getHeightMap().getGridSquare(zoneLoc);
|
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.getName());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.getName());
|
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
|
||||||
this.throwbackInfo(playerCharacter, "Zone Height: " + heightmapZone.worldAltitude);
|
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
|
||||||
this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.getSeaLevel());
|
|
||||||
this.throwbackInfo(playerCharacter, "Grid : " + (int) gridSquare.x + "x" + (int) gridSquare.y);
|
|
||||||
this.throwbackInfo(playerCharacter, "*** 256: " + currentHeight);
|
|
||||||
this.throwbackInfo(playerCharacter, "***Adjusted Height: " + (currentHeight + playerCharacter.getCharacterHeight()));
|
|
||||||
|
|
||||||
HeightMap.SCALEVALUE = 1f / 255f;
|
if (end)
|
||||||
currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc());
|
return;
|
||||||
HeightMap.SCALEVALUE = 1f / 256f;
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
Vector2f gridOffset;
|
||||||
|
Vector2f parentGrid;
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
|
if (currentZone == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Zone parentZone = currentZone.getParent();
|
||||||
|
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
|
||||||
|
//find the next parents heightmap if the currentzone heightmap is null.
|
||||||
|
while (heightMap == null) {
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor()) {
|
||||||
|
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Using parent zone instead: ");
|
||||||
|
currentZone = currentZone.getParent();
|
||||||
|
heightMap = currentZone.getHeightMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
|
||||||
|
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
|
||||||
|
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
|
||||||
|
|
||||||
|
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
|
||||||
|
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
||||||
|
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
||||||
|
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
|
||||||
|
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
|
||||||
|
|
||||||
|
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
||||||
|
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
||||||
|
} else
|
||||||
|
parentGrid = new Vector2f(-1, -1);
|
||||||
|
|
||||||
|
gridSquare = heightMap.getGridSquare(zoneLoc);
|
||||||
|
gridOffset = HeightMap.getGridOffset(gridSquare);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
|
||||||
|
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
|
||||||
|
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
|
||||||
|
|
||||||
|
if (parentGrid.x != -1) {
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
|
||||||
|
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
|
||||||
|
}
|
||||||
|
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
if (parentZone != null) {
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = 100 / parentXRadius;
|
||||||
|
float bucketScaleZ = 200 / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float strMod = pc.statStrBase - 40;
|
||||||
|
|
||||||
|
strMod *= .00999999998f;
|
||||||
|
|
||||||
|
strMod += 1f;
|
||||||
|
|
||||||
|
float radius = 0;
|
||||||
|
switch (pc.getRaceID()) {
|
||||||
|
case 2017:
|
||||||
|
radius = 3.1415927f;
|
||||||
|
case 2000:
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
strMod *= 1.5707964f;
|
||||||
|
|
||||||
|
strMod += 3.1415927f;
|
||||||
|
|
||||||
|
strMod -= .5f;
|
||||||
|
|
||||||
|
|
||||||
|
realWorldAltitude += strMod;
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "***255 Adjusted: " + (currentHeight + playerCharacter.getCharacterHeight()));
|
|
||||||
this.throwbackInfo(playerCharacter, "Drowning Height: " + (heightmapZone.getSeaLevel() + playerCharacter.getCharacterHeight()));
|
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "------------");
|
|
||||||
this.throwbackInfo(playerCharacter, "Parent : " + parentZone.getName());
|
|
||||||
this.throwbackInfo(playerCharacter, "Height returned : " + parentHeight);
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x) + "][" + (gridSquare.y) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x + 1) + "][" + (gridSquare.y) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x) + "][" + (gridSquare.y + 1) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x + 1) + "][" + (gridSquare.y + 1) + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Queries heightmap engine";
|
return "Temporarily Changes SubRace";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /getheight";
|
return "' /subrace mobBaseID";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
|
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
|
output += "Max Inventory Weight:" + targetPC.getInventoryCapacity();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "ALTITUDE :" + targetPC.getAltitude();
|
output += "ALTITUDE :" + targetPC.getAltitude();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -336,8 +336,9 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
output += "Swimming : " + targetPC.isSwimming();
|
output += "Swimming : " + targetPC.isSwimming();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "isMoving : " + targetPC.isMoving();
|
output += "isMoving : " + targetPC.isMoving() + newline;
|
||||||
|
output += "Zerg Multiplier: " + targetPC.ZergMultiplier + newline;
|
||||||
|
output += "isBoxed: " + targetPC.isBoxed + newline;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -525,7 +526,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
ConcurrentHashMap<String, Effect> effects = item.getEffects();
|
ConcurrentHashMap<String, Effect> effects = item.getEffects();
|
||||||
for (String name : effects.keySet()) {
|
for (String name : effects.keySet()) {
|
||||||
Effect eff = effects.get(name);
|
Effect eff = effects.get(name);
|
||||||
output += eff.getEffectsBase().getIDString();
|
output += eff.getEffectsBase().getIDString() + " Static:" + eff.isStatic();
|
||||||
output += newline;
|
output += newline;
|
||||||
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
|
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (item == null || !worked) {
|
if (item == null || !worked) {
|
||||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
throwbackError(pc, "DB error 2: Unable to create item.");
|
||||||
|
if(item == null)
|
||||||
|
throwbackError(pc, "Item Null");
|
||||||
|
else
|
||||||
|
throwbackError(pc, "Worked = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +226,10 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (item == null || !worked) {
|
if (item == null || !worked) {
|
||||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
throwbackError(pc, "DB error 2: Unable to create item.");
|
||||||
|
if(item == null)
|
||||||
|
throwbackError(pc, "Item Null");
|
||||||
|
else
|
||||||
|
throwbackError(pc, "Worked = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.workthreads.HourlyJobThread;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -41,10 +40,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
|||||||
String trigger = args[0];
|
String trigger = args[0];
|
||||||
switch (trigger) {
|
switch (trigger) {
|
||||||
case "true":
|
case "true":
|
||||||
HourlyJobThread.mineWindowOpen(mine);
|
Mine.mineWindowOpen(mine);
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
HourlyJobThread.mineWindowClose(mine);
|
Mine.mineWindowClose(mine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PrintEffectsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintEffectsCmd() {
|
|
||||||
super("printeffects");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
AbstractCharacter tar;
|
|
||||||
|
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
|
||||||
tar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Effects For Character: " + tar.getName() + newline;
|
|
||||||
|
|
||||||
for(String effect : tar.effects.keySet()){
|
|
||||||
output += effect + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Returns the player's current stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /printstats'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -39,6 +39,9 @@ public class PrintResistsCmd extends AbstractDevCmd {
|
|||||||
if (mb != null)
|
if (mb != null)
|
||||||
name = mb.getFirstName();
|
name = mb.getFirstName();
|
||||||
type = "Mob";
|
type = "Mob";
|
||||||
|
throwbackInfo(pc, "Server resists for " + type + ' ' + name);
|
||||||
|
tar.getResists().printResistsToClient(pc);
|
||||||
|
return;
|
||||||
} else if (tar instanceof NPC) {
|
} else if (tar instanceof NPC) {
|
||||||
NPC npc = (NPC) tar;
|
NPC npc = (NPC) tar;
|
||||||
Contract contract = npc.getContract();
|
Contract contract = npc.getContract();
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PrintRunesCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintRunesCmd() {
|
|
||||||
super("printrunes");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
AbstractCharacter tar;
|
|
||||||
|
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
|
||||||
tar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
|
|
||||||
|
|
||||||
for(CharacterRune rune : ((AbstractCharacter)target).runes){
|
|
||||||
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Returns the player's current stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /printstats'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
||||||
|
tar.calculateMaxHealthManaStamina();
|
||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
||||||
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||||
@@ -72,6 +74,11 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + 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 += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + 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);
|
throwbackInfo(pc, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,19 +110,15 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
main = getWeaponBase(1, equip);
|
main = getWeaponBase(1, equip);
|
||||||
ItemBase off = null;
|
ItemBase off = null;
|
||||||
|
|
||||||
if(equip != null){
|
if (equip != null)
|
||||||
if(equip.get(2) != null && !equip.get(2).getItemBase().isShield()){
|
getWeaponBase(2, equip);
|
||||||
//off hand weapon
|
if (main == null && off == null) {
|
||||||
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
|
||||||
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
|
||||||
out += "Range: " + tar.rangeHandTwo + newline;
|
|
||||||
out += "Attack Speed: " + tar.speedHandTwo + newline;
|
|
||||||
} else {
|
} else {
|
||||||
out += "Attack Rating: " + tar.atrHandOne + newline;
|
if (main != null)
|
||||||
out += "Damage: " + tar.minDamageHandOne + " - " + tar.maxDamageHandOne + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
|
||||||
out += "Range: " + tar.rangeHandOne + newline;
|
if (off != null)
|
||||||
out += "Attack Speed: " + tar.speedHandOne + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
|
|
||||||
|
|||||||
@@ -59,25 +59,22 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(GameObjectType.NPC,
|
DbManager.removeFromCache(GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -154,11 +151,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -167,11 +163,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
@@ -25,17 +25,42 @@ public class RegionCmd extends AbstractDevCmd {
|
|||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
Regions region = ((AbstractCharacter)target).region;
|
|
||||||
if (region == null) {
|
if (pc.region == null) {
|
||||||
this.throwbackInfo(pc, "No Region Found.");
|
this.throwbackInfo(pc, "No Region Found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region != null) {
|
|
||||||
this.throwbackInfo(pc, "Region Info: " + ((AbstractCharacter) target).getName());
|
String newLine = System.getProperty("line.separator");
|
||||||
this.throwbackInfo(pc, "Region Name: " + region);
|
String result = "";
|
||||||
this.throwbackInfo(pc, "Region Height: " + region.lerpY((AbstractCharacter)target));
|
result += (pc.region.getClass().getSimpleName());
|
||||||
|
result += (" {");
|
||||||
|
result += (newLine);
|
||||||
|
Field[] fields = pc.region.getClass().getDeclaredFields();
|
||||||
|
|
||||||
|
//print field names paired with their values
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
result += (" ");
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (field.getName().contains("Furniture"))
|
||||||
|
continue;
|
||||||
|
result += (field.getName());
|
||||||
|
result += (": ");
|
||||||
|
//requires access to private field:
|
||||||
|
result += (field.get(pc.region).toString());
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
System.out.println(ex);
|
||||||
}
|
}
|
||||||
|
result.trim();
|
||||||
|
result += (newLine);
|
||||||
|
}
|
||||||
|
result += ("}");
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, result.toString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
import engine.Enum.BuildingGroup;
|
||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
@@ -137,16 +138,49 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//remove cached shrines.
|
//remove cached shrines.
|
||||||
if ((building.getBlueprintUUID() != 0)
|
if ((building.getBlueprintUUID() != 0)
|
||||||
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
||||||
Shrine.RemoveShrineFromCacheByBuilding(building);
|
Shrine.RemoveShrineFromCacheByBuilding(building);
|
||||||
|
|
||||||
// Remove hirelings for this building
|
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mobA = null;
|
||||||
|
|
||||||
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
|
if (ac.getObjectType() == GameObjectType.NPC)
|
||||||
BuildingManager.removeHireling(building, abstractCharacter);
|
npc = (NPC) ac;
|
||||||
|
else if (ac.getObjectType() == GameObjectType.Mob)
|
||||||
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
|
if (npc != null) {
|
||||||
|
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||||
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
DbManager.removeFromCache(npc);
|
||||||
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
|
WorldGrid.removeObject(npc, pc);
|
||||||
|
} else if (mobA != null) {
|
||||||
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
|
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||||
|
DbManager.removeFromCache(mobA);
|
||||||
|
WorldGrid.RemoveWorldObject(mobA);
|
||||||
|
WorldGrid.removeObject(mobA, pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Zone zone = building.getParentZone();
|
Zone zone = building.getParentZone();
|
||||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||||
DbManager.removeFromCache(building);
|
DbManager.removeFromCache(building);
|
||||||
@@ -175,13 +209,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.removeObject(mob, pc);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
|||||||
@@ -1,43 +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;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
|
|
||||||
public class SeaAuditCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SeaAuditCmd() {
|
|
||||||
super("seaaudit");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.getAllZones())
|
|
||||||
if (zone.getSeaLevel() > zone.worldAltitude)
|
|
||||||
this.throwbackInfo(playerCharacter, zone.getObjectUUID() + zone.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Queries heightmap engine";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /getheight";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -62,7 +62,7 @@ public class SetAdminRuneCmd extends AbstractDevCmd {
|
|||||||
if (worked) {
|
if (worked) {
|
||||||
ChatManager.chatSayInfo(pcSender,
|
ChatManager.chatSayInfo(pcSender,
|
||||||
"rune of ID " + runeID + " removed");
|
"rune of ID " + runeID + " removed");
|
||||||
InterestManager.reloadCharacter(pcSender);
|
InterestManager.reloadCharacter(pcSender,false);
|
||||||
} else
|
} else
|
||||||
throwbackError(pcSender, "Failed to remove the rune of type "
|
throwbackError(pcSender, "Failed to remove the rune of type "
|
||||||
+ runeID);
|
+ runeID);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class SetBaseClassCmd extends AbstractDevCmd {
|
|||||||
this.setTarget(pc); //for logging
|
this.setTarget(pc); //for logging
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
"BaseClass changed to " + classID);
|
"BaseClass changed to " + classID);
|
||||||
InterestManager.reloadCharacter(pc);
|
InterestManager.reloadCharacter(pc,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import engine.devcmd.AbstractDevCmd;
|
|||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
public class SetLevelCmd extends AbstractDevCmd {
|
public class SetLevelCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level < 1 || level > 75) {
|
if (level < 1 || level > MBServerStatics.LEVELCAP) {
|
||||||
this.sendHelp(pc);
|
this.sendHelp(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -57,12 +58,12 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
tar.setLevel((short) level);
|
tar.setLevel((short) level);
|
||||||
this.setTarget(tar); //for logging
|
this.setTarget(tar); //for logging
|
||||||
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
|
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
|
||||||
InterestManager.reloadCharacter(tar);
|
InterestManager.reloadCharacter(tar,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
|
return "Sets your character's level to 'amount'. 'amount' must be between 1-" + MBServerStatics.LEVELCAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
|
|||||||
pc.setPromotionClass(classID);
|
pc.setPromotionClass(classID);
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
"PromotionClass changed to " + classID);
|
"PromotionClass changed to " + classID);
|
||||||
InterestManager.reloadCharacter(pc);
|
InterestManager.reloadCharacter(pc,false);
|
||||||
this.setTarget(pc); //for logging
|
this.setTarget(pc); //for logging
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class SetRuneCmd extends AbstractDevCmd {
|
|||||||
if (worked) {
|
if (worked) {
|
||||||
ChatManager.chatSayInfo(pcSender,
|
ChatManager.chatSayInfo(pcSender,
|
||||||
"rune of ID " + runeID + " removed");
|
"rune of ID " + runeID + " removed");
|
||||||
InterestManager.reloadCharacter(pcSender);
|
InterestManager.reloadCharacter(pcSender,false);
|
||||||
} else
|
} else
|
||||||
throwbackError(pcSender, "Failed to remove the rune of type "
|
throwbackError(pcSender, "Failed to remove the rune of type "
|
||||||
+ runeID);
|
+ runeID);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// pum.setEffectID(token);
|
// pum.setEffectID(token);
|
||||||
// pum.setSourceType(pc.getObjectType().ordinal());
|
// pum.setSourceType(pc.getObjectType().ordinal());
|
||||||
// pum.setSourceID(pc.getObjectUUID());
|
// pum.setSourceID(pc.getObjectUUID());
|
||||||
// pum.setStartLocType(pc.getObjectType().ordinal());
|
// pum.setTargetType(pc.getObjectType().ordinal());
|
||||||
// pum.setTargetID(pc.getObjectUUID());
|
// pum.setTargetID(pc.getObjectUUID());
|
||||||
// pum.setNumTrains(40);
|
// pum.setNumTrains(40);
|
||||||
// pum.setDuration(-1);
|
// pum.setDuration(-1);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.LootManager;
|
import engine.gameManager.LootManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.loot.BootySetEntry;
|
import engine.loot.BootySetEntry;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -26,7 +28,9 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
String output;
|
String output;
|
||||||
|
|
||||||
output = "Booty Simulation:" + newline;
|
output = "Booty Simulation:" + newline;
|
||||||
|
if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){
|
||||||
|
return;//ugh what?
|
||||||
|
}
|
||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output += "Name: " + mob.getName() + newline;
|
output += "Name: " + mob.getName() + newline;
|
||||||
output += "Special Loot:" + newline;
|
output += "Special Loot:" + newline;
|
||||||
@@ -51,7 +55,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
int failures = 0;
|
int failures = 0;
|
||||||
int goldAmount = 0;
|
int goldAmount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mob.loadInventory();
|
mob.loadInventory();
|
||||||
@@ -79,12 +83,19 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
goldAmount += lootItem.getNumOfItems();
|
goldAmount += lootItem.getNumOfItems();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if(Warehouse.maxResources.containsKey(lootItem.getItemBaseID())){
|
||||||
|
Resources.add(lootItem);
|
||||||
|
} else {
|
||||||
OtherDrops.add(lootItem);
|
OtherDrops.add(lootItem);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
failures++;
|
failures++;
|
||||||
|
//throwbackError(playerCharacter,ex.getLocalizedMessage());
|
||||||
|
//Logger.error(ex.fillInStackTrace());
|
||||||
|
//return;
|
||||||
}
|
}
|
||||||
if (mob.getEquip() != null) {
|
if (mob.getEquip() != null) {
|
||||||
for (MobEquipment me : mob.getEquip().values()) {
|
for (MobEquipment me : mob.getEquip().values()) {
|
||||||
@@ -131,8 +142,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||||
|
for(Item glass : GlassItems){
|
||||||
|
output += " " + glass.getName() + newline;
|
||||||
|
}
|
||||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||||
|
for(Item rune : Runes){
|
||||||
|
output += " " + rune.getName() + newline;
|
||||||
|
}
|
||||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||||
|
for(Item contract : Contracts){
|
||||||
|
output += " " + contract.getName() + newline;
|
||||||
|
}
|
||||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class SlotTestCmd extends AbstractDevCmd {
|
|||||||
outString += "Hirelings List:";
|
outString += "Hirelings List:";
|
||||||
|
|
||||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||||
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
|
outString += "\r\n" + hireling.getName() + "(" + hireling.getObjectUUID() + ") slot : " + building.getHirelings().get(hireling);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, serverZone, null, null, "", 1);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "Sea Level = " + zone.getSeaLevel();
|
output += "Sea Level = " + zone.getSeaLevel();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "World Altitude = " + zone.worldAltitude;
|
output += "World Altitude = " + zone.getWorldAltitude();
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|
||||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||||
|
|||||||
@@ -9,17 +9,14 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.MobBase;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.powers.RunePowerEntry;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -61,27 +58,6 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + newline;
|
output += mob.getName() + newline;
|
||||||
output += mob.agentType.toString() + newline;
|
|
||||||
|
|
||||||
int contractID = 0;
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard() == true) {
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
|
||||||
contractID = mob.guardCaptain.contract.getContractID();
|
|
||||||
else
|
|
||||||
contractID = mob.contract.getContractID();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contractID != 0) {
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
|
||||||
output += "Captain Contract: " + contractID + newline;
|
|
||||||
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
|
||||||
} else
|
|
||||||
output += "Contract: " + contractID + newline;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob.behaviourType != null) {
|
if (mob.behaviourType != null) {
|
||||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||||
@@ -112,46 +88,17 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (mob.guardedCity != null)
|
if (mob.guardedCity != null)
|
||||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||||
output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline;
|
|
||||||
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
|
||||||
output += "Powers:" + newline;
|
output += "Powers:" + newline;
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
for (int token : mob.mobPowers.keySet())
|
||||||
|
output += PowersManager.getPowerByToken(token).getName() + newline;
|
||||||
// Additional powers may come from the contract ID. This is to support
|
|
||||||
// powers for player guards irrespective of the mobbase used.
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard()) {
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
|
||||||
|
|
||||||
if (mob.contract != null)
|
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
|
||||||
|
|
||||||
powerEntries.addAll(contractEntries);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (RunePowerEntry runePowerEntry : powerEntries)
|
|
||||||
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
|
|
||||||
|
|
||||||
// List outlaws defined for this player guard's city
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard()) {
|
|
||||||
|
|
||||||
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
|
|
||||||
|
|
||||||
if (outlaws.isEmpty() == false)
|
|
||||||
output += "Outlaws: " + newline;
|
|
||||||
|
|
||||||
for (Integer outlawUUID : outlaws)
|
|
||||||
output += outlawUUID + newline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
output += "Race type: " + MobBase.mobbase_race_types.get(mob.getMobBaseID());
|
||||||
throwbackInfo(playerCharacter, output);
|
throwbackInfo(playerCharacter, output);
|
||||||
|
|
||||||
|
throwbackInfo(playerCharacter, "Race Types: " + MobBase.mobbase_race_types.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.*;
|
||||||
|
import engine.objects.*;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eighty
|
||||||
|
*/
|
||||||
|
public class setProfit extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public setProfit() {
|
||||||
|
super("setprofit");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
if (words.length < 2) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Sets profit margin of targeted NPC";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /setprofit buy/sell VALUE(1.0)'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -308,72 +308,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeHireling(Building building, AbstractCharacter hireling) {
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob guardCaptain = (Mob) hireling;
|
|
||||||
|
|
||||||
// Clear minions from database if a guard captain
|
|
||||||
|
|
||||||
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
|
||||||
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear minions from world
|
|
||||||
|
|
||||||
for (Integer minionUUID : hireling.minions) {
|
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
|
||||||
DbManager.removeFromCache(minionMob);
|
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
|
||||||
WorldGrid.unloadObject(minionMob);
|
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove hireling from building
|
|
||||||
|
|
||||||
building.getHirelings().remove(hireling);
|
|
||||||
|
|
||||||
// Remove from zone mob set
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob hirelingMob = (Mob) hireling;
|
|
||||||
|
|
||||||
if (hirelingMob.getParentZone() != null)
|
|
||||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
|
||||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
|
||||||
|
|
||||||
NPC hirelingNPC = (NPC) hireling;
|
|
||||||
|
|
||||||
if (hirelingNPC.getParentZone() != null)
|
|
||||||
if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC))
|
|
||||||
hirelingNPC.getParentZone().zoneNPCSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unload hireling from world
|
|
||||||
|
|
||||||
DbManager.removeFromCache(hireling);
|
|
||||||
WorldGrid.RemoveWorldObject(hireling);
|
|
||||||
WorldGrid.removeObject(hireling);
|
|
||||||
|
|
||||||
// Delete hireling from database
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob))
|
|
||||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
|
||||||
else
|
|
||||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void cleanupHirelings(Building building) {
|
public static void cleanupHirelings(Building building) {
|
||||||
|
|
||||||
// Early exit: Cannot have hirelings in a building
|
// Early exit: Cannot have hirelings in a building
|
||||||
@@ -386,18 +320,42 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (building.getRank() < 1) {
|
if (building.getRank() < 1) {
|
||||||
|
|
||||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
|
||||||
BuildingManager.removeHireling(building, slottedNPC);
|
|
||||||
|
|
||||||
|
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
((NPC) slottedNPC).remove();
|
||||||
|
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete hireling if building has deranked.
|
// Delete hireling if building has deranked.
|
||||||
|
|
||||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||||
|
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mob = null;
|
||||||
|
|
||||||
|
if (hireling.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
npc = (NPC) hireling;
|
||||||
|
else if (hireling.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
mob = (Mob) hireling;
|
||||||
|
|
||||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||||
BuildingManager.removeHireling(building, hireling);
|
|
||||||
|
if (npc != null) {
|
||||||
|
if (!npc.remove())
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
} else if (mob != null) {
|
||||||
|
if (!NPCManager.removeMobileFromBuilding(mob, building))
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,9 +520,10 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
|
||||||
|
Logger.error("failed at addHireling with contract: " + contract.getContractID());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
if (item.getChargesRemaining() > 0)
|
if (item.getChargesRemaining() > 0)
|
||||||
@@ -572,63 +531,41 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mobile;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contract.getContractID() == 910) {
|
if (contract.getContractID() == 910) {
|
||||||
|
|
||||||
//guard dog
|
//guard dog
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ public enum ChatManager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
else {
|
else {
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.util.HashSet;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static engine.math.FastMath.sqr;
|
||||||
|
|
||||||
public enum CombatManager {
|
public enum CombatManager {
|
||||||
|
|
||||||
COMBATMANAGER;
|
COMBATMANAGER;
|
||||||
@@ -39,6 +41,63 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Message sent by player to attack something.
|
* Message sent by player to attack something.
|
||||||
*/
|
*/
|
||||||
|
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
|
PlayerCharacter player;
|
||||||
|
int targetType;
|
||||||
|
AbstractWorldObject target;
|
||||||
|
|
||||||
|
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//source must match player this account belongs to
|
||||||
|
|
||||||
|
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
|
||||||
|
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetType = msg.getTargetType();
|
||||||
|
|
||||||
|
if (targetType == GameObjectType.PlayerCharacter.ordinal()) {
|
||||||
|
target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Building.ordinal()) {
|
||||||
|
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
target = Mob.getFromCache(msg.getTargetID());
|
||||||
|
} else {
|
||||||
|
player.setCombatTarget(null);
|
||||||
|
return; //not valid type to attack
|
||||||
|
}
|
||||||
|
|
||||||
|
// quit of the combat target is already the current combat target
|
||||||
|
// or there is no combat target
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//set sources target
|
||||||
|
|
||||||
|
player.setCombatTarget(target);
|
||||||
|
|
||||||
|
//put in combat if not already
|
||||||
|
|
||||||
|
if (!player.isCombat())
|
||||||
|
toggleCombat(true, origin);
|
||||||
|
|
||||||
|
//make character stand if sitting
|
||||||
|
|
||||||
|
if (player.isSit())
|
||||||
|
toggleSit(false, origin);
|
||||||
|
|
||||||
|
AttackTarget(player, target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
||||||
|
|
||||||
@@ -82,6 +141,11 @@ public enum CombatManager {
|
|||||||
if (off == null)
|
if (off == null)
|
||||||
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
|
||||||
|
|
||||||
|
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||||
|
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
@@ -459,28 +523,28 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Attempt to attack target
|
* Attempt to attack target
|
||||||
*/
|
*/
|
||||||
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
private static void attack(AbstractCharacter ac, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
||||||
|
|
||||||
float atr;
|
float atr;
|
||||||
int minDamage, maxDamage;
|
int minDamage, maxDamage;
|
||||||
int errorTrack = 0;
|
int errorTrack = 0;
|
||||||
|
int subTrack = 0;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (attacker == null)
|
if (ac == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mainHand) {
|
if (mainHand) {
|
||||||
atr = attacker.getAtrHandOne();
|
atr = ac.getAtrHandOne();
|
||||||
minDamage = attacker.getMinDamageHandOne();
|
minDamage = ac.getMinDamageHandOne();
|
||||||
maxDamage = attacker.getMaxDamageHandOne();
|
maxDamage = ac.getMaxDamageHandOne();
|
||||||
} else {
|
} else {
|
||||||
atr = attacker.getAtrHandTwo();
|
atr = ac.getAtrHandTwo();
|
||||||
minDamage = attacker.getMinDamageHandTwo();
|
minDamage = ac.getMinDamageHandTwo();
|
||||||
maxDamage = attacker.getMaxDamageHandTwo();
|
maxDamage = ac.getMaxDamageHandTwo();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tarIsRat = false;
|
boolean tarIsRat = false;
|
||||||
@@ -499,9 +563,9 @@ public enum CombatManager {
|
|||||||
//Dont think we need to do this anymore.
|
//Dont think we need to do this anymore.
|
||||||
|
|
||||||
if (tarIsRat)
|
if (tarIsRat)
|
||||||
if (attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
||||||
|
|
||||||
float percent = 1 + attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
float percent = 1 + ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
||||||
|
|
||||||
minDamage *= percent;
|
minDamage *= percent;
|
||||||
maxDamage *= percent;
|
maxDamage *= percent;
|
||||||
@@ -512,24 +576,24 @@ public enum CombatManager {
|
|||||||
//subtract stamina
|
//subtract stamina
|
||||||
|
|
||||||
if (wb == null)
|
if (wb == null)
|
||||||
attacker.modifyStamina(-0.5f, attacker, true);
|
ac.modifyStamina(-0.5f, ac, true);
|
||||||
else {
|
else {
|
||||||
float stam = wb.getWeight() / 3;
|
float stam = wb.getWeight() / 3;
|
||||||
stam = (stam < 1) ? 1 : stam;
|
stam = (stam < 1) ? 1 : stam;
|
||||||
attacker.modifyStamina(-(stam), attacker, true);
|
ac.modifyStamina(-(stam), ac, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker.cancelOnAttackSwing();
|
ac.cancelOnAttackSwing();
|
||||||
|
|
||||||
errorTrack = 2;
|
errorTrack = 2;
|
||||||
|
|
||||||
//set last time this player has attacked something.
|
//set last time this player has attacked something.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != attacker.getObjectUUID() && attacker.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != ac.getObjectUUID() && ac.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
attacker.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
} else
|
} else
|
||||||
attacker.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
||||||
|
|
||||||
errorTrack = 3;
|
errorTrack = 3;
|
||||||
|
|
||||||
@@ -540,46 +604,74 @@ public enum CombatManager {
|
|||||||
if (target.getObjectType().equals(GameObjectType.Building)) {
|
if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
defense = 0;
|
defense = 0;
|
||||||
|
|
||||||
|
Building building = (Building) target;
|
||||||
|
|
||||||
|
if (building.getParentZone() != null && building.getParentZone().isPlayerCity()) {
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")) {
|
||||||
|
|
||||||
|
building.getTimestamps().put("CallForHelp", System.currentTimeMillis() + 15000);
|
||||||
|
|
||||||
|
for (Mob mob : building.getParentZone().zoneMobSet) {
|
||||||
|
if (!mob.isPlayerGuard())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getCombatTarget() != null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getGuild() != null && building.getGuild() != null)
|
||||||
|
if (!Guild.sameGuild(mob.getGuild().getNation(), building.getGuild().getNation()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getLoc().distanceSquared2D(building.getLoc()) > sqr(300))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mob.setCombatTarget(ac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AbstractCharacter tar = (AbstractCharacter) target;
|
AbstractCharacter tar = (AbstractCharacter) target;
|
||||||
defense = tar.getDefenseRating();
|
defense = tar.getDefenseRating();
|
||||||
handleRetaliate(tar, attacker); //Handle target attacking back if in combat and has no other target
|
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 4;
|
errorTrack = 4;
|
||||||
|
|
||||||
//Get hit chance
|
//Get hit chance
|
||||||
|
float constant = (atr+defense)*0.315f;
|
||||||
int chance;
|
float atrChance = atr - constant;
|
||||||
float dif = atr - defense;
|
float defChance = defense - constant + atrChance;
|
||||||
|
float smallChance = atrChance/defChance;
|
||||||
if (dif > 100)
|
int chance = (int)(smallChance * 100);
|
||||||
chance = 94;
|
|
||||||
else if (dif < -100)
|
|
||||||
chance = 4;
|
|
||||||
else
|
|
||||||
chance = (int) ((0.45 * dif) + 49);
|
|
||||||
|
|
||||||
errorTrack = 5;
|
errorTrack = 5;
|
||||||
|
|
||||||
|
if(chance < 5){
|
||||||
|
chance = 5;
|
||||||
|
}
|
||||||
|
if(chance > 95){
|
||||||
|
chance = 95;
|
||||||
|
}
|
||||||
|
|
||||||
//calculate hit/miss
|
//calculate hit/miss
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
int roll = ThreadLocalRandom.current().nextInt(1,101);
|
||||||
DeferredPowerJob dpj = null;
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
if (roll < chance) {
|
if (roll < chance) {
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
|
|
||||||
boolean skipPassives = false;
|
boolean skipPassives = false;
|
||||||
PlayerBonuses bonuses = attacker.getBonuses();
|
PlayerBonuses bonuses = ac.getBonuses();
|
||||||
|
|
||||||
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
||||||
skipPassives = true;
|
skipPassives = true;
|
||||||
@@ -594,26 +686,26 @@ public enum CombatManager {
|
|||||||
// Apply Weapon power effect if any. don't try to apply twice if
|
// Apply Weapon power effect if any. don't try to apply twice if
|
||||||
// dual wielding. Perform after passive test for sync purposes.
|
// dual wielding. Perform after passive test for sync purposes.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
((PlayerCharacter) ac).setWeaponPower(dpj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to apply second backstab.
|
//check to apply second backstab.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
||||||
float attackRange = getWeaponRange(wb, bonuses);
|
float attackRange = getWeaponRange(wb, bonuses);
|
||||||
@@ -633,24 +725,24 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Handle Block passive
|
//Handle Block passive
|
||||||
|
|
||||||
if (testPassive(attacker, tarAc, "Block") && canTestBlock(attacker, target)) {
|
if (testPassive(ac, tarAc, "Block") && canTestBlock(ac, target)) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Parry passive
|
//Handle Parry passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (canTestParry(attacker, target) && testPassive(attacker, tarAc, "Parry")) {
|
if (canTestParry(ac, target) && testPassive(ac, tarAc, "Parry")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,12 +753,12 @@ public enum CombatManager {
|
|||||||
//Handle Dodge passive
|
//Handle Dodge passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (testPassive(attacker, tarAc, "Dodge")) {
|
if (testPassive(ac, tarAc, "Dodge")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,7 +774,7 @@ public enum CombatManager {
|
|||||||
//if target is player, set last attack timestamp
|
//if target is player, set last attack timestamp
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) target, attacker, false);
|
updateAttackTimers((PlayerCharacter) target, ac, false);
|
||||||
|
|
||||||
//Get damage Type
|
//Get damage Type
|
||||||
|
|
||||||
@@ -690,7 +782,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (wb != null)
|
if (wb != null)
|
||||||
damageType = wb.getDamageType();
|
damageType = wb.getDamageType();
|
||||||
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege())
|
else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege())
|
||||||
damageType = DamageType.Siege;
|
damageType = DamageType.Siege;
|
||||||
else
|
else
|
||||||
damageType = DamageType.Crush;
|
damageType = DamageType.Crush;
|
||||||
@@ -709,7 +801,7 @@ public enum CombatManager {
|
|||||||
//make sure target is not immune to damage type;
|
//make sure target is not immune to damage type;
|
||||||
|
|
||||||
if (resists != null && resists.immuneTo(damageType)) {
|
if (resists != null && resists.immuneTo(damageType)) {
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,11 +811,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
float damage;
|
float damage;
|
||||||
|
|
||||||
if (wb != null)
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
|
||||||
else
|
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
|
||||||
|
|
||||||
float d = 0f;
|
float d = 0f;
|
||||||
|
|
||||||
errorTrack = 12;
|
errorTrack = 12;
|
||||||
@@ -731,39 +819,58 @@ public enum CombatManager {
|
|||||||
//Subtract Damage from target's health
|
//Subtract Damage from target's health
|
||||||
|
|
||||||
if (tarAc != null) {
|
if (tarAc != null) {
|
||||||
|
|
||||||
if (tarAc.isSit())
|
if (tarAc.isSit())
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
|
||||||
|
|
||||||
|
subTrack = 1;
|
||||||
|
|
||||||
|
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)
|
if (tarAc.getHealth() > 0)
|
||||||
d = tarAc.modifyHealth(-damage, attacker, false);
|
d = tarAc.modifyHealth(-damage, ac, false);
|
||||||
|
subTrack = 5;
|
||||||
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
subTrack = 6;
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
|
subTrack = 7;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
subTrack = 8;
|
||||||
if (target.getHealth() > 0)
|
if (target.getHealth() > 0)
|
||||||
d = ((Building) target).modifyHealth(-damage, attacker);
|
d = ((Building) target).modifyHealth(-damage, ac);
|
||||||
|
subTrack = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 13;
|
errorTrack = 13;
|
||||||
|
|
||||||
//Test to see if any damage needs done to weapon or armor
|
//Test to see if any damage needs done to weapon or armor
|
||||||
|
|
||||||
testItemDamage(attacker, target, weapon, wb);
|
testItemDamage(ac, target, weapon, wb);
|
||||||
|
|
||||||
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
||||||
|
|
||||||
if (tarAc != null && !tarAc.isAlive())
|
if (tarAc != null && !tarAc.isAlive())
|
||||||
removeAttackTimers(attacker);
|
removeAttackTimers(ac);
|
||||||
|
|
||||||
//test double death fix
|
//test double death fix
|
||||||
|
|
||||||
if (d != 0)
|
if (d != 0)
|
||||||
sendCombatMessage(attacker, target, damage, wb, dpj, mainHand); //send damage message
|
sendCombatMessage(ac, target, damage, wb, dpj, mainHand); //send damage message
|
||||||
|
|
||||||
errorTrack = 14;
|
errorTrack = 14;
|
||||||
|
|
||||||
@@ -790,7 +897,7 @@ public enum CombatManager {
|
|||||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
if (procChance < MBServerStatics.PROC_CHANCE)
|
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||||
((WeaponProcEffectModifier) aem).applyProc(attacker, target);
|
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -802,52 +909,53 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//handle damage shields
|
//handle damage shields
|
||||||
|
|
||||||
if (attacker.isAlive() && tarAc != null && tarAc.isAlive())
|
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||||
handleDamageShields(attacker, tarAc, damage);
|
handleDamageShields(ac, tarAc, damage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Apply Weapon power effect if any.
|
// Apply Weapon power effect if any.
|
||||||
// don't try to apply twice if dual wielding.
|
// don't try to apply twice if dual wielding.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PowersBase wp = dpj.getPower();
|
PowersBase wp = dpj.getPower();
|
||||||
|
|
||||||
if (wp.requiresHitRoll() == false) {
|
if (wp.requiresHitRoll() == false) {
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
} else
|
} else
|
||||||
((PlayerCharacter) attacker).setWeaponPower(null);
|
((PlayerCharacter) ac).setWeaponPower(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob)
|
if (target.getObjectType() == GameObjectType.Mob)
|
||||||
((Mob) target).handleDirectAggro(attacker);
|
((Mob) target).handleDirectAggro(ac);
|
||||||
|
|
||||||
errorTrack = 17;
|
errorTrack = 17;
|
||||||
|
|
||||||
//miss, Send miss message
|
//miss, Send miss message
|
||||||
|
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
|
|
||||||
//if attacker is player, set last attack timestamp
|
//if attacker is player, set last attack timestamp
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 18;
|
errorTrack = 18;
|
||||||
|
|
||||||
//cancel effects that break on attack or attackSwing
|
//cancel effects that break on attack or attackSwing
|
||||||
attacker.cancelOnAttack();
|
ac.cancelOnAttack();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(attacker.getName() + ' ' + errorTrack + ' ' + e);
|
Logger.error(ac.getName() + ' ' + "ErrorTrack: " + errorTrack + " ErrorSubTrack = " + subTrack + e);
|
||||||
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,7 +1034,9 @@ public enum CombatManager {
|
|||||||
damage += minDamage;
|
damage += minDamage;
|
||||||
|
|
||||||
//calculate resists in if any
|
//calculate resists in if any
|
||||||
|
if(source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
|
damage *= ((PlayerCharacter)source).ZergMultiplier;
|
||||||
|
}
|
||||||
if (resists != null)
|
if (resists != null)
|
||||||
return resists.getResistedDamage(source, target, damageType, damage, 0);
|
return resists.getResistedDamage(source, target, damageType, damage, 0);
|
||||||
else
|
else
|
||||||
@@ -1125,7 +1235,7 @@ public enum CombatManager {
|
|||||||
toggleCombat(msg.getToggle(), origin);
|
toggleCombat(msg.getToggle(), origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
private static void toggleCombat(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
@@ -1142,7 +1252,7 @@ public enum CombatManager {
|
|||||||
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
private static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
@@ -1165,6 +1275,13 @@ public enum CombatManager {
|
|||||||
|
|
||||||
range += (calcHitBox(ac) + calcHitBox(target));
|
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);
|
float magnitudeSquared = tl.distanceSquared(sl);
|
||||||
|
|
||||||
return magnitudeSquared > range * range;
|
return magnitudeSquared > range * range;
|
||||||
@@ -1172,69 +1289,61 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Called when character takes damage.
|
//Called when character takes damage.
|
||||||
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) {
|
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
|
||||||
|
|
||||||
if (attacker == null || target == null)
|
if (ac == null || tarAc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (attacker.equals(target))
|
if (ac.equals(tarAc))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.isAlive() || !attacker.isAlive())
|
if (!tarAc.isAlive() || !ac.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean isCombat = target.isCombat();
|
boolean isCombat = tarAc.isCombat();
|
||||||
|
|
||||||
//If target in combat and has no target, then attack back
|
//If target in combat and has no target, then attack back
|
||||||
|
|
||||||
AbstractWorldObject awoCombTar = target.getCombatTarget();
|
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
|
||||||
|
|
||||||
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege()))
|
if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege()))
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
||||||
target.setCombatTarget(attacker);
|
tarAc.setCombatTarget(ac);
|
||||||
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
||||||
|
|
||||||
if (target.getTimers() != null)
|
if (tarAc.getTimers() != null)
|
||||||
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||||
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
Mob pet = ((PlayerCharacter) target).getPet();
|
Mob pet = ((PlayerCharacter) tarAc).getPet();
|
||||||
|
|
||||||
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||||
pet.setCombatTarget(attacker);
|
pet.setCombatTarget(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mob Retaliate.
|
//Handle Mob Retaliate.
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
|
||||||
Mob attackedMobile = (Mob) target;
|
Mob retaliater = (Mob) tarAc;
|
||||||
|
|
||||||
//handle minion informing his captain of an attack
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
|
||||||
|
|
||||||
if (attackedMobile.agentType.equals(AIAgentType.GUARDMINION) && attackedMobile.guardCaptain != null && attackedMobile.guardCaptain.isAlive()) {
|
|
||||||
|
|
||||||
if (attackedMobile.guardCaptain.combatTarget == null)
|
|
||||||
attackedMobile.guardCaptain.setCombatTarget(attacker);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mobile already has a target; don't switch.
|
|
||||||
|
|
||||||
if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attackedMobile.setCombatTarget(attacker);
|
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
||||||
|
return;
|
||||||
|
|
||||||
|
retaliater.setCombatTarget(ac);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ package engine.gameManager;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.devcmd.cmds.*;
|
import engine.devcmd.cmds.*;
|
||||||
|
import engine.net.DispatchMessage;
|
||||||
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -46,11 +48,9 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintRunesCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
||||||
@@ -121,6 +121,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
|
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SplatMobCmd());
|
DevCmdManager.registerDevCmd(new SplatMobCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotNpcCmd());
|
DevCmdManager.registerDevCmd(new SlotNpcCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new setProfit());
|
||||||
DevCmdManager.registerDevCmd(new GateInfoCmd());
|
DevCmdManager.registerDevCmd(new GateInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
||||||
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
||||||
@@ -130,6 +131,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
||||||
DevCmdManager.registerDevCmd(new GotoObj());
|
DevCmdManager.registerDevCmd(new GotoObj());
|
||||||
DevCmdManager.registerDevCmd(new convertLoc());
|
DevCmdManager.registerDevCmd(new convertLoc());
|
||||||
|
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
|
||||||
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
||||||
@@ -144,7 +146,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||||
DevCmdManager.registerDevCmd(new SeaAuditCmd());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerDevCmd(AbstractDevCmd cmd) {
|
private static void registerDevCmd(AbstractDevCmd cmd) {
|
||||||
@@ -180,8 +182,17 @@ public enum DevCmdManager {
|
|||||||
|
|
||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//only admin level can run dev commands on production
|
||||||
|
if((cmd.toLowerCase().equals("printstats") || cmd.toLowerCase().equals("printresists")) && target.equals(pcSender)){
|
||||||
|
// execute command;
|
||||||
|
try {
|
||||||
|
adc.doCmd(pcSender, argString, target);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false) {
|
||||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -205,6 +216,11 @@ public enum DevCmdManager {
|
|||||||
e.printStackTrace();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ import engine.net.DispatchMessage;
|
|||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@@ -34,6 +36,11 @@ public enum LootManager {
|
|||||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||||
|
|
||||||
|
public static ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510}));
|
||||||
|
public static ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27570,188900,188910,188920,188930,188940,188950,189500}));
|
||||||
|
public static ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27550,27560,189100,189110,189120,189130,189140,189150}));
|
||||||
|
public static ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27600,188700,188720,189550,189560}));
|
||||||
|
|
||||||
// Drop Rates
|
// Drop Rates
|
||||||
|
|
||||||
public static float NORMAL_DROP_RATE;
|
public static float NORMAL_DROP_RATE;
|
||||||
@@ -68,16 +75,13 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateMobLoot(Mob mob) {
|
public static void GenerateMobLoot(Mob mob) {
|
||||||
|
|
||||||
//determine if mob is in hotzone
|
|
||||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
|
||||||
|
|
||||||
//iterate the booty sets
|
//iterate the booty sets
|
||||||
|
|
||||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
||||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob);
|
||||||
|
|
||||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
||||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.bootySet), mob);
|
||||||
|
|
||||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||||
for (Item it : mob.getInventory()) {
|
for (Item it : mob.getInventory()) {
|
||||||
@@ -85,7 +89,7 @@ public enum LootManager {
|
|||||||
ItemBase ib = it.getItemBase();
|
ItemBase ib = it.getItemBase();
|
||||||
if(ib == null)
|
if(ib == null)
|
||||||
break;
|
break;
|
||||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
if (ib.getName().toLowerCase().contains("of the gods")) {
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
chatMsg.setMessageType(10);
|
chatMsg.setMessageType(10);
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
@@ -95,54 +99,105 @@ public enum LootManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
|
||||||
|
mob.runeCounter++;
|
||||||
boolean hotzoneWasRan = false;
|
mob.contractCounter++;
|
||||||
float dropRate = 1.0f;
|
float dropRate = NORMAL_DROP_RATE;
|
||||||
|
//roll the geenric world drop table
|
||||||
|
if(mob.parentZone.getSafeZone() == 0) {
|
||||||
|
GenerateLootDrop(mob, 1300);
|
||||||
|
if(ThreadLocalRandom.current().nextInt(1, 10000) == 5000) {
|
||||||
|
MobLoot extraLoot = rollForGlass(mob);
|
||||||
|
if (extraLoot != null) {
|
||||||
|
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate all entries in this bootySet and process accordingly
|
// Iterate all entries in this bootySet and process accordingly
|
||||||
|
|
||||||
for (BootySetEntry bse : entries) {
|
for (BootySetEntry bse : entries) {
|
||||||
switch (bse.bootyType) {
|
switch (bse.bootyType) {
|
||||||
case "GOLD":
|
case "GOLD":
|
||||||
GenerateGoldDrop(mob, bse, inHotzone);
|
GenerateGoldDrop(mob, bse);
|
||||||
break;
|
break;
|
||||||
case "LOOT":
|
case "LOOT":
|
||||||
|
|
||||||
if (mob.getSafeZone() == false)
|
|
||||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
|
||||||
|
|
||||||
if (inHotzone == true)
|
|
||||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
|
||||||
|
|
||||||
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
||||||
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
|
||||||
|
if(ThreadLocalRandom.current().nextInt(1,100) == 50){
|
||||||
// Generate hotzone loot if in hotzone
|
MobLoot extraLoot = rollForContract(bse.genTable, mob);
|
||||||
// Only one bite at the hotzone apple per bootyset.
|
if (extraLoot != null) {
|
||||||
|
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||||
if (inHotzone == true && hotzoneWasRan == false)
|
}
|
||||||
if (_genTables.containsKey(bse.genTable + 1) && ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) {
|
}
|
||||||
GenerateLootDrop(mob, bse.genTable + 1, true); //generate loot drop from hotzone table
|
if(ThreadLocalRandom.current().nextInt(1,100) == 50){
|
||||||
hotzoneWasRan = true;
|
MobLoot extraLoot = rollForRune(bse.genTable, mob);
|
||||||
|
if (extraLoot != null) {
|
||||||
|
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "ITEM":
|
case "ITEM":
|
||||||
GenerateInventoryDrop(mob, bse);
|
GenerateInventoryDrop(mob, bse);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MobLoot specialDrop = null;
|
||||||
|
switch(mob.getObjectUUID()) {
|
||||||
|
case 22595://elf 1
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252134),true);
|
||||||
|
mob.setFirstName("Melandrach The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 22432: //elf 2
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252135),true);
|
||||||
|
mob.setFirstName("Kyrtaar The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 22537: //elf 3
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252136),true);
|
||||||
|
mob.setFirstName("Vamir The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 16387: //human 4 DONE
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252129),true);
|
||||||
|
mob.setFirstName("Alatar The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 32724:// human 5 GOOD
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252130),true);
|
||||||
|
mob.setFirstName("Elphaba The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 23379: //human 1 GOOD
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252131),true);
|
||||||
|
mob.setFirstName("Bavmorda The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 10826: //human 2 REDO
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252132),true);
|
||||||
|
mob.setFirstName("Draco The Blood-Mage");
|
||||||
|
break;
|
||||||
|
case 15929: //human 3 GOOD
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252133),true);
|
||||||
|
mob.setFirstName("Atlantes The Blood-Mage");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(specialDrop != null) {
|
||||||
|
mob.setLevel((short) 65);
|
||||||
|
mob.setSpawnTime(10800);
|
||||||
|
mob.healthMax = (7500);
|
||||||
|
mob.setHealth(7500);
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
|
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||||
|
mob.setResists(new Resists("Dropper"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob) {
|
||||||
|
|
||||||
if (mob == null || _genTables.containsKey(genTableID) == false)
|
if (mob == null || _genTables.containsKey(genTableID) == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
MobLoot outItem;
|
MobLoot outItem;
|
||||||
|
|
||||||
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1);
|
int genRoll = ThreadLocalRandom.current().nextInt(1,94 + 1);
|
||||||
|
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||||
|
|
||||||
@@ -160,7 +215,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
itemTableRoll = TableRoll(mob.level, inHotzone);
|
itemTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||||
if (tableRow == null)
|
if (tableRow == null)
|
||||||
@@ -172,7 +227,10 @@ public enum LootManager {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
int chance = ThreadLocalRandom.current().nextInt(1,101);
|
||||||
|
if(chance > 10)
|
||||||
|
return null;
|
||||||
|
int amount = ThreadLocalRandom.current().nextInt((int)(tableRow.minSpawn * 0.5f), (int)((tableRow.maxSpawn + 1) * 0.5f));
|
||||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +240,7 @@ public enum LootManager {
|
|||||||
|
|
||||||
if(selectedRow.pModTable != 0){
|
if(selectedRow.pModTable != 0){
|
||||||
try {
|
try {
|
||||||
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
|
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll);
|
||||||
outItem.setIsID(false);
|
outItem.setIsID(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
|
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
|
||||||
@@ -190,7 +248,7 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
if(selectedRow.sModTable != 0){
|
if(selectedRow.sModTable != 0){
|
||||||
try {
|
try {
|
||||||
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
|
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll);
|
||||||
outItem.setIsID(false);
|
outItem.setIsID(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||||
@@ -199,7 +257,7 @@ public enum LootManager {
|
|||||||
return outItem;
|
return outItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
|
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
|
||||||
|
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||||
|
|
||||||
@@ -216,7 +274,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
prefixTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||||
|
|
||||||
@@ -231,7 +289,7 @@ public enum LootManager {
|
|||||||
return inItem;
|
return inItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
|
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
|
||||||
|
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||||
|
|
||||||
@@ -248,7 +306,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
suffixTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||||
|
|
||||||
@@ -263,7 +321,7 @@ public enum LootManager {
|
|||||||
return inItem;
|
return inItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
public static int TableRoll(int mobLevel) {
|
||||||
|
|
||||||
if (mobLevel > 65)
|
if (mobLevel > 65)
|
||||||
mobLevel = 65;
|
mobLevel = 65;
|
||||||
@@ -278,15 +336,12 @@ public enum LootManager {
|
|||||||
if (min < 70)
|
if (min < 70)
|
||||||
min = 70;
|
min = 70;
|
||||||
|
|
||||||
if (inHotzone)
|
|
||||||
min += mobLevel;
|
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
|
|
||||||
return roll;
|
return roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) {
|
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse) {
|
||||||
|
|
||||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
|
|
||||||
@@ -297,14 +352,9 @@ public enum LootManager {
|
|||||||
|
|
||||||
//determine and add gold to mob inventory
|
//determine and add gold to mob inventory
|
||||||
|
|
||||||
int high = bse.highGold;
|
int high = (int)(bse.highGold * NORMAL_GOLD_RATE);
|
||||||
int low = bse.lowGold;
|
int low = (int)(bse.lowGold * NORMAL_GOLD_RATE);
|
||||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
int gold = ThreadLocalRandom.current().nextInt(low, high);
|
||||||
|
|
||||||
if (inHotzone == true)
|
|
||||||
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
|
||||||
else
|
|
||||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
|
||||||
|
|
||||||
if (gold > 0) {
|
if (gold > 0) {
|
||||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||||
@@ -313,25 +363,31 @@ public enum LootManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
public static void GenerateLootDrop(Mob mob, int tableID) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(mob.parentZone.getSafeZone() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MobLoot toAdd = getGenTableItem(tableID, mob);
|
||||||
|
if(toAdd.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || toAdd.getItemBase().getType().equals(Enum.ItemType.RUNE))
|
||||||
|
return;//block all contracts and runes that drop outside the confines of the new system
|
||||||
|
|
||||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
if (toAdd != null) {
|
||||||
|
toAdd.setIsID(true);
|
||||||
if (toAdd != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||||
int i = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateEquipmentDrop(Mob mob) {
|
public static void GenerateEquipmentDrop(Mob mob) {
|
||||||
|
|
||||||
if(mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard))
|
if(mob.parentZone.getSafeZone() == 1) {
|
||||||
return; // safehold guards don't drop their equipment
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//do equipment here
|
//do equipment here
|
||||||
int dropCount = 0;
|
int dropCount = 0;
|
||||||
if (mob.getEquip() != null)
|
if (mob.getEquip() != null)
|
||||||
@@ -342,25 +398,64 @@ public enum LootManager {
|
|||||||
|
|
||||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
float dropChance = me.getDropChance() * 100;
|
float dropChance = me.getDropChance() * 100;
|
||||||
|
|
||||||
if (equipmentRoll > dropChance)
|
if (equipmentRoll > dropChance)
|
||||||
continue;
|
continue;
|
||||||
|
ItemBase genericIB = me.getItemBase();
|
||||||
|
if(genericIB.isVorg()){
|
||||||
|
if(genericIB.isClothArmor()){
|
||||||
|
//get random cloth piece
|
||||||
|
genericIB = getRandomVorgCloth();//ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
|
||||||
|
} else if(genericIB.isHeavyArmor()){
|
||||||
|
//get random heavy armor piece
|
||||||
|
genericIB = getRandomVorgHA();//ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
|
||||||
|
} else if(genericIB.isMediumArmor()){
|
||||||
|
//get random medium armor piece
|
||||||
|
genericIB = getRandomVorgMA();//ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
|
||||||
|
} else if(genericIB.isLightArmor()){
|
||||||
|
//get random light armor piece
|
||||||
|
genericIB = getRandomVorgLA();//ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
|
||||||
|
}
|
||||||
|
mob.spawnTime = ThreadLocalRandom.current().nextInt(300,2700);
|
||||||
|
}
|
||||||
|
MobLoot ml = new MobLoot(mob, genericIB, false);
|
||||||
|
|
||||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
if (ml != null && dropCount < 1 && genericIB.isVorg() == false) {
|
||||||
|
|
||||||
if (ml != null && dropCount < 1) {
|
|
||||||
ml.setIsID(true);
|
ml.setIsID(true);
|
||||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||||
mob.getCharItemManager().addItemToInventory(ml);
|
mob.getCharItemManager().addItemToInventory(ml);
|
||||||
dropCount = 1;
|
dropCount = 1;
|
||||||
//break; // Exit on first successful roll.
|
//break; // Exit on first successful roll.
|
||||||
}
|
}
|
||||||
|
if(ml != null && genericIB.isVorg() && mob.getMobBaseID() != 14062){
|
||||||
|
ml.setIsID(true);
|
||||||
|
ml.setDurabilityCurrent(ml.getDurabilityMax());
|
||||||
|
mob.getCharItemManager().addItemToInventory(ml);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||||
|
|
||||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
if(ItemBase.getItemBase(bse.itemBase).isDiscRune()) {
|
||||||
|
if(!Mob.disciplineDroppers.contains(mob))
|
||||||
|
Mob.disciplineDroppers.add(mob);
|
||||||
|
|
||||||
|
mob.setResists(new Resists("Dropper"));
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ItemBase.getItemBase(bse.itemBase).getName() + ". Are you tough enough to take it?");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if((bse.itemBase == 3040 || bse.itemBase == 3021) && mob.level < 80){
|
||||||
|
// chance = 100;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(mob.parentZone.getSafeZone() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 99);
|
||||||
|
|
||||||
//early exit, failed to hit minimum chance roll
|
//early exit, failed to hit minimum chance roll
|
||||||
|
|
||||||
@@ -456,4 +551,164 @@ public enum LootManager {
|
|||||||
itemMan.addItemToInventory(playerWinnings);
|
itemMan.addItemToInventory(playerWinnings);
|
||||||
itemMan.updateInventory();
|
itemMan.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MobLoot rollForContract(int table, Mob mob){
|
||||||
|
|
||||||
|
int roll = 99;
|
||||||
|
if (table == 1900 || table == 1500)
|
||||||
|
roll = 73;
|
||||||
|
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
|
||||||
|
if (selectedRow == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int itemTableId = selectedRow.itemTableID;
|
||||||
|
|
||||||
|
if (_itemTables.containsKey(itemTableId) == false)
|
||||||
|
return null;
|
||||||
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321));
|
||||||
|
if (tableRow == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int itemUUID = tableRow.cacheID;
|
||||||
|
|
||||||
|
if (itemUUID == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||||
|
if(outItem != null) {
|
||||||
|
mob.contractCounter = ThreadLocalRandom.current().nextInt(200);
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " looks like he found something special");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(mob,chatMsg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE,false,false);
|
||||||
|
return outItem;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static MobLoot rollForRune(int table, Mob mob){
|
||||||
|
int roll = 97;
|
||||||
|
if(table == 1900 || table == 1500){
|
||||||
|
roll = 77;
|
||||||
|
}
|
||||||
|
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
|
||||||
|
if (selectedRow == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int itemTableId = selectedRow.itemTableID;
|
||||||
|
|
||||||
|
if (_itemTables.containsKey(itemTableId) == false)
|
||||||
|
return null;
|
||||||
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321));
|
||||||
|
if (tableRow == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int itemUUID = tableRow.cacheID;
|
||||||
|
|
||||||
|
if (itemUUID == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||||
|
if(outItem != null) {
|
||||||
|
mob.runeCounter = ThreadLocalRandom.current().nextInt(200);
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " looks like he found something special");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(mob,chatMsg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE,false,false);
|
||||||
|
return outItem;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static MobLoot rollForGlass( Mob mob){
|
||||||
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(220,321));
|
||||||
|
if (tableRow == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int itemUUID = tableRow.cacheID;
|
||||||
|
|
||||||
|
if (itemUUID == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||||
|
if(outItem != null)
|
||||||
|
return outItem;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemBase getRandomVorgCloth(){
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
if(random < 20)
|
||||||
|
return ItemBase.getItemBase(27600);
|
||||||
|
if(random > 20 && random < 40)
|
||||||
|
return ItemBase.getItemBase(188700);
|
||||||
|
if(random > 40 && random < 60)
|
||||||
|
return ItemBase.getItemBase(188720);
|
||||||
|
if(random > 60 && random < 80)
|
||||||
|
return ItemBase.getItemBase(189550);
|
||||||
|
if(random > 80)
|
||||||
|
return ItemBase.getItemBase(189560);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemBase getRandomVorgLA(){
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(160);
|
||||||
|
if(random < 20)
|
||||||
|
return ItemBase.getItemBase(27550);
|
||||||
|
if(random > 20 && random < 40)
|
||||||
|
return ItemBase.getItemBase(27560);
|
||||||
|
if(random > 40 && random < 60)
|
||||||
|
return ItemBase.getItemBase(189100);
|
||||||
|
if(random > 60 && random < 80)
|
||||||
|
return ItemBase.getItemBase(189110);
|
||||||
|
if(random > 80 && random < 100)
|
||||||
|
return ItemBase.getItemBase(189120);
|
||||||
|
if(random > 100 && random < 120)
|
||||||
|
return ItemBase.getItemBase(189130);
|
||||||
|
if(random > 120 && random < 140)
|
||||||
|
return ItemBase.getItemBase(189140);
|
||||||
|
if(random > 140)
|
||||||
|
return ItemBase.getItemBase(189150);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static ItemBase getRandomVorgMA(){
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(160);
|
||||||
|
if(random < 20)
|
||||||
|
return ItemBase.getItemBase(27570);
|
||||||
|
if(random > 20 && random < 40)
|
||||||
|
return ItemBase.getItemBase(188900);
|
||||||
|
if(random > 40 && random < 60)
|
||||||
|
return ItemBase.getItemBase(188910);
|
||||||
|
if(random > 60 && random < 80)
|
||||||
|
return ItemBase.getItemBase(188920);
|
||||||
|
if(random > 80 && random < 100)
|
||||||
|
return ItemBase.getItemBase(188930);
|
||||||
|
if(random > 100 && random < 120)
|
||||||
|
return ItemBase.getItemBase(188940);
|
||||||
|
if(random > 120 && random < 140)
|
||||||
|
return ItemBase.getItemBase(188950);
|
||||||
|
if(random > 140)
|
||||||
|
return ItemBase.getItemBase(189500);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static ItemBase getRandomVorgHA(){
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(180);
|
||||||
|
if(random < 20)
|
||||||
|
return ItemBase.getItemBase(27580);
|
||||||
|
if(random > 20 && random < 40)
|
||||||
|
return ItemBase.getItemBase(27590);
|
||||||
|
if(random > 40 && random < 60)
|
||||||
|
return ItemBase.getItemBase(188500);
|
||||||
|
if(random > 60 && random < 80)
|
||||||
|
return ItemBase.getItemBase(188510);
|
||||||
|
if(random > 80 && random < 100)
|
||||||
|
return ItemBase.getItemBase(188520);
|
||||||
|
if(random > 100 && random < 120)
|
||||||
|
return ItemBase.getItemBase(188530);
|
||||||
|
if(random > 120 && random < 140)
|
||||||
|
return ItemBase.getItemBase(188540);
|
||||||
|
if(random > 140 && random < 160)
|
||||||
|
return ItemBase.getItemBase(188550);
|
||||||
|
if(random > 160)
|
||||||
|
return ItemBase.getItemBase(189510);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,320 +5,206 @@
|
|||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
// Defines static methods which comprise the magicbane
|
// Defines static methods which comprise the magicbane
|
||||||
// building maintenance system.
|
// building maintenance system.
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
public enum MaintenanceManager {
|
public enum MaintenanceManager {
|
||||||
|
|
||||||
MAINTENANCEMANAGER;
|
MAINTENANCEMANAGER;
|
||||||
|
|
||||||
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
||||||
|
|
||||||
building.maintDateTime = maintDate;
|
building.maintDateTime = maintDate;
|
||||||
DbManager.BuildingQueries.updateMaintDate(building);
|
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);
|
|
||||||
}
|
|
||||||
// Reset maintenance dates for these buildings
|
|
||||||
|
|
||||||
for (Building building : maintList) {
|
|
||||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
|
||||||
|
|
||||||
}
|
|
||||||
// Derak or destroy buildings that did not
|
|
||||||
// have funds available.
|
|
||||||
|
|
||||||
for (Building building : derankList)
|
|
||||||
building.destroyOrDerank(null);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 (building.getRank() == 8) {
|
|
||||||
|
|
||||||
hasResources = true;
|
|
||||||
|
|
||||||
if (warehouse == null)
|
|
||||||
hasResources = false;
|
|
||||||
else {
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
|
||||||
|
|
||||||
if (resourceValue < 5)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
|
||||||
|
|
||||||
if (resourceValue < 5)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Validation completed but has failed. We can derank
|
|
||||||
// the target building and early exit
|
|
||||||
|
|
||||||
if ((hasFunds == false) ||
|
|
||||||
((building.getRank() == 8) && !hasResources)) {
|
|
||||||
|
|
||||||
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
|
||||||
// and it's not an R8 deranking
|
|
||||||
|
|
||||||
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
|
||||||
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Early exit as we're done if we're not an R8 tree
|
|
||||||
|
|
||||||
if (building.getRank() < 8)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Now for the resources if it's an R8 tree
|
|
||||||
|
|
||||||
// Withdraw Stone
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
|
||||||
} else {
|
|
||||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Withdraw Lumber
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
|
||||||
} else {
|
|
||||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Withdraw Galvor
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
|
||||||
} else {
|
|
||||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
|
||||||
} else {
|
|
||||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void dailyMaintenance() {
|
public static void dailyMaintenance() {
|
||||||
|
|
||||||
Logger.info("Maintenance has started");
|
Logger.info("Maintenance has started");
|
||||||
|
|
||||||
// Run maintenance on player buildings
|
// Run maintenance on player buildings
|
||||||
|
|
||||||
if (ConfigManager.MB_WORLD_MAINTENANCE.getValue().equalsIgnoreCase("true"))
|
if (ConfigManager.MB_WORLD_MAINTENANCE.getValue().equalsIgnoreCase("true"))
|
||||||
processBuildingMaintenance();
|
processMaintenance();
|
||||||
else
|
else
|
||||||
Logger.info("Maintenance Costings: DISABLED");
|
Logger.info("Maintenance Costings: DISABLED");
|
||||||
|
|
||||||
Logger.info("Maintenance has completed!");
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,10 @@ public enum MovementManager {
|
|||||||
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
if (((PlayerCharacter) toMove).isCasting())
|
if (((PlayerCharacter) toMove).isCasting())
|
||||||
((PlayerCharacter) toMove).update();
|
((PlayerCharacter) toMove).update();
|
||||||
|
if(((PlayerCharacter) toMove).isFlying() && toMove.getEffects().containsKey("MoveBuff"))
|
||||||
|
PlayerCharacter.GroundPlayer(((PlayerCharacter) toMove));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
toMove.setIsCasting(false);
|
toMove.setIsCasting(false);
|
||||||
toMove.setItemCasting(false);
|
toMove.setItemCasting(false);
|
||||||
|
|
||||||
@@ -116,8 +117,8 @@ public enum MovementManager {
|
|||||||
|
|
||||||
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
||||||
|
|
||||||
if (msg.getInBuildingUUID() > 0) {
|
if (msg.getTargetID() > 0) {
|
||||||
Building building = BuildingManager.getBuildingFromCache(msg.getInBuildingUUID());
|
Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
if (building != null) {
|
if (building != null) {
|
||||||
|
|
||||||
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
||||||
@@ -128,8 +129,8 @@ public enum MovementManager {
|
|||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
toMove.setInBuilding(msg.getInBuilding());
|
toMove.setInBuilding(msg.getInBuilding());
|
||||||
toMove.setInFloorID(msg.getInBuildingFloor());
|
toMove.setInFloorID(msg.getUnknown01());
|
||||||
toMove.setInBuildingID(msg.getInBuildingUUID());
|
toMove.setInBuildingID(msg.getTargetID());
|
||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
||||||
|
|
||||||
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
@@ -174,9 +175,9 @@ public enum MovementManager {
|
|||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
||||||
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
||||||
msg.setInBuilding(toMove.region.level);
|
msg.setInBuilding(toMove.region.level);
|
||||||
msg.setInBuildingFloor(toMove.region.room);
|
msg.setUnknown01(toMove.region.room);
|
||||||
msg.setStartLocType(GameObjectType.Building.ordinal());
|
msg.setTargetType(GameObjectType.Building.ordinal());
|
||||||
msg.setInBuildingUUID(regionBuilding.getObjectUUID());
|
msg.setTargetID(regionBuilding.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -185,8 +186,8 @@ public enum MovementManager {
|
|||||||
toMove.setInBuilding(-1);
|
toMove.setInBuilding(-1);
|
||||||
msg.setStartCoord(toMove.getLoc());
|
msg.setStartCoord(toMove.getLoc());
|
||||||
msg.setEndCoord(endLocation);
|
msg.setEndCoord(endLocation);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
||||||
@@ -233,7 +234,7 @@ public enum MovementManager {
|
|||||||
toMove.cancelOnMove();
|
toMove.cancelOnMove();
|
||||||
|
|
||||||
//cancel any attacks for manual move.
|
//cancel any attacks for manual move.
|
||||||
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getInitiatedFromAttack() == 0)
|
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
|
||||||
toMove.setCombatTarget(null);
|
toMove.setCombatTarget(null);
|
||||||
|
|
||||||
|
|
||||||
@@ -464,7 +465,7 @@ public enum MovementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc) {
|
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
|
||||||
|
|
||||||
|
|
||||||
if (targetLoc == null)
|
if (targetLoc == null)
|
||||||
@@ -473,6 +474,7 @@ public enum MovementManager {
|
|||||||
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
||||||
|
|
||||||
teleporter.stopMovement(targetLoc);
|
teleporter.stopMovement(targetLoc);
|
||||||
|
teleporter.setRegion(region);
|
||||||
|
|
||||||
//mobs ignore region sets for now.
|
//mobs ignore region sets for now.
|
||||||
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
|
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
|||||||
@@ -5,17 +5,13 @@ import engine.InterestManagement.WorldGrid;
|
|||||||
import engine.math.Quaternion;
|
import engine.math.Quaternion;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.PowersBase;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import javax.smartcardio.ATR;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -27,6 +23,84 @@ public enum NPCManager {
|
|||||||
NPC_MANAGER;
|
NPC_MANAGER;
|
||||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||||
|
|
||||||
|
public static void applyRuneSetEffects(Mob mob) {
|
||||||
|
|
||||||
|
// Early exit
|
||||||
|
|
||||||
|
if (mob.runeSet == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Apply all rune effects.
|
||||||
|
|
||||||
|
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
||||||
|
mob.isPlayerGuard = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only captains have contracts
|
||||||
|
|
||||||
|
if (mob.contract != null || mob.isPlayerGuard)
|
||||||
|
applyEffectsForRune(mob, 252621);
|
||||||
|
|
||||||
|
|
||||||
|
// Apply effects from RuneSet
|
||||||
|
|
||||||
|
if (mob.runeSet != 0)
|
||||||
|
for (int runeID : _runeSetMap.get(mob.runeSet))
|
||||||
|
applyEffectsForRune(mob, runeID);
|
||||||
|
|
||||||
|
// Not sure why but apply Warrior effects for some reason?
|
||||||
|
|
||||||
|
applyEffectsForRune(mob, 2518);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
|
||||||
|
|
||||||
|
EffectsBase effectsBase;
|
||||||
|
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
|
||||||
|
|
||||||
|
// Race runes are in the runeset but not in runebase for some reason
|
||||||
|
|
||||||
|
if (sourceRune == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
|
||||||
|
|
||||||
|
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||||
|
|
||||||
|
if (effectsBase == null) {
|
||||||
|
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to upgrade effects if needed.
|
||||||
|
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||||
|
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Current effect is a higher rank, dont apply.
|
||||||
|
if (eff.getTrains() > mbe.getRank())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//new effect is of a higher rank. remove old effect and apply new one.
|
||||||
|
eff.cancelJob();
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
||||||
|
|
||||||
necroPet.setCombatTarget(null);
|
necroPet.setCombatTarget(null);
|
||||||
@@ -122,6 +196,80 @@ public enum NPCManager {
|
|||||||
playerCharacter.necroPets.clear();
|
playerCharacter.necroPets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void removeSiegeMinions(Mob mobile) {
|
||||||
|
|
||||||
|
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
|
||||||
|
|
||||||
|
if (mobile.isMoving()) {
|
||||||
|
|
||||||
|
mobile.stopMovement(mobile.getLoc());
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
toRemove.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
WorldGrid.removeObject(toRemove);
|
||||||
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||||
|
|
||||||
|
if (petOwner != null) {
|
||||||
|
|
||||||
|
petOwner.setPet(null);
|
||||||
|
|
||||||
|
toRemove.guardCaptain = null;
|
||||||
|
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
|
||||||
|
|
||||||
|
// Remove npc from it's building
|
||||||
|
|
||||||
|
try {
|
||||||
|
mobile.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobile.parentZone != null)
|
||||||
|
mobile.parentZone.zoneMobSet.remove(mobile);
|
||||||
|
|
||||||
|
if (building != null) {
|
||||||
|
building.getHirelings().remove(mobile);
|
||||||
|
removeSiegeMinions(mobile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete npc from database
|
||||||
|
|
||||||
|
if (DbManager.MobQueries.DELETE_MOB(mobile) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Remove npc from the simulation
|
||||||
|
|
||||||
|
mobile.removeFromCache();
|
||||||
|
DbManager.removeFromCache(mobile);
|
||||||
|
WorldGrid.RemoveWorldObject(mobile);
|
||||||
|
WorldGrid.removeObject(mobile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadAllPirateNames() {
|
public static void loadAllPirateNames() {
|
||||||
|
|
||||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||||
@@ -192,7 +340,7 @@ public enum NPCManager {
|
|||||||
|
|
||||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||||
Mob siegeMobile = (Mob) abstractCharacter;
|
Mob siegeMobile = (Mob) abstractCharacter;
|
||||||
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildingSlot == -1)
|
if (buildingSlot == -1)
|
||||||
@@ -228,6 +376,33 @@ public enum NPCManager {
|
|||||||
return buildingSlot;
|
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) {
|
public static void AssignPatrolPoints(Mob mob) {
|
||||||
mob.patrolPoints = new ArrayList<>();
|
mob.patrolPoints = new ArrayList<>();
|
||||||
|
|
||||||
@@ -244,234 +419,9 @@ public enum NPCManager {
|
|||||||
mob.patrolPoints.add(newPatrolPoint);
|
mob.patrolPoints.add(newPatrolPoint);
|
||||||
|
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
mob.setLoc(newPatrolPoint);
|
mob.loc = newPatrolPoint;
|
||||||
mob.endLoc = newPatrolPoint;
|
mob.endLoc = newPatrolPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyGuardStanceModifiers(Mob guard){
|
|
||||||
float damageModifier = 1;
|
|
||||||
float attackRatingModifier = 1;
|
|
||||||
float defenseModifier = 1;
|
|
||||||
float attackSpeedModifier = 1;
|
|
||||||
float powerDamageModifier = 1;
|
|
||||||
//handle stance modifiers for guard mob
|
|
||||||
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){
|
|
||||||
//apply rogue bonuses
|
|
||||||
attackRatingModifier += 0.5f;
|
|
||||||
defenseModifier += 0.5f;
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}else {
|
|
||||||
Integer contractID;
|
|
||||||
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
|
||||||
contractID = guard.guardCaptain.contract.getContractID();
|
|
||||||
} else{
|
|
||||||
contractID = guard.contract.getContractID();
|
|
||||||
}
|
|
||||||
if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()){
|
|
||||||
//apply mage offensive Stance
|
|
||||||
powerDamageModifier += 0.5f;
|
|
||||||
} else{
|
|
||||||
//apply fighter offensive stance
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
guard.minDamageHandOne *= damageModifier;
|
|
||||||
guard.minDamageHandTwo *= damageModifier;
|
|
||||||
guard.maxDamageHandOne *= damageModifier;
|
|
||||||
guard.maxDamageHandTwo *= damageModifier;
|
|
||||||
guard.atrHandOne *= attackRatingModifier;
|
|
||||||
guard.atrHandTwo *= attackRatingModifier;
|
|
||||||
guard.defenseRating *= defenseModifier;
|
|
||||||
guard.speedHandOne *= attackSpeedModifier;
|
|
||||||
guard.speedHandTwo *= attackSpeedModifier;
|
|
||||||
|
|
||||||
//TODO figure out how to apply +50% powerdamage to mage guards
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDamageAndSpeedForGuard(Mob guard){
|
|
||||||
|
|
||||||
float rankModifier = 1 + (guard.getRank() * 0.1f);
|
|
||||||
int primaryStat = 0;
|
|
||||||
if(guard.equip == null) {
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier);
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier);
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
}else{
|
|
||||||
if(guard.equip.containsKey(1)){
|
|
||||||
//has main hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(1).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = weapon.getSpeed();
|
|
||||||
guard.rangeHandOne = weapon.getRange();
|
|
||||||
} else if(guard.equip.containsKey(2) && !guard.equip.get(2).getItemBase().isShield()){
|
|
||||||
//has off hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(2).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandTwo = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandTwo = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandTwo = weapon.getSpeed();
|
|
||||||
guard.rangeHandTwo = weapon.getRange();
|
|
||||||
} else {
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
guard.rangeHandOne = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDefenseForGuard(Mob guard){
|
|
||||||
int dexterity = guard.getStatDexCurrent();
|
|
||||||
if(dexterity < 1)
|
|
||||||
dexterity = 1;
|
|
||||||
int baseDef = guard.mobBase.getDefenseRating();
|
|
||||||
int armorDefense = 0;
|
|
||||||
for(MobEquipment equipped : guard.equip.values())
|
|
||||||
if(equipped.getItemBase().isArmor() || equipped.getItemBase().isShield())
|
|
||||||
armorDefense += equipped.getItemBase().getDefense();
|
|
||||||
guard.defenseRating = dexterity + baseDef + armorDefense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setAttackRatingForGuard(Mob guard) {
|
|
||||||
int strength = guard.getStatStrCurrent();
|
|
||||||
int baseAtr = guard.mobBase.getAttackRating();
|
|
||||||
if (guard.equip.get(1) != null)
|
|
||||||
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(1).getItemBase().getPercentRequired() * 4) + (guard.equip.get(1).getItemBase().getPercentRequired() * 3));
|
|
||||||
else if (guard.equip.get(2) != null && !guard.equip.get(2).getItemBase().isShield())
|
|
||||||
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(2).getItemBase().getPercentRequired() * 4) + (guard.equip.get(2).getItemBase().getPercentRequired() * 3));
|
|
||||||
else
|
|
||||||
guard.atrHandOne = baseAtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMaxHealthForGuard(Mob guard){
|
|
||||||
//values derived fom reading memory address for health on client when selecting player guards
|
|
||||||
switch(guard.getRank()){
|
|
||||||
default:
|
|
||||||
guard.healthMax = 750; //rank 1
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
guard.healthMax = 2082;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
guard.healthMax = 2740;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
guard.healthMax = 3414;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
guard.healthMax = 4080;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
guard.healthMax = 4746;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
guard.healthMax = 5412;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseEffects(Mob mob) {
|
|
||||||
EffectsBase effectsBase;
|
|
||||||
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
|
|
||||||
|
|
||||||
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
|
||||||
|
|
||||||
if (effectsBase == null) {
|
|
||||||
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check to upgrade effects if needed.
|
|
||||||
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
|
|
||||||
|
|
||||||
if (eff == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Current effect is a higher rank, dont apply.
|
|
||||||
if (eff.getTrains() > mbe.getRank())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//new effect is of a higher rank. remove old effect and apply new one.
|
|
||||||
eff.cancelJob();
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyEquipmentResists(Mob mob){
|
|
||||||
if(mob.equip != null){
|
|
||||||
for(MobEquipment equipped : mob.equip.values()){
|
|
||||||
ItemBase itemBase = equipped.getItemBase();
|
|
||||||
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
|
||||||
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseSkill(Mob mob) {
|
|
||||||
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
|
|
||||||
if(baseSkill != null)
|
|
||||||
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRuneSkills(Mob mob, int runeID){
|
|
||||||
//load mob skill adjustments from mobbase rune
|
|
||||||
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
|
|
||||||
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
|
|
||||||
if(SkillsBase.getFromCache(entry.skill_type) == null)
|
|
||||||
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
|
|
||||||
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
|
|
||||||
if(skillBase == null)
|
|
||||||
continue;
|
|
||||||
if (entry.level <= mob.level)
|
|
||||||
if (mob.skills.containsKey(entry.name) == false)
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
|
|
||||||
else
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRunesForNPC(NPC npc){
|
|
||||||
npc.runes = new ArrayList<>();
|
|
||||||
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
|
|
||||||
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID());
|
|
||||||
npc.runes.add(shopkeeper);
|
|
||||||
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
|
|
||||||
for (int runeID : _runeSetMap.get(npc.runeSetID)) {
|
|
||||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
|
||||||
if(rb != null) {
|
|
||||||
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
|
|
||||||
npc.runes.add(toApply);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import engine.net.client.ClientConnection;
|
|||||||
import engine.net.client.msg.*;
|
import engine.net.client.msg.*;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.*;
|
import engine.powers.*;
|
||||||
|
import engine.powers.effectmodifiers.SeeInvisibleEffectModifier;
|
||||||
import engine.powers.poweractions.AbstractPowerAction;
|
import engine.powers.poweractions.AbstractPowerAction;
|
||||||
import engine.powers.poweractions.TrackPowerAction;
|
import engine.powers.poweractions.TrackPowerAction;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
@@ -53,10 +54,29 @@ public enum PowersManager {
|
|||||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers;
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
|
|
||||||
private static JobScheduler js;
|
private static JobScheduler js;
|
||||||
|
|
||||||
|
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
|
||||||
|
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
|
||||||
|
|
||||||
|
public static ArrayList<PowerQueObject> static_power_que = new ArrayList<>();
|
||||||
|
|
||||||
|
public static class PowerQueObject{
|
||||||
|
public PowerQueObject(PerformActionMsg inmsg,ClientConnection inorigin,boolean insendCastToSelf){
|
||||||
|
this.msg = inmsg;
|
||||||
|
this.origin = inorigin;
|
||||||
|
this.sendCastToSelf = insendCastToSelf;
|
||||||
|
}
|
||||||
|
public PerformActionMsg msg;
|
||||||
|
public ClientConnection origin;
|
||||||
|
public boolean sendCastToSelf;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PowersManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void initPowersManager(boolean fullPowersLoad) {
|
public static void initPowersManager(boolean fullPowersLoad) {
|
||||||
|
|
||||||
if (fullPowersLoad)
|
if (fullPowersLoad)
|
||||||
@@ -100,16 +120,6 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<RunePowerEntry> getPowersForRune(int rune_id) {
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> powerEntries = PowersManager._allRunePowers.get(rune_id);
|
|
||||||
|
|
||||||
if (powerEntries == null)
|
|
||||||
powerEntries = new ArrayList<>();
|
|
||||||
|
|
||||||
return powerEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This pre-loads all powers and effects
|
// This pre-loads all powers and effects
|
||||||
public static void InitializePowers() {
|
public static void InitializePowers() {
|
||||||
|
|
||||||
@@ -172,11 +182,9 @@ public enum PowersManager {
|
|||||||
|
|
||||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||||
// Cast failed for some reason, reset timer
|
// Cast failed for some reason, reset timer
|
||||||
|
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
// Send Fail to cast message
|
// Send Fail to cast message
|
||||||
PlayerCharacter pc = SessionManager
|
PlayerCharacter pc = SessionManager
|
||||||
.getPlayerCharacter(origin);
|
.getPlayerCharacter(origin);
|
||||||
@@ -210,6 +218,8 @@ public enum PowersManager {
|
|||||||
if (playerCharacter == null)
|
if (playerCharacter == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
boolean skipCheck = false;
|
||||||
|
|
||||||
boolean CSRCast = false;
|
boolean CSRCast = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -222,10 +232,67 @@ public enum PowersManager {
|
|||||||
+ Integer.toHexString(msg.getPowerUsedID()) + " ("
|
+ Integer.toHexString(msg.getPowerUsedID()) + " ("
|
||||||
+ msg.getPowerUsedID() + ')');
|
+ msg.getPowerUsedID() + ')');
|
||||||
}
|
}
|
||||||
|
Boolean earlyExit = false;
|
||||||
//Sending recycle message to player if died while casting.
|
//Sending recycle message to player if died while casting.
|
||||||
if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor
|
if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor
|
||||||
|
|
||||||
|
earlyExit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.getPowerUsedID() == 430628895){ // group teleport
|
||||||
|
|
||||||
|
Boolean activeBane = false;
|
||||||
|
|
||||||
|
if(ZoneManager.getCityAtLocation(playerCharacter.loc) != null && ZoneManager.getCityAtLocation(playerCharacter.loc).getBane() != null)
|
||||||
|
activeBane = ZoneManager.getCityAtLocation(playerCharacter.loc).getBane().getSiegePhase().equals(SiegePhase.WAR);
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(playerCharacter.loc);
|
||||||
|
if(currentZone == null)
|
||||||
|
earlyExit = true;
|
||||||
|
|
||||||
|
if(currentZone.isPlayerCity() && !activeBane)
|
||||||
|
earlyExit = true;
|
||||||
|
|
||||||
|
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
|
||||||
|
for (Building building : currentZone.zoneBuildingSet) {
|
||||||
|
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
|
||||||
|
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
|
||||||
|
if (currentMine.isActive == false) {
|
||||||
|
earlyExit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getTargetX(),msg.getTargetY(),msg.getTargetZ());
|
||||||
|
currentZone = ZoneManager.findSmallestZone(endLoc);
|
||||||
|
|
||||||
|
if(currentZone == null)
|
||||||
|
earlyExit = true;
|
||||||
|
|
||||||
|
if(currentZone.isPlayerCity() && !activeBane)
|
||||||
|
earlyExit = true;
|
||||||
|
|
||||||
|
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
|
||||||
|
for (Building building : currentZone.zoneBuildingSet) {
|
||||||
|
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
|
||||||
|
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
|
||||||
|
if (currentMine.isActive == false) {
|
||||||
|
earlyExit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// get power
|
||||||
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
|
|
||||||
|
if(pb.description.equals("Personal Movement Buff") && playerCharacter.isFlying()) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "You cannot use movement speed buffs while flying");
|
||||||
|
earlyExit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (earlyExit) {
|
||||||
|
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
@@ -233,7 +300,6 @@ public enum PowersManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
|
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
|
||||||
// sendPowerMsg(pc, 10, msg);
|
// sendPowerMsg(pc, 10, msg);
|
||||||
// return false;
|
// return false;
|
||||||
@@ -246,8 +312,6 @@ public enum PowersManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get power
|
|
||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
|
||||||
if (pb == null) {
|
if (pb == null) {
|
||||||
ChatManager.chatSayInfo(playerCharacter,
|
ChatManager.chatSayInfo(playerCharacter,
|
||||||
"This power is not implemented yet.");
|
"This power is not implemented yet.");
|
||||||
@@ -258,15 +322,18 @@ public enum PowersManager {
|
|||||||
return true;
|
return true;
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCharacter.getLastPower() != null)
|
if (playerCharacter.getLastPower() != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Check if Power Target is allowed to cast.
|
//Check if Power Target is allowed to cast.
|
||||||
|
|
||||||
|
|
||||||
// Check powers for normal users
|
// Check powers for normal users
|
||||||
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
|
|
||||||
|
if(msg.getPowerUsedID() == 429399948)
|
||||||
|
for(CharacterRune cr : playerCharacter.getRunes())
|
||||||
|
if(cr.getRuneBaseID() == 3029)
|
||||||
|
skipCheck = true;
|
||||||
|
if (!skipCheck && (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID())))
|
||||||
if (!playerCharacter.isCSR()) {
|
if (!playerCharacter.isCSR()) {
|
||||||
if (!MBServerStatics.POWERS_DEBUG) {
|
if (!MBServerStatics.POWERS_DEBUG) {
|
||||||
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
||||||
@@ -279,18 +346,31 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// get numTrains for power
|
// get numTrains for power
|
||||||
int trains = msg.getNumTrains();
|
int trains = msg.getNumTrains();
|
||||||
|
int token = pb.token;
|
||||||
|
int overrideTrains = 0;
|
||||||
|
int overrideRecycle = 0;
|
||||||
|
if(token == 429420458){
|
||||||
|
overrideTrains = 40;
|
||||||
|
overrideRecycle = 300000;
|
||||||
|
}
|
||||||
// can't go over the max trains for the power, unless CSR
|
// can't go over the max trains for the power, unless CSR
|
||||||
if (trains > pb.getMaxTrains() && !playerCharacter.isCSR()) {
|
if (trains > pb.getMaxTrains() && !playerCharacter.isCSR()) {
|
||||||
trains = pb.getMaxTrains();
|
trains = pb.getMaxTrains();
|
||||||
msg.setNumTrains(trains);
|
msg.setNumTrains(trains);
|
||||||
}
|
}
|
||||||
|
|
||||||
// can't go over total trains by player
|
// can't go over total trains by player
|
||||||
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
||||||
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
||||||
if (cp != null) {
|
if (cp != null) {
|
||||||
int tot = cp.getTotalTrains();
|
int tot = cp.getTotalTrains();
|
||||||
|
switch(token){
|
||||||
|
case 430596127:
|
||||||
|
if(playerCharacter.getPromotionClass().getName().equals("Wizard"))
|
||||||
|
tot = 40; //single teleport granted at 40 for wizard
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (tot == 0 && !playerCharacter.isCSR())
|
if (tot == 0 && !playerCharacter.isCSR())
|
||||||
return false;
|
return false;
|
||||||
if (trains != tot && !playerCharacter.isCSR()) {
|
if (trains != tot && !playerCharacter.isCSR()) {
|
||||||
@@ -299,27 +379,19 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(overrideTrains > 0)
|
||||||
|
msg.setNumTrains(overrideTrains);
|
||||||
// get recycle time in ms
|
// get recycle time in ms
|
||||||
int time = pb.getRecycleTime(trains);
|
int time = pb.getRecycleTime(trains);
|
||||||
|
|
||||||
// verify player is in correct mode (combat/nonCombat)
|
if(overrideRecycle > 0)
|
||||||
if (playerCharacter.isCombat()) {
|
time = overrideRecycle;
|
||||||
if (!pb.allowedInCombat())
|
|
||||||
// ChatManager.chatPowerError(pc,
|
|
||||||
// "This power is not allowed in combat mode.");
|
|
||||||
return true;
|
|
||||||
} else if (!pb.allowedOutOfCombat())
|
|
||||||
// ChatManager.chatPowerError(pc,
|
|
||||||
// "You must be in combat mode to use this power.");
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// verify player is not stunned or prohibited from casting
|
// verify player is not stunned or prohibited from casting
|
||||||
PlayerBonuses bonus = playerCharacter.getBonuses();
|
PlayerBonuses bonus = playerCharacter.getBonuses();
|
||||||
SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
|
SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
|
||||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// if moving make sure spell valid for movement
|
// if moving make sure spell valid for movement
|
||||||
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
||||||
|
|
||||||
@@ -345,35 +417,43 @@ public enum PowersManager {
|
|||||||
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
||||||
if (pb.isAOE()) {
|
if (pb.isAOE()) {
|
||||||
if (!pb.usePointBlank()) {
|
if (!pb.usePointBlank()) {
|
||||||
AbstractWorldObject target = getTarget(msg);
|
AbstractWorldObject target;
|
||||||
|
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||||
|
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||||
|
target = pet;
|
||||||
|
}else{
|
||||||
|
target = getTarget(msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (target != null && target.getObjectType() == GameObjectType.Building && !pb.targetBuilding()) {
|
if (target != null && target.getObjectType() == GameObjectType.Building && !pb.targetBuilding()) {
|
||||||
PowersManager.sendPowerMsg(playerCharacter, 9, new PerformActionMsg(msg));
|
PowersManager.sendPowerMsg(playerCharacter, 9, new PerformActionMsg(msg));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
if (playerCharacter.getLoc().distanceSquared2D(msg.getTargetLoc()) > sqr(pb
|
if (playerCharacter.getLoc().distanceSquared2D(msg.getTargetLoc()) > sqr(pb
|
||||||
.getRange()))
|
.getRange()))
|
||||||
return true;
|
return true;
|
||||||
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange()))
|
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange())) {
|
||||||
// pc.getLoc().distance(target.getLoc()) >
|
// pc.getLoc().distance(target.getLoc()) >
|
||||||
// pb.getRange())
|
// pb.getRange())
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// get target
|
// get target
|
||||||
AbstractWorldObject target = getTarget(msg);
|
AbstractWorldObject target;
|
||||||
|
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||||
if (target == null)
|
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||||
|
target = pet;
|
||||||
|
}else{
|
||||||
|
target = getTarget(msg);
|
||||||
|
}
|
||||||
|
if (target == null) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216)
|
if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
float range = pb.getRange();
|
float range = pb.getRange();
|
||||||
// verify target is in range
|
// verify target is in range
|
||||||
|
|
||||||
@@ -382,16 +462,13 @@ public enum PowersManager {
|
|||||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||||
// TODO send message that target is out of range
|
// TODO send message that target is out of range
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// verify target is valid type
|
// verify target is valid type
|
||||||
if (!validateTarget(target, playerCharacter, pb))
|
if (!validateTarget(target, playerCharacter, pb))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
targetLiveCounter = ((AbstractCharacter) target).getLiveCounter();
|
targetLiveCounter = ((AbstractCharacter) target).getLiveCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify regular player can cast spell, otherwise authenticate
|
// verify regular player can cast spell, otherwise authenticate
|
||||||
if (!pb.regularPlayerCanCast()) {
|
if (!pb.regularPlayerCanCast()) {
|
||||||
Account a = SessionManager.getAccount(playerCharacter);
|
Account a = SessionManager.getAccount(playerCharacter);
|
||||||
@@ -401,7 +478,6 @@ public enum PowersManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify player has proper effects applied to use power
|
// verify player has proper effects applied to use power
|
||||||
if (pb.getEffectPrereqs().size() > 0 && playerCharacter.getEffects() != null) {
|
if (pb.getEffectPrereqs().size() > 0 && playerCharacter.getEffects() != null) {
|
||||||
|
|
||||||
@@ -415,11 +491,9 @@ public enum PowersManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!passed)
|
if (!passed)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//verify player has proper equipment to use power
|
//verify player has proper equipment to use power
|
||||||
if (pb.getEquipPrereqs().size() > 0) {
|
if (pb.getEquipPrereqs().size() > 0) {
|
||||||
|
|
||||||
@@ -538,6 +612,13 @@ public enum PowersManager {
|
|||||||
// get cast time in ms.
|
// get cast time in ms.
|
||||||
time = pb.getCastTime(trains);
|
time = pb.getCastTime(trains);
|
||||||
|
|
||||||
|
|
||||||
|
if(pb.token == 430596127)
|
||||||
|
time = 5000;
|
||||||
|
|
||||||
|
if(pb.name.equals("Summon") && playerCharacter.getRace().getName().contains("Vampire"))
|
||||||
|
time = 60000;
|
||||||
|
|
||||||
// set player is casting for regens
|
// set player is casting for regens
|
||||||
|
|
||||||
|
|
||||||
@@ -549,6 +630,10 @@ public enum PowersManager {
|
|||||||
|
|
||||||
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
||||||
|
|
||||||
|
if(msg.getPowerUsedID() == 429495514 && playerCharacter.getRace().getName().contains("Shade")){
|
||||||
|
copyMsg.setPowerUsedID(429397210);//intercept shade using hide and cast sneak instead
|
||||||
|
}
|
||||||
|
|
||||||
// run timer job to end cast
|
// run timer job to end cast
|
||||||
if (time < 1) // run immediately
|
if (time < 1) // run immediately
|
||||||
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
||||||
@@ -614,7 +699,13 @@ public enum PowersManager {
|
|||||||
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
||||||
if (pb.isAOE()) {
|
if (pb.isAOE()) {
|
||||||
if (!pb.usePointBlank()) {
|
if (!pb.usePointBlank()) {
|
||||||
AbstractWorldObject target = getTarget(msg);
|
AbstractWorldObject target;
|
||||||
|
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||||
|
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||||
|
target = pet;
|
||||||
|
}else{
|
||||||
|
target = getTarget(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -629,7 +720,13 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// get target
|
// get target
|
||||||
AbstractWorldObject target = getTarget(msg);
|
AbstractWorldObject target;
|
||||||
|
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||||
|
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||||
|
target = pet;
|
||||||
|
}else{
|
||||||
|
target = getTarget(msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return true;
|
return true;
|
||||||
@@ -1234,9 +1331,8 @@ public enum PowersManager {
|
|||||||
if (pc == null)
|
if (pc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerCharacter target = SessionManager
|
PlayerCharacter target = SessionManager.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||||
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
if (target == null || target.equals(pc) || target.isCombat() || target.getGuild().getNation().equals(pc.getGuild().getNation()) == false) {
|
||||||
if (target == null || target.equals(pc) || target.isCombat()) {
|
|
||||||
|
|
||||||
if (target == null) // Player not found. Send not found message
|
if (target == null) // Player not found. Send not found message
|
||||||
ChatManager.chatInfoError(pc,
|
ChatManager.chatInfoError(pc,
|
||||||
@@ -1245,7 +1341,10 @@ public enum PowersManager {
|
|||||||
ChatManager.chatInfoError(pc,
|
ChatManager.chatInfoError(pc,
|
||||||
"Cannot summon player in combat.");
|
"Cannot summon player in combat.");
|
||||||
// else trying to summon self, just fail
|
// else trying to summon self, just fail
|
||||||
|
if(target != null && target.getGuild().getNation().equals(pc.getGuild().getNation()) == false){
|
||||||
|
ChatManager.chatInfoError(pc,
|
||||||
|
"Cannot summon outside of nation.");
|
||||||
|
}
|
||||||
// recycle summon
|
// recycle summon
|
||||||
sendRecyclePower(msg.getPowerToken(), origin);
|
sendRecyclePower(msg.getPowerToken(), origin);
|
||||||
|
|
||||||
@@ -1277,7 +1376,7 @@ public enum PowersManager {
|
|||||||
if (source == null)
|
if (source == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long tooLate = pc.getSummoner(source.getObjectUUID());
|
long tooLate = pc.getSummoner(source.getObjectUUID()) + 45000;
|
||||||
if (tooLate < System.currentTimeMillis()) {
|
if (tooLate < System.currentTimeMillis()) {
|
||||||
ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
|
ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
|
||||||
pc.removeSummoner(source.getObjectUUID());
|
pc.removeSummoner(source.getObjectUUID());
|
||||||
@@ -1339,7 +1438,15 @@ public enum PowersManager {
|
|||||||
duration = 15000; // Healer Summons, 15 seconds
|
duration = 15000; // Healer Summons, 15 seconds
|
||||||
else
|
else
|
||||||
duration = 45000; // Belgosh Summons, 45 seconds
|
duration = 45000; // Belgosh Summons, 45 seconds
|
||||||
|
if(pc.inSafeZone() == false) {
|
||||||
|
for (AbstractWorldObject absChar : WorldGrid.getObjectsInRangePartial(pc.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)) {
|
||||||
|
PlayerCharacter player = (PlayerCharacter) absChar;
|
||||||
|
if (player.guild.getNation().equals(pc.guild.getNation()) == false) {
|
||||||
|
duration += 60000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Teleport to summoners location
|
// Teleport to summoners location
|
||||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||||
@@ -1468,6 +1575,41 @@ public enum PowersManager {
|
|||||||
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
||||||
allTargets, playerCharacter, maxTargets);
|
allTargets, playerCharacter, maxTargets);
|
||||||
|
|
||||||
|
trackChars = new HashSet<>();
|
||||||
|
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
|
||||||
|
//ArrayList<Guild> nationsInRange = new ArrayList<>();
|
||||||
|
ArrayList<AbstractWorldObject> purgeList = new ArrayList<>();
|
||||||
|
for(AbstractWorldObject trackChar : allInRange) {
|
||||||
|
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||||
|
purgeList.add(trackChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
allInRange.removeAll(purgeList);
|
||||||
|
|
||||||
|
//first round to add players in range
|
||||||
|
for(AbstractWorldObject trackChar : allInRange){
|
||||||
|
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||||
|
continue;
|
||||||
|
if(allInRange.contains(trackChar)) {
|
||||||
|
trackChars.add((AbstractCharacter)trackChar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//track full range for chaining nation members
|
||||||
|
ArrayList<Guild> nationsInRange = new ArrayList<>();
|
||||||
|
for(AbstractCharacter pc : trackChars){
|
||||||
|
if(nationsInRange.contains(pc.guild.getNation()) == false)
|
||||||
|
nationsInRange.add(pc.guild.getNation());
|
||||||
|
}
|
||||||
|
HashSet<AbstractWorldObject> fullRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,1024,MBServerStatics.MASK_PLAYER);
|
||||||
|
for(AbstractWorldObject trackChar : fullRange) {
|
||||||
|
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||||
|
continue;
|
||||||
|
if(nationsInRange.contains(((PlayerCharacter) trackChar).guild.getNation()) && trackChars.contains(trackChar) == false)
|
||||||
|
trackChars.add((AbstractCharacter)trackChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||||
|
|
||||||
// send track window
|
// send track window
|
||||||
@@ -1643,7 +1785,8 @@ public enum PowersManager {
|
|||||||
ac.setItemCasting(false);
|
ac.setItemCasting(false);
|
||||||
if (ac == null || target == null || pb == null)
|
if (ac == null || target == null || pb == null)
|
||||||
return;
|
return;
|
||||||
|
if(pb.targetSelf)
|
||||||
|
target = ac;
|
||||||
ac.clearTimer(Integer.toString(pb.getToken()));
|
ac.clearTimer(Integer.toString(pb.getToken()));
|
||||||
if (liveCounter == ac.getLiveCounter())
|
if (liveCounter == ac.getLiveCounter())
|
||||||
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
|
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
|
||||||
@@ -2224,9 +2367,9 @@ public enum PowersManager {
|
|||||||
|
|
||||||
int type = msg.getTargetType();
|
int type = msg.getTargetType();
|
||||||
int UUID = msg.getTargetID();
|
int UUID = msg.getTargetID();
|
||||||
|
if (type == -1 || type == 0 || UUID == -1 || UUID == 0) {
|
||||||
if (type == -1 || type == 0 || UUID == -1 || UUID == 0)
|
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (AbstractWorldObject) DbManager.getObject(GameObjectType.values()[type], UUID);
|
return (AbstractWorldObject) DbManager.getObject(GameObjectType.values()[type], UUID);
|
||||||
}
|
}
|
||||||
@@ -2249,17 +2392,11 @@ public enum PowersManager {
|
|||||||
ChatManager.chatSystemInfo(pc, smsg);
|
ChatManager.chatSystemInfo(pc, smsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int chance;
|
float constant = (atr+defense)*0.315f;
|
||||||
|
float atrChance = atr - constant;
|
||||||
if (atr > defense || defense == 0)
|
float defChance = defense - constant + atrChance;
|
||||||
chance = 94;
|
float smallChance = atrChance/defChance;
|
||||||
else {
|
int chance = (int)(smallChance * 100);
|
||||||
float dif = atr / defense;
|
|
||||||
if (dif <= 0.8f)
|
|
||||||
chance = 4;
|
|
||||||
else
|
|
||||||
chance = ((int) (450 * (dif - 0.8f)) + 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate hit/miss
|
// calculate hit/miss
|
||||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||||
@@ -2467,11 +2604,11 @@ public enum PowersManager {
|
|||||||
ChatManager.chatSystemInfo(pc, outmsg);
|
ChatManager.chatSystemInfo(pc, outmsg);
|
||||||
return false; // can't target player, stop here
|
return false; // can't target player, stop here
|
||||||
} // target is mob
|
} // target is mob
|
||||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0)
|
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == false)
|
||||||
return pb.targetMob();
|
return pb.targetMob();
|
||||||
|
|
||||||
// target is pet
|
// target is pet
|
||||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_PET) != 0)
|
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == true)
|
||||||
return pb.targetPet();
|
return pb.targetPet();
|
||||||
|
|
||||||
// target is Building
|
// target is Building
|
||||||
@@ -2550,7 +2687,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
PowersBase power = getLastPower(ac);
|
PowersBase power = getLastPower(ac);
|
||||||
|
|
||||||
if (power != null && power.cancelOnTakeDamage())
|
if (power != null && power.cancelOnTakeDamage() && power.getName().equals("Translocate") == false)
|
||||||
cancelPower(ac, true);
|
cancelPower(ac, true);
|
||||||
cancelItems(ac, false, true);
|
cancelItems(ac, false, true);
|
||||||
ac.cancelTimer("Stuck");
|
ac.cancelTimer("Stuck");
|
||||||
@@ -2710,8 +2847,13 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void applyZergBuff(AbstractGameObject obj){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static void removeZergBuff(HashSet<Integer> playersIDs){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.objects.City;
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.db.archive.MineRecord;
|
||||||
import engine.objects.Runegate;
|
import engine.net.DispatchMessage;
|
||||||
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -22,6 +24,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -33,13 +36,14 @@ public enum SimulationManager {
|
|||||||
SERVERHEARTBEAT;
|
SERVERHEARTBEAT;
|
||||||
|
|
||||||
private static final long CITY_PULSE = 2000;
|
private static final long CITY_PULSE = 2000;
|
||||||
private static final long RUNEGATE_PULSE = 3000;
|
private static final long RUNEGATE_PULSE = 500;
|
||||||
private static final long UPDATE_PULSE = 1000;
|
private static final long UPDATE_PULSE = 1000;
|
||||||
private static final long FlIGHT_PULSE = 100;
|
private static final long FlIGHT_PULSE = 100;
|
||||||
public static Duration executionTime = Duration.ofNanos(1);
|
public static Duration executionTime = Duration.ofNanos(1);
|
||||||
public static Duration executionMax = Duration.ofNanos(1);
|
public static Duration executionMax = Duration.ofNanos(1);
|
||||||
private static SimulationManager instance = null;
|
private static SimulationManager instance = null;
|
||||||
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||||
|
private long _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||||
private long _runegatePulseTime = System.currentTimeMillis()
|
private long _runegatePulseTime = System.currentTimeMillis()
|
||||||
+ RUNEGATE_PULSE;
|
+ RUNEGATE_PULSE;
|
||||||
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
|
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
|
||||||
@@ -69,6 +73,8 @@ public enum SimulationManager {
|
|||||||
return popString;
|
return popString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the simulation. *** Important: Whatever you do in here, do it damn
|
* Update the simulation. *** Important: Whatever you do in here, do it damn
|
||||||
* quick!
|
* quick!
|
||||||
@@ -126,7 +132,17 @@ public enum SimulationManager {
|
|||||||
e.printStackTrace();
|
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());
|
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
|
||||||
|
|
||||||
if (executionTime.compareTo(executionMax) > 0)
|
if (executionTime.compareTo(executionMax) > 0)
|
||||||
@@ -203,7 +219,6 @@ public enum SimulationManager {
|
|||||||
city = (City) cityObject;
|
city = (City) cityObject;
|
||||||
city.onEnter();
|
city.onEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getMultiplier5Man(int count) {
|
||||||
|
float[] thresholds = {0.25f, 0.43f, 0.56f, 0.67f, 0.75f};
|
||||||
|
return getMultiplier(count, 5, thresholds);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getMultiplier20Man(int count) {
|
||||||
|
return getMultiplier10Man(count * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getMultiplier40Man(int count) {
|
||||||
|
return getMultiplier10Man(count * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.HeightMap;
|
|
||||||
import engine.db.archive.CityRecord;
|
import engine.db.archive.CityRecord;
|
||||||
import engine.db.archive.DataWarehouse;
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
@@ -454,31 +453,4 @@ public enum ZoneManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float caclulateWorldAltitude(Zone zone) {
|
|
||||||
|
|
||||||
float worldAlttitude = MBServerStatics.SEA_FLOOR_ALTITUDE;
|
|
||||||
|
|
||||||
// Seafloor
|
|
||||||
|
|
||||||
if (zone.getParent() == null)
|
|
||||||
return worldAlttitude;
|
|
||||||
|
|
||||||
Zone parentZone = zone.getParent();
|
|
||||||
|
|
||||||
// Children of seafloor
|
|
||||||
|
|
||||||
if (parentZone.getParent() == null)
|
|
||||||
return worldAlttitude + zone.getYCoord();
|
|
||||||
|
|
||||||
// return height from heightmap engine at zone location
|
|
||||||
|
|
||||||
worldAlttitude = HeightMap.getWorldHeight(parentZone, zone.getLoc());
|
|
||||||
|
|
||||||
// Add zone offset to value
|
|
||||||
|
|
||||||
worldAlttitude += zone.getYCoord();
|
|
||||||
|
|
||||||
return worldAlttitude;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,13 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.job.AbstractScheduleJob;
|
import engine.job.AbstractScheduleJob;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
|
import engine.objects.Bane;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
|
import engine.workthreads.ZergMechanicThread;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import static engine.workthreads.ZergMechanicThread.startZergThreadBane;
|
||||||
|
|
||||||
public class ActivateBaneJob extends AbstractScheduleJob {
|
public class ActivateBaneJob extends AbstractScheduleJob {
|
||||||
|
|
||||||
private final int cityUUID;
|
private final int cityUUID;
|
||||||
@@ -67,6 +71,10 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
|||||||
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
|
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
|
||||||
DispatchMessage.dispatchMsgToAll(msg);
|
DispatchMessage.dispatchMsgToAll(msg);
|
||||||
|
|
||||||
|
if(city.getBane() != null) {
|
||||||
|
startZergThreadBane(city.getBane());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,9 +9,11 @@
|
|||||||
|
|
||||||
package engine.jobs;
|
package engine.jobs;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.job.AbstractJob;
|
import engine.job.AbstractJob;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class AttackJob extends AbstractJob {
|
public class AttackJob extends AbstractJob {
|
||||||
|
|
||||||
@@ -29,6 +31,9 @@ public class AttackJob extends AbstractJob {
|
|||||||
@Override
|
@Override
|
||||||
protected void doJob() {
|
protected void doJob() {
|
||||||
CombatManager.doCombat(this.source, slot);
|
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() {
|
public boolean success() {
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.source.region != null)
|
||||||
|
this.target.setRegion(this.source.region);
|
||||||
//teleport target to source
|
//teleport target to source
|
||||||
target.teleport(source.getLoc());
|
target.teleport(source.getLoc());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,15 @@ public class ModTableEntry {
|
|||||||
|
|
||||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||||
|
|
||||||
for (ModTableEntry iteration : itemTableEntryList)
|
if(itemTableEntryList == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
for (ModTableEntry iteration : itemTableEntryList) {
|
||||||
|
if (iteration == null)
|
||||||
|
continue;
|
||||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
modTableEntry = iteration;
|
modTableEntry = iteration;
|
||||||
|
}
|
||||||
return modTableEntry;
|
return modTableEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class Bounds {
|
|||||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
if (building.getBounds().colliders == null)
|
if (building.getBounds() == null || building.getBounds().colliders == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Colliders collider : building.getBounds().colliders) {
|
for (Colliders collider : building.getBounds().colliders) {
|
||||||
|
|||||||
+238
-425
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ public class MobAIThread implements Runnable{
|
|||||||
public static int AI_DROP_AGGRO_RANGE = 60;
|
public static int AI_DROP_AGGRO_RANGE = 60;
|
||||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||||
public static int AI_PATROL_DIVISOR = 15;
|
public static int AI_PATROL_DIVISOR = 15;
|
||||||
public static float AI_CAST_FREQUENCY;
|
public static float AI_CAST_FREQUENCY = 1.0f;
|
||||||
// Thread constructor
|
// Thread constructor
|
||||||
|
|
||||||
public MobAIThread() {
|
public MobAIThread() {
|
||||||
|
|||||||
@@ -12,13 +12,20 @@ package engine.mobileAI.utilities;
|
|||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mobileAI.MobAI;
|
||||||
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
|
import engine.net.client.msg.PerformActionMsg;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import engine.powers.ActionsBase;
|
||||||
|
import engine.powers.PowersBase;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
import static engine.math.FastMath.sqr;
|
import static engine.math.FastMath.sqr;
|
||||||
@@ -264,9 +271,19 @@ public class CombatUtilities {
|
|||||||
swingIsBlock(agent, target, passiveAnim);
|
swingIsBlock(agent, target, passiveAnim);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (agent.getEquip().get(1) != null && agent.getEquip().get(2) != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
|
//mob is duel wielding and should conduct an attack for each hand
|
||||||
|
ItemBase weapon1 = agent.getEquip().get(1).getItemBase();
|
||||||
|
double range1 = getMaxDmg(weapon1.getMinDamage(), agent, weapon1) - getMinDmg(weapon1.getMinDamage(), agent, weapon1);
|
||||||
|
double damage1 = getMinDmg(weapon1.getMinDamage(), agent, weapon1) + ((ThreadLocalRandom.current().nextFloat() * range1) + (ThreadLocalRandom.current().nextFloat() * range1)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage1, CombatManager.getSwingAnimation(weapon1, null, true));
|
||||||
|
ItemBase weapon2 = agent.getEquip().get(2).getItemBase();
|
||||||
|
double range2 = getMaxDmg(weapon2.getMinDamage(), agent, weapon2) - getMinDmg(weapon2.getMinDamage(), agent, weapon2);
|
||||||
|
double damage2 = getMinDmg(weapon2.getMinDamage(), agent, weapon2) + ((ThreadLocalRandom.current().nextFloat() * range2) + (ThreadLocalRandom.current().nextFloat() * range2)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage2, CombatManager.getSwingAnimation(weapon1, null, false));
|
||||||
|
} else {
|
||||||
swingIsDamage(agent, target, determineDamage(agent), anim);
|
swingIsDamage(agent, target, determineDamage(agent), anim);
|
||||||
|
}
|
||||||
|
|
||||||
if (agent.getWeaponPower() != null)
|
if (agent.getWeaponPower() != null)
|
||||||
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
||||||
@@ -294,7 +311,6 @@ public class CombatUtilities {
|
|||||||
if (targetMob.isSiege())
|
if (targetMob.isSiege())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float determineDamage(Mob agent) {
|
public static float determineDamage(Mob agent) {
|
||||||
@@ -309,10 +325,19 @@ public class CombatUtilities {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int damage = 0;
|
float damage = 0;
|
||||||
|
|
||||||
DamageType dt = getDamageType(agent);
|
DamageType dt = getDamageType(agent);
|
||||||
damage = ThreadLocalRandom.current().nextInt((int)getMinDmg(agent), (int)getMaxDmg(agent) + 1);
|
if ((agent.agentType.equals(AIAgentType.PET)) == true || agent.isPet() == true || agent.isNecroPet() == true) {
|
||||||
|
damage = calculatePetDamage(agent);
|
||||||
|
} else if (agent.isPlayerGuard() == true) {
|
||||||
|
//damage = calculateGuardDamage(agent);
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
} else if (agent.getLevel() > 80) {
|
||||||
|
damage = calculateEpicDamage(agent);
|
||||||
|
} else {
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
}
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||||
if (((AbstractCharacter) target).isSit()) {
|
if (((AbstractCharacter) target).isSit()) {
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
@@ -338,16 +363,365 @@ public class CombatUtilities {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMinDmg(Mob agent) {
|
public static int calculatePetDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for pet
|
||||||
return agent.minDamageHandTwo;
|
float range;
|
||||||
else return agent.minDamageHandOne;
|
float damage;
|
||||||
|
float min = 40;
|
||||||
|
float max = 60;
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double minDmg = getMinDmg(min, agent, null);
|
||||||
|
double maxDmg = getMaxDmg(max, agent, null);
|
||||||
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
|
range = (float) (maxDmg - minDmg);
|
||||||
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (damage * dmgMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMaxDmg(Mob agent) {
|
public static int calculateGuardDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for guard
|
||||||
return agent.maxDamageHandTwo;
|
ItemBase weapon = agent.getEquip().get(1).getItemBase();
|
||||||
else return agent.maxDamageHandOne;
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
|
||||||
|
double minDmg = weapon.getMinDamage();
|
||||||
|
double maxDmg = weapon.getMaxDamage();
|
||||||
|
double min = getMinDmg(minDmg, agent, weapon);
|
||||||
|
double max = getMaxDmg(maxDmg, agent, weapon);
|
||||||
|
|
||||||
|
DamageType dt = weapon.getDamageType();
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int calculateEpicDamage(Mob agent) {
|
||||||
|
//handle r8 mob damage
|
||||||
|
DamageType dt = DamageType.Crush;
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double min = agent.getMinDamageHandOne();
|
||||||
|
double max = agent.getMaxDamageHandOne();
|
||||||
|
if (agent.getEquip().get(1) != null) {
|
||||||
|
if (agent.getEquip().get(1).getItemBase() != null) {
|
||||||
|
dt = agent.getEquip().get(1).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandOne();
|
||||||
|
max = agent.getMaxDamageHandOne();
|
||||||
|
} else if (agent.getEquip().get(2).getItemBase() != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
|
dt = agent.getEquip().get(2).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandTwo();
|
||||||
|
max = agent.getMaxDamageHandTwo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateMobDamage(Mob agent) {
|
||||||
|
ItemBase weapon = null;
|
||||||
|
double minDmg;
|
||||||
|
double maxDmg;
|
||||||
|
DamageType dt;
|
||||||
|
|
||||||
|
//main hand or offhand damage
|
||||||
|
|
||||||
|
if (agent.getEquip().get(1) != null)
|
||||||
|
weapon = agent.getEquip().get(1).getItemBase();
|
||||||
|
else if (agent.getEquip().get(2) != null)
|
||||||
|
weapon = agent.getEquip().get(2).getItemBase();
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
minDmg = getMinDmg(weapon.getMinDamage(), agent, weapon);
|
||||||
|
maxDmg = getMaxDmg(weapon.getMaxDamage(), agent, weapon);
|
||||||
|
dt = weapon.getDamageType();
|
||||||
|
} else {
|
||||||
|
minDmg = agent.getMobBase().getDamageMin();
|
||||||
|
maxDmg = agent.getMobBase().getDamageMax();
|
||||||
|
dt = DamageType.Crush;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double range = maxDmg - minDmg;
|
||||||
|
double damage = minDmg + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMinDmg(double min, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired())) {
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
if (agent.getSkills().containsKey(weapon.getMastery())) {
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
|
return agent.getMinDamageHandOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
|
||||||
|
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
|
return agent.getMaxDamageHandOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean MobCast(Mob mob) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Method picks a random spell from a mobile's list of powers
|
||||||
|
// and casts it on the current target (or itself). Validation
|
||||||
|
// (including empty lists) is done previously within canCast();
|
||||||
|
|
||||||
|
ArrayList<Integer> powerTokens;
|
||||||
|
ArrayList<Integer> purgeTokens;
|
||||||
|
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||||
|
|
||||||
|
if (mob.behaviourType.callsForHelp)
|
||||||
|
MobAI.MobCallForHelp(mob);
|
||||||
|
|
||||||
|
// Generate a list of tokens from the mob powers for this mobile.
|
||||||
|
|
||||||
|
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||||
|
purgeTokens = new ArrayList<>();
|
||||||
|
|
||||||
|
// If player has this effect on them currently then remove
|
||||||
|
// this token from our list.
|
||||||
|
|
||||||
|
for (int powerToken : powerTokens) {
|
||||||
|
|
||||||
|
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||||
|
|
||||||
|
String stackType = actionBase.stackType;
|
||||||
|
|
||||||
|
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||||
|
purgeTokens.add(powerToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
powerTokens.removeAll(purgeTokens);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
|
||||||
|
if (powerTokens.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Pick random spell from our list of powers
|
||||||
|
|
||||||
|
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||||
|
int powerRank = mob.mobPowers.get(powerToken);
|
||||||
|
|
||||||
|
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
//check for hit-roll
|
||||||
|
|
||||||
|
if (mobPower.requiresHitRoll)
|
||||||
|
if (triggerDefense(mob, mob.getCombatTarget()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Cast the spell
|
||||||
|
|
||||||
|
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||||
|
|
||||||
|
PerformActionMsg msg;
|
||||||
|
|
||||||
|
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||||
|
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||||
|
} else {
|
||||||
|
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.setUnknown04(2);
|
||||||
|
|
||||||
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
|
|
||||||
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean GuardCast(Mob mob) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Method picks a random spell from a mobile's list of powers
|
||||||
|
// and casts it on the current target (or itself). Validation
|
||||||
|
// (including empty lists) is done previously within canCast();
|
||||||
|
|
||||||
|
ArrayList<Integer> powerTokens;
|
||||||
|
ArrayList<Integer> purgeTokens;
|
||||||
|
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||||
|
|
||||||
|
if (mob.behaviourType.callsForHelp)
|
||||||
|
MobAI.MobCallForHelp(mob);
|
||||||
|
|
||||||
|
// Generate a list of tokens from the mob powers for this mobile.
|
||||||
|
|
||||||
|
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||||
|
purgeTokens = new ArrayList<>();
|
||||||
|
|
||||||
|
// If player has this effect on them currently then remove
|
||||||
|
// this token from our list.
|
||||||
|
|
||||||
|
for (int powerToken : powerTokens) {
|
||||||
|
|
||||||
|
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||||
|
|
||||||
|
String stackType = actionBase.stackType;
|
||||||
|
|
||||||
|
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||||
|
purgeTokens.add(powerToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
powerTokens.removeAll(purgeTokens);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
|
||||||
|
if (powerTokens.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int powerToken;
|
||||||
|
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
|
||||||
|
|
||||||
|
if (nukeRoll < 55) {
|
||||||
|
|
||||||
|
//use direct damage spell
|
||||||
|
powerToken = powerTokens.get(powerTokens.size() - 1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//use random spell
|
||||||
|
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
int powerRank = 1;
|
||||||
|
|
||||||
|
switch(mob.getRank()){
|
||||||
|
case 1:
|
||||||
|
powerRank = 10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
powerRank = 15;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
powerRank = 20;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
powerRank = 25;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
powerRank = 30;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
powerRank = 35;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
powerRank = 40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
//check for hit-roll
|
||||||
|
|
||||||
|
if (mobPower.requiresHitRoll)
|
||||||
|
if (triggerDefense(mob, mob.getCombatTarget()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Cast the spell
|
||||||
|
|
||||||
|
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||||
|
|
||||||
|
PerformActionMsg msg;
|
||||||
|
|
||||||
|
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||||
|
|
||||||
|
if (mobPower.category.equals("DISPEL")) {
|
||||||
|
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||||
|
} else {
|
||||||
|
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.setUnknown04(2);
|
||||||
|
|
||||||
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
|
|
||||||
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,39 +115,8 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3fImmutable GetMoveLocation(Mob aiAgent, AbstractCharacter aggroTarget) {
|
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset) {
|
||||||
|
agent.resetLastSetLocUpdate();
|
||||||
// Player isnt moving and neither is mob. Just return
|
|
||||||
// the mobile's current location. Ain't goin nowhere!
|
|
||||||
// *** Refactor: Check to ensure methods calling us
|
|
||||||
// all don't sent move messages when not moving.
|
|
||||||
|
|
||||||
if ((aggroTarget.isMoving() == false))
|
|
||||||
return aggroTarget.getLoc();
|
|
||||||
|
|
||||||
if (aggroTarget.getEndLoc().x != 0) {
|
|
||||||
|
|
||||||
float aggroTargetDistanceSquared = aggroTarget.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
|
|
||||||
float aiAgentDistanceSquared = aiAgent.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
|
|
||||||
|
|
||||||
if (aiAgentDistanceSquared >= aggroTargetDistanceSquared)
|
|
||||||
return aggroTarget.getEndLoc();
|
|
||||||
else {
|
|
||||||
float distanceToMove = sqrt(aggroTargetDistanceSquared + aiAgentDistanceSquared) * .5f;
|
|
||||||
|
|
||||||
return aggroTarget.getFaceDir().scaleAdd(distanceToMove, aggroTarget.getLoc());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// One of us is moving so let's calculate our destination loc for this
|
|
||||||
// simulation frame. We will simply project our position onto the
|
|
||||||
// character's movement vector and return the closest point.
|
|
||||||
|
|
||||||
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset, boolean isWalking) {
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//don't move farther than 30 units from player.
|
//don't move farther than 30 units from player.
|
||||||
@@ -158,7 +127,7 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
||||||
|
|
||||||
aiMove(agent, newLoc, isWalking);
|
aiMove(agent, newLoc, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.toString());
|
Logger.error(e.toString());
|
||||||
}
|
}
|
||||||
@@ -172,32 +141,8 @@ public class MovementUtilities {
|
|||||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
|
|
||||||
|
|
||||||
//Determing where I want to move.
|
|
||||||
return new Vector3fImmutable((center.x - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius),
|
|
||||||
center.y,
|
|
||||||
(center.z - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Long estimateMovementTime(Mob agent) {
|
|
||||||
if (agent.getEndLoc().x == 0 && agent.getEndLoc().y == 0)
|
|
||||||
return 0L;
|
|
||||||
|
|
||||||
return (long) ((agent.getLoc().distance2D(agent.getEndLoc()) * 1000) / agent.getSpeed());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
|
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
|
||||||
|
|
||||||
//update our walk/run state.
|
|
||||||
if (isWalking && !agent.isWalk()) {
|
|
||||||
agent.setWalkMode(true);
|
|
||||||
MovementManager.sendRWSSMsg(agent);
|
|
||||||
} else if (!isWalking && agent.isWalk()) {
|
|
||||||
agent.setWalkMode(false);
|
|
||||||
MovementManager.sendRWSSMsg(agent);
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveToPointMsg msg = new MoveToPointMsg();
|
MoveToPointMsg msg = new MoveToPointMsg();
|
||||||
|
|
||||||
|
|
||||||
@@ -244,10 +189,10 @@ public class MovementUtilities {
|
|||||||
msg.setSourceID(agent.getObjectUUID());
|
msg.setSourceID(agent.getObjectUUID());
|
||||||
msg.setStartCoord(startLoc);
|
msg.setStartCoord(startLoc);
|
||||||
msg.setEndCoord(endLoc);
|
msg.setEndCoord(endLoc);
|
||||||
msg.setInBuildingFloor(-1);
|
msg.setUnknown01(-1);
|
||||||
msg.setInBuilding(-1);
|
msg.setInBuilding(-1);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -273,23 +218,4 @@ public class MovementUtilities {
|
|||||||
return character.getLoc();
|
return character.getLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean updateMovementToCharacter(Mob aiAgent, AbstractCharacter aggroTarget) {
|
|
||||||
|
|
||||||
if (aiAgent.destination.equals(Vector3fImmutable.ZERO))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!aiAgent.isMoving())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
|
||||||
if (aggroTarget.isMoving()) {
|
|
||||||
return !aiAgent.destination.equals(aggroTarget.getEndLoc()) && !aiAgent.destination.equals(aggroTarget.getLoc());
|
|
||||||
} else {
|
|
||||||
if (aiAgent.destination.equals(aggroTarget.getLoc()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import static engine.net.MessageDispatcher.maxRecipients;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch Message is the main interface to Magicbane's threaded
|
* Dispatch Message is the main interface to Magicbane's threaded
|
||||||
* async message delivery system.
|
* asynch message delivery system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DispatchMessage {
|
public class DispatchMessage {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class NetMsgFactory {
|
|||||||
// if (MBServerStatics.worldServerName.equals("Grief"))
|
// if (MBServerStatics.worldServerName.equals("Grief"))
|
||||||
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||||
} else
|
} else
|
||||||
Logger.error("Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
Logger.error("PROTOCOL ERROR: Player: " + ((ClientConnection) origin).getPlayerCharacter().getName() + " Account: " + ((ClientConnection) origin).getPlayerCharacter().getAccount().getUname() + "Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.net.client;
|
package engine.net.client;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
@@ -122,6 +123,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (pc.isSit()) {
|
if (pc.isSit()) {
|
||||||
pc.setCombat(false);
|
pc.setCombat(false);
|
||||||
pc.cancelOnSit();
|
pc.cancelOnSit();
|
||||||
|
pc.stopMovement(pc.loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
@@ -222,6 +224,11 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(msg.getSlotNumber() == 11 && pc.getRaceID() == 1999){
|
||||||
|
forceTransferFromEquipToInventory(msg, origin, "Saetor cannot wear shoes.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int uuid = msg.getUUID();
|
int uuid = msg.getUUID();
|
||||||
int slot = msg.getSlotNumber();
|
int slot = msg.getSlotNumber();
|
||||||
//System.out.println("loading to slot: " + slot);
|
//System.out.println("loading to slot: " + slot);
|
||||||
@@ -554,18 +561,32 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (i == null)
|
if (i == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(i.getItemBaseID() == 7)
|
||||||
|
return; //cant delete gold
|
||||||
|
|
||||||
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID()))
|
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!itemManager.inventoryContains(i))
|
if (!itemManager.inventoryContains(i))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i.isCanDestroy())
|
if(i.getItemBaseID() == 980066)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (i.canDestroy) {
|
||||||
|
int value = i.getItemBase().value;
|
||||||
|
if(i.getItemBase().isRune())
|
||||||
|
value = 500000;
|
||||||
|
if(sourcePlayer.getCharItemManager().getGoldInventory().getNumOfItems() + value > 10000000){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (itemManager.delete(i) == true) {
|
if (itemManager.delete(i) == true) {
|
||||||
|
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||||
|
sourcePlayer.getCharItemManager().updateInventory();
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
||||||
@@ -643,7 +664,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setInBuilding(-1);
|
moveMsg.setInBuilding(-1);
|
||||||
moveMsg.setInBuildingFloor(-1);
|
moveMsg.setUnknown01(-1);
|
||||||
|
|
||||||
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
@@ -1358,219 +1379,171 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (sourcePlayer == null)
|
if (sourcePlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (origin.buyLock.tryLock()) {
|
if (origin.buyLock.tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
||||||
|
if (itemMan == null) {
|
||||||
if (itemMan == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||||
|
if (npc == null) {
|
||||||
if (npc == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Item gold = itemMan.getGoldInventory();
|
Item gold = itemMan.getGoldInventory();
|
||||||
|
if (gold == null) {
|
||||||
if (gold == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Item buy = null;
|
Item buy = null;
|
||||||
|
|
||||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||||
if (sellInventory == null)
|
if (sellInventory == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
for (MobEquipment me : sellInventory) {
|
for (MobEquipment me : sellInventory) {
|
||||||
if (me.getObjectUUID() == msg.getItemID()) {
|
if (me.getObjectUUID() == msg.getItemID()) {
|
||||||
ItemBase ib = me.getItemBase();
|
ItemBase ib = me.getItemBase();
|
||||||
if (ib == null)
|
if (ib == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight())) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int cost = me.getMagicValue();
|
int cost = me.magicValue;
|
||||||
|
if(npc.getContractID() == 1201 && me.getItemBase().getName().equals("Prospector"))
|
||||||
|
cost = 50;
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||||
|
if(me.getItemBase().getType().equals(ItemType.POTION))
|
||||||
|
profit -= 1.0f;
|
||||||
if (profit < 1)
|
if (profit < 1)
|
||||||
profit = 1;
|
profit = 1;
|
||||||
|
if(npc.getContractID() == 900){
|
||||||
|
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
|
||||||
|
}
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
|
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
//dont' have enough goldItem exit!
|
//dont' have enough goldItem exit!
|
||||||
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
int buildingDeposit = cost - me.getMagicValue();
|
int buildingDeposit = cost - me.getMagicValue();
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||||
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
||||||
|
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
|
||||||
|
handleResourcePurchase(me,itemMan,npc,buy,sourcePlayer,ib);
|
||||||
|
}else {
|
||||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||||
|
|
||||||
if (buy != null) {
|
if (buy != null) {
|
||||||
me.transferEnchants(buy);
|
me.transferEnchants(buy);
|
||||||
itemMan.addItemToInventory(buy);
|
itemMan.addItemToInventory(buy);
|
||||||
|
if(npc.contractUUID == 900 && buy.getItemBaseID() == 1705032){
|
||||||
|
buy.setNumOfItems(10);
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||||
|
}
|
||||||
//itemMan.updateInventory();
|
//itemMan.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
||||||
|
|
||||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||||
|
|
||||||
if (npcCim == null)
|
if (npcCim == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buy = Item.getFromCache(msg.getItemID());
|
buy = Item.getFromCache(msg.getItemID());
|
||||||
|
|
||||||
if (buy == null)
|
if (buy == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemBase ib = buy.getItemBase();
|
ItemBase ib = buy.getItemBase();
|
||||||
|
|
||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!npcCim.inventoryContains(buy))
|
if (!npcCim.inventoryContains(buy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO test cost and subtract goldItem
|
//TODO test cost and subtract goldItem
|
||||||
|
|
||||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||||
int cost = buy.getBaseValue();
|
int cost = buy.getBaseValue();
|
||||||
|
|
||||||
if (buy.isID() || buy.isCustomValue())
|
if (buy.isID() || buy.isCustomValue())
|
||||||
cost = buy.getMagicValue();
|
cost = buy.getMagicValue();
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||||
|
|
||||||
if (profit < 1)
|
if (profit < 1)
|
||||||
profit = 1;
|
profit = 1;
|
||||||
|
|
||||||
if (!buy.isCustomValue())
|
if (!buy.isCustomValue())
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
else
|
else
|
||||||
cost = buy.getValue();
|
cost = buy.getValue();
|
||||||
|
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null)
|
if (b != null)
|
||||||
if (b.getProtectionState().equals(ProtectionState.NPC))
|
if (b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
|
|
||||||
int buildingDeposit = cost;
|
int buildingDeposit = cost;
|
||||||
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buy != null)
|
if (buy != null)
|
||||||
itemMan.buyFromNPC(buy, npc);
|
itemMan.buyFromNPC(buy, npc);
|
||||||
|
|
||||||
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
||||||
|
|
||||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||||
|
|
||||||
if (npcCim == null)
|
if (npcCim == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buy = MobLoot.getFromCache(msg.getItemID());
|
buy = MobLoot.getFromCache(msg.getItemID());
|
||||||
|
|
||||||
if (buy == null)
|
if (buy == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemBase ib = buy.getItemBase();
|
ItemBase ib = buy.getItemBase();
|
||||||
|
|
||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!npcCim.inventoryContains(buy))
|
if (!npcCim.inventoryContains(buy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO test cost and subtract goldItem
|
//TODO test cost and subtract goldItem
|
||||||
|
|
||||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||||
|
|
||||||
int cost = buy.getMagicValue();
|
int cost = buy.getMagicValue();
|
||||||
cost *= npc.getSellPercent(sourcePlayer);
|
cost *= npc.getSellPercent(sourcePlayer);
|
||||||
|
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
int buildingDeposit = cost;
|
int buildingDeposit = cost;
|
||||||
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buy != null)
|
if (buy != null)
|
||||||
itemMan.buyFromNPC(buy, npc);
|
itemMan.buyFromNPC(buy, npc);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buy != null) {
|
if (buy != null) {
|
||||||
|
|
||||||
msg.setItem(buy);
|
msg.setItem(buy);
|
||||||
//send the buy message back to update player
|
//send the buy message back to update player
|
||||||
// msg.setItemType(buy.getObjectType().ordinal());
|
// msg.setItemType(buy.getObjectType().ordinal());
|
||||||
@@ -1579,16 +1552,44 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
itemMan.updateInventory();
|
itemMan.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
origin.buyLock.unlock();
|
origin.buyLock.unlock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, NPC npc, Item buy, PlayerCharacter sourcePlayer, ItemBase ib){
|
||||||
|
boolean stacked = false;
|
||||||
|
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||||
|
for(Item item : itemMan.getInventory()){
|
||||||
|
int itemID = item.getItemBaseID();
|
||||||
|
int meID = me.getItemBase().getUUID();
|
||||||
|
if(itemID == meID){
|
||||||
|
if(Warehouse.maxResources.isEmpty())
|
||||||
|
Warehouse.getMaxResources();
|
||||||
|
int maxStack = Warehouse.maxResources.get(itemID);
|
||||||
|
if(maxStack > item.getNumOfItems() + buystack){
|
||||||
|
item.setNumOfItems(item.getNumOfItems() + buystack);
|
||||||
|
stacked = true;
|
||||||
|
itemMan.updateInventory();
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!stacked){
|
||||||
|
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||||
|
if (buy != null) {
|
||||||
|
me.transferEnchants(buy);
|
||||||
|
itemMan.addItemToInventory(buy);
|
||||||
|
buy.setNumOfItems(buystack);
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemMan.updateInventory();
|
||||||
|
}
|
||||||
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||||
@@ -1631,8 +1632,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (toRepair == null)
|
if (toRepair == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (toRepair.getItemBase().isGlass())
|
//if (toRepair.getItemBase().isGlass())
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
//make sure item is in player's inventory or equipment
|
//make sure item is in player's inventory or equipment
|
||||||
if (!itemMan.inventoryContains(toRepair) && !itemMan.equippedContains(toRepair))
|
if (!itemMan.inventoryContains(toRepair) && !itemMan.equippedContains(toRepair))
|
||||||
@@ -1654,6 +1655,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
}
|
}
|
||||||
//TODO get cost to repair
|
//TODO get cost to repair
|
||||||
int cost = (int) ((max - dur) * 80.1);
|
int cost = (int) ((max - dur) * 80.1);
|
||||||
|
|
||||||
|
//glass costs 3x as much to repair
|
||||||
|
if (toRepair.getItemBase().isGlass()){
|
||||||
|
cost *= 3;
|
||||||
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null)
|
if (b != null)
|
||||||
@@ -1888,9 +1895,25 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
break;
|
break;
|
||||||
case LEAVEREQUEST:
|
case LEAVEREQUEST:
|
||||||
origin.disconnect();
|
origin.disconnect();
|
||||||
|
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||||
|
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
|
||||||
|
if(origin.machineID.equals(pc.getClientConnection().machineID))
|
||||||
|
sameMachine.add(pc);
|
||||||
|
}
|
||||||
|
if(sameMachine.isEmpty() == false){
|
||||||
|
if(sameMachine.get(0) != null) {
|
||||||
|
sameMachine.get(0).isBoxed = false;
|
||||||
|
sameMachine.get(0).removeEffectBySource(EffectSourceType.DeathShroud,41,true);
|
||||||
|
ChatManager.chatSystemInfo(sameMachine.get(0), "You Are No Longer Flagged 'Boxed'");
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case POWER:
|
case POWER:
|
||||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||||
|
//PowersManager.static_power_que.add(new PowersManager.PowerQueObject((PerformActionMsg) msg, origin, false));
|
||||||
|
break;
|
||||||
|
case REQUESTMELEEATTACK:
|
||||||
|
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
||||||
break;
|
break;
|
||||||
case READYTOENTER:
|
case READYTOENTER:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public enum Protocol {
|
|||||||
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
||||||
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
||||||
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
||||||
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, AttackCmdMsgHandler.class), // Attack
|
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, null), // Attack
|
||||||
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
||||||
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
||||||
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
||||||
|
|||||||
@@ -57,6 +57,21 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
if (contract.canSlotinBuilding(building))
|
if (contract.canSlotinBuilding(building))
|
||||||
ItemLists.add(hirelings);
|
ItemLists.add(hirelings);
|
||||||
|
|
||||||
|
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
|
||||||
|
if(contract.getContractID() == 899)//alchemist
|
||||||
|
ItemLists.add(hirelings);
|
||||||
|
|
||||||
|
if(contract.getContractID() == 866)//banker
|
||||||
|
ItemLists.add(hirelings);
|
||||||
|
|
||||||
|
if(contract.getContractID() == 865)//siege engineer
|
||||||
|
ItemLists.add(hirelings);
|
||||||
|
}
|
||||||
|
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
|
||||||
|
if(contract.getContractID() == 865)//siege engineer
|
||||||
|
ItemLists.add(hirelings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,13 +93,20 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Item contractItem = Item.getFromCache(msg.getContractItem());
|
Item contractItem = Item.getFromCache(msg.getContractItem());
|
||||||
|
|
||||||
if (contractItem == null)
|
if (contractItem == null)
|
||||||
return false;
|
return false;
|
||||||
|
if (msg.getContractItem() == 850) {//runemaster
|
||||||
|
for (AbstractCharacter abs : building.getHirelings().keySet()) {
|
||||||
|
NPC npc = (NPC) abs;
|
||||||
|
if (npc.contract.getContractID() == 850)
|
||||||
|
return false; //can only have 1 runemaster
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||||
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
||||||
@@ -104,10 +126,33 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if contract can be slotted in this building
|
// Check if contract can be slotted in this building
|
||||||
|
//Logger.error("inserting contract: " + contract.getContractID());
|
||||||
|
if (contract.canSlotinBuilding(building) == false) {
|
||||||
|
boolean override = false;
|
||||||
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
|
||||||
|
if (contract.getContractID() == 899)//alchemist
|
||||||
|
override = true;
|
||||||
|
|
||||||
if (contract.canSlotinBuilding(building) == false)
|
if (contract.getContractID() == 866)//banker
|
||||||
|
override = true;
|
||||||
|
|
||||||
|
if (contract.getContractID() == 865)//siege engineer
|
||||||
|
override = true;
|
||||||
|
}
|
||||||
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
|
||||||
|
if (contract.getContractID() == 865)//siege engineer
|
||||||
|
override = true;
|
||||||
|
}
|
||||||
|
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
|
||||||
|
if(contract.getContractID() == 865)//siege engineer
|
||||||
|
override = true;
|
||||||
|
}
|
||||||
|
if(override == false) {
|
||||||
|
Logger.error("failed at override with contract: " + contract.getContractID());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Logger.error("override successful: " + contract.getContractID());
|
||||||
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
|
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
|||||||
GroupManager.RefreshOthersGroupList(player);
|
GroupManager.RefreshOthersGroupList(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setEnteredWorld(true);
|
player.enteredWorld = true;
|
||||||
// Set player active
|
// Set player active
|
||||||
player.resetRegenUpdateTime();
|
player.resetRegenUpdateTime();
|
||||||
player.setActive(true);
|
player.setActive(true);
|
||||||
@@ -66,6 +66,9 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// Send Guild, Nation and IC MOTD
|
// Send Guild, Nation and IC MOTD
|
||||||
GuildManager.enterWorldMOTD(player);
|
GuildManager.enterWorldMOTD(player);
|
||||||
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
|
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
|
||||||
|
ChatManager.sendSystemMessage(player, "Gold Drop Rate: " + ConfigManager.MB_NORMAL_GOLD_RATE.getValue());
|
||||||
|
ChatManager.sendSystemMessage(player, "Loot Drop Rate: " + ConfigManager.MB_NORMAL_DROP_RATE.getValue());
|
||||||
|
ChatManager.sendSystemMessage(player, "Experience Rate: " + ConfigManager.MB_NORMAL_EXP_RATE.getValue());
|
||||||
|
|
||||||
// Send branch string if available from ConfigManager.
|
// Send branch string if available from ConfigManager.
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
package engine.net.client.handlers;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.CombatManager;
|
|
||||||
import engine.net.client.ClientConnection;
|
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @Author:
|
|
||||||
* @Summary: Processes application protocol message which keeps
|
|
||||||
* client's tcp connection open.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|
||||||
|
|
||||||
public AttackCmdMsgHandler() {
|
|
||||||
super(AttackCmdMsg.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
|
||||||
|
|
||||||
// Member variable declaration
|
|
||||||
|
|
||||||
AttackCmdMsg msg;
|
|
||||||
|
|
||||||
// Member variable assignment
|
|
||||||
|
|
||||||
msg = (AttackCmdMsg) baseMsg;
|
|
||||||
|
|
||||||
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (playerCharacter == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
AbstractWorldObject target = null;
|
|
||||||
Enum.GameObjectType targetType;
|
|
||||||
|
|
||||||
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
|
|
||||||
|
|
||||||
switch(targetType){
|
|
||||||
case Mob:
|
|
||||||
target = Mob.getMob(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case PlayerCharacter:
|
|
||||||
target = PlayerCharacter.getPlayerCharacter(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case Building:
|
|
||||||
target = BuildingManager.getBuilding(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case NPC:
|
|
||||||
target = NPC.getNPC(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(target == null) {
|
|
||||||
playerCharacter.setCombatTarget(null);
|
|
||||||
return true; // cannot attack a null target
|
|
||||||
}
|
|
||||||
//set sources target
|
|
||||||
|
|
||||||
playerCharacter.setCombatTarget(target);
|
|
||||||
|
|
||||||
//put in combat if not already
|
|
||||||
|
|
||||||
if (!playerCharacter.isCombat())
|
|
||||||
CombatManager.toggleCombat(true, origin);
|
|
||||||
|
|
||||||
//make character stand if sitting
|
|
||||||
|
|
||||||
if (playerCharacter.isSit())
|
|
||||||
CombatManager.toggleSit(false, origin);
|
|
||||||
|
|
||||||
CombatManager.AttackTarget(playerCharacter, target);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,18 +14,17 @@ import engine.Enum.GuildHistoryType;
|
|||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.GroupManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
|
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||||
import engine.net.client.msg.guild.BanishUnbanishMsg;
|
import engine.net.client.msg.guild.BanishUnbanishMsg;
|
||||||
import engine.net.client.msg.guild.GuildListMsg;
|
import engine.net.client.msg.guild.GuildListMsg;
|
||||||
import engine.objects.Guild;
|
import engine.objects.*;
|
||||||
import engine.objects.GuildHistory;
|
|
||||||
import engine.objects.GuildStatusController;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||||
@@ -116,6 +115,20 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
|||||||
GuildListMsg guildListMsg = new GuildListMsg(guild);
|
GuildListMsg guildListMsg = new GuildListMsg(guild);
|
||||||
dispatch = Dispatch.borrow(source, guildListMsg);
|
dispatch = Dispatch.borrow(source, guildListMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
if(GroupManager.getGroup(target) != null) {
|
||||||
|
Group group = GroupManager.getGroup(target);
|
||||||
|
group.removeGroupMember(PlayerCharacter.getPlayerCharacter(target));
|
||||||
|
GroupManager.removeFromGroups(PlayerCharacter.getPlayerCharacter(target));
|
||||||
|
GroupUpdateMsg gim;
|
||||||
|
gim = new GroupUpdateMsg();
|
||||||
|
gim.setGroup(group);
|
||||||
|
gim.setMessageType(3);
|
||||||
|
gim.setPlayer(PlayerCharacter.getPlayerCharacter(target));
|
||||||
|
group.sendUpdate(gim);
|
||||||
|
|
||||||
|
String text = PlayerCharacter.getPlayerCharacter(target).getFirstName() + " has left your group.";
|
||||||
|
ChatManager.chatGroupInfo(source, text);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
|
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,15 +61,6 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
|||||||
dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
// If the hotZone has changed then update the client's map accordingly.
|
|
||||||
|
|
||||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
|
||||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
|
||||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serialize the realms for this map
|
// Serialize the realms for this map
|
||||||
|
|
||||||
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
|
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
|||||||
if (city != null)
|
if (city != null)
|
||||||
bane = city.getBane();
|
bane = city.getBane();
|
||||||
|
|
||||||
if (bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
if (bane != null) {
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -71,9 +71,12 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
|||||||
if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
|
if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Can't destroy a shrine
|
// destorying a shrine will yield a rubble pile for looting
|
||||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
|
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) {
|
||||||
|
building.modifyHealth(-building.getHealth(), origin.getPlayerCharacter());
|
||||||
|
building.destroyOrDerank(origin.getPlayerCharacter());
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot destroy mines outside of normal mine mechanics
|
// Cannot destroy mines outside of normal mine mechanics
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import engine.net.client.msg.ClientNetMsg;
|
|||||||
import engine.net.client.msg.group.GroupInviteMsg;
|
import engine.net.client.msg.group.GroupInviteMsg;
|
||||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||||
import engine.objects.Group;
|
import engine.objects.Group;
|
||||||
|
import engine.objects.Guild;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class GroupInviteHandler extends AbstractClientMsgHandler {
|
public class GroupInviteHandler extends AbstractClientMsgHandler {
|
||||||
@@ -103,6 +104,12 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
|
|||||||
if (target.isIgnoringPlayer(source))
|
if (target.isIgnoringPlayer(source))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(source.getGuild().getNation().equals(target.getGuild().getNation()) == false)
|
||||||
|
return false; // cannot group outside of nation
|
||||||
|
|
||||||
|
if(source.getGuild().getNation().equals(target.getGuild().getNation()) && source.getGuild().getNation().equals(Guild.getErrantGuild()))
|
||||||
|
if(source.getGuild().equals(target.getGuild()) == false)
|
||||||
|
return false; // cannot group as an errant guild with other errant guilds
|
||||||
|
|
||||||
// dont block invites to people already in a group and
|
// dont block invites to people already in a group and
|
||||||
// dont check for pending invites, the client does it
|
// dont check for pending invites, the client does it
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import engine.objects.Guild;
|
|||||||
import engine.objects.GuildStatusController;
|
import engine.objects.GuildStatusController;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
import static engine.objects.Bane.getBaneByAttackerGuild;
|
||||||
|
|
||||||
public class InviteToSubHandler extends AbstractClientMsgHandler {
|
public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
public InviteToSubHandler() {
|
public InviteToSubHandler() {
|
||||||
@@ -95,6 +97,25 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
if (sourceGuild.equals(targetGuild))
|
if (sourceGuild.equals(targetGuild))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if(sourceGuild.getNation().getOwnedCity().getBane() != null)
|
||||||
|
return true; // cannot invite guilds to sub if you are baned
|
||||||
|
|
||||||
|
if(sourceGuild.getNation().getSubGuildList() != null){
|
||||||
|
for(Guild subGuild : sourceGuild.getNation().getSubGuildList()){
|
||||||
|
if(subGuild.getOwnedCity() != null)
|
||||||
|
if(subGuild.getOwnedCity().getBane() != null)
|
||||||
|
return true;//cannot invite guilds to sub if any tree in your nation has a bane on it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(targetGuild.getOwnedCity() != null)
|
||||||
|
if(targetGuild.getOwnedCity().getBane() != null)
|
||||||
|
return true; // cannot be subbed if you have a bane placed on you
|
||||||
|
|
||||||
|
|
||||||
|
if(getBaneByAttackerGuild(targetGuild) != null)
|
||||||
|
return true; // cannot sub to a nation if they have a bane placed
|
||||||
|
|
||||||
//target must be GL or IC
|
//target must be GL or IC
|
||||||
|
|
||||||
if (GuildStatusController.isInnerCouncil(target.getGuildStatus()) == false && GuildStatusController.isGuildLeader(target.getGuildStatus()) == false) {
|
if (GuildStatusController.isInnerCouncil(target.getGuildStatus()) == false && GuildStatusController.isGuildLeader(target.getGuildStatus()) == false) {
|
||||||
|
|||||||
@@ -12,16 +12,15 @@ package engine.net.client.handlers;
|
|||||||
import engine.Enum.GuildHistoryType;
|
import engine.Enum.GuildHistoryType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.GroupManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
|
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||||
import engine.net.client.msg.guild.LeaveGuildMsg;
|
import engine.net.client.msg.guild.LeaveGuildMsg;
|
||||||
import engine.objects.Guild;
|
import engine.objects.*;
|
||||||
import engine.objects.GuildStatusController;
|
|
||||||
import engine.objects.Mine;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -61,6 +60,21 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(GroupManager.getGroup(playerCharacter) != null) {
|
||||||
|
Group group = GroupManager.getGroup(playerCharacter);
|
||||||
|
group.removeGroupMember(playerCharacter);
|
||||||
|
GroupManager.removeFromGroups(playerCharacter);
|
||||||
|
GroupUpdateMsg gim;
|
||||||
|
gim = new GroupUpdateMsg();
|
||||||
|
gim.setGroup(group);
|
||||||
|
gim.setMessageType(3);
|
||||||
|
gim.setPlayer(playerCharacter);
|
||||||
|
group.sendUpdate(gim);
|
||||||
|
|
||||||
|
String text = playerCharacter.getFirstName() + " has left your group.";
|
||||||
|
ChatManager.chatGroupInfo(playerCharacter, text);
|
||||||
|
}
|
||||||
|
|
||||||
// Send left guild message to rest of guild
|
// Send left guild message to rest of guild
|
||||||
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
|
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import engine.Enum.DispatchChannel;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
@@ -62,7 +63,6 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
Building building;
|
Building building;
|
||||||
|
|
||||||
msg = (ManageCityAssetsMsg) baseMsg;
|
msg = (ManageCityAssetsMsg) baseMsg;
|
||||||
|
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
@@ -72,34 +72,21 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
if (building == null) {
|
if (building == null) {
|
||||||
if (msg.actionType == 14) {
|
if (msg.actionType == 14) {
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||||
|
|
||||||
if (!zone.isPlayerCity()) {
|
if (!zone.isPlayerCity()) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
|
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
|
||||||
|
if (city == null || !city.getGuild().equals(player.getGuild()) ||
|
||||||
if (city == null) {
|
(!GuildStatusController.isInnerCouncil(player.getGuildStatus()) &&
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
!GuildStatusController.isGuildLeader(player.getGuildStatus()))) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!city.getGuild().equals(player.getGuild())) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "You are not in the correct guild to command this city.");
|
ErrorPopupMsg.sendErrorMsg(player, "You are not in the correct guild to command this city.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GuildStatusController.isInnerCouncil(player.getGuildStatus()) && !GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "You must be an Inner Council or Guild leader to access city commands.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||||
mca.actionType = 15;
|
mca.actionType = 15;
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -111,20 +98,18 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||||
outMsg.setTargetID(building.getObjectUUID());
|
outMsg.setTargetID(building.getObjectUUID());
|
||||||
outMsg.setAssetName(building.getName());
|
outMsg.setAssetName(building.getName());
|
||||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.actionType == 2 || msg.actionType == 22) {
|
switch (msg.actionType) {
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
||||||
|
|
||||||
outMsg.actionType = 18;
|
outMsg.actionType = 18;
|
||||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||||
outMsg.setTargetID(building.getObjectUUID());
|
outMsg.setTargetID(building.getObjectUUID());
|
||||||
|
} else if (BuildingManager.playerCanManage(player, building)) {
|
||||||
} else if (BuildingManager.playerCanManage(player, building)) { //TODO allow Friends list.
|
|
||||||
configWindowState(player, building, outMsg);
|
configWindowState(player, building, outMsg);
|
||||||
outMsg.actionType = 3;
|
outMsg.actionType = 3;
|
||||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||||
@@ -132,95 +117,58 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
outMsg.setTargetType3(building.getObjectType().ordinal());
|
outMsg.setTargetType3(building.getObjectType().ordinal());
|
||||||
outMsg.setTargetID3(building.getObjectUUID());
|
outMsg.setTargetID3(building.getObjectUUID());
|
||||||
outMsg.setUnknown54(1);
|
outMsg.setUnknown54(1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Handle other cases
|
||||||
if (building.getBlueprintUUID() != 0)
|
|
||||||
switch (building.getBlueprint().getBuildingGroup()) {
|
|
||||||
case SHRINE:
|
|
||||||
if (building.getRank() == -1) {
|
if (building.getRank() == -1) {
|
||||||
if (!Bounds.collide(player.getLoc(), building)) {
|
if (!Bounds.collide(player.getLoc(), building)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
switch (building.getBlueprint().getBuildingGroup()) {
|
||||||
|
case SHRINE:
|
||||||
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
||||||
|
if (shrine == null || shrine.getFavors() == 0) {
|
||||||
if (shrine == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (shrine.getFavors() == 0) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//loot elan stones
|
||||||
BuildingManager.lootBuilding(player, building);
|
MobLoot elanStones = new MobLoot(player,ItemBase.getItemBase(1705032),1,false);
|
||||||
return true;
|
Item promotedItem = elanStones.promoteToItem(player);
|
||||||
}
|
promotedItem.setNumOfItems(shrine.getFavors());
|
||||||
|
player.getCharItemManager().addItemToInventory(promotedItem);
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(promotedItem,promotedItem.getNumOfItems());
|
||||||
|
player.getCharItemManager().updateInventory();
|
||||||
|
shrine.setFavors(0);
|
||||||
break;
|
break;
|
||||||
case WAREHOUSE:
|
case WAREHOUSE:
|
||||||
//TODO check
|
|
||||||
if (building.getRank() == -1) {
|
|
||||||
if (!Bounds.collide(player.getLoc(), building)) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
||||||
|
if (warehouse == null || warehouse.isEmpty()) {
|
||||||
if (warehouse == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (warehouse.isEmpty()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
BuildingManager.lootBuilding(player, building);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
AbstractCharacter owner = building.getOwner();
|
AbstractCharacter owner = building.getOwner();
|
||||||
|
|
||||||
//no owner, send building info
|
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
msg.actionType = 4;
|
msg.actionType = 4;
|
||||||
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, msg), DispatchChannel.SECONDARY);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
} else {
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
outMsg.actionType = 4;
|
outMsg.actionType = 4;
|
||||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||||
outMsg.setTargetID(building.getObjectUUID());
|
outMsg.setTargetID(building.getObjectUUID());
|
||||||
outMsg.setAssetName(building.getName());
|
outMsg.setAssetName(building.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
}
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||||
return true;
|
return true;
|
||||||
}
|
case 13:
|
||||||
|
|
||||||
if (msg.actionType == 13) {
|
|
||||||
outMsg.actionType = 13;
|
outMsg.actionType = 13;
|
||||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
case 5:
|
||||||
|
|
||||||
|
|
||||||
//Rename Building.
|
|
||||||
|
|
||||||
if (msg.actionType == 5) {
|
|
||||||
|
|
||||||
//TODO we need to check names before allowing
|
|
||||||
building.setName(msg.getAssetName());
|
building.setName(msg.getAssetName());
|
||||||
configWindowState(player, building, outMsg);
|
configWindowState(player, building, outMsg);
|
||||||
|
|
||||||
outMsg.actionType = 3;
|
outMsg.actionType = 3;
|
||||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||||
outMsg.setTargetID(building.getObjectUUID());
|
outMsg.setTargetID(building.getObjectUUID());
|
||||||
@@ -228,49 +176,36 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
outMsg.setTargetID3(building.getObjectUUID());
|
outMsg.setTargetID3(building.getObjectUUID());
|
||||||
outMsg.setAssetName1(building.getName());
|
outMsg.setAssetName1(building.getName());
|
||||||
outMsg.setUnknown54(1);
|
outMsg.setUnknown54(1);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
case 14:
|
||||||
//TOL, update city name also
|
|
||||||
//TODO update city and zone in database
|
|
||||||
//TODO update city map data in game server
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.actionType == 14) {
|
|
||||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||||
mca.actionType = 15;
|
mca.actionType = 15;
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
return true;
|
||||||
|
case 20:
|
||||||
|
// Handle case 20
|
||||||
|
return handleCase20(player, outMsg, building, msg, origin);
|
||||||
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.actionType == 20) {
|
private boolean handleCase20(PlayerCharacter player, ManageCityAssetsMsg outMsg, Building building, ManageCityAssetsMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
Zone baneZone = building.getParentZone();
|
Zone baneZone = building.getParentZone();
|
||||||
|
|
||||||
if (baneZone == null)
|
if (baneZone == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (banedCity == null)
|
if (banedCity == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Bane bane = banedCity.getBane();
|
Bane bane = banedCity.getBane();
|
||||||
|
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int baneHour = msg.getBaneHour();
|
int baneHour = msg.getBaneHour();
|
||||||
|
|
||||||
if (baneHour < 16 || baneHour > 24) {
|
if (baneHour < 16 || baneHour > 24) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
||||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
||||||
@@ -278,13 +213,10 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
baneLive = baneLive.secondOfMinute().setCopy(1);
|
||||||
bane.setLiveDate(baneLive);
|
bane.setLiveDate(baneLive);
|
||||||
outMsg.actionType = 18;
|
outMsg.actionType = 18;
|
||||||
|
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void configWindowState(PlayerCharacter player, Building building, ManageCityAssetsMsg manageCityAssetsMsg) {
|
public void configWindowState(PlayerCharacter player, Building building, ManageCityAssetsMsg manageCityAssetsMsg) {
|
||||||
|
|
||||||
@@ -294,7 +226,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Owner is obviously allowed to upgrade his own buildings
|
// Owner is obviously allowed to upgrade his own buildings
|
||||||
|
|
||||||
if (building.getOwner().equals(player)) {
|
if (building.getOwner() != null && building.getOwner().equals(player)) {
|
||||||
|
|
||||||
// Players cannot destroy or transfer a TOL.
|
// Players cannot destroy or transfer a TOL.
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
Building shrineBuilding;
|
Building shrineBuilding;
|
||||||
Shrine shrine;
|
Shrine shrine;
|
||||||
|
|
||||||
if (npc.getGuild() != player.getGuild())
|
if (npc.getGuild().getNation() != player.getGuild().getNation())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
shrineBuilding = npc.getBuilding();
|
shrineBuilding = npc.getBuilding();
|
||||||
@@ -173,10 +173,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
//already haz boon.
|
//already haz boon.
|
||||||
|
|
||||||
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
//if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 199);
|
// ErrorPopupMsg.sendErrorPopup(player, 199);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (!Shrine.canTakeFavor(player, shrine))
|
if (!Shrine.canTakeFavor(player, shrine))
|
||||||
return;
|
return;
|
||||||
@@ -191,12 +191,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rank = shrine.getRank();
|
if(shrinePower.getName().equals("Boon: Nephilim"))
|
||||||
//R8 trees always get atleast rank 2 boons. rank uses index, where 0 is first place, 1 is second, etc...
|
shrinePower.name = "Boon: Chaos";
|
||||||
if (shrineBuilding.getCity() != null && shrineBuilding.getCity().getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
|
||||||
if (rank != 0)
|
int trains = 5 * npc.getRank() + 5;//40 - (rank * 10);
|
||||||
rank = 1;
|
|
||||||
int trains = 40 - (rank * 10);
|
|
||||||
if (trains < 0)
|
if (trains < 0)
|
||||||
trains = 0;
|
trains = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import engine.net.client.msg.*;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
* @Summary: Processes application protocol message which
|
* @Summary: Processes application protocol message which
|
||||||
@@ -23,6 +26,8 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
|
||||||
|
|
||||||
public MinionTrainingMsgHandler() {
|
public MinionTrainingMsgHandler() {
|
||||||
super(MinionTrainingMessage.class);
|
super(MinionTrainingMessage.class);
|
||||||
}
|
}
|
||||||
@@ -32,11 +37,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (playerCharacter == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||||
|
|
||||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||||
@@ -44,24 +48,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc == null)
|
if (npc == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||||
|
|
||||||
if (building == null)
|
if (b == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//clear minion
|
//clear minion
|
||||||
|
|
||||||
if (npc.minionLock.writeLock().tryLock()) {
|
if (npc.minionLock.writeLock().tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (minionMsg.getType() == 2) {
|
if (minionMsg.getType() == 2) {
|
||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.siegeMinionMap.containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.siegeMinionMap.remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -83,21 +86,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||||
|
|
||||||
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(b.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(b.getObjectUUID());
|
||||||
|
|
||||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||||
mca1.setTargetID3(npc.getObjectUUID());
|
mca1.setTargetID3(npc.getObjectUUID());
|
||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(b.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -112,7 +117,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.siegeMinionMap.size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -151,7 +156,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -179,13 +184,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.REMOVE_GUARD_MINION(npc.getObjectUUID(), toRemove.firstName))
|
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -194,21 +199,19 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
|
||||||
|
|
||||||
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||||
|
|
||||||
if (trebOwner != null) {
|
if (petOwner != null) {
|
||||||
trebOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
toRemove.guardCaptain = null;
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(building.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(building.getObjectUUID());
|
||||||
@@ -218,11 +221,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -258,7 +261,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase = npc.getMobBaseID();
|
int mobBase = npc.getMobBaseID();
|
||||||
@@ -273,7 +276,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.ADD_GUARD_MINION(npc.getObjectUUID(), pirateName))
|
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
@@ -284,7 +287,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
|
|
||||||
package engine.net.client.handlers;
|
package engine.net.client.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -28,11 +26,13 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
|
|||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
||||||
ClientConnection origin) throws MsgSendException {
|
ClientConnection origin) throws MsgSendException {
|
||||||
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
||||||
PlayerCharacter pc = origin.getPlayerCharacter();
|
|
||||||
|
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null;
|
||||||
if (pc == null)
|
if (pc == null)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
MovementManager.movement(msg, pc);
|
MovementManager.movement(msg, pc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,9 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hPMod = (building.getMaxHitPoints() * Realm.getRealmHealthMod(city));
|
hPMod = (building.getMaxHitPoints() * Realm.getRealmHealthMod(city));
|
||||||
|
float percentOfHealth = building.getCurrentHitpoints() / building.getHealthMax();
|
||||||
building.setMaxHitPoints(building.getMaxHitPoints() + hPMod);
|
building.setMaxHitPoints(building.getMaxHitPoints() + hPMod);
|
||||||
|
building.setCurrentHitPoints(building.getMaxHitPoints() * percentOfHealth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,8 +441,10 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// }
|
// }
|
||||||
// break;
|
// break;
|
||||||
//}
|
//}
|
||||||
|
int i = 0;
|
||||||
|
if(i != 0) {
|
||||||
LootManager.peddleFate(player, item);
|
LootManager.peddleFate(player, item);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30: //water bucket
|
case 30: //water bucket
|
||||||
@@ -538,6 +542,10 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, ib.getUseID(), ib.getUseAmount(), true);
|
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, ib.getUseID(), ib.getUseAmount(), true);
|
||||||
|
|
||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
|
} else if(ib.getUUID() > 252128 && ib.getUUID() < 252568){
|
||||||
|
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||||
|
itemMan.consume(item);
|
||||||
|
}
|
||||||
}else //just remove the item at this point
|
}else //just remove the item at this point
|
||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
msg = (OpenFriendsCondemnListMsg) baseMsg;
|
msg = (OpenFriendsCondemnListMsg) baseMsg;
|
||||||
|
|
||||||
|
sourceBuilding = BuildingManager.getBuildingFromCache(msg.getBuildingID());
|
||||||
|
|
||||||
|
if(sourceBuilding != null && sourceBuilding.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
openFriendsCondemnListMsg = new OpenFriendsCondemnListMsg(msg);
|
openFriendsCondemnListMsg = new OpenFriendsCondemnListMsg(msg);
|
||||||
friendListType = Enum.FriendListType.getListTypeByID(msg.getMessageType());
|
friendListType = Enum.FriendListType.getListTypeByID(msg.getMessageType());
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import engine.Enum.ProfitType;
|
|||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.FastMath;
|
import engine.math.FastMath;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -36,7 +37,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
super(OrderNPCMsg.class);
|
super(OrderNPCMsg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processRedeedHireling(AbstractCharacter hireling, Building building, ClientConnection origin) {
|
public static void processRedeedMob(Mob mob, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
Contract contract;
|
Contract contract;
|
||||||
@@ -47,28 +48,33 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
itemMan = player.getCharItemManager();
|
itemMan = player.getCharItemManager();
|
||||||
|
|
||||||
contract = hireling.contract;
|
contract = mob.getContract();
|
||||||
|
|
||||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!building.getHirelings().containsKey(hireling))
|
if (!building.getHirelings().containsKey(mob))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, hireling);
|
if (!NPCManager.removeMobileFromBuilding(mob, building)) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
building.getHirelings().remove(mob);
|
||||||
|
|
||||||
itemBase = ItemBase.getItemBase(contract.getContractID());
|
itemBase = ItemBase.getItemBase(contract.getContractID());
|
||||||
|
|
||||||
if (itemBase == null) {
|
if (itemBase == null) {
|
||||||
Logger.error("Could not find Contract for npc: " + hireling.getObjectUUID());
|
Logger.error("Could not find Contract for npc: " + mob.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean itemWorked = false;
|
boolean itemWorked = false;
|
||||||
|
|
||||||
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) hireling.getRank() - 1), (byte) ((byte) hireling.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) mob.getRank() - 1), (byte) ((byte) mob.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
||||||
item.setNumOfItems(1);
|
item.setNumOfItems(1);
|
||||||
item.containerType = Enum.ItemContainerType.INVENTORY;
|
item.containerType = Enum.ItemContainerType.INVENTORY;
|
||||||
|
|
||||||
@@ -276,6 +282,28 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static synchronized void processRedeedNPC(AbstractCharacter abstractCharacter, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
|
// Member variable declaration
|
||||||
|
|
||||||
|
switch (abstractCharacter.getObjectType()) {
|
||||||
|
case NPC:
|
||||||
|
NPC npc = (NPC) abstractCharacter;
|
||||||
|
|
||||||
|
Building cityBuilding = npc.getBuilding();
|
||||||
|
|
||||||
|
if (cityBuilding == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BuildingManager.processRedeedNPC(npc, npc.building, origin);
|
||||||
|
break;
|
||||||
|
case Mob:
|
||||||
|
Mob mob = (Mob) abstractCharacter;
|
||||||
|
processRedeedMob(mob, mob.building, origin);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
||||||
@@ -466,7 +494,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(npc, building, origin);
|
processRedeedNPC(npc, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
@@ -534,7 +562,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building.getHirelings().containsKey(mob) == false)
|
if (building.getHirelings().containsKey(mob) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, mob);
|
if (NPCManager.removeMobileFromBuilding(mob, building) == false) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
||||||
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
||||||
@@ -569,7 +600,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(mob, building, origin);
|
processRedeedNPC(mob, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
|
|||||||
@@ -412,6 +412,9 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||||
break;
|
break;
|
||||||
|
if(contract.getItemBaseID() == 1035){//saetor shrine override
|
||||||
|
msg.getFirstPlacementInfo().setBlueprintUUID(1720000);
|
||||||
|
}
|
||||||
buildingCreated = placeShrine(playerCharacter, origin, msg);
|
buildingCreated = placeShrine(playerCharacter, origin, msg);
|
||||||
break;
|
break;
|
||||||
case BARRACK:
|
case BARRACK:
|
||||||
@@ -745,7 +748,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
||||||
0,
|
HeightMap.getWorldHeight(treeInfo.getLoc()),
|
||||||
treeInfo.getLoc().z);
|
treeInfo.getLoc().z);
|
||||||
|
|
||||||
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
||||||
@@ -754,7 +757,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
plantLoc.z - serverZone.getAbsZ(), treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
plantLoc.z - serverZone.getAbsZ(), treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
||||||
|
|
||||||
// Uh oh!
|
// Uh oh!
|
||||||
|
|
||||||
if (cityObjects == null || cityObjects.isEmpty()) {
|
if (cityObjects == null || cityObjects.isEmpty()) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return false;
|
return false;
|
||||||
@@ -768,7 +770,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
||||||
treeObject.runAfterLoad();
|
treeObject.runAfterLoad();
|
||||||
|
;
|
||||||
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
||||||
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
||||||
|
|
||||||
@@ -793,16 +795,15 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
ZoneManager.addPlayerCityZone(zoneObject);
|
ZoneManager.addPlayerCityZone(zoneObject);
|
||||||
serverZone.addNode(zoneObject);
|
serverZone.addNode(zoneObject);
|
||||||
|
|
||||||
zoneObject.worldAltitude = ZoneManager.caclulateWorldAltitude(zoneObject);
|
zoneObject.generateWorldAltitude();
|
||||||
|
|
||||||
cityObject.setParent(zoneObject);
|
cityObject.setParent(zoneObject);
|
||||||
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already
|
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already
|
||||||
|
|
||||||
//Link the tree of life with the new zone
|
//Link the tree of life with the new zone
|
||||||
|
|
||||||
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
treeObject.setParentZone(zoneObject);
|
treeObject.setParentZone(zoneObject);
|
||||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
|
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(14));
|
||||||
|
|
||||||
// Update guild binds and tags
|
// Update guild binds and tags
|
||||||
//load the new city on the clients
|
//load the new city on the clients
|
||||||
@@ -819,6 +820,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
treeObject.setLoc(treeObject.getLoc());
|
treeObject.setLoc(treeObject.getLoc());
|
||||||
InterestManager.setObjectDirty(treeObject);
|
InterestManager.setObjectDirty(treeObject);
|
||||||
|
// WorldGrid.addObject(treeObject, playerCharacter);
|
||||||
|
|
||||||
serverRealm.addCity(cityObject.getObjectUUID());
|
serverRealm.addCity(cityObject.getObjectUUID());
|
||||||
playerNation.setCityUUID(cityObject.getObjectUUID());
|
playerNation.setCityUUID(cityObject.getObjectUUID());
|
||||||
@@ -916,7 +918,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Early exit if something went horribly wrong
|
// Early exit if something went horribly wrong
|
||||||
// with locating the current realm and/or zone
|
// with locating the current realm and/or zone
|
||||||
|
|
||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -979,8 +980,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City cityObject;
|
City cityObject;
|
||||||
PlacementInfo buildingList;
|
PlacementInfo buildingList;
|
||||||
|
|
||||||
// Setup working variables
|
// Setup working variables we'll need
|
||||||
|
|
||||||
buildingList = msg.getFirstPlacementInfo();
|
buildingList = msg.getFirstPlacementInfo();
|
||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
||||||
@@ -1093,6 +1093,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
||||||
|
|
||||||
|
|
||||||
// Overlap check and wall deed verifications
|
// Overlap check and wall deed verifications
|
||||||
for (PlacementInfo wall : walls) {
|
for (PlacementInfo wall : walls) {
|
||||||
|
|
||||||
@@ -1111,6 +1112,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
for (Building building : serverZone.zoneBuildingSet) {
|
for (Building building : serverZone.zoneBuildingSet) {
|
||||||
|
|
||||||
|
|
||||||
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
||||||
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
||||||
|
|
||||||
@@ -1130,14 +1132,12 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
||||||
|
|
||||||
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
||||||
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to place wall piece
|
// Attempt to place wall piece
|
||||||
|
|
||||||
wallPiece = createStructure(player, wall, serverZone);
|
wallPiece = createStructure(player, wall, serverZone);
|
||||||
@@ -1148,12 +1148,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// walls are auto protected
|
// walls are auto protected
|
||||||
|
|
||||||
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
||||||
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deduct gold from character's inventory
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1173,7 +1175,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All siege buildings build in 15 minutes
|
// All siege buildings build in 15 minutes
|
||||||
|
|
||||||
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
||||||
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
||||||
completionDate = DateTime.now().plusMinutes(15);
|
completionDate = DateTime.now().plusMinutes(15);
|
||||||
@@ -1193,7 +1194,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
||||||
|
|
||||||
// Make sure we have a valid mesh
|
// Make sure we have a valid mesh
|
||||||
|
|
||||||
if (newMesh == null) {
|
if (newMesh == null) {
|
||||||
Logger.error("CreateStructure: DB returned null object.");
|
Logger.error("CreateStructure: DB returned null object.");
|
||||||
return null;
|
return null;
|
||||||
@@ -1213,7 +1213,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
private boolean createShrine(PlayerCharacter player, PlacementInfo buildingInfo, Zone currentZone) {
|
private boolean createShrine(PlayerCharacter player, PlacementInfo buildingInfo, Zone currentZone) {
|
||||||
|
|
||||||
Blueprint blueprint;
|
Blueprint blueprint;
|
||||||
Building newMesh;
|
Building newMesh = null;
|
||||||
Shrine newShrine;
|
Shrine newShrine;
|
||||||
City city;
|
City city;
|
||||||
ShrineType shrineType;
|
ShrineType shrineType;
|
||||||
@@ -1274,6 +1274,9 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(blueprint.getName().equals("Nephilim Shrine ") && newMesh != null){
|
||||||
|
newMesh.setName("Chaos Shrine");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1365,16 +1368,15 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
newMesh = (Building) ago;
|
newMesh = (Building) ago;
|
||||||
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
||||||
|
// WorldGrid.addObject(newMesh, player);
|
||||||
newMesh.setLoc(newMesh.getLoc());
|
newMesh.setLoc(newMesh.getLoc());
|
||||||
InterestManager.setObjectDirty(newMesh);
|
InterestManager.setObjectDirty(newMesh);
|
||||||
newMesh.runAfterLoad();
|
newMesh.runAfterLoad();
|
||||||
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
||||||
Warehouse warehouse = (Warehouse) ago;
|
Warehouse warehouse = (Warehouse) ago;
|
||||||
City city = City.getCity(currentZone.getPlayerCityUUID());
|
City city = City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
||||||
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setEnteredWorld(false);
|
player.enteredWorld = false;
|
||||||
|
|
||||||
Account acc = SessionManager.getAccount(origin);
|
Account acc = SessionManager.getAccount(origin);
|
||||||
|
|
||||||
@@ -110,6 +110,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
|
|||||||
player.stopMovement(player.getBindLoc());
|
player.stopMovement(player.getBindLoc());
|
||||||
player.setSafeMode();
|
player.setSafeMode();
|
||||||
player.updateLocation();
|
player.updateLocation();
|
||||||
|
player.setRegion(AbstractWorldObject.GetRegionByWorldObject(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setTimeStamp("logout", 0);
|
player.setTimeStamp("logout", 0);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import engine.Enum;
|
|||||||
import engine.InterestManagement.RealmMap;
|
import engine.InterestManagement.RealmMap;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -131,14 +132,15 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
|||||||
TaxCityMsg msg;
|
TaxCityMsg msg;
|
||||||
|
|
||||||
player = origin.getPlayerCharacter();
|
player = origin.getPlayerCharacter();
|
||||||
|
ChatManager.chatSystemInfo(player,"Taxing has been disabled");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//msg = (TaxCityMsg) baseMsg;
|
||||||
|
|
||||||
|
//ViewTaxes(msg, player);
|
||||||
|
|
||||||
|
|
||||||
msg = (TaxCityMsg) baseMsg;
|
//return true;
|
||||||
|
|
||||||
ViewTaxes(msg, player);
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public class UpgradeAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
Logger.error("Attempt to upgrade null building by " + player.getName());
|
Logger.error("Attempt to upgrade null building by " + player.getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(buildingToRank.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
|
||||||
|
return true;
|
||||||
|
|
||||||
// Early exit for building that is already ranking
|
// Early exit for building that is already ranking
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.net.*;
|
import engine.net.*;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -77,11 +78,12 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
if (playerCharacter == null || origin == null || rb == null) {
|
if (playerCharacter == null || origin == null || rb == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
int raceID = playerCharacter.getRaceID();
|
||||||
//Check race is met
|
//Check race is met
|
||||||
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
||||||
|
if(runeID != 3007 && runeID != 3014) {//bounty hunter and huntsman
|
||||||
if (races.size() > 0) {
|
if (races.size() > 0) {
|
||||||
int raceID = playerCharacter.getRaceID();
|
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
for (int validID : races.keySet()) {
|
for (int validID : races.keySet()) {
|
||||||
if (validID == raceID) {
|
if (validID == raceID) {
|
||||||
@@ -89,6 +91,18 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(runeID == 3040)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 2514 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3036 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3033 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -105,6 +119,19 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(runeID == 3040)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3036 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3033 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3035 && baseClassID == 2501)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -121,11 +148,28 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(runeID == 3040)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3004 && (playerCharacter.getPromotionClassID() == 2505 || playerCharacter.getPromotionClassID() == 2510))
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3036 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(runeID == 3033 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
if(playerCharacter.getPromotionClassID() == 2519){//priest
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
//Check disciplines are met
|
//Check disciplines are met
|
||||||
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
||||||
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
||||||
@@ -174,7 +218,16 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
int mod = rba.getModValue();
|
int mod = rba.getModValue();
|
||||||
switch (attrID) {
|
switch (attrID) {
|
||||||
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
mod = 0;
|
||||||
|
}
|
||||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cost = mod;
|
cost = mod;
|
||||||
@@ -232,8 +285,29 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||||
|
RuneBase rb2 = charRune.getRuneBase();
|
||||||
|
switch (rb2.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//if discipline, check number applied
|
//if discipline, check number applied
|
||||||
if (isDiscipline(runeID)) {
|
if (isDiscipline(runeID)) {
|
||||||
|
//if(playerCharacter.getLevel() == 80)
|
||||||
|
discCount -= 1; // level 80 characters get an extra disc rune
|
||||||
if (playerCharacter.getLevel() < 70) {
|
if (playerCharacter.getLevel() < 70) {
|
||||||
if (discCount > 2) {
|
if (discCount > 2) {
|
||||||
return false;
|
return false;
|
||||||
@@ -304,7 +378,15 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
playerCharacter.recalculate();
|
playerCharacter.recalculate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
cost = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, msm);
|
dispatch = Dispatch.borrow(playerCharacter, msm);
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ public class CityDataMsg extends ClientNetMsg {
|
|||||||
temp.putInt(cityList.size());
|
temp.putInt(cityList.size());
|
||||||
|
|
||||||
for (City city : cityList)
|
for (City city : cityList)
|
||||||
|
try {
|
||||||
City.serializeForClientMsg(city, temp);
|
City.serializeForClientMsg(city, temp);
|
||||||
|
}catch(Exception e){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
temp.put((byte) 0); // PAD
|
temp.put((byte) 0); // PAD
|
||||||
|
|
||||||
// Serialize runegates
|
// Serialize runegates
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
import engine.net.ByteBufferReader;
|
import engine.net.ByteBufferReader;
|
||||||
@@ -42,8 +43,8 @@ public class CityZoneMsg extends ClientNetMsg {
|
|||||||
this.locY = locY;
|
this.locY = locY;
|
||||||
this.locZ = locZ;
|
this.locZ = locZ;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.radiusX = radiusX;
|
this.radiusX = Enum.CityBoundsType.ZONE.extents;
|
||||||
this.radiusZ = radiusZ;
|
this.radiusZ = Enum.CityBoundsType.ZONE.extents;
|
||||||
this.unknown01 = 0;
|
this.unknown01 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
@@ -530,6 +531,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
this.upgradeCost = Integer.MAX_VALUE;
|
this.upgradeCost = Integer.MAX_VALUE;
|
||||||
else if (building.getRank() == building.getBlueprint().getMaxRank())
|
else if (building.getRank() == building.getBlueprint().getMaxRank())
|
||||||
this.upgradeCost = Integer.MAX_VALUE;
|
this.upgradeCost = Integer.MAX_VALUE;
|
||||||
|
else
|
||||||
|
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
|
||||||
|
this.upgradeCost = Integer.MAX_VALUE;
|
||||||
else
|
else
|
||||||
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
|
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +96,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putString("A weapon suited to laying siege");
|
writer.putString("A weapon suited to laying siege");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void serializeGuardList(ByteBufferWriter writer, int minion, Mob captain) {
|
private static void serializeGuardList(ByteBufferWriter writer, int minion) {
|
||||||
|
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(captain.getRank());//minion rank
|
writer.putInt(1);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
writer.putInt(600); //roll time
|
writer.putInt(600); //roll time
|
||||||
@@ -342,17 +343,14 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain list
|
//artillery captain list
|
||||||
|
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
|
||||||
writer.putInt(1 + npc.minions.size());
|
writer.putInt(1 + siegeMinions.size());
|
||||||
serializeBulwarkList(writer, 1); //Trebuchet
|
serializeBulwarkList(writer, 1); //Trebuchet
|
||||||
//serializeBulwarkList(writer, 2); //Ballista
|
//serializeBulwarkList(writer, 2); //Ballista
|
||||||
|
|
||||||
if (npc.minions != null && npc.minions.size() > 0)
|
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
|
||||||
|
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
|
|
||||||
|
for (Mob mob : siegeMinions.keySet()) {
|
||||||
this.unknown83 = mob.getObjectUUID();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
@@ -668,15 +666,14 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain list
|
//artillery captain list
|
||||||
|
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
|
||||||
|
|
||||||
writer.putInt(mobA.minions.size() + 1);
|
writer.putInt(siegeMinions.size() + 1);
|
||||||
|
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
||||||
|
|
||||||
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
|
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||||
|
|
||||||
if (mobA.minions != null && mobA.minions.size() > 0)
|
for (Mob mob : siegeMinions.keySet()) {
|
||||||
|
|
||||||
for (Integer minionUUID : mobA.minions) {
|
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
this.unknown83 = mob.getObjectUUID();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
@@ -22,19 +21,19 @@ import engine.objects.Building;
|
|||||||
|
|
||||||
public class MoveToPointMsg extends ClientNetMsg {
|
public class MoveToPointMsg extends ClientNetMsg {
|
||||||
|
|
||||||
private int sourceType; //ordinal of the character type that sent this message 54=PlayerCharacter
|
private int sourceType;
|
||||||
private int sourceID; // uuid of the source character of this message
|
private int sourceID;
|
||||||
private float startLat; //start loc of move message (offset if inside a building not world loc)
|
private float startLat;
|
||||||
private float startLon; //start loc of move message (offset if inside a building not world loc)
|
private float startLon;
|
||||||
private float startAlt; //start loc of move message (offset if inside a building not world loc)
|
private float startAlt;
|
||||||
private float endLat; //end loc of move message (offset if inside a building not world loc)
|
private float endLat;
|
||||||
private float endLon; //end loc of move message (offset if inside a building not world loc)
|
private float endLon;
|
||||||
private float endAlt; //end loc of move message (offset if inside a building not world loc)
|
private float endAlt;
|
||||||
private int startLocType; // enum ordinal of the object player is inside 0=nothing 8=building
|
private int targetType;
|
||||||
private int inBuildingUUID; // uuid of the building character is currently inside
|
private int targetID;
|
||||||
private int inBuilding; // is inside a building 0=true -1=false
|
private int inBuilding; // 0=true, -1=false 0/1/2 = floor you are on
|
||||||
private int inBuildingFloor; // floor of building character is currently in -1=not inside building 0/1/2/3 = floor number
|
private int unknown01;
|
||||||
private byte initiatedByAttack; // move message sent as a result of move to target to attack 0=false 1=true
|
private byte unknown02;
|
||||||
private byte unknown03;
|
private byte unknown03;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,11 +54,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endLat = msg.endLat;
|
this.endLat = msg.endLat;
|
||||||
this.endLon = msg.endLon;
|
this.endLon = msg.endLon;
|
||||||
this.endAlt = msg.endAlt;
|
this.endAlt = msg.endAlt;
|
||||||
this.startLocType = msg.startLocType;
|
this.targetType = msg.targetType;
|
||||||
this.inBuildingUUID = msg.inBuildingUUID;
|
this.targetID = msg.targetID;
|
||||||
this.inBuilding = msg.inBuilding;
|
this.inBuilding = msg.inBuilding;
|
||||||
this.inBuildingFloor = msg.inBuildingFloor;
|
this.unknown01 = msg.unknown01;
|
||||||
this.initiatedByAttack = msg.initiatedByAttack;
|
this.unknown02 = msg.unknown02;
|
||||||
this.unknown03 = msg.unknown03;
|
this.unknown03 = msg.unknown03;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,11 +73,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endLat = building.getLoc().x;
|
this.endLat = building.getLoc().x;
|
||||||
this.endLon = building.getLoc().z;
|
this.endLon = building.getLoc().z;
|
||||||
this.endAlt = building.getLoc().y;
|
this.endAlt = building.getLoc().y;
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = -1;
|
this.inBuilding = -1;
|
||||||
this.inBuildingFloor = -1;
|
this.unknown01 = -1;
|
||||||
this.initiatedByAttack = 0;
|
this.unknown02 = 0;
|
||||||
this.unknown03 = 0;
|
this.unknown03 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +108,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
writer.putFloat(this.endAlt);
|
writer.putFloat(this.endAlt);
|
||||||
writer.putFloat(this.endLon);
|
writer.putFloat(this.endLon);
|
||||||
|
|
||||||
writer.putInt(this.startLocType);
|
writer.putInt(this.targetType);
|
||||||
writer.putInt(this.inBuildingUUID);
|
writer.putInt(this.targetID);
|
||||||
|
|
||||||
writer.putInt(this.inBuilding);
|
writer.putInt(this.inBuilding);
|
||||||
writer.putInt(this.inBuildingFloor);
|
writer.putInt(this.unknown01);
|
||||||
|
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
@@ -136,13 +135,13 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endAlt = reader.getFloat();
|
this.endAlt = reader.getFloat();
|
||||||
this.endLon = reader.getFloat();
|
this.endLon = reader.getFloat();
|
||||||
|
|
||||||
this.startLocType = reader.getInt();
|
this.targetType = reader.getInt();
|
||||||
this.inBuildingUUID = reader.getInt();
|
this.targetID = reader.getInt();
|
||||||
|
|
||||||
this.inBuilding = reader.getInt();
|
this.inBuilding = reader.getInt();
|
||||||
this.inBuildingFloor = reader.getInt();
|
this.unknown01 = reader.getInt();
|
||||||
|
|
||||||
this.initiatedByAttack = reader.get();
|
this.unknown02 = reader.get();
|
||||||
this.unknown03 = reader.get();
|
this.unknown03 = reader.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,20 +209,20 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endAlt = value;
|
this.endAlt = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStartLocType() {
|
public int getTargetType() {
|
||||||
return this.startLocType;
|
return this.targetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartLocType(int value) {
|
public void setTargetType(int value) {
|
||||||
this.startLocType = value;
|
this.targetType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInBuildingUUID() {
|
public int getTargetID() {
|
||||||
return this.inBuildingUUID;
|
return this.targetID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInBuildingUUID(int value) {
|
public void setTargetID(int value) {
|
||||||
this.inBuildingUUID = value;
|
this.targetID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInBuilding() {
|
public int getInBuilding() {
|
||||||
@@ -234,8 +233,12 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.inBuilding = value;
|
this.inBuilding = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInBuildingFloor(int value) {
|
public int getUnknown01() {
|
||||||
this.inBuildingFloor = value;
|
return this.unknown01;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnknown01(int value) {
|
||||||
|
this.unknown01 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartCoord(Vector3fImmutable value) {
|
public void setStartCoord(Vector3fImmutable value) {
|
||||||
@@ -251,8 +254,8 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearTarget() {
|
public void clearTarget() {
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayer(AbstractCharacter ac) {
|
public void setPlayer(AbstractCharacter ac) {
|
||||||
@@ -260,10 +263,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.sourceID = ac.getObjectUUID();
|
this.sourceID = ac.getObjectUUID();
|
||||||
this.setStartCoord(ac.getLoc());
|
this.setStartCoord(ac.getLoc());
|
||||||
this.setEndCoord(ac.getEndLoc());
|
this.setEndCoord(ac.getEndLoc());
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = ac.getInBuilding();
|
this.inBuilding = ac.getInBuilding();
|
||||||
this.inBuildingFloor = ac.getInFloorID();
|
this.unknown01 = ac.getInFloorID();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,10 +274,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
if (target == null) {
|
if (target == null) {
|
||||||
this.setStartCoord(ac.getLoc());
|
this.setStartCoord(ac.getLoc());
|
||||||
this.setEndCoord(ac.getEndLoc());
|
this.setEndCoord(ac.getEndLoc());
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = -1;
|
this.inBuilding = -1;
|
||||||
this.inBuildingFloor = -1;
|
this.unknown01 = -1;
|
||||||
} else {
|
} else {
|
||||||
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
|
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
|
||||||
Vector3fImmutable convertLocEnd = convertLocStart;
|
Vector3fImmutable convertLocEnd = convertLocStart;
|
||||||
@@ -283,10 +286,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
this.setStartCoord(convertLocStart);
|
this.setStartCoord(convertLocStart);
|
||||||
this.setEndCoord(convertLocEnd);
|
this.setEndCoord(convertLocEnd);
|
||||||
this.startLocType = GameObjectType.Building.ordinal();
|
this.targetType = GameObjectType.Building.ordinal();
|
||||||
this.inBuildingUUID = target.getObjectUUID();
|
this.targetID = target.getObjectUUID();
|
||||||
this.inBuilding = ac.getInBuilding();
|
this.inBuilding = ac.getInBuilding();
|
||||||
this.inBuildingFloor = ac.getInFloorID();
|
this.unknown01 = ac.getInFloorID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -295,11 +298,7 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
return unknown03;
|
return unknown03;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInitiatedFromAttack() {
|
public int getUnknown02() {
|
||||||
return initiatedByAttack;
|
return unknown02;
|
||||||
}
|
|
||||||
|
|
||||||
public int getInBuildingFloor() {
|
|
||||||
return this.inBuildingFloor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,6 +601,9 @@ public class PlaceAssetMsg extends ClientNetMsg {
|
|||||||
public int getBlueprintUUID() {
|
public int getBlueprintUUID() {
|
||||||
return this.blueprintUUID;
|
return this.blueprintUUID;
|
||||||
}
|
}
|
||||||
|
public void setBlueprintUUID(int id) {
|
||||||
|
this.blueprintUUID = id;
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3fImmutable getLoc() {
|
public Vector3fImmutable getLoc() {
|
||||||
return this.loc;
|
return this.loc;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class RefinerScreenMsg extends ClientNetMsg {
|
|||||||
return this.unknown02;
|
return this.unknown02;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnknown02(int value) {
|
public void setUnknown02(float value) {
|
||||||
this.unknown02 = value;
|
this.unknown02 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ public class TrainMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
if (sk == null)
|
if (sk == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sk.getSkillsBase().getToken() == 40661438) {
|
if (sk.getSkillsBase().getToken() == 40661438) {
|
||||||
int maxValue = 15;
|
int maxValue = 15;
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,19 @@
|
|||||||
|
|
||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.DispatchChannel;
|
import engine.Enum.DispatchChannel;
|
||||||
import engine.Enum.GuildHistoryType;
|
import engine.Enum.GuildHistoryType;
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.*;
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.GuildManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.*;
|
import engine.net.*;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import engine.util.BoxTracker;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -137,6 +137,29 @@ public class VendorDialogMsg extends ClientNetMsg {
|
|||||||
msg.updateMessage(3, vd);
|
msg.updateMessage(3, vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(contract.getObjectUUID() == 1502040){
|
||||||
|
if(!playerCharacter.getTimestamps().containsKey("lastBoxChange"))
|
||||||
|
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis() - 1000);
|
||||||
|
|
||||||
|
if(playerCharacter.getTimeStamp("lastBoxChange") + 30000L > System.currentTimeMillis()) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "You Must Wait To Promote Again.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(playerCharacter.isBoxed == false) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "You Are Already The Active Character.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis());
|
||||||
|
|
||||||
|
for(PlayerCharacter newlyBoxed : BoxTracker.getPlayers(playerCharacter.getClientConnection().machineID)){
|
||||||
|
newlyBoxed.isBoxed = true;
|
||||||
|
}
|
||||||
|
playerCharacter.isBoxed = false;
|
||||||
|
InterestManager.setObjectDirty(playerCharacter);
|
||||||
|
playerCharacter.removeEffectBySource(Enum.EffectSourceType.DeathShroud,50,true);
|
||||||
|
}
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
@@ -548,23 +571,36 @@ public class VendorDialogMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
// verify race valid for profession
|
// verify race valid for profession
|
||||||
Race race = pc.getRace();
|
Race race = pc.getRace();
|
||||||
|
if(race.getRaceRuneID() == 1999 && (promoID == 2512 || promoID == 2511)) {
|
||||||
|
|
||||||
|
} else if(promo.getName().equals("Ranger")&& race.getName().equals("Saetor"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}else {
|
||||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||||
// TODO send client promotion error
|
// TODO send client promotion error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// verify baseclass valid for profession
|
// verify baseclass valid for profession
|
||||||
BaseClass bc = pc.getBaseClass();
|
BaseClass bc = pc.getBaseClass();
|
||||||
|
if(promo.getName().equals("Druid") && (bc.getName().equals("Rogue") || bc.getName().equals("Mage"))) { //allow rogue and mage druids
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
||||||
// TODO send client promotion error
|
// TODO send client promotion error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// verify gender
|
// verify gender
|
||||||
|
if(race.getName().equals("Saetor") == false) { //saetors can promote to huntress and fury
|
||||||
if (promoID == 2511 && pc.isMale()) // Fury
|
if (promoID == 2511 && pc.isMale()) // Fury
|
||||||
return;
|
return;
|
||||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (promoID == 2517 && !pc.isMale()) // Warlock
|
if (promoID == 2517 && !pc.isMale()) // Warlock
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import engine.net.ByteBufferReader;
|
|||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
|
import engine.objects.Race;
|
||||||
|
|
||||||
public class CommitNewCharacterMsg extends ClientNetMsg {
|
public class CommitNewCharacterMsg extends ClientNetMsg {
|
||||||
|
|
||||||
@@ -175,7 +176,7 @@ public class CommitNewCharacterMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public int getRace() {
|
public int getRace() {
|
||||||
for (int i = 0; i < 23; i++)
|
for (int i = 0; i < 23; i++)
|
||||||
if (this.runes[i] > 1999 && this.runes[i] < 2030)
|
if(Race.getRace(this.runes[i]) != null)
|
||||||
return this.runes[i];
|
return this.runes[i];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user