Compare commits
739 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5142a87b60 | |||
| 9b7568b576 | |||
| 7bec57e77d | |||
| 28bccdd3d8 | |||
| cca342e99d | |||
| e41c79e6d7 | |||
| 7dfb0da862 | |||
| c2d4e0c1dd | |||
| 512621981a | |||
| 81c9a84edf | |||
| c099444464 | |||
| 94afb7f40f | |||
| d43f87b295 | |||
| d5b787430e | |||
| 3af6cab92e | |||
| 106e7be1ac | |||
| 0d8f1f7252 | |||
| 330344f55b | |||
| 7a5f138c78 | |||
| 6a9ca26d81 | |||
| 32c28e8f54 | |||
| 99dcfbb4a2 | |||
| 16dffee0e3 | |||
| a5cb785587 | |||
| 7bcd75719c | |||
| d96993576a | |||
| 17afaf6720 | |||
| 3e9f38c857 | |||
| a36dbc6539 | |||
| 7d3ff49796 | |||
| d2ac62e320 | |||
| 4b83311a89 | |||
| 7fd55bb6f3 | |||
| a40025bca1 | |||
| d58ba67cc2 | |||
| 3d4a9e18d0 | |||
| 7e5fe56bc0 | |||
| 4cf3b0929f | |||
| 98a6d268d0 | |||
| a9a4b36121 | |||
| 75a4a69036 | |||
| 982a35bb4f | |||
| 27c3fe515c | |||
| 29d82d9e81 | |||
| 81427e6911 | |||
| 296a7012b0 | |||
| b9b88449ed | |||
| 6585248eb8 | |||
| feebddd495 | |||
| 3e510a487c | |||
| 5277fbbe56 | |||
| 1a64272801 | |||
| fc7b7eb915 | |||
| 1e3249561c | |||
| 1ac76ae4d3 | |||
| 56cea25e06 | |||
| 2c33ff5a2a | |||
| 3cdf848e33 | |||
| 7ed291860f | |||
| e3e8fae90c | |||
| 0a2e487a76 | |||
| 6018be3c72 | |||
| 486141ce0b | |||
| cc96d68974 | |||
| 6740896244 | |||
| 811eb42e47 | |||
| 1633b5d0dd | |||
| 808eb989ea | |||
| 6879a8dccf | |||
| 8cf17e3abd | |||
| 0711c8f05b | |||
| b0ad37dbf8 | |||
| 2c3d5a3fcf | |||
| 78e8aab808 | |||
| 2bc033170f | |||
| 556eb30ab0 | |||
| 4f74d43081 | |||
| 80c4dcc082 | |||
| 9cd30d5299 | |||
| b148ea5f6e | |||
| 3612232788 | |||
| 99acc4736f | |||
| fac426a09c | |||
| c75a153c92 | |||
| ce5611aafd | |||
| 9e6b50d264 | |||
| f5801e0837 | |||
| 79864713b5 | |||
| 42daf1c049 | |||
| 1784ac1e5d | |||
| 137a547d3d | |||
| d9738c39a5 | |||
| 45bd3159ce | |||
| acd1246a87 | |||
| 1e64108b56 | |||
| 1481cc7ac0 | |||
| c0b75564c2 | |||
| 4958165603 | |||
| 35258f6ab5 | |||
| 3913201eed | |||
| 37bedcf919 | |||
| 11e40d7e57 | |||
| 0cdd8a75dc | |||
| 2e45d8548f | |||
| 61f8c210ae | |||
| acc5c04810 | |||
| 8030ecb800 | |||
| 12b350580a | |||
| 78dd409fa8 | |||
| 0727175cb2 | |||
| 7c3a3fb84c | |||
| 5781737afc | |||
| 75e1dddd08 | |||
| 1e78442910 | |||
| de6158842d | |||
| 0c07586927 | |||
| cfca585ab5 | |||
| db2a168229 | |||
| 040121f7cd | |||
| 570a22f0cb | |||
| 1ebc5d5e00 | |||
| 4b1d7ea718 | |||
| 402f608f7a | |||
| b9b6b37505 | |||
| 3be5236ba8 | |||
| 4cbe9fc236 | |||
| 6ac05d3db2 | |||
| 2531041d7c | |||
| 77e5866351 | |||
| 22e80e1ef4 | |||
| a86e07a89f | |||
| 5f277c3cff | |||
| ef234beeb7 | |||
| 69c5c5da92 | |||
| 7ed5431c99 | |||
| 627255ce3d | |||
| 0d1c9e8b8b | |||
| 5fa79fbac6 | |||
| 45b4ae9e3e | |||
| f410fc5482 | |||
| 92db9e1086 | |||
| f0875a6093 | |||
| 0c50cd9536 | |||
| 3c1280e546 | |||
| aece43a3bc | |||
| 1417760f5b | |||
| 2947753c3c | |||
| 98664a8983 | |||
| 5e5203aa36 | |||
| a41288ac78 | |||
| bdb9a12bd5 | |||
| 458bdbd72d | |||
| 65b10f72fa | |||
| b50110f7b0 | |||
| 1e09930bdb | |||
| 614fb9a5e9 | |||
| 17b4b993e2 | |||
| fa45e9556f | |||
| deab274ba2 | |||
| 82cefce424 | |||
| 0fd6dfb648 | |||
| a5ccba2e27 | |||
| e09bd9aae0 | |||
| 74b1994f5e | |||
| dfa646d828 | |||
| 668b61b734 | |||
| 20c032fa4d | |||
| 62235497ad | |||
| 983dd46870 | |||
| 4da089e9b8 | |||
| aaff28d720 | |||
| 93befc0887 | |||
| d304d0706c | |||
| eff44c334d | |||
| e082a0b49c | |||
| 42186fd2a3 | |||
| 769b84b9da | |||
| 3842cce1ab | |||
| f4fc7fc75b | |||
| f89ce2ee15 | |||
| ecd7215003 | |||
| 585f984554 | |||
| 3d96e6504e | |||
| f0efd0c477 | |||
| bc50408c45 | |||
| 7125e9b360 | |||
| 2fb7260077 | |||
| d3ef0c828d | |||
| bedf3761bd | |||
| b3b9867624 | |||
| d0f1a73a9f | |||
| 4bcf00fd6f | |||
| 5f7465194e | |||
| f0c6584818 | |||
| a61b8d193b | |||
| c863cd5f54 | |||
| c01c69db83 | |||
| 001a89ccf0 | |||
| c2633d0d9f | |||
| 5957ff6f7b | |||
| afc80c0e03 | |||
| 740949812c | |||
| ee0fc67984 | |||
| 434a9d5fda | |||
| ec6ec33c74 | |||
| 71c240e347 | |||
| eaf9894f99 | |||
| b68aa3b289 | |||
| 345e729d1a | |||
| 2e8b4c97ac | |||
| 01d5e37a81 | |||
| 67dc95e496 | |||
| e56c5a4fdc | |||
| 4e3a578ad1 | |||
| 1b7114d8bd | |||
| 27cc7655b3 | |||
| f7b593149d | |||
| 01e7e0fac3 | |||
| 228781e62f | |||
| d0c41816ac | |||
| 2bc872e9d9 | |||
| 127300c58b | |||
| 1da1b2f546 | |||
| 79f7458010 | |||
| c8f90ea654 | |||
| 27c1ec0e55 | |||
| bda4bb66e1 | |||
| 2691b4317b | |||
| 25878db5f0 | |||
| 9cd5e42c08 | |||
| c39dc59ef5 | |||
| 0b5564267f | |||
| 6ca5e46ef6 | |||
| 4b855cdf6e | |||
| b4638f9218 | |||
| 5b8934c922 | |||
| 9d89f5d7f4 | |||
| 1c6be6a1ea | |||
| 5d054142ff | |||
| 7723ac8830 | |||
| b5cc45aafd | |||
| 94d3364808 | |||
| dab46c185c | |||
| 8bf5360f6f | |||
| ee431510fb | |||
| 465736912b | |||
| f2ae969e84 | |||
| f2eaf61bd0 | |||
| 189c052ed5 | |||
| fa28129aa4 | |||
| c42d438a7c | |||
| 2e1efce858 | |||
| 825d7eb071 | |||
| cd80b9f228 | |||
| 502dda0b3b | |||
| a8ea778c6e | |||
| 6c29321581 | |||
| 7ed94d171a | |||
| afd73082f3 | |||
| 890f3523f3 | |||
| 8e8ed92e26 | |||
| b935ae9fc4 | |||
| d6272d7310 | |||
| e60a7a5ac0 | |||
| 7e8cb056ed | |||
| 9ae3cb796d | |||
| 9a6a131bbf | |||
| 3909ddb3ba | |||
| dbc26b8243 | |||
| 93a4acb108 | |||
| 9c1c4e02a9 | |||
| 00aa06c5f1 | |||
| f3578f82e6 | |||
| 85ee1faf4a | |||
| b72c8e8ce3 | |||
| 77a89b8f8a | |||
| a9a9b6a8ac | |||
| fab77a0dbb | |||
| e83e0def2e | |||
| ebcc721d43 | |||
| ff6d236ea7 | |||
| 41a9c19001 | |||
| 187ef18ac2 | |||
| 93304e3eb7 | |||
| b1f14c4beb | |||
| 1b2c073886 | |||
| f20a5bb881 | |||
| 394ba5a165 | |||
| c35e689d1b | |||
| a9b6fcb9ee | |||
| 8eeb539f16 | |||
| a863902370 | |||
| 12f8139d1e | |||
| 4f25e7e24f | |||
| 5860a263d9 | |||
| 1460ddb975 | |||
| 5326126dcb | |||
| e6a8cdd5e2 | |||
| 0dc8eeee90 | |||
| e719d13c8c | |||
| 9ee2592ec7 | |||
| 720b97dc69 | |||
| 177917a8c8 | |||
| a1323e5d17 | |||
| 760b2c3df1 | |||
| 31f8b5a294 | |||
| 3498cc370f | |||
| 66dd7b5f90 | |||
| 5cc979e2f3 | |||
| 1bcf307f94 | |||
| cdf67f4ce5 | |||
| 67f2dce2fd | |||
| 162f28d874 | |||
| c6ab1b5468 | |||
| d17db3a1fd | |||
| 9428436883 | |||
| 62dfb8a42e | |||
| c6647a99b8 | |||
| a11797c5e4 | |||
| 84a124bb52 | |||
| b296742de0 | |||
| c0560ece47 | |||
| 89fd647870 | |||
| 07da5cb77c | |||
| aaf84d13f8 | |||
| fd1bb0def7 | |||
| 3223eae7b6 | |||
| d836f80805 | |||
| 1a6dcf3f57 | |||
| dce48f3d66 | |||
| 10d98f32b6 | |||
| acdf6db91a | |||
| 0ee7269c8f | |||
| 4b888b3d92 | |||
| f0ed15baf0 | |||
| 6c882a7788 | |||
| 11e03e0051 | |||
| 6e47b80d23 | |||
| a3d3c32b07 | |||
| 3a27f2f4c8 | |||
| 1638804f1f | |||
| 362958c0f1 | |||
| 74720956a1 | |||
| 58e1f4d70b | |||
| c871c253b1 | |||
| 547b101c60 | |||
| b9ccbe219f | |||
| c31409d26f | |||
| 00d6e4f819 | |||
| dc9f33dc7b | |||
| 3d45f26611 | |||
| 8554bad731 | |||
| b2a8fe357e | |||
| 08ac0b8d8d | |||
| 23bf491d4b | |||
| 76d22abd0b | |||
| e4e8086e41 | |||
| 63116551bc | |||
| d06ce44bd5 | |||
| 387f75766f | |||
| 2a18b96d23 | |||
| bf2174fbe5 | |||
| 462f6725b6 | |||
| ed09bffc87 | |||
| 218de2bb70 | |||
| c90961b691 | |||
| 1b5b904a8f | |||
| ed219efb92 | |||
| 4d704d3ab0 | |||
| 11076ff586 | |||
| 6b22e624f6 | |||
| a81f90238b | |||
| e7c2e827b9 | |||
| 82aa2f9b77 | |||
| d9cc2d2a56 | |||
| 28e3769d1e | |||
| e092d764bd | |||
| 27c0a852e9 | |||
| bf6ad69d4c | |||
| 0b4b270d2f | |||
| 4b63493b73 | |||
| 9b6c8af171 | |||
| 4c7421cd62 | |||
| 7662069100 | |||
| adb10e34f3 | |||
| bd0d814142 | |||
| 06364a2b9e | |||
| afb6d3e8a3 | |||
| a48ff5851c | |||
| ede21f8d54 | |||
| d08190cbff | |||
| cd50ca4309 | |||
| 97c118ae1a | |||
| 8878f07628 | |||
| dee30d8121 | |||
| 5087465ecb | |||
| 39844251b0 | |||
| 8c983eadff | |||
| 7efe5209aa | |||
| 95cf5fa209 | |||
| adde3fc3a8 | |||
| b7089e88d3 | |||
| da63d9d926 | |||
| c8a5224c75 | |||
| d4618ae4b9 | |||
| 0591b9d41f | |||
| 52c5f51613 | |||
| f8b9c97730 | |||
| c7fa537cfb | |||
| e0e8296339 | |||
| e677ca9f33 | |||
| c19f6df690 | |||
| 3ed7f7c3fb | |||
| 6b10374adb | |||
| 0a65ea61e7 | |||
| 6500659c1f | |||
| 480887a78f | |||
| 05ac2d0a90 | |||
| bbac9ce6b9 | |||
| 5b9866f704 | |||
| 4a6e4d2a85 | |||
| b7ef3de527 | |||
| 4bfb866abe | |||
| 23d2b595d9 | |||
| 7d30fd2b96 | |||
| 93d5976c1e | |||
| 260bc453d1 | |||
| 5a619db9bd | |||
| d622406912 | |||
| a5e2b69ae3 | |||
| 56686944af | |||
| aa957f41af | |||
| 9336305334 | |||
| bc9c5224d0 | |||
| eda27b2e9c | |||
| c5d6b382f8 | |||
| ae0d182e2e | |||
| ad78d152f7 | |||
| 000ccdaf0a | |||
| 57249727de | |||
| d6c49d0793 | |||
| 2fa58c4f38 | |||
| c361c2a78a | |||
| 4d862355be | |||
| 52028e0e97 | |||
| 3e4e13a8ae | |||
| 0ceea002d5 | |||
| 7d8f4049b9 | |||
| dbefaa7ead | |||
| 9c1ec1069f | |||
| f36c980eb9 | |||
| cb1a7f014d | |||
| e729bc9541 | |||
| c97a6f555a | |||
| 95a104e397 | |||
| e7ad83cc60 | |||
| 821b7264ec | |||
| 0bf3456119 | |||
| ff7bd7a699 | |||
| a028bebafd | |||
| 789d9a3bb6 | |||
| 8e19b66a9b | |||
| 975845375f | |||
| 74b37063bf | |||
| c2fee2290d | |||
| f7c8c44ebb | |||
| 91b2ff6e62 | |||
| 8293f552b1 | |||
| a84336fc31 | |||
| 3951114eb7 | |||
| f24877e9ce | |||
| b81b83570a | |||
| 2417073a4d | |||
| ebc0b7a89e | |||
| 3d6bfcf48f | |||
| a5864b74f8 | |||
| de8896ff4e | |||
| e579912733 | |||
| c7b4404c36 | |||
| f1de7d413a | |||
| cc6f5f5f25 | |||
| 19bf75ade8 | |||
| 73eacc3779 | |||
| 69f3504ee9 | |||
| bd89b5e975 | |||
| 186eea3099 | |||
| 5e0badef17 | |||
| ea24d493fd | |||
| d12d040def | |||
| 491a9dbae9 | |||
| 1e0372c40d | |||
| d2f6344846 | |||
| 47cb824b3f | |||
| 7d8117173f | |||
| 2f076d3215 | |||
| 1a0b8c1d35 | |||
| 887db109c1 | |||
| d8b7f74cd1 | |||
| b81b4f0e0a | |||
| 0b4e0d65a9 | |||
| 2f837ace1e | |||
| 319d68d15e | |||
| 2224d811eb | |||
| 9ec97ce448 | |||
| f13b8b5d3e | |||
| 633f5837dc | |||
| 3238cfa0ff | |||
| 83b1503cee | |||
| 6854fad222 | |||
| 56dd3cfa95 | |||
| f81a1acb20 | |||
| 4ed5744707 | |||
| 085f2816a9 | |||
| 0526fdef2f | |||
| 093ee9f59a | |||
| 1d56b138a5 | |||
| 419ce3f49c | |||
| a27f257f80 | |||
| 8eee7ca23e | |||
| 28cf0d2232 | |||
| e12a8a3c7c | |||
| 9ad5f239b0 | |||
| 3db8ee7afd | |||
| f07974f673 | |||
| 0d5cef1652 | |||
| 04203c092a | |||
| 78feee482b | |||
| 8c35844e08 | |||
| 0fbb43e021 | |||
| 145449f26d | |||
| feef6263b4 | |||
| 6c622c377f | |||
| 8943121336 | |||
| 70cb469190 | |||
| a42f307a70 | |||
| 2a3ae6eaec | |||
| 9e4b596aa1 | |||
| aa1fe792a3 | |||
| 79919121a8 | |||
| 80ccfff635 | |||
| 381139af35 | |||
| e79da63556 | |||
| 533565e37e | |||
| da0510d2bc | |||
| 1f732a8ca9 | |||
| 0d24789a93 | |||
| 35427cfb4a | |||
| 695a78b1e2 | |||
| 9f6710ccb9 | |||
| fff1e80f61 | |||
| 141af19daa | |||
| 630748541f | |||
| d32818f351 | |||
| d6f94bd0e7 | |||
| db6a4e471d | |||
| a24c611bac | |||
| 3926160ab1 | |||
| 4a7013de61 | |||
| 56564f1c3b | |||
| 8a3e39e97d | |||
| 5224c79441 | |||
| ede016a93d | |||
| cc1825dec9 | |||
| d257ce50cf | |||
| 5b246211e1 | |||
| 33c923b0de | |||
| 02d524663a | |||
| 5bd85addb7 | |||
| 40bae67443 | |||
| 1cf1d731c4 | |||
| 24215e21c9 | |||
| 3accd779b9 | |||
| 1d673ca2e5 | |||
| c935ea1986 | |||
| 678ccafd3c | |||
| 31292785a5 | |||
| cdc4717033 | |||
| 35c8ac0289 | |||
| f5cc4a3290 | |||
| 74bd7ddb8b | |||
| 4feb95131c | |||
| d22ba7b89d | |||
| 722fd14be5 | |||
| 12e73d59c7 | |||
| 5c70f15064 | |||
| 8ca641f353 | |||
| 0f9500a0d7 | |||
| 0d51afb737 | |||
| 60e331de1a | |||
| 4a554b0d61 | |||
| 3f3d85fb36 | |||
| d2d655a839 | |||
| 0096b8051c | |||
| 86102c8933 | |||
| f06e2c2e5c | |||
| 74b425e567 | |||
| 22c8cdcf65 | |||
| 7ed026f088 | |||
| 232c381e96 | |||
| 69ea460d5e | |||
| cbe9a30590 | |||
| 1bbbc396bd | |||
| 8601f9fcd5 | |||
| 7f029fd0e2 | |||
| cc7188b404 | |||
| aa0621bb02 | |||
| b4ff1a3f7f | |||
| 9d6b1dcf60 | |||
| 6e123ecb86 | |||
| 2b8b9464af | |||
| cd8099b42f | |||
| 2cdcba47a5 | |||
| b7b4623c75 | |||
| 2d958b929d | |||
| e8f0e9f5de | |||
| 03f0f3fcf0 | |||
| 65db64d3df | |||
| 5a25958aa5 | |||
| 1f8c5495ab | |||
| a54aa03ade | |||
| e82445fcd2 | |||
| 9e9716fc88 | |||
| 4f01da368c | |||
| 93c4103f61 | |||
| f8180a7000 | |||
| 634f1478ce | |||
| 7335946c10 | |||
| fb4eea67ed | |||
| 96ba17f67a | |||
| ff17cacda7 | |||
| 4d6ce2b155 | |||
| b2c9331899 | |||
| 1cb01b1cce | |||
| e79fd0c3b4 | |||
| 6dd1d97be5 | |||
| 805034e30b | |||
| 9646964698 | |||
| 9ffaf96017 | |||
| ce98f80b85 | |||
| f683201086 | |||
| 4796f7042d | |||
| 94ff3cf222 | |||
| 174be35cac | |||
| ba266e506a | |||
| 4123157b92 | |||
| 7bb9aeacf7 | |||
| 1eda55a3f1 | |||
| f670e3143c | |||
| d55b57f7d0 | |||
| ea2f6f4593 | |||
| b592f050c2 | |||
| 25f522c539 | |||
| e89404abda | |||
| ad2cde9d85 | |||
| ba94fabfb8 | |||
| f7ab38e9a8 | |||
| 0d97fa614b | |||
| 6878916874 | |||
| c545468f26 | |||
| 7993fb22d2 | |||
| 19bdb89c0f | |||
| 6b0b0cc357 | |||
| bc1ae9a2c9 | |||
| 408e3a45ca | |||
| 52e0b5be4d | |||
| 161335da26 | |||
| 7f1bc2a4b7 | |||
| e37a4fab38 | |||
| 2760a45d2f | |||
| 77673fde5f | |||
| 5fd4e5a088 | |||
| b01b62ac3d | |||
| 7193ff7698 | |||
| dd72e20ff9 | |||
| f465ea4045 | |||
| 973dfc94f7 | |||
| a5255bcf11 | |||
| ec35228de9 | |||
| 47a93f6545 | |||
| 0cff40070b | |||
| 3f3fb53675 | |||
| b198dbcc09 | |||
| 60b8843563 | |||
| eff8be91d6 | |||
| 55e2d3fb5e | |||
| a6f417d9cc | |||
| 7b1b09dc40 | |||
| 5724608005 | |||
| f5d410f868 | |||
| a5c1422534 | |||
| 6df0e5625c | |||
| 5de932b095 | |||
| db7d606b36 | |||
| 30d302c43e | |||
| 95cfc43956 | |||
| 7c8d78581e | |||
| 6f4a9f7d1a | |||
| 7a5569ab89 | |||
| 042f7c675f | |||
| 3c4d8239db | |||
| 4f20cc9aba | |||
| 34812694b7 | |||
| 0bbbcbaa81 | |||
| 72172b9f05 | |||
| 1876e09b48 | |||
| 31c83f2bb5 | |||
| 065aa34652 | |||
| 8bbaae418d | |||
| 10db850de4 | |||
| 753c3686ea | |||
| f4bd928796 | |||
| 916a12a434 | |||
| 3a8521683b | |||
| df4d5a654f | |||
| 7fb5d7d23d | |||
| a7c9a15405 | |||
| b3b115e9ba | |||
| 1b5a64d8fc | |||
| 01f0e25e08 | |||
| 0782814c8e | |||
| 111ba02289 | |||
| f09a7d4d12 | |||
| e1e72b71bd | |||
| 4dce2e2aa2 | |||
| 743c897254 | |||
| f134f71695 | |||
| 91016dd53c | |||
| 39d04188b4 | |||
| c99433c9bd | |||
| 6cc94e076d | |||
| f294e48140 | |||
| c25f325f87 | |||
| ac0c11cb46 | |||
| 79e86e0a6f | |||
| 46f35f0b10 | |||
| 1b20201f8d | |||
| 0d744d900c | |||
| 9a8e0bd5c9 | |||
| 1bc3609cbe |
@@ -8,6 +8,7 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -17,7 +18,6 @@ import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
@@ -88,7 +88,7 @@ public enum InterestManager implements Runnable {
|
||||
if (send) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public enum InterestManager implements Runnable {
|
||||
}
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
loadedStaticObjects.removeAll(toRemove);
|
||||
@@ -292,7 +292,7 @@ public enum InterestManager implements Runnable {
|
||||
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
||||
NPC npc = (NPC) awo;
|
||||
@@ -304,13 +304,13 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (lsm.getStructureList().size() > 0) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
for (LoadCharacterMsg lc : lcmList) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, lc);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
loadedStaticObjects.addAll(toLoad);
|
||||
@@ -414,7 +414,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (!uom.getObjectList().isEmpty()) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (lcm != null) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TerritoryChangeMessage;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -68,7 +68,7 @@ public enum RealmMap {
|
||||
|
||||
public static Realm getRealmForCity(City city) {
|
||||
Realm outRealm = null;
|
||||
outRealm = city.getRealm();
|
||||
outRealm = city.realm;
|
||||
return outRealm;
|
||||
}
|
||||
|
||||
@@ -91,17 +91,17 @@ public enum RealmMap {
|
||||
if (city != null) {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
} else {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
} else {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class Terrain {
|
||||
|
||||
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
||||
|
||||
// Retrieve the next zone with a terrain defined.
|
||||
// Retrieve the next zone up in the tree with a terrain defined.
|
||||
|
||||
Zone terrainZone = getNextZoneWithTerrain(zone);
|
||||
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.mbEnums.GridObjectType;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.math.FastMath;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.mbEnums.GridObjectType;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
@@ -201,7 +201,7 @@ public class WorldGrid {
|
||||
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
DispatchManager.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void loadObject(AbstractWorldObject awo) {
|
||||
@@ -213,15 +213,15 @@ public class WorldGrid {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
DispatchManager.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
@@ -239,19 +239,19 @@ public class WorldGrid {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
DispatchManager.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case PlayerCharacter:
|
||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
@@ -263,7 +263,7 @@ public class WorldGrid {
|
||||
ClientConnection origin) {
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
DispatchManager.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
|
||||
@@ -89,7 +89,8 @@ public class GuildRecord extends DataRecord {
|
||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||
guildRecord.guildName = guildRecord.guild.getName();
|
||||
guildRecord.charterName = mbEnums.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
||||
mbEnums.GuildCharterType guildCharterType = guild.charter;
|
||||
guildRecord.charterName = guildCharterType.name;
|
||||
|
||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||
|
||||
|
||||
@@ -52,25 +52,24 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, int realmID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||
|
||||
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
||||
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||
|
||||
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
||||
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
||||
preparedStatement.setLong(3, realmID); //objectUUID of realm city belongs in
|
||||
preparedStatement.setFloat(4, xCoord); //xOffset from parentZone center
|
||||
preparedStatement.setFloat(5, yCoord); //yOffset from parentZone center
|
||||
preparedStatement.setFloat(6, zCoord); //zOffset from parentZone center
|
||||
preparedStatement.setString(7, name); //city name
|
||||
preparedStatement.setTimestamp(8, Timestamp.valueOf(established));
|
||||
preparedStatement.setFloat(9, rotation);
|
||||
preparedStatement.setFloat(10, W);
|
||||
preparedStatement.setTimestamp(11, Timestamp.valueOf(upgradeTime));
|
||||
preparedStatement.setFloat(3, xCoord); //xOffset from parentZone center
|
||||
preparedStatement.setFloat(4, yCoord); //yOffset from parentZone center
|
||||
preparedStatement.setFloat(5, zCoord); //zOffset from parentZone center
|
||||
preparedStatement.setString(6, name); //city name
|
||||
preparedStatement.setTimestamp(7, Timestamp.valueOf(established));
|
||||
preparedStatement.setFloat(8, rotation);
|
||||
preparedStatement.setFloat(9, W);
|
||||
preparedStatement.setTimestamp(10, Timestamp.valueOf(upgradeTime));
|
||||
|
||||
boolean work = preparedStatement.execute();
|
||||
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mbEnums;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.effectmodifiers.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class dbEffectsBaseHandler extends dbHandlerBase {
|
||||
|
||||
public dbEffectsBaseHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static ArrayList<EffectsBase> getAllEffectsBase() {
|
||||
|
||||
ArrayList<EffectsBase> effectList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectbase ORDER BY `IDString` DESC")) {
|
||||
|
||||
ResultSet rs = prepareStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
EffectsBase effectBase = new EffectsBase(rs);
|
||||
effectList.add(effectBase);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
|
||||
return effectList;
|
||||
}
|
||||
|
||||
public static void cacheAllEffectModifiers() {
|
||||
|
||||
String IDString;
|
||||
AbstractEffectModifier abstractEffectModifier = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectmod")) {
|
||||
|
||||
ResultSet rs = prepareStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
IDString = rs.getString("IDString");
|
||||
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
|
||||
mbEnums.ModType modifier = mbEnums.ModType.GetModType(rs.getString("modType"));
|
||||
|
||||
//combine item prefix and suffix effect modifiers
|
||||
|
||||
abstractEffectModifier = getCombinedModifiers(abstractEffectModifier, rs, effectBase, modifier);
|
||||
|
||||
if (abstractEffectModifier != null) {
|
||||
|
||||
if (EffectsBase.modifiersMap.containsKey(effectBase.getIDString()) == false)
|
||||
EffectsBase.modifiersMap.put(effectBase.getIDString(), new HashSet<>());
|
||||
|
||||
EffectsBase.modifiersMap.get(effectBase.getIDString()).add(abstractEffectModifier);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, mbEnums.ModType modifier) throws SQLException {
|
||||
switch (modifier) {
|
||||
case AdjustAboveDmgCap:
|
||||
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
|
||||
break;
|
||||
case Ambidexterity:
|
||||
abstractEffectModifier = new AmbidexterityEffectModifier(rs);
|
||||
break;
|
||||
case AnimOverride:
|
||||
break;
|
||||
case ArmorPiercing:
|
||||
abstractEffectModifier = new ArmorPiercingEffectModifier(rs);
|
||||
break;
|
||||
case AttackDelay:
|
||||
abstractEffectModifier = new AttackDelayEffectModifier(rs);
|
||||
break;
|
||||
case Attr:
|
||||
abstractEffectModifier = new AttributeEffectModifier(rs);
|
||||
break;
|
||||
case BlackMantle:
|
||||
abstractEffectModifier = new BlackMantleEffectModifier(rs);
|
||||
break;
|
||||
case BladeTrails:
|
||||
abstractEffectModifier = new BladeTrailsEffectModifier(rs);
|
||||
break;
|
||||
case Block:
|
||||
abstractEffectModifier = new BlockEffectModifier(rs);
|
||||
break;
|
||||
case BlockedPowerType:
|
||||
abstractEffectModifier = new BlockedPowerTypeEffectModifier(rs);
|
||||
break;
|
||||
case CannotAttack:
|
||||
abstractEffectModifier = new CannotAttackEffectModifier(rs);
|
||||
break;
|
||||
case CannotCast:
|
||||
abstractEffectModifier = new CannotCastEffectModifier(rs);
|
||||
break;
|
||||
case CannotMove:
|
||||
abstractEffectModifier = new CannotMoveEffectModifier(rs);
|
||||
break;
|
||||
case CannotTrack:
|
||||
abstractEffectModifier = new CannotTrackEffectModifier(rs);
|
||||
break;
|
||||
case Charmed:
|
||||
abstractEffectModifier = new CharmedEffectModifier(rs);
|
||||
break;
|
||||
case ConstrainedAmbidexterity:
|
||||
abstractEffectModifier = new ConstrainedAmbidexterityEffectModifier(rs);
|
||||
break;
|
||||
case DamageCap:
|
||||
abstractEffectModifier = new DamageCapEffectModifier(rs);
|
||||
break;
|
||||
case DamageShield:
|
||||
abstractEffectModifier = new DamageShieldEffectModifier(rs);
|
||||
break;
|
||||
case DCV:
|
||||
abstractEffectModifier = new DCVEffectModifier(rs);
|
||||
break;
|
||||
case Dodge:
|
||||
abstractEffectModifier = new DodgeEffectModifier(rs);
|
||||
break;
|
||||
case DR:
|
||||
abstractEffectModifier = new DREffectModifier(rs);
|
||||
break;
|
||||
case Durability:
|
||||
abstractEffectModifier = new DurabilityEffectModifier(rs);
|
||||
break;
|
||||
case ExclusiveDamageCap:
|
||||
abstractEffectModifier = new ExclusiveDamageCapEffectModifier(rs);
|
||||
break;
|
||||
case Fade:
|
||||
abstractEffectModifier = new FadeEffectModifier(rs);
|
||||
break;
|
||||
case Fly:
|
||||
abstractEffectModifier = new FlyEffectModifier(rs);
|
||||
break;
|
||||
case Health:
|
||||
abstractEffectModifier = new HealthEffectModifier(rs);
|
||||
break;
|
||||
case HealthFull:
|
||||
abstractEffectModifier = new HealthFullEffectModifier(rs);
|
||||
break;
|
||||
case HealthRecoverRate:
|
||||
abstractEffectModifier = new HealthRecoverRateEffectModifier(rs);
|
||||
break;
|
||||
case IgnoreDamageCap:
|
||||
abstractEffectModifier = new IgnoreDamageCapEffectModifier(rs);
|
||||
break;
|
||||
case IgnorePassiveDefense:
|
||||
abstractEffectModifier = new IgnorePassiveDefenseEffectModifier(rs);
|
||||
break;
|
||||
case ImmuneTo:
|
||||
abstractEffectModifier = new ImmuneToEffectModifier(rs);
|
||||
break;
|
||||
case ImmuneToAttack:
|
||||
abstractEffectModifier = new ImmuneToAttackEffectModifier(rs);
|
||||
break;
|
||||
case ImmuneToPowers:
|
||||
abstractEffectModifier = new ImmuneToPowersEffectModifier(rs);
|
||||
break;
|
||||
case Invisible:
|
||||
abstractEffectModifier = new InvisibleEffectModifier(rs);
|
||||
break;
|
||||
case ItemName:
|
||||
abstractEffectModifier = new ItemNameEffectModifier(rs);
|
||||
if (((ItemNameEffectModifier) abstractEffectModifier).name.isEmpty())
|
||||
break;
|
||||
if (effectBase != null)
|
||||
effectBase.setName((((ItemNameEffectModifier) abstractEffectModifier).name));
|
||||
break;
|
||||
case Mana:
|
||||
abstractEffectModifier = new ManaEffectModifier(rs);
|
||||
break;
|
||||
case ManaFull:
|
||||
abstractEffectModifier = new ManaFullEffectModifier(rs);
|
||||
break;
|
||||
case ManaRecoverRate:
|
||||
abstractEffectModifier = new ManaRecoverRateEffectModifier(rs);
|
||||
break;
|
||||
case MaxDamage:
|
||||
abstractEffectModifier = new MaxDamageEffectModifier(rs);
|
||||
break;
|
||||
case MeleeDamageModifier:
|
||||
abstractEffectModifier = new MeleeDamageEffectModifier(rs);
|
||||
break;
|
||||
case MinDamage:
|
||||
abstractEffectModifier = new MinDamageEffectModifier(rs);
|
||||
break;
|
||||
case NoMod:
|
||||
abstractEffectModifier = new NoModEffectModifier(rs);
|
||||
break;
|
||||
case OCV:
|
||||
abstractEffectModifier = new OCVEffectModifier(rs);
|
||||
break;
|
||||
case Parry:
|
||||
abstractEffectModifier = new ParryEffectModifier(rs);
|
||||
break;
|
||||
case PassiveDefense:
|
||||
abstractEffectModifier = new PassiveDefenseEffectModifier(rs);
|
||||
break;
|
||||
case PowerCost:
|
||||
abstractEffectModifier = new PowerCostEffectModifier(rs);
|
||||
break;
|
||||
case PowerCostHealth:
|
||||
abstractEffectModifier = new PowerCostHealthEffectModifier(rs);
|
||||
break;
|
||||
case PowerDamageModifier:
|
||||
abstractEffectModifier = new PowerDamageEffectModifier(rs);
|
||||
break;
|
||||
case ProtectionFrom:
|
||||
abstractEffectModifier = new ProtectionFromEffectModifier(rs);
|
||||
break;
|
||||
case Resistance:
|
||||
abstractEffectModifier = new ResistanceEffectModifier(rs);
|
||||
break;
|
||||
case ScaleHeight:
|
||||
abstractEffectModifier = new ScaleHeightEffectModifier(rs);
|
||||
break;
|
||||
case ScaleWidth:
|
||||
abstractEffectModifier = new ScaleWidthEffectModifier(rs);
|
||||
break;
|
||||
case ScanRange:
|
||||
abstractEffectModifier = new ScanRangeEffectModifier(rs);
|
||||
break;
|
||||
case SeeInvisible:
|
||||
abstractEffectModifier = new SeeInvisibleEffectModifier(rs);
|
||||
break;
|
||||
case Silenced:
|
||||
abstractEffectModifier = new SilencedEffectModifier(rs);
|
||||
break;
|
||||
case Skill:
|
||||
abstractEffectModifier = new SkillEffectModifier(rs);
|
||||
break;
|
||||
case Slay:
|
||||
abstractEffectModifier = new SlayEffectModifier(rs);
|
||||
break;
|
||||
case Speed:
|
||||
abstractEffectModifier = new SpeedEffectModifier(rs);
|
||||
break;
|
||||
case SpireBlock:
|
||||
abstractEffectModifier = new SpireBlockEffectModifier(rs);
|
||||
break;
|
||||
case Stamina:
|
||||
abstractEffectModifier = new StaminaEffectModifier(rs);
|
||||
break;
|
||||
case StaminaFull:
|
||||
abstractEffectModifier = new StaminaFullEffectModifier(rs);
|
||||
break;
|
||||
case StaminaRecoverRate:
|
||||
abstractEffectModifier = new StaminaRecoverRateEffectModifier(rs);
|
||||
break;
|
||||
case Stunned:
|
||||
abstractEffectModifier = new StunnedEffectModifier(rs);
|
||||
break;
|
||||
case Value:
|
||||
abstractEffectModifier = new ValueEffectModifier(rs);
|
||||
if (effectBase != null) {
|
||||
ValueEffectModifier valueEffect = (ValueEffectModifier) abstractEffectModifier;
|
||||
effectBase.setValue(valueEffect.minMod);
|
||||
}
|
||||
break;
|
||||
case WeaponProc:
|
||||
abstractEffectModifier = new WeaponProcEffectModifier(rs);
|
||||
break;
|
||||
case WeaponRange:
|
||||
abstractEffectModifier = new WeaponRangeEffectModifier(rs);
|
||||
break;
|
||||
case WeaponSpeed:
|
||||
abstractEffectModifier = new WeaponSpeedEffectModifier(rs);
|
||||
break;
|
||||
|
||||
}
|
||||
return abstractEffectModifier;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
@@ -30,73 +29,6 @@ public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public void GENERATE_COST_DATA() {
|
||||
ArrayList<String> effectList = GET_EFFECTS_WITH_COST();
|
||||
|
||||
for (String effectID : effectList) {
|
||||
JSONObject costMap = GET_EFFECT_COSTMAP(effectID);
|
||||
WRITE_COSTMAP(effectID, costMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public JSONObject GET_EFFECT_COSTMAP(String effectID) {
|
||||
HashMap<mbEnums.ResourceType, Integer> costMap = new HashMap<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, effectID);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.resourceLookup.get(rs.getInt("resource"));
|
||||
int value = rs.getInt("amount");
|
||||
costMap.put(resourceType, value);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return new JSONObject(costMap);
|
||||
}
|
||||
|
||||
public ArrayList<String> GET_EFFECTS_WITH_COST() {
|
||||
|
||||
ArrayList<String> effectList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT DISTINCT `IDString` FROM `static_power_effectcost`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
effectList.add(rs.getString("IdString"));
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return effectList;
|
||||
}
|
||||
|
||||
public boolean WRITE_COSTMAP(String effectID, JSONObject costmap) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `static_effect_costmaps` (`effectID`, `costMap`) VALUES (?, ?) " +
|
||||
"ON DUPLICATE KEY UPDATE `costmap` = VALUES(`costmap`)")) {
|
||||
|
||||
preparedStatement.setString(1, effectID);
|
||||
preparedStatement.setString(2, costmap.toString());
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void LOAD_ALL_COSTMAPS() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
@@ -123,22 +55,4 @@ public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
|
||||
|
||||
ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, idString);
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
effectsResourceCosts = getObjectsFromRs(rs, 1000);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return effectsResourceCosts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(6, guildTag.symbolColor);
|
||||
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
||||
preparedStatement.setInt(8, guildTag.symbol);
|
||||
preparedStatement.setInt(9, g.getCharter());
|
||||
preparedStatement.setInt(9, g.charter.templateID);
|
||||
preparedStatement.setString(10, g.getLeadershipType());
|
||||
preparedStatement.setString(11, g.getMotto());
|
||||
|
||||
@@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
||||
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
||||
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
||||
preparedStatement.setInt(7, g.getCharter());
|
||||
preparedStatement.setInt(7, g.charter.templateID);
|
||||
preparedStatement.setString(8, g.getMOTD());
|
||||
preparedStatement.setString(9, g.getICMOTD());
|
||||
preparedStatement.setString(10, "");
|
||||
|
||||
@@ -554,7 +554,7 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
|
||||
// Write 0 if we will not modify the value from template
|
||||
|
||||
if (item.value == item.template.item_value)
|
||||
if (value == item.template.item_value)
|
||||
value = 0;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
|
||||
@@ -221,20 +221,4 @@ public class dbLootHandler extends dbHandlerBase {
|
||||
return bootySets;
|
||||
}
|
||||
|
||||
public void LOAD_ENCHANT_VALUES() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `IDString`, `minMod` FROM `static_power_effectmod` WHERE `modType` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, "Value");
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
Item.addEnchantValue(rs.getString("IDString"), rs.getInt("minMod"));
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.MineProduction;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.MobBaseEffects;
|
||||
import engine.objects.MobBaseStats;
|
||||
|
||||
@@ -310,6 +310,22 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_RACE(NPC npc, int value) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `npc_raceID`=? WHERE `UID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, value);
|
||||
preparedStatement.setLong(2, npc.getObjectUUID());
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_PIRATE_NAMES() {
|
||||
|
||||
String pirateName;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Petition;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Heraldry;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class dbPowerHandler extends dbHandlerBase {
|
||||
|
||||
public dbPowerHandler() {
|
||||
this.localClass = Mob.class;
|
||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public static void addAllSourceTypes() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
String IDString, source;
|
||||
|
||||
while (rs.next()) {
|
||||
IDString = rs.getString("IDString");
|
||||
int token = DbManager.hasher.SBStringHash(IDString);
|
||||
|
||||
source = rs.getString("source").replace("-", "").trim();
|
||||
mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source);
|
||||
|
||||
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
||||
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
||||
|
||||
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAllAnimationOverrides() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_animation_override")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
String IDString;
|
||||
int animation;
|
||||
while (rs.next()) {
|
||||
IDString = rs.getString("IDString");
|
||||
|
||||
EffectsBase eb = PowersManager.getEffectByIDString(IDString);
|
||||
if (eb != null)
|
||||
IDString = eb.getIDString();
|
||||
|
||||
animation = rs.getInt("animation");
|
||||
PowersManager.AnimationOverrides.put(IDString, animation);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.RuneBaseEffect;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Portal;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Shrine;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.MaxSkills;
|
||||
import engine.objects.SkillsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.VendorDialog;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
@@ -136,6 +136,12 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
int cityUID = rs.getInt("cityUUID");
|
||||
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
||||
City city = City.getCity(cityUID);
|
||||
|
||||
if (city == null) {
|
||||
Logger.error("No city " + cityUID + " for warehouse");
|
||||
continue;
|
||||
}
|
||||
|
||||
city.warehouse = new Warehouse(jsonObject);
|
||||
city.warehouse.city = city;
|
||||
|
||||
@@ -154,7 +160,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_WORKORDER(WorkOrder workOrder) {
|
||||
public boolean WRITE_WORKORDER(WorkOrder workOrder) {
|
||||
|
||||
JSONObject warehouseJSON = WorkOrder.toJson(workOrder);
|
||||
|
||||
@@ -187,7 +193,12 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_WORKORDERS() {
|
||||
|
||||
// Method loads NPC workOrders from disk at bootstrap.
|
||||
// A workOrder will persist until completed or junked
|
||||
// via the client interface.
|
||||
|
||||
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
||||
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
||||
@@ -202,22 +213,22 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
// Remove the old workOrder records
|
||||
|
||||
for (WorkOrder workOrder : submitList)
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
|
||||
// Submit the new workOrders to the ForgeManager
|
||||
// Submit new workOrders to the ForgeManager
|
||||
|
||||
for (WorkOrder workOrder : submitList) {
|
||||
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
|
||||
// Delete but do not reconstitute orphan workOrders
|
||||
|
||||
if (workOrder.vendor == null)
|
||||
continue;
|
||||
|
||||
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||
|
||||
// If workorder is not yet complete process it
|
||||
|
||||
if (workOrder.runCompleted == false)
|
||||
ForgeManager.forge.add(workOrder);
|
||||
|
||||
ForgeManager.forge.add(workOrder);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.ZoneTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mbEnums.PowerActionType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.util.ThreadUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ApplyBonusCmd extends AbstractDevCmd {
|
||||
|
||||
public ApplyBonusCmd() {
|
||||
super("applybonus");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
String action = words[0];
|
||||
|
||||
PowerActionType actionType = null;
|
||||
|
||||
HashMap<String, HashSet<String>> appliedMods = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
if (action.equals("all") == false)
|
||||
for (PowerActionType powerActionType : PowerActionType.values()) {
|
||||
if (powerActionType.name().equalsIgnoreCase(action) == false)
|
||||
continue;
|
||||
actionType = powerActionType;
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
this.throwbackError(pcSender, "Invalid power Action type for " + action);
|
||||
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
|
||||
return;
|
||||
}
|
||||
if (action.equals("all") == false)
|
||||
if (actionType == null) {
|
||||
this.throwbackError(pcSender, "Invalid power Action type for " + action);
|
||||
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (PowersBase pb : PowersManager.powersBaseByIDString.values()) {
|
||||
if (pb.getActions() == null || pb.getActions().isEmpty())
|
||||
continue;
|
||||
|
||||
for (ActionsBase ab : pb.getActions()) {
|
||||
if (ab.getPowerAction() == null)
|
||||
continue;
|
||||
if (action.equals("all") == false)
|
||||
if (ab.getPowerAction().getType().equalsIgnoreCase(action) == false)
|
||||
continue;
|
||||
String effect1 = "";
|
||||
String effect2 = "";
|
||||
ChatManager.chatSystemInfo(pcSender, "Applying Power " + pb.getName() + " : " + pb.getDescription());
|
||||
if (ab.getPowerAction().getEffectsBase() == null) {
|
||||
|
||||
try {
|
||||
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
ThreadUtils.sleep(500);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (ab.getPowerAction().getEffectsBase().getModifiers() == null || ab.getPowerAction().getEffectsBase().getModifiers().isEmpty()) {
|
||||
try {
|
||||
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean run = true;
|
||||
for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()) {
|
||||
if (appliedMods.containsKey(mod.modType.name()) == false) {
|
||||
appliedMods.put(mod.modType.name(), new HashSet<>());
|
||||
}
|
||||
|
||||
// if (appliedMods.get(mod.modType.name()).contains(mod.sourceType.name())){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
appliedMods.get(mod.modType.name()).add(mod.sourceType.name());
|
||||
try {
|
||||
try {
|
||||
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /bounds'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Audits all the mobs in a zone.";
|
||||
|
||||
}
|
||||
|
||||
private String getActionTypes() {
|
||||
String output = "";
|
||||
|
||||
for (PowerActionType actionType : PowerActionType.values()) {
|
||||
output += actionType.name() + " | ";
|
||||
|
||||
}
|
||||
|
||||
return output.substring(0, output.length() - 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.*;
|
||||
|
||||
public class GotoObj extends AbstractDevCmd {
|
||||
|
||||
@@ -475,7 +475,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "EquipSet: " + targetMob.equipmentSetID;
|
||||
output += newline;
|
||||
try {
|
||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
|
||||
output += "Parent Zone LoadNum : " + targetMob.parentZone.templateID;
|
||||
} catch (Exception ex) {
|
||||
//who cares
|
||||
}
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class MakeBaneCmd extends AbstractDevCmd {
|
||||
|
||||
public MakeBaneCmd() {
|
||||
super("makebane");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (words.length < 1 || words.length > 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
int attackerID = 0;
|
||||
int rank = 8;
|
||||
|
||||
if (words.length == 2) {
|
||||
try {
|
||||
attackerID = Integer.parseInt(words[0]);
|
||||
rank = Integer.parseInt(words[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
|
||||
return;
|
||||
}
|
||||
} else if (words.length == 1) {
|
||||
if (target == null) {
|
||||
throwbackError(pc, "No target specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(target instanceof PlayerCharacter)) {
|
||||
throwbackError(pc, "Target is not a player");
|
||||
return;
|
||||
}
|
||||
attackerID = target.getObjectUUID();
|
||||
|
||||
try {
|
||||
rank = Integer.parseInt(words[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "Rank must be specified, 1 through 8");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (rank < 1 || rank > 8) {
|
||||
throwbackError(pc, "Rank must be 1 through 8");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
||||
|
||||
|
||||
if (player.getGuild().isEmptyGuild()) {
|
||||
throwbackError(pc, "Errant's can not place banes");
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
|
||||
|
||||
if (attackerAGL == null) {
|
||||
throwbackError(pc, "No guild leader found for attacking guild.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(attackerAGL instanceof PlayerCharacter)) {
|
||||
throwbackError(pc, "Attacking guild leader is an NPC.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getGuild().isNPCGuild()) {
|
||||
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (player.getGuild().getOwnedCity() != null) {
|
||||
// throwbackError(pc, "The attacking guild already has a city.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Unable to find the zone you're in.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!zone.guild_zone) {
|
||||
throwbackError(pc, "This is not a player city.");
|
||||
return;
|
||||
}
|
||||
|
||||
City city = City.getCity(zone.playerCityUUID);
|
||||
if (city == null) {
|
||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (city.getTOL() == null) {
|
||||
throwbackError(pc, "Unable to find the tree of life for this city.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (city.getBane() != null) {
|
||||
throwbackError(pc, "This city is already baned.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
|
||||
throwbackError(pc, "This guild is already baning someone.");
|
||||
return;
|
||||
}
|
||||
|
||||
Blueprint blueprint = Blueprint.getBlueprint(24300);
|
||||
|
||||
if (blueprint == null) {
|
||||
throwbackError(pc, "Unable to find building set for banestone.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3f rot = new Vector3f(0, 0, 0);
|
||||
|
||||
// *** Refactor : Overlap test goes here
|
||||
|
||||
//Let's drop a banestone!
|
||||
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
|
||||
|
||||
if (localLocation == null) {
|
||||
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
|
||||
Logger.info("Failed to Convert World coordinates to local zone coordinates");
|
||||
return;
|
||||
}
|
||||
|
||||
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
|
||||
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
|
||||
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
|
||||
null, blueprint.getBlueprintUUID(), 1, 0.0f);
|
||||
|
||||
if (stone == null) {
|
||||
ChatManager.chatSystemError(pc, "Failed to create banestone.");
|
||||
return;
|
||||
}
|
||||
stone.addEffectBit((1 << 19));
|
||||
BuildingManager.setRank(stone, (byte) rank);
|
||||
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
||||
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
||||
|
||||
//Make the bane
|
||||
|
||||
Bane bane = Bane.makeBane(player, city, stone);
|
||||
|
||||
if (bane == null) {
|
||||
|
||||
//delete bane stone, failed to make bane object
|
||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
|
||||
|
||||
throwbackError(pc, "Failed to create bane.");
|
||||
return;
|
||||
}
|
||||
|
||||
WorldGrid.addObject(stone, pc);
|
||||
|
||||
//Add baned effect to TOL
|
||||
city.getTOL().addEffectBit((1 << 16));
|
||||
city.getTOL().updateEffects();
|
||||
|
||||
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
|
||||
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
|
||||
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
|
||||
player.teleport(movePlayerOutsideStone);
|
||||
|
||||
throwbackInfo(pc, "The city has been succesfully baned.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Creates an bane.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./makebane playerUUID baneRank'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,8 +64,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
@@ -78,8 +79,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||
DbManager.removeFromCache(GameObjectType.Mob,
|
||||
@@ -159,8 +161,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
DbManager.removeFromCache(mbEnums.GameObjectType.NPC,
|
||||
@@ -172,8 +175,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||
DbManager.removeFromCache(mbEnums.GameObjectType.Mob,
|
||||
|
||||
@@ -180,8 +180,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.removeObject(minionMob, pc);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
if (minionMob.getParentZone() != null) {
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
}
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
@@ -202,9 +203,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
||||
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
||||
return;
|
||||
if (mob.getParentZone() != null) {
|
||||
if (mob.parentZone != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
||||
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove npc from hirelings list.
|
||||
@@ -222,8 +225,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
if (mob.parentZone != null) {
|
||||
mob.parentZone.zoneMobSet.remove(mob);
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"Mob with ID " + mob.getDBID() + " removed");
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.NPC;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -41,7 +41,7 @@ public class SetHealthCmd extends AbstractDevCmd {
|
||||
|
||||
// Update all surrounding clients.
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -32,7 +32,7 @@ public class SetManaCmd extends AbstractDevCmd {
|
||||
|
||||
//Update all surrounding clients. - NOT for Mana?
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DbObjectType;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.ApplyRuneMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -54,7 +54,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
|
||||
PromotionClass promo = pc.getPromotionClass();
|
||||
if (promo != null) {
|
||||
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetRaceCmd extends AbstractDevCmd {
|
||||
|
||||
public SetRaceCmd() {
|
||||
super("setRace");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
int newRace = Integer.parseInt(words[0]);
|
||||
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.NPC) == false) {
|
||||
throwbackError(player, "You Must Target An NPC");
|
||||
}
|
||||
|
||||
NPC npc = (NPC) target;
|
||||
npc.loadID = newRace;
|
||||
DbManager.NPCQueries.UPDATE_RACE(npc, newRace);
|
||||
InterestManager.reloadCharacter(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets NPC race";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setrace ID'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -42,7 +42,7 @@ public class SetStaminaCmd extends AbstractDevCmd {
|
||||
|
||||
// Update all surrounding clients.
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.client.msg.ApplyBuildingEffectMsg;
|
||||
import engine.net.client.msg.UpdateCharOrMobMessage;
|
||||
import engine.objects.*;
|
||||
@@ -39,13 +39,13 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
||||
if (raceID == 0)
|
||||
raceID = player.getRaceID();
|
||||
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
|
||||
DispatchMessage.sendToAllInRange(player, ucm);
|
||||
DispatchManager.sendToAllInRange(player, ucm);
|
||||
return;
|
||||
}
|
||||
if (words[0].equals("all")) {
|
||||
for (int i = 15999; i < 16337; i++) {
|
||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
|
||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -56,7 +56,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
||||
|
||||
} else {
|
||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
|
||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.UpgradeBuildingJob;
|
||||
import engine.loot.WorkOrder;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
@@ -49,8 +50,7 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
@@ -69,17 +69,15 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
|
||||
for (int i = numOfSlots; i > 0; i--) {
|
||||
|
||||
for (int i = numOfSlots; i > 0; i--)
|
||||
if (!building.getHirelings().containsValue(i))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -92,9 +90,8 @@ public enum BuildingManager {
|
||||
|
||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
||||
|
||||
if (buildingLocation == null) {
|
||||
if (buildingLocation == null)
|
||||
Logger.error("Invalid slot for building: " + building.getObjectUUID());
|
||||
}
|
||||
|
||||
return buildingLocation;
|
||||
}
|
||||
@@ -107,73 +104,67 @@ public enum BuildingManager {
|
||||
if (building == null)
|
||||
return false;
|
||||
|
||||
//cannot access destroyed buildings
|
||||
if (building.getRank() == -1)
|
||||
return false;
|
||||
|
||||
if (IsOwner(building, player))
|
||||
return true;
|
||||
|
||||
//individual friend.
|
||||
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
||||
return true;
|
||||
|
||||
//Admins can access stuff
|
||||
|
||||
//admin characters can always access buildings
|
||||
if (player.isCSR())
|
||||
return true;
|
||||
|
||||
//Guild stuff
|
||||
|
||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
//TODO test friends list once added
|
||||
//does not meet above criteria. Cannot access.
|
||||
}
|
||||
|
||||
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) {
|
||||
|
||||
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
||||
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
if (building == null)
|
||||
return false;
|
||||
|
||||
|
||||
if (building.getRank() == -1)
|
||||
return false;
|
||||
|
||||
//owner can always access their own building
|
||||
if (IsOwner(building, player))
|
||||
return true;
|
||||
|
||||
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||
return false;
|
||||
//check for default IC access if building belongs to same guild
|
||||
if(player.guild.equals(building.getGuild())) {
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null) {
|
||||
switch (building.getBlueprint().getBuildingGroup()) {
|
||||
case TOL:
|
||||
case BARRACK:
|
||||
case SPIRE:
|
||||
case SHRINE:
|
||||
case BANESTONE:
|
||||
case MINE:
|
||||
case WAREHOUSE:
|
||||
case BULWARK:
|
||||
case SIEGETENT:
|
||||
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check against friends list entries if any present
|
||||
if (building.getFriends() != null) {
|
||||
|
||||
//check individuals
|
||||
if (building.getFriends().get(player.getObjectUUID()) != null)
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.guild.objectUUID) != null) {
|
||||
|
||||
//check friend type for guild related access
|
||||
switch (building.getFriends().get(player.guild.objectUUID).friendType) {
|
||||
case 8: //full member
|
||||
if (GuildStatusController.isFullMember(player.getGuildStatus()))
|
||||
return true;
|
||||
break;
|
||||
case 9: //Inner Council
|
||||
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||
return true;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//did not meet access grant criteria, deny access
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) {
|
||||
@@ -274,9 +265,7 @@ public enum BuildingManager {
|
||||
// Submit upgrade job for future date or current instant
|
||||
|
||||
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building),
|
||||
building.getUpgradeDateTime().atZone(ZoneId.systemDefault())
|
||||
.toInstant().toEpochMilli());
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
||||
} else
|
||||
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
|
||||
}
|
||||
@@ -335,8 +324,35 @@ public enum BuildingManager {
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.unloadObject(minionMob);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
if (minionMob.parentZone != null)
|
||||
minionMob.parentZone.zoneMobSet.remove(minionMob);
|
||||
}
|
||||
|
||||
// Clear all workorders for this hireling
|
||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||
|
||||
NPC hirelingNPC = (NPC) hireling;
|
||||
|
||||
if (ForgeManager.vendorWorkOrderLookup.get(hirelingNPC) != null)
|
||||
|
||||
for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hirelingNPC)) {
|
||||
workOrder.runCompleted.set(true);
|
||||
workOrder.vendor = null;
|
||||
|
||||
// Remove any cooking items from collections
|
||||
// to ensure we don't leak memory.
|
||||
|
||||
for (Item item : workOrder.cooking) {
|
||||
DbManager.removeFromCache(item);
|
||||
ForgeManager.itemWorkOrderLookup.remove(item);
|
||||
}
|
||||
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
}
|
||||
|
||||
// Finally remove the NPC from ForgeManager
|
||||
|
||||
ForgeManager.vendorWorkOrderLookup.remove(hirelingNPC);
|
||||
}
|
||||
|
||||
// Remove hireling from building
|
||||
@@ -349,10 +365,9 @@ public enum BuildingManager {
|
||||
|
||||
Mob hirelingMob = (Mob) hireling;
|
||||
|
||||
if (hirelingMob.getParentZone() != null)
|
||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
||||
|
||||
if (hirelingMob.parentZone != null)
|
||||
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob))
|
||||
hirelingMob.parentZone.zoneMobSet.remove(hireling);
|
||||
}
|
||||
|
||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||
@@ -377,10 +392,8 @@ public enum BuildingManager {
|
||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
||||
else
|
||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void cleanupHirelings(Building building) {
|
||||
|
||||
// Early exit: Cannot have hirelings in a building
|
||||
@@ -392,22 +405,17 @@ public enum BuildingManager {
|
||||
// Remove all hirelings for destroyed buildings
|
||||
|
||||
if (building.getRank() < 1) {
|
||||
|
||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
||||
BuildingManager.removeHireling(building, slottedNPC);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete hireling if building has deranked.
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||
BuildingManager.removeHireling(building, hireling);
|
||||
|
||||
}
|
||||
|
||||
refreshHirelings(building);
|
||||
}
|
||||
|
||||
@@ -439,6 +447,7 @@ public enum BuildingManager {
|
||||
return false;
|
||||
|
||||
//lets pass true if player is owner anyway.
|
||||
|
||||
if (building.getOwner().equals(player))
|
||||
return true;
|
||||
|
||||
@@ -451,52 +460,22 @@ public enum BuildingManager {
|
||||
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
|
||||
return false;
|
||||
|
||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) != false || GuildStatusController.isInnerCouncil(player.getGuildStatus()) != false;
|
||||
}
|
||||
|
||||
//This is mainly used for Rolling and gold sharing between building and warehouse.
|
||||
|
||||
public static int GetWithdrawAmountForRolling(Building building, int cost) {
|
||||
|
||||
//all funds are available to roll.
|
||||
|
||||
if (cost <= GetAvailableGold(building))
|
||||
return cost;
|
||||
|
||||
// cost is more than available gold, return available gold
|
||||
|
||||
return GetAvailableGold(building);
|
||||
|
||||
}
|
||||
|
||||
public static int GetAvailableGold(Building building) {
|
||||
|
||||
if (building.getStrongboxValue() == 0)
|
||||
return 0;
|
||||
|
||||
if (building.getStrongboxValue() < building.reserve)
|
||||
return 0;
|
||||
|
||||
return building.getStrongboxValue() - building.reserve;
|
||||
}
|
||||
|
||||
public static int GetOverdraft(Building building, int cost) {
|
||||
int availableGold = GetWithdrawAmountForRolling(building, cost);
|
||||
return cost - availableGold;
|
||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||
}
|
||||
|
||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||
|
||||
//Nation Members and Guild members are not hostile.
|
||||
// if (building.getGuild() != null){
|
||||
// if (pc.getGuild() != null)
|
||||
// if (building.getGuild().getObjectUUID() == pc.getGuildUUID()
|
||||
// || pc.getGuild().getNation().getObjectUUID() == building.getGuild().getNation().getObjectUUID())
|
||||
// return false;
|
||||
// }
|
||||
if (Guild.sameNationExcludeErrant(building.getGuild(), player.getGuild()))
|
||||
return false;
|
||||
|
||||
if(building.enforceKOS) {
|
||||
if (building.getCity() != null) {
|
||||
Building TOL = building.getCity().getTOL();
|
||||
if (TOL != null) {
|
||||
building = TOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!building.reverseKOS) {
|
||||
|
||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||
@@ -548,7 +527,7 @@ public enum BuildingManager {
|
||||
|
||||
String pirateName = NPCManager.getPirateName(NpcID.getMobbaseID());
|
||||
|
||||
NPC npc = null;
|
||||
NPC npc;
|
||||
|
||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
||||
|
||||
@@ -564,7 +543,7 @@ public enum BuildingManager {
|
||||
|
||||
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) {
|
||||
|
||||
int rank = 1;
|
||||
int rank;
|
||||
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
@@ -623,6 +602,7 @@ public enum BuildingManager {
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, mbEnums.AIAgentType.GUARDCAPTAIN);
|
||||
|
||||
if (mobile == null)
|
||||
@@ -682,9 +662,7 @@ public enum BuildingManager {
|
||||
if (building.getOwner() == null)
|
||||
return false;
|
||||
|
||||
|
||||
return building.getOwner().getObjectUUID() == player.getObjectUUID();
|
||||
|
||||
}
|
||||
|
||||
public static float GetMissingHealth(Building building) {
|
||||
@@ -696,6 +674,7 @@ public enum BuildingManager {
|
||||
}
|
||||
|
||||
public static Regions GetRegion(Building building, float x, float y, float z) {
|
||||
|
||||
if (building.getBounds() == null)
|
||||
return null;
|
||||
|
||||
@@ -703,17 +682,18 @@ public enum BuildingManager {
|
||||
return null;
|
||||
|
||||
Regions currentRegion = null;
|
||||
for (Regions region : building.getBounds().getRegions()) {
|
||||
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z))) {
|
||||
for (Regions region : building.getBounds().getRegions()) {
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z)))
|
||||
if (y > (region.highLerp.y - 5))
|
||||
currentRegion = region;
|
||||
}
|
||||
}
|
||||
|
||||
return currentRegion;
|
||||
}
|
||||
|
||||
public static Regions GetRegion(Building building, int room, int level, float x, float z) {
|
||||
|
||||
if (building.getBounds() == null)
|
||||
return null;
|
||||
|
||||
@@ -724,12 +704,12 @@ public enum BuildingManager {
|
||||
|
||||
if (region.getLevel() != level)
|
||||
continue;
|
||||
|
||||
if (region.getRoom() != room)
|
||||
continue;
|
||||
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z))) {
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z)))
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -741,11 +721,10 @@ public enum BuildingManager {
|
||||
if (building == null)
|
||||
return mbEnums.Ruins.getRandomRuin().getLocation();
|
||||
|
||||
|
||||
bindLoc = building.getLoc();
|
||||
|
||||
|
||||
float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
bindLoc = building.getStuckLocation();
|
||||
if (bindLoc != null)
|
||||
@@ -798,7 +777,6 @@ public enum BuildingManager {
|
||||
int newMeshUUID;
|
||||
boolean success;
|
||||
|
||||
|
||||
// If this building has no blueprint then set rank and exit immediatly.
|
||||
|
||||
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
||||
@@ -810,22 +788,22 @@ public enum BuildingManager {
|
||||
// Delete any upgrade jobs before doing anything else. It won't quite work
|
||||
// if in a few lines we happen to delete this building.
|
||||
|
||||
JobContainer jc = building.getTimers().get("UPGRADE");
|
||||
JobContainer jobContainer = building.getTimers().get("UPGRADE");
|
||||
|
||||
if (jc != null) {
|
||||
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
|
||||
if (jobContainer != null) {
|
||||
if (!JobScheduler.getInstance().cancelScheduledJob(jobContainer))
|
||||
Logger.error("failed to cancel existing upgrade job.");
|
||||
}
|
||||
|
||||
// Attempt write to database, or delete the building
|
||||
// Attempt to write to database or delete the building
|
||||
// if we are destroying it.
|
||||
|
||||
if (rank == -1)
|
||||
if (rank < 0)
|
||||
success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||
else
|
||||
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
||||
|
||||
if (success == false) {
|
||||
if (!success) {
|
||||
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
@@ -882,7 +860,6 @@ public enum BuildingManager {
|
||||
|
||||
if (Bounds.collide(loc, building.getBounds()))
|
||||
return building;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
||||
@@ -87,7 +86,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +160,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatSayMsg chatSayMsg = new ChatSayMsg(player, text);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, chatSayMsg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
||||
DispatchManager.dispatchMsgToInterestArea(pcSender, chatSayMsg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ public enum ChatManager {
|
||||
msg.setMessageType(4);
|
||||
msg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||
Dispatch dispatch = Dispatch.borrow(targetPlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -195,7 +194,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatShoutMsg msg = new ChatShoutMsg(sender, text);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, msg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
||||
DispatchManager.dispatchMsgToInterestArea(pcSender, msg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -217,7 +216,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
|
||||
DispatchMessage.dispatchMsgToAll(sender, msg, true);
|
||||
DispatchManager.dispatchMsgToAll(sender, msg, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -284,13 +283,13 @@ public enum ChatManager {
|
||||
// Send dispatch to each player
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(pcRecip, chatTellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
// Also send /tell to sender
|
||||
if (pcSender != null) {
|
||||
Dispatch dispatch = Dispatch.borrow(pcSender, chatTellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
} else
|
||||
@@ -339,8 +338,8 @@ public enum ChatManager {
|
||||
chatGuildMsg.setSourceID(sender.getObjectUUID());
|
||||
chatGuildMsg.setSourceName(sender.getFirstName());
|
||||
chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
|
||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
|
||||
.getCharter() : 0); // Charter?
|
||||
Guild guild1 = sender.getGuild();
|
||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? guild1.charter.ordinal() : 0); // Charter?
|
||||
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
||||
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(mbEnums.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
||||
|
||||
@@ -349,7 +348,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGuildMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -404,7 +403,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatICMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -463,7 +462,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGroupMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -490,14 +489,14 @@ public enum ChatManager {
|
||||
msg.setName(sender.getFirstName());
|
||||
msg.setGuildTitle(GuildStatusController.getTitle(sender.getGuildStatus()));
|
||||
msg.setGuildUUID(guild.getObjectUUID());
|
||||
msg.setCharter(guild.getCharter());
|
||||
msg.setCharter(guild.charter.ordinal());
|
||||
|
||||
// Send dispatch to each player
|
||||
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +732,7 @@ public enum ChatManager {
|
||||
public static void chatPVP(String text) {
|
||||
// Create message
|
||||
ChatPvPMsg msg = new ChatPvPMsg(null, text);
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
DispatchManager.dispatchMsgToAll(msg);
|
||||
}
|
||||
|
||||
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
||||
@@ -844,7 +843,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -993,7 +992,7 @@ public enum ChatManager {
|
||||
chatSystemMsg.setChannel(channel);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ import engine.job.JobScheduler;
|
||||
import engine.jobs.AttackJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.net.client.msg.UpdateStateMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.DamageShield;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -29,9 +29,24 @@ import java.util.EnumSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static java.lang.Math.pow;
|
||||
|
||||
public enum CombatManager {
|
||||
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements all combat mechanics for Magicbane.
|
||||
//
|
||||
// Combat initiates in "combatCycle" to determine which hands will be swung, and attack is processed based on that.
|
||||
// Handles all combat for AbstractCharacter including player characters and mobiles.
|
||||
// Controls toggling of combat and sit/stand for all AbstractCharacters
|
||||
//
|
||||
//
|
||||
|
||||
COMBAT_MANAGER;
|
||||
public static final int COMBAT_BLOCK_ANIMATION = 298;
|
||||
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||
|
||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
||||
|
||||
@@ -76,25 +91,25 @@ public enum CombatManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//swing left hand only
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//no weapon equipped with a shield, punch with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//one weapon equipped with a shield, swing with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//two weapons equipped, swing both hands
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||
@@ -104,16 +119,19 @@ public enum CombatManager {
|
||||
|
||||
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot) {
|
||||
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (!attacker.isCombat())
|
||||
return;
|
||||
|
||||
if (attacker.getTimestamps().get("Attack" + slot.name()) != null && attacker.getTimestamps().get("Attack" + slot.name()) < System.currentTimeMillis()) {
|
||||
setAutoAttackJob(attacker, slot, 1000);
|
||||
return;
|
||||
}
|
||||
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
||||
if (attacker.getTimers() != null && attacker.getTimers().containsKey("Attack" + slot.name()))
|
||||
if (attacker.getTimers().get("Attack" + slot.name()).timeToExecutionLeft() <= 0)
|
||||
attacker.getTimers().remove("Attack" + slot.name());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check if character is in range to attack target
|
||||
|
||||
PlayerBonuses bonus = attacker.getBonuses();
|
||||
@@ -127,7 +145,7 @@ public enum CombatManager {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(mbEnums.ModType.WeaponRange, mbEnums.SourceType.None);
|
||||
|
||||
attackRange = weapon.template.item_weapon_max_range * rangeMod;
|
||||
attackRange += weapon.template.item_weapon_max_range * rangeMod;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -137,31 +155,46 @@ public enum CombatManager {
|
||||
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
|
||||
boolean inRange = false;
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
attackRange += ((PlayerCharacter) attacker).getCharacterHeight() * 0.5f;
|
||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
} else {
|
||||
attackRange += attacker.calcHitBox();
|
||||
|
||||
}
|
||||
|
||||
if (attackRange > 15 && attacker.isMoving()) {
|
||||
//cannot shoot bow while moving;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (target.getObjectType()) {
|
||||
case PlayerCharacter:
|
||||
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Mob:
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Building:
|
||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2;
|
||||
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ);
|
||||
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z)))
|
||||
inRange = true;
|
||||
break;
|
||||
if (attackRange > 15) {
|
||||
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
||||
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
if (distanceSquared < rangeSquared) {
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2;
|
||||
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ);
|
||||
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z)))
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//get delay for the auto attack job
|
||||
@@ -169,7 +202,7 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null) {
|
||||
|
||||
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
|
||||
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||
@@ -180,7 +213,7 @@ public enum CombatManager {
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
|
||||
delay = wepSpeed * 100L;
|
||||
delay = (long)wepSpeed * 100L;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -188,6 +221,16 @@ public enum CombatManager {
|
||||
|
||||
if (inRange) {
|
||||
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
||||
if(!attacker.getTimestamps().contains(slot.name()+"Attack")){
|
||||
attacker.getTimestamps().put(slot.name()+"Attack", System.currentTimeMillis() - 1000);
|
||||
} else if(System.currentTimeMillis() < attacker.getTimestamps().get(slot.name()+"Attack") + delay){
|
||||
setAutoAttackJob(attacker,slot,delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//handle retaliate
|
||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
||||
@@ -197,23 +240,21 @@ public enum CombatManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
// take stamina away from attacker if its not a mob
|
||||
if (weapon != null && !attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// take stamina away from attacker
|
||||
if (weapon != null) {
|
||||
float stam = weapon.template.item_wt / 3f;
|
||||
stam = (stam < 1) ? 1 : stam;
|
||||
attacker.modifyStamina(-(stam), attacker, true);
|
||||
} else
|
||||
attacker.modifyStamina(-0.5f, attacker, true);
|
||||
attacker.modifyStamina(1, attacker, true);
|
||||
|
||||
//cancel things that are cancelled by an attack
|
||||
|
||||
@@ -233,6 +274,22 @@ public enum CombatManager {
|
||||
atr = attacker.atrHandTwo;
|
||||
}
|
||||
|
||||
//apply weapon powers before early exit for miss or passives
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int def = 0;
|
||||
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
@@ -252,19 +309,18 @@ public enum CombatManager {
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.Building)
|
||||
hitChance = 100;
|
||||
|
||||
int passiveAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
|
||||
}
|
||||
|
||||
int passiveAnim = getPassiveAnimation(mbEnums.PassiveType.None); // checking for a miss due to ATR vs Def
|
||||
if (ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
||||
DispatchManager.sendToAllInRange(attacker, msg);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
@@ -296,19 +352,24 @@ public enum CombatManager {
|
||||
|
||||
|
||||
if (!passiveType.equals(mbEnums.PassiveType.None)) {
|
||||
passiveAnim = getPassiveAnimation(passiveType);
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//check for proccing
|
||||
checkForProc(attacker,target,weapon);
|
||||
|
||||
//calculate the base damage
|
||||
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||
if (damage == 0) {
|
||||
@@ -316,6 +377,9 @@ public enum CombatManager {
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob) attacker).isPet())
|
||||
calculatePetDamage(attacker);
|
||||
|
||||
//get the damage type
|
||||
|
||||
mbEnums.DamageType damageType;
|
||||
@@ -372,7 +436,7 @@ public enum CombatManager {
|
||||
//apply Damage back
|
||||
attacker.modifyHealth(-total, absTarget, true);
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, attacker, total, 0);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,6 +446,9 @@ public enum CombatManager {
|
||||
|
||||
if (resists.immuneTo(damageType)) {
|
||||
//set auto attack job
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
@@ -398,33 +465,19 @@ public enum CombatManager {
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
||||
else
|
||||
((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage);
|
||||
((Building) target).modifyHealth(-damage, attacker);
|
||||
|
||||
int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
int attackAnim = getSwingAnimation(null, null, slot);
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
DeferredPowerJob weaponPower = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, weaponPower, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
}else {
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
attackAnim = getSwingAnimation(weapon.template, weaponPower, slot);
|
||||
} else {
|
||||
attackAnim = getSwingAnimation(weapon.template, null, slot);
|
||||
}
|
||||
}
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +500,7 @@ public enum CombatManager {
|
||||
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
@@ -460,7 +513,7 @@ public enum CombatManager {
|
||||
playerCharacter.setSit(toggle);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -488,7 +541,11 @@ public enum CombatManager {
|
||||
target.setCombatTarget(attacker);
|
||||
}
|
||||
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||
|
||||
//No weapon, return default animation
|
||||
if (wb == null)
|
||||
return 75;
|
||||
|
||||
int token;
|
||||
|
||||
@@ -498,31 +555,71 @@ public enum CombatManager {
|
||||
|
||||
if (token == 563721004) //kick animation
|
||||
return 79;
|
||||
|
||||
if (wb != null) {
|
||||
if (mainHand) {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
int anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
return anim;
|
||||
}else {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
return wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wb == null)
|
||||
//Item has no equipment slots and should not try to return an animation, return default instead
|
||||
if (wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()) {
|
||||
return 75;
|
||||
}
|
||||
|
||||
if (mainHand)
|
||||
return wb.weapon_attack_anim_right.get(0)[0];
|
||||
else
|
||||
return wb.weapon_attack_anim_left.get(0)[0];
|
||||
//declare variables
|
||||
int anim;
|
||||
int random;
|
||||
|
||||
//Item can only be equipped in one slot, return animation for that slot
|
||||
if (wb.item_eq_slots_or.size() == 1) {
|
||||
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
//Item can be equipped in either hand, and should have animation sets for each hand
|
||||
if (slot.equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
public static int getPassiveAnimation(mbEnums.PassiveType passiveType) {
|
||||
switch (passiveType) {
|
||||
case Block:
|
||||
return COMBAT_BLOCK_ANIMATION;
|
||||
case Parry:
|
||||
return COMBAT_PARRY_ANIMATION;
|
||||
case Dodge:
|
||||
return COMBAT_DODGE_ANIMATION;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||
//calculate next allowed attack and update the timestamp
|
||||
|
||||
if (attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
||||
|
||||
//handle auto attack job creation
|
||||
@@ -532,9 +629,56 @@ public enum CombatManager {
|
||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
||||
JobContainer job;
|
||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||
timers.put("Attack" + slot, job);
|
||||
timers.put("Attack" + slot.name(), job);
|
||||
} else
|
||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||
|
||||
}
|
||||
|
||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||
//damage calc for pet
|
||||
float range;
|
||||
float damage;
|
||||
float min = 40;
|
||||
float max = 60;
|
||||
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(mbEnums.ModType.MeleeDamageModifier, mbEnums.SourceType.None);
|
||||
double minDmg = getMinDmg(min, agent);
|
||||
double maxDmg = getMaxDmg(max, agent);
|
||||
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 getMinDmg(double min, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static double getMaxDmg(double max, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static void checkForProc(AbstractCharacter attacker, AbstractWorldObject target, Item weapon){
|
||||
|
||||
if(weapon == null) // cant proc without a weapon
|
||||
return;
|
||||
|
||||
for(Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectsBase().getModifiers()){
|
||||
if(mod.modType.equals(mbEnums.ModType.WeaponProc))
|
||||
if(ThreadLocalRandom.current().nextInt(0,101) < 6)
|
||||
((WeaponProcEffectModifier)mod).applyProc(attacker,target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ package engine.gameManager;
|
||||
import engine.mbEnums;
|
||||
import engine.server.login.LoginServer;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.wpak.EffectsParser;
|
||||
import engine.wpak.PowerActionParser;
|
||||
import engine.wpak.PowersParser;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -164,6 +167,13 @@ public enum ConfigManager {
|
||||
Logger.info("Compiling regex");
|
||||
|
||||
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
||||
|
||||
Logger.info("Loading WPAK data");
|
||||
|
||||
//EffectsParser.parseWpakFile();
|
||||
//PowersParser.parseWpakFile();
|
||||
//PowerActionParser.parseWpakFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ package engine.gameManager;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import engine.db.handlers.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.db.handlers.*;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.Hasher;
|
||||
@@ -69,8 +69,6 @@ public enum DbManager {
|
||||
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
|
||||
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
|
||||
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
|
||||
|
||||
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
|
||||
public static final dbPetitionHandler PetitionQueries = new dbPetitionHandler();
|
||||
private static final EnumMap<GameObjectType, ConcurrentHashMap<Integer, AbstractGameObject>> objectCache = new EnumMap<>(GameObjectType.class);
|
||||
public static Hasher hasher;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.devcmd.cmds.*;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -22,6 +22,13 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public enum DevCmdManager {
|
||||
|
||||
// MB Dev Notes:
|
||||
// Class registers "Dev Commands" where access requires
|
||||
// Status = "ADMIN" be set in the obj_account table
|
||||
//
|
||||
// Use these at your own risk.
|
||||
|
||||
DEV_CMD_MANAGER;
|
||||
|
||||
public static ConcurrentHashMap<String, AbstractDevCmd> devCmds;
|
||||
@@ -35,9 +42,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static void registerCommands() {
|
||||
|
||||
// Player
|
||||
@@ -72,6 +76,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
||||
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
||||
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRaceCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
||||
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||
@@ -91,7 +96,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new RenameCmd());
|
||||
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRankCmd());
|
||||
DevCmdManager.registerDevCmd(new MakeBaneCmd());
|
||||
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
||||
DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
|
||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||
@@ -118,7 +122,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new SetNpcNameCmd());
|
||||
DevCmdManager.registerDevCmd(new BoundsCmd());
|
||||
DevCmdManager.registerDevCmd(new RegionCmd());
|
||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net;
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Item;
|
||||
@@ -26,12 +28,17 @@ import java.util.HashSet;
|
||||
import static engine.net.MessageDispatcher.dispatchCount;
|
||||
import static engine.net.MessageDispatcher.maxRecipients;
|
||||
|
||||
/*
|
||||
* Dispatch Message is the main interface to Magicbane's threaded
|
||||
* async message delivery system.
|
||||
*/
|
||||
// MB Dev Notes:
|
||||
// Dispatch Manager is the main interface to the threaded async message
|
||||
// delivery system used by Magicbane.
|
||||
//
|
||||
// A Dispatch is .borrowed() and used to wrap an outgoing protocol message.
|
||||
// A distribution list is created and passed to the MessageDispatcher for
|
||||
// delivery.
|
||||
|
||||
public class DispatchMessage {
|
||||
public enum DispatchManager {
|
||||
|
||||
DISPATCH_MANAGER;
|
||||
|
||||
public static void startMessagePump() {
|
||||
|
||||
@@ -83,7 +90,7 @@ public class DispatchMessage {
|
||||
sourcePlayer = (PlayerCharacter) sourceObject;
|
||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +158,7 @@ public class DispatchMessage {
|
||||
|
||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +287,7 @@ public class DispatchMessage {
|
||||
|
||||
}
|
||||
|
||||
protected static void serializeDispatch(Dispatch messageDispatch) {
|
||||
public static void serializeDispatch(Dispatch messageDispatch) {
|
||||
ClientConnection connection;
|
||||
|
||||
if (messageDispatch.player == null) {
|
||||
@@ -12,7 +12,6 @@ import engine.loot.ModTableEntry;
|
||||
import engine.loot.ModTypeTableEntry;
|
||||
import engine.loot.WorkOrder;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ItemProductionMsg;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Item;
|
||||
@@ -23,19 +22,25 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public enum ForgeManager implements Runnable {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class handles all forge rolling mechanics for the game.
|
||||
// Class implements forge rolling mechanics for Magicbane.
|
||||
//
|
||||
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler).
|
||||
// Concurrency is managed by the same lock used by the warehouse (city.cityTransactionLock).
|
||||
// WorkOrders are persisted then reconstituted at bootstrap from table dyn.workorders.
|
||||
// .submit(workOrder) may be called from any thread: (ItemProductionMsgHandler).
|
||||
// Concurrency is managed by same lock used for warehouse (city.cityTransactionLock).
|
||||
// WorkOrders are persisted then reconstituted at bootstrap using table dyn.workorders.
|
||||
// Forge window (ManageNPCMsg) uses item.upgradeDate to serialize completion time.
|
||||
//
|
||||
// p.s. replaces garbage code that looked like it was written by a crack head with face boils.
|
||||
// Replaces garbage code that looked as if written by a mental patient.
|
||||
//
|
||||
// @TODO Reuse same set of virtual items for the life of a workOrder.
|
||||
|
||||
FORGE_MANAGER;
|
||||
|
||||
@@ -52,33 +57,41 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
while (true) {
|
||||
|
||||
// .forge is a delayQueue (blocking priority queue using an epoc sort)
|
||||
// workOrders are popped and processed when their completion time has passed.
|
||||
// The forge is a blocking priority queue using an epoc sort.
|
||||
// workOrders are popped once the workOrder.completionTime has
|
||||
// passed.
|
||||
|
||||
try {
|
||||
workOrder = forge.take();
|
||||
|
||||
// Early exit for completed workOrders loaded from disk
|
||||
// or vendors who were re-deeded with items still cooking.
|
||||
|
||||
if (workOrder.vendor == null || workOrder.runCompleted.get())
|
||||
continue;
|
||||
|
||||
// This workOrder has completed production.
|
||||
|
||||
if (workOrder.total_produced >= workOrder.total_to_produce) {
|
||||
|
||||
// Complete this workOrder.
|
||||
// CONFIRM_PRODUCE to refresh the interface after we add
|
||||
// the Identified flag to the item.
|
||||
|
||||
for (Item workOrderItem : workOrder.cooking) {
|
||||
workOrderItem.flags.add(mbEnums.ItemFlags.Identified);
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
}
|
||||
|
||||
workOrder.runCompleted = true;
|
||||
// Set this workOrder to completed and update on disk
|
||||
|
||||
// Update workOrder on disk
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
workOrder.runCompleted.set(true);
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (workOrder.runCompleted)
|
||||
continue;
|
||||
|
||||
// Move current cooking batch to vendor inventory
|
||||
// PERSIST our current cooking batch of virtual
|
||||
// items then add to the vendor inventory
|
||||
|
||||
completeWorkOrderBatch(workOrder);
|
||||
|
||||
@@ -131,30 +144,32 @@ public enum ForgeManager implements Runnable {
|
||||
if (validation_result != 0)
|
||||
return validation_result;
|
||||
|
||||
try {
|
||||
// Configure this production run.
|
||||
// Configure this production run.
|
||||
|
||||
try {
|
||||
workOrder.workOrderID = workOrderCounter.incrementAndGet();
|
||||
workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder);
|
||||
workOrder.rollingDuration = NPCManager.calcRollingDuration(workOrder.vendor, workOrder.templateID);
|
||||
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||
workOrder.slots_used = calcAvailableSlots(workOrder);
|
||||
workOrder.slots_used.set(calcAvailableSlots(workOrder));
|
||||
|
||||
if (workOrder.slots_used.get() == 0)
|
||||
return 58;
|
||||
|
||||
workOrder.total_produced = 0;
|
||||
|
||||
// Single item configuration
|
||||
// Single item configuration from protocol message (ItemProductionMsg)
|
||||
|
||||
if (!workOrder.multiple_slot_request && workOrder.total_to_produce == 0)
|
||||
if (workOrder.multiple_slot_request == false && workOrder.total_to_produce == 0)
|
||||
workOrder.total_to_produce = 1;
|
||||
|
||||
// Set total cost for production run
|
||||
// Calculate total cost for this production run
|
||||
|
||||
workOrder.total_to_produce *= workOrder.slots_used;
|
||||
workOrder.total_to_produce *= workOrder.slots_used.get();
|
||||
|
||||
workOrder.production_cost = calcProductionCost(workOrder);
|
||||
workOrder.production_cost_total.putAll(workOrder.production_cost);
|
||||
workOrder.production_cost_total.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
|
||||
workOrder.production_cost.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
|
||||
|
||||
// Withdraw gold and resource costs. Availability has previously been validated.
|
||||
// Withdraw gold and resources. Availability has previously been validated.
|
||||
|
||||
if (!WorkOrder.withdrawWorkOrderCost(workOrder))
|
||||
return 58; //58: The formula is beyond the means of this facility
|
||||
@@ -163,15 +178,17 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
forgeWorkOrderBatch(workOrder);
|
||||
|
||||
// Enqueue workOrder in the .forge and then
|
||||
// add the workOrder to it's vendor
|
||||
// Assign the new workOrder to the vendor
|
||||
|
||||
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||
|
||||
// Enqueue the new workOrder
|
||||
|
||||
forge.add(workOrder);
|
||||
|
||||
// PERSIST workOrder (dyn_workorders)
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -182,24 +199,6 @@ public enum ForgeManager implements Runnable {
|
||||
return validation_result;
|
||||
}
|
||||
|
||||
public static long calcRollingDuration(WorkOrder workOrder) {
|
||||
|
||||
float rollingDuration;
|
||||
|
||||
rollingDuration = workOrder.vendor.getBuilding().getRank() * -5L + 40;
|
||||
rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration);
|
||||
rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||
|
||||
// Bane circles
|
||||
|
||||
if (template.item_bane_rank > 0)
|
||||
rollingDuration = (long) template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
return (long) rollingDuration;
|
||||
}
|
||||
|
||||
public static int calcAvailableSlots(WorkOrder workOrder) {
|
||||
|
||||
// Slots available in a forge are based on the npc rank
|
||||
@@ -213,7 +212,7 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
// Single item rolls are always a single slot
|
||||
|
||||
if (availableSlots > 0 && !workOrder.multiple_slot_request)
|
||||
if (availableSlots > 0 && workOrder.multiple_slot_request == false)
|
||||
availableSlots = 1;
|
||||
|
||||
return availableSlots;
|
||||
@@ -266,12 +265,12 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
// Assign a prefix and suffix to this item if random rolled
|
||||
|
||||
if (workOrder.prefixToken == 0)
|
||||
if (workOrder.prefixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
||||
else
|
||||
forgedItem.prefixToken = workOrder.prefixToken;
|
||||
|
||||
if (workOrder.suffixToken == 0)
|
||||
if (workOrder.suffixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
||||
else
|
||||
forgedItem.suffixToken = workOrder.suffixToken;
|
||||
@@ -312,7 +311,8 @@ public enum ForgeManager implements Runnable {
|
||||
completedItem.prefixToken = virutalItem.prefixToken;
|
||||
completedItem.suffixToken = virutalItem.suffixToken;
|
||||
|
||||
// Add effects to these tokens. Writes to disk.
|
||||
// Add effects for the tokens. Writes to disk using
|
||||
// table dyn_item_enchantment
|
||||
|
||||
ItemManager.applyItemEffects(completedItem);
|
||||
|
||||
@@ -321,9 +321,9 @@ public enum ForgeManager implements Runnable {
|
||||
workOrder.vendor.charItemManager.addItemToInventory(completedItem);
|
||||
|
||||
ItemProductionMsg outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.DEPOSIT, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
|
||||
toRemove.add(virutalItem);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public enum ForgeManager implements Runnable {
|
||||
// Remove virtual items from the forge window
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
|
||||
// Remove virtual item from all collections
|
||||
|
||||
@@ -349,21 +349,20 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||
|
||||
for (int i = 0; i < workOrder.slots_used; ++i) {
|
||||
for (int i = 0; i < workOrder.slots_used.get(); ++i) {
|
||||
|
||||
Item forged_item = forgeItem(workOrder);
|
||||
|
||||
// Update NPC window
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, forged_item, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
workOrder.total_produced = workOrder.total_produced + 1;
|
||||
}
|
||||
|
||||
// Write updated workOrder to disk
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
}
|
||||
|
||||
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {
|
||||
@@ -394,6 +393,12 @@ public enum ForgeManager implements Runnable {
|
||||
if (rollForModifier < 80) {
|
||||
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
modTableEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, randomModifier);
|
||||
|
||||
// @TODO : Figure out how a null can be returned from a defined set.
|
||||
|
||||
if (modTableEntry == null)
|
||||
return 0;
|
||||
|
||||
EffectsBase effectsBase = PowersManager.getEffectByIDString(modTableEntry.action);
|
||||
modifier = effectsBase.getToken();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.UpdateGoldMsg;
|
||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||
@@ -46,12 +44,12 @@ public enum GroupManager {
|
||||
|
||||
}
|
||||
|
||||
public static void LeaveGroup(ClientConnection origin) throws MsgSendException {
|
||||
public static void LeaveGroup(ClientConnection origin) {
|
||||
PlayerCharacter source = SessionManager.getPlayerCharacter(origin);
|
||||
LeaveGroup(source);
|
||||
}
|
||||
|
||||
public static void LeaveGroup(PlayerCharacter source) throws MsgSendException {
|
||||
public static void LeaveGroup(PlayerCharacter source) {
|
||||
|
||||
if (source == null)
|
||||
return;
|
||||
@@ -80,7 +78,7 @@ public enum GroupManager {
|
||||
groupUpdateMsg.setMessageType(3);
|
||||
groupUpdateMsg.setPlayer(groupMember);
|
||||
Dispatch dispatch = Dispatch.borrow(source, groupUpdateMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +158,7 @@ public enum GroupManager {
|
||||
gum.setPlayerUUID(groupMember.getObjectUUID());
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(groupMember, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -189,7 +187,7 @@ public enum GroupManager {
|
||||
gum.setMessageType(1);
|
||||
gum.setPlayer(groupMember);
|
||||
Dispatch dispatch = Dispatch.borrow(groupMember, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -217,7 +215,7 @@ public enum GroupManager {
|
||||
gum.setPlayer(playerToRefresh);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(source, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
public static void RefreshOthersGroupList(PlayerCharacter source) {
|
||||
@@ -372,12 +370,12 @@ public enum GroupManager {
|
||||
ugm.configure();
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(splitPlayer, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
UpdateGoldMsg updateTargetGold = new UpdateGoldMsg(tar);
|
||||
updateTargetGold.configure();
|
||||
DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(tar, updateTargetGold, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
// //TODO send group split message
|
||||
String text = "Group Split: " + amount;
|
||||
|
||||
@@ -12,7 +12,6 @@ import engine.mbEnums;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.guild.AcceptInviteToGuildMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
@@ -89,16 +88,17 @@ public enum GuildManager {
|
||||
|
||||
if (fromTeleportScreen) {
|
||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)) {
|
||||
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), DateTime.now(), historyType);
|
||||
playerCharacter.getGuildHistory().add(guildHistory);
|
||||
}
|
||||
|
||||
DispatchMessage.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
|
||||
DispatchManager.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
|
||||
|
||||
// Send guild join message
|
||||
|
||||
ChatManager.chatGuildInfo(playerCharacter,
|
||||
playerCharacter.getFirstName() + " has joined the guild");
|
||||
|
||||
@@ -108,44 +108,44 @@ public enum GuildManager {
|
||||
// TODO update player to world
|
||||
}
|
||||
|
||||
public static void enterWorldMOTD(PlayerCharacter pc) {
|
||||
public static void enterWorldMOTD(PlayerCharacter playerCharacter) {
|
||||
|
||||
Guild guild;
|
||||
Guild nation;
|
||||
|
||||
if (pc == null) {
|
||||
if (playerCharacter == null)
|
||||
return;
|
||||
}
|
||||
|
||||
guild = pc.getGuild();
|
||||
guild = playerCharacter.getGuild();
|
||||
|
||||
if (guild == null || guild.getObjectUUID() == 0) // Don't send to errant
|
||||
return;
|
||||
|
||||
// Send Guild MOTD
|
||||
|
||||
String motd = guild.getMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatGuildMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatGuildMOTD(playerCharacter, motd);
|
||||
|
||||
// Send Nation MOTD
|
||||
|
||||
nation = guild.getNation();
|
||||
|
||||
if (nation != null) {
|
||||
if (nation != null)
|
||||
if (nation.getObjectUUID() != 0) { // Don't send to errant nation
|
||||
motd = nation.getMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatNationMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatNationMOTD(playerCharacter, motd);
|
||||
}
|
||||
}
|
||||
|
||||
// Send IC MOTD if player is IC
|
||||
if (GuildStatusController.isInnerCouncil(pc.getGuildStatus())) {
|
||||
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus())) {
|
||||
motd = guild.getICMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatICMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatICMOTD(playerCharacter, motd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +156,8 @@ public enum GuildManager {
|
||||
if (guild == null)
|
||||
return;
|
||||
|
||||
int cityID = (city != null) ? city.getObjectUUID() : 0;
|
||||
|
||||
|
||||
//update binds ingame
|
||||
|
||||
|
||||
for (PlayerCharacter playerCharacter : Guild.GuildRoster(guild)) {
|
||||
boolean updateBindBuilding = false;
|
||||
|
||||
@@ -170,7 +166,6 @@ public enum GuildManager {
|
||||
if (oldBoundBuilding == null || oldBoundBuilding.getBlueprint() == null || oldBoundBuilding.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
|
||||
updateBindBuilding = true;
|
||||
|
||||
|
||||
if (updateBindBuilding) {
|
||||
Building bindBuilding = null;
|
||||
if (city != null)
|
||||
@@ -183,7 +178,6 @@ public enum GuildManager {
|
||||
playerCharacter.setBindBuildingID(bindBuilding != null ? bindBuilding.getObjectUUID() : 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,12 +187,9 @@ public enum GuildManager {
|
||||
if (guild == null)
|
||||
return;
|
||||
|
||||
for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
|
||||
|
||||
for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters())
|
||||
if (player.getGuild().equals(guild))
|
||||
DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
|
||||
}
|
||||
DispatchManager.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
}
|
||||
|
||||
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player) {
|
||||
|
||||
@@ -102,7 +102,7 @@ public enum ItemManager {
|
||||
if (characterSkill == null)
|
||||
return false;
|
||||
|
||||
if (characterSkill.getModifiedAmountBeforeMods() > required_value)
|
||||
if (characterSkill.getModifiedAmountBeforeMods() >= required_value)
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public enum ItemManager {
|
||||
if (!ValidRace(item, abstractCharacter.absRace))
|
||||
return false;
|
||||
|
||||
if (!ValidClass(item, abstractCharacter.absBaseClass,abstractCharacter.absPromotionClass))
|
||||
if (!ValidClass(item, abstractCharacter.absBaseClass, abstractCharacter.absPromotionClass))
|
||||
return false;
|
||||
|
||||
//players can't wear 0 value items.
|
||||
|
||||
@@ -10,7 +10,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.loot.*;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
@@ -25,6 +24,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
*/
|
||||
public enum LootManager {
|
||||
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements all loot generation mechanics for Magicbane.
|
||||
// Class handles variables like drop rates
|
||||
// Generation initiates in GenerateMobLoot and is passed a mobile
|
||||
// Utilized database tables:
|
||||
// - static_loot_bootySet - static_loot_gen - static_loot_item - static_loot_mod - static_loot_modtype
|
||||
// Class also handles mechanic for Fate Peddler
|
||||
//
|
||||
|
||||
LOOTMANAGER;
|
||||
|
||||
// Newer tables
|
||||
@@ -86,7 +95,7 @@ public enum LootManager {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + item.template.item_base_name + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
DispatchManager.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
@@ -18,7 +17,6 @@ import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.TeleportToPointMsg;
|
||||
@@ -50,9 +48,9 @@ public enum MovementManager {
|
||||
UpdateStateMsg rssm = new UpdateStateMsg();
|
||||
rssm.setPlayer(ac);
|
||||
if (ac.getObjectType() == GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(ac, rssm);
|
||||
DispatchManager.sendToAllInRange(ac, rssm);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -61,7 +59,7 @@ public enum MovementManager {
|
||||
* target upon each move, unless something has set the firstHitCombatTarget
|
||||
* Also used to determine the size of a monster's hitbox
|
||||
*/
|
||||
public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) throws MsgSendException {
|
||||
public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) {
|
||||
|
||||
// check for stun/root
|
||||
if (!toMove.isAlive())
|
||||
@@ -241,7 +239,7 @@ public enum MovementManager {
|
||||
// If it's not a player moving just send the message
|
||||
|
||||
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) == false) {
|
||||
DispatchMessage.sendToAllInRange(toMove, msg);
|
||||
DispatchManager.sendToAllInRange(toMove, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -253,9 +251,9 @@ public enum MovementManager {
|
||||
player.setTimeStamp("lastMoveGate", System.currentTimeMillis());
|
||||
|
||||
if (collide)
|
||||
DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
|
||||
|
||||
// Handle formation movement if needed
|
||||
@@ -349,7 +347,7 @@ public enum MovementManager {
|
||||
|
||||
// Handle formation movement in group
|
||||
|
||||
public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) throws MsgSendException {
|
||||
public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) {
|
||||
// get forward vector
|
||||
Vector3f faceDir = new Vector3f(pc.getFaceDir().x, 0, pc.getFaceDir().z).normalize();
|
||||
// get perpendicular vector
|
||||
@@ -443,7 +441,7 @@ public enum MovementManager {
|
||||
groupMsg.setStartCoord(member.getLoc());
|
||||
groupMsg.setEndCoord(destination);
|
||||
groupMsg.clearTarget();
|
||||
DispatchMessage.sendToAllInRange(member, groupMsg);
|
||||
DispatchManager.sendToAllInRange(member, groupMsg);
|
||||
|
||||
// update group member
|
||||
member.setFaceDir(destination.subtract2D(member.getLoc()).normalize());
|
||||
@@ -463,7 +461,7 @@ public enum MovementManager {
|
||||
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
|
||||
|
||||
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, teleporter.loc.getX(), teleporter.loc.getY(), teleporter.loc.getZ(), 0, -1, -1);
|
||||
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
@@ -29,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static engine.math.FastMath.acos;
|
||||
|
||||
@@ -68,7 +68,7 @@ public enum NPCManager {
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,9 +525,33 @@ public enum NPCManager {
|
||||
|
||||
ConcurrentHashMap.KeySetView<WorkOrder, Boolean> vendorWorkOrders = ForgeManager.vendorWorkOrderLookup.get(npc);
|
||||
|
||||
if (vendorWorkOrders == null)
|
||||
return itemList;
|
||||
|
||||
for (WorkOrder workOrder : vendorWorkOrders)
|
||||
itemList.addAll(workOrder.cooking);
|
||||
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public static long calcRollingDuration(NPC vendor, int templateID) {
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||
float rollingDuration;
|
||||
|
||||
if (template == null)
|
||||
return 0;
|
||||
|
||||
if (template.item_bane_rank > 0)
|
||||
return (long) (template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||
|
||||
if (vendor.building == null)
|
||||
return 600;
|
||||
|
||||
rollingDuration = vendor.getBuilding().getRank() * -5L + 40;
|
||||
rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration);
|
||||
rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
return (long) rollingDuration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.InterestManagement.Terrain;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.handlers.dbEffectsBaseHandler;
|
||||
import engine.db.handlers.dbPowerHandler;
|
||||
import engine.db.handlers.dbSkillReqHandler;
|
||||
import engine.job.AbstractJob;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
@@ -25,13 +23,18 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.*;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.powers.*;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import engine.powers.poweractions.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.wpak.EffectsParser;
|
||||
import engine.wpak.PowerActionParser;
|
||||
import engine.wpak.PowersParser;
|
||||
import engine.wpak.data.Effect;
|
||||
import engine.wpak.data.PowerAction;
|
||||
import engine.wpakpowers.WpakPowerManager;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -54,7 +57,6 @@ public enum PowersManager {
|
||||
public static HashMap<String, AbstractPowerAction> powerActionsByIDString = new HashMap<>();
|
||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers;
|
||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
|
||||
public static HashMap<String, HashMap<ResourceType, Integer>> _effect_costMaps = new HashMap<>();
|
||||
@@ -62,10 +64,12 @@ public enum PowersManager {
|
||||
|
||||
public static void initPowersManager(boolean fullPowersLoad) {
|
||||
|
||||
if (fullPowersLoad)
|
||||
PowersManager.InitializePowers();
|
||||
else
|
||||
if (fullPowersLoad) {
|
||||
//PowersManager.InitializePowers();
|
||||
WpakPowerManager.init();
|
||||
}else {
|
||||
PowersManager.InitializeLoginPowers();
|
||||
}
|
||||
|
||||
PowersManager.js = JobScheduler.getInstance();
|
||||
|
||||
@@ -113,33 +117,138 @@ public enum PowersManager {
|
||||
return powerEntries;
|
||||
}
|
||||
|
||||
public static void InitializeEffects(){
|
||||
// Add EffectsBase
|
||||
ArrayList<EffectsBase> effectList = new ArrayList<>();
|
||||
|
||||
for (Effect entry : WpakPowerManager._effectsLookup.values()) {
|
||||
EffectsBase effectBase = new EffectsBase(entry);
|
||||
effectList.add(effectBase);
|
||||
PowersManager.effectsBaseByToken.put(effectBase.getToken(), effectBase);
|
||||
PowersManager.effectsBaseByIDString.put(effectBase.getIDString(), effectBase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void InitializePowerActions(){
|
||||
// Add PowerActions
|
||||
//AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
|
||||
|
||||
HashMap<String, EffectsBase> effects = PowersManager.effectsBaseByIDString;
|
||||
|
||||
for (PowerAction powerAction : WpakPowerManager._powerActionLookup.values()) {
|
||||
AbstractPowerAction apa;
|
||||
PowerActionType type = powerAction.action_type;
|
||||
String IDString = powerAction.action_id;
|
||||
int token = DbManager.hasher.SBStringHash(IDString);
|
||||
//cache token, used for applying effects.
|
||||
PowersManager.ActionTokenByIDString.put(IDString, token);
|
||||
apa = null;
|
||||
switch (type) {
|
||||
default:
|
||||
Logger.error("valid type not found for poweraction of ID" + IDString);
|
||||
break;
|
||||
case ApplyEffect:
|
||||
apa = new ApplyEffectPowerAction(powerAction, effects);
|
||||
break;
|
||||
case ApplyEffects:
|
||||
apa = new ApplyEffectsPowerAction(powerAction, effects);
|
||||
break;
|
||||
case DeferredPower:
|
||||
apa = new DeferredPowerPowerAction(powerAction, effects);
|
||||
break;
|
||||
case DamageOverTime:
|
||||
apa = new DamageOverTimePowerAction(powerAction, effects);
|
||||
break;
|
||||
case Peek:
|
||||
apa = new PeekPowerAction(powerAction);
|
||||
break;
|
||||
case Charm:
|
||||
apa = new CharmPowerAction(powerAction);
|
||||
break;
|
||||
case RemoveEffect:
|
||||
apa = new RemoveEffectPowerAction(powerAction);
|
||||
break;
|
||||
case Track:
|
||||
apa = new TrackPowerAction(powerAction, effects);
|
||||
break;
|
||||
case DirectDamage:
|
||||
apa = new DirectDamagePowerAction(powerAction, effects);
|
||||
break;
|
||||
case Transform:
|
||||
apa = new TransformPowerAction(powerAction, effects);
|
||||
break;
|
||||
case CreateMob:
|
||||
apa = new CreateMobPowerAction(powerAction);
|
||||
break;
|
||||
case Invis:
|
||||
apa = new InvisPowerAction(powerAction, effects);
|
||||
break;
|
||||
case ClearNearbyAggro:
|
||||
apa = new ClearNearbyAggroPowerAction(powerAction);
|
||||
break;
|
||||
case MobRecall:
|
||||
apa = new MobRecallPowerAction(powerAction);
|
||||
break;
|
||||
case SetItemFlag:
|
||||
apa = new SetItemFlagPowerAction(powerAction);
|
||||
break;
|
||||
case SimpleDamage:
|
||||
apa = new SimpleDamagePowerAction(powerAction);
|
||||
break;
|
||||
case TransferStatOT:
|
||||
apa = new TransferStatOTPowerAction(powerAction, effects);
|
||||
break;
|
||||
case TransferStat:
|
||||
apa = new TransferStatPowerAction(powerAction, effects);
|
||||
break;
|
||||
case Teleport:
|
||||
apa = new TeleportPowerAction(powerAction);
|
||||
break;
|
||||
case TreeChoke:
|
||||
apa = new TreeChokePowerAction(powerAction);
|
||||
break;
|
||||
case Block:
|
||||
apa = new BlockPowerAction(powerAction);
|
||||
break;
|
||||
case Resurrect:
|
||||
apa = new ResurrectPowerAction(powerAction);
|
||||
break;
|
||||
case ClaimMine:
|
||||
apa = new ClaimMinePowerAction(powerAction);
|
||||
break;
|
||||
case Recall:
|
||||
apa = new RecallPowerAction(powerAction);
|
||||
break;
|
||||
case SpireDisable:
|
||||
apa = new SpireDisablePowerAction(powerAction);
|
||||
break;
|
||||
case Steal:
|
||||
apa = new StealPowerAction(powerAction);
|
||||
break;
|
||||
case Summon:
|
||||
apa = new SummonPowerAction(powerAction);
|
||||
break;
|
||||
case RunegateTeleport:
|
||||
apa = new RunegateTeleportPowerAction(powerAction);
|
||||
break;
|
||||
}
|
||||
PowersManager.powerActionsByIDString.put(IDString, apa);
|
||||
}
|
||||
}
|
||||
|
||||
// This pre-loads all powers and effects
|
||||
public static void InitializePowers() {
|
||||
|
||||
// Add EffectsBase
|
||||
ArrayList<EffectsBase> ebList = dbEffectsBaseHandler.getAllEffectsBase();
|
||||
EffectsParser.parseWpakFile();
|
||||
PowersParser.parseWpakFile();
|
||||
PowerActionParser.parseWpakFile();
|
||||
|
||||
for (EffectsBase eb : ebList) {
|
||||
PowersManager.effectsBaseByToken.put(eb.getToken(), eb);
|
||||
PowersManager.effectsBaseByIDString.put(eb.getIDString(), eb);
|
||||
//Initialize Effects Data
|
||||
InitializeEffects();
|
||||
|
||||
}
|
||||
|
||||
// Add Fail Conditions
|
||||
EffectsBase.getFailConditions(PowersManager.effectsBaseByIDString);
|
||||
|
||||
// Add Modifiers to Effects
|
||||
dbEffectsBaseHandler.cacheAllEffectModifiers();
|
||||
|
||||
// Add Source Types to Effects
|
||||
dbPowerHandler.addAllSourceTypes();
|
||||
dbPowerHandler.addAllAnimationOverrides();
|
||||
|
||||
// Add PowerActions
|
||||
AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
|
||||
|
||||
// Load valid Item Flags
|
||||
// AbstractPowerAction.loadValidItemFlags(PowersManager.powerActionsByIDString);
|
||||
//Initialize Power Actions
|
||||
InitializePowerActions();
|
||||
|
||||
// get all PowersBase
|
||||
ArrayList<PowersBase> pbList = dbSkillReqHandler.getAllPowersBase();
|
||||
@@ -160,29 +269,36 @@ public enum PowersManager {
|
||||
|
||||
}
|
||||
|
||||
public static EffectsBase setEffectToken(int ID, int token) {
|
||||
for (EffectsBase eb : PowersManager.effectsBaseByIDString.values()) {
|
||||
if (eb.getUUID() == ID) {
|
||||
eb.setToken(token);
|
||||
return eb;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||
boolean sendCastToSelf) {
|
||||
|
||||
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||
if (pb != null && pb.isHarmful == false) {
|
||||
if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
return;
|
||||
if (pb != null && pb.enforceLore()) {
|
||||
//if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
// return;
|
||||
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false)
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false) {
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
PlayerCharacter pc = SessionManager
|
||||
.getPlayerCharacter(origin);
|
||||
|
||||
if (pc != null) {
|
||||
sendPowerMsg(pc, 2, msg);
|
||||
if (pc.isCasting()) {
|
||||
pc.update();
|
||||
}
|
||||
|
||||
pc.setIsCasting(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +307,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
PlayerCharacter pc = SessionManager
|
||||
@@ -244,7 +360,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -488,7 +604,7 @@ public enum PowersManager {
|
||||
0f, 0f, 0, null,
|
||||
9999, 0);
|
||||
mhm.setOmitFromChat(1);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, mhm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, mhm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
else if (pb.useMana())
|
||||
if (playerCharacter.getMana() < cost)
|
||||
@@ -519,7 +635,7 @@ public enum PowersManager {
|
||||
// else send recycle message to unlock power
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
//what the fuck?
|
||||
@@ -529,7 +645,7 @@ public enum PowersManager {
|
||||
// else
|
||||
// msg.setUnknown04(1); // Regular Race, use mana?
|
||||
int tr = msg.getNumTrains();
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, sendCastToSelf, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, sendCastToSelf, false);
|
||||
|
||||
//Make new msg..
|
||||
PerformActionMsg copyMsg = new PerformActionMsg(msg);
|
||||
@@ -540,7 +656,7 @@ public enum PowersManager {
|
||||
playerCharacter.update();
|
||||
playerCharacter.setSit(false);
|
||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -683,8 +799,8 @@ public enum PowersManager {
|
||||
|
||||
msg.setNumTrains(9999);
|
||||
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
msg.setNumTrains(tr);
|
||||
|
||||
@@ -751,7 +867,7 @@ public enum PowersManager {
|
||||
performActionMsg.setUnknown04(2);
|
||||
|
||||
dispatch = Dispatch.borrow(playerCharacter, performActionMsg);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, performActionMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, performActionMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -909,10 +1025,6 @@ public enum PowersManager {
|
||||
if (pb.isHarmful())
|
||||
mobTarget.handleDirectAggro(playerCharacter);
|
||||
}
|
||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||
}
|
||||
|
||||
// update target of used power timer
|
||||
|
||||
@@ -934,8 +1046,7 @@ public enum PowersManager {
|
||||
continue;
|
||||
// If something blocks the action, then stop
|
||||
|
||||
if (ab.blocked(target, pb, trains)) {
|
||||
|
||||
if (ab.blocked(target,pb.vampDrain)) {
|
||||
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
||||
continue;
|
||||
}
|
||||
@@ -946,7 +1057,7 @@ public enum PowersManager {
|
||||
// if (!stackType.equals("IgnoreStack")) {
|
||||
if (target.getEffects().containsKey(stackType)) {
|
||||
// remove any existing power that overrides
|
||||
Effect ef = target.getEffects().get(stackType);
|
||||
engine.objects.Effect ef = target.getEffects().get(stackType);
|
||||
AbstractEffectJob effect = null;
|
||||
if (ef != null) {
|
||||
JobContainer jc = ef.getJobContainer();
|
||||
@@ -992,7 +1103,7 @@ public enum PowersManager {
|
||||
PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
castMsg.setNumTrains(9999);
|
||||
castMsg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
msgCasted = true;
|
||||
}
|
||||
}
|
||||
@@ -1002,7 +1113,7 @@ public enum PowersManager {
|
||||
PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
castMsg.setNumTrains(9999);
|
||||
castMsg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
msgCasted = true;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1174,7 @@ public enum PowersManager {
|
||||
|
||||
msg.setNumTrains(9999);
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
// get target loc
|
||||
Vector3fImmutable targetLoc = msg.getTargetLoc();
|
||||
@@ -1110,7 +1221,7 @@ public enum PowersManager {
|
||||
continue;
|
||||
// If something blocks the action, then stop
|
||||
|
||||
if (ab.blocked(target, pb, trains))
|
||||
if (ab.blocked(target,pb.vampDrain))
|
||||
continue;
|
||||
// TODO handle overwrite stack order here
|
||||
String stackType = ab.getStackType();
|
||||
@@ -1118,7 +1229,7 @@ public enum PowersManager {
|
||||
// if (!stackType.equals("IgnoreStack")) {
|
||||
if (target.getEffects().containsKey(stackType)) {
|
||||
// remove any existing power that overrides
|
||||
Effect ef = target.getEffects().get(stackType);
|
||||
engine.objects.Effect ef = target.getEffects().get(stackType);
|
||||
AbstractEffectJob effect = null;
|
||||
if (ef != null) {
|
||||
JobContainer jc = ef.getJobContainer();
|
||||
@@ -1170,7 +1281,7 @@ public enum PowersManager {
|
||||
// TODO echo power use to everyone else
|
||||
msg.setNumTrains(9999);
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
}
|
||||
|
||||
@@ -1248,7 +1359,7 @@ public enum PowersManager {
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -1374,7 +1485,7 @@ public enum PowersManager {
|
||||
PerformActionMsg msg = new PerformActionMsg(pb.getToken(),
|
||||
trains, ac.getObjectType().ordinal(), ac.getObjectUUID(), tarType, tarID, 0,
|
||||
0, 0, 1, 0);
|
||||
DispatchMessage.sendToAllInRange(target, msg);
|
||||
DispatchManager.sendToAllInRange(target, msg);
|
||||
|
||||
|
||||
ConcurrentHashMap<String, JobContainer> timers = ac.getTimers();
|
||||
@@ -1424,7 +1535,7 @@ public enum PowersManager {
|
||||
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
|
||||
continue;
|
||||
// If something blocks the action, then stop
|
||||
if (ab.blocked(target, pb, trains))
|
||||
if (ab.blocked(target,pb.vampDrain))
|
||||
// sendPowerMsg(pc, 5, msg);
|
||||
continue;
|
||||
// TODO handle overwrite stack order here
|
||||
@@ -1432,7 +1543,7 @@ public enum PowersManager {
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType;
|
||||
if (target.getEffects().containsKey(stackType)) {
|
||||
// remove any existing power that overrides
|
||||
Effect ef = target.getEffects().get(stackType);
|
||||
engine.objects.Effect ef = target.getEffects().get(stackType);
|
||||
AbstractEffectJob effect = null;
|
||||
if (ef != null) {
|
||||
JobContainer jc = ef.getJobContainer();
|
||||
@@ -1492,7 +1603,7 @@ public enum PowersManager {
|
||||
.getObjectType().ordinal(), ac.getObjectUUID(), target.getObjectType().ordinal(),
|
||||
target.getObjectUUID(), 0, 0, 0, 2, 0);
|
||||
|
||||
DispatchMessage.sendToAllInRange(ac, msg);
|
||||
DispatchManager.sendToAllInRange(ac, msg);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1879,7 +1990,7 @@ public enum PowersManager {
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer
|
||||
.toString(toRemove.getUUID()) : stackType;
|
||||
if (fromChant) {
|
||||
Effect eff = awo.getEffects().get(stackType);
|
||||
engine.objects.Effect eff = awo.getEffects().get(stackType);
|
||||
if (eff != null)
|
||||
eff.cancelJob(true);
|
||||
} else
|
||||
@@ -1943,7 +2054,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -2103,12 +2214,12 @@ public enum PowersManager {
|
||||
case 3:
|
||||
case 4:
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
break;
|
||||
default:
|
||||
msg.setUnknown04(1);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2126,7 +2237,7 @@ public enum PowersManager {
|
||||
|
||||
ApplyEffectMsg aem = new ApplyEffectMsg(pc, pc, 0, eb.getToken(), 9, pb.getToken(), pb.getName());
|
||||
aem.setUnknown03(type);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -2147,7 +2258,7 @@ public enum PowersManager {
|
||||
aem.setUnknown03(type);
|
||||
aem.setUnknown05(1);
|
||||
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -2162,7 +2273,7 @@ public enum PowersManager {
|
||||
switch (type) {
|
||||
case 3:
|
||||
case 4:
|
||||
DispatchMessage.sendToAllInRange(mob, msg);
|
||||
DispatchManager.sendToAllInRange(mob, msg);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2401,7 +2512,7 @@ public enum PowersManager {
|
||||
if (pam != null) {
|
||||
pam.setNumTrains(9999);
|
||||
pam.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(ac, pam);
|
||||
DispatchManager.sendToAllInRange(ac, pam);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2465,7 +2576,7 @@ public enum PowersManager {
|
||||
PerformActionMsg pam = new PerformActionMsg(pb.getToken(), 9999, ac
|
||||
.getObjectType().ordinal(), ac.getObjectUUID(), target.getObjectType().ordinal(),
|
||||
target.getObjectUUID(), 0, 0, 0, 2, 0);
|
||||
DispatchMessage.sendToAllInRange(ac, pam);
|
||||
DispatchManager.sendToAllInRange(ac, pam);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.InterestManagement.Terrain;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
package engine.jobs;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ChatChannelType;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.City;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -66,7 +66,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
msg.setMessageType(4); // Error message
|
||||
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
|
||||
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
DispatchManager.dispatchMsgToAll(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.DoorState;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.mbEnums.DoorState;
|
||||
import engine.net.client.msg.DoorTryOpenMsg;
|
||||
import engine.objects.Blueprint;
|
||||
import engine.objects.Building;
|
||||
@@ -40,7 +40,7 @@ public class DoorCloseJob extends AbstractScheduleJob {
|
||||
this.building.setDoorState(doorNumber, DoorState.CLOSED);
|
||||
|
||||
DoorTryOpenMsg msg = new DoorTryOpenMsg(door, this.building.getObjectUUID(), 0, (byte) 0);
|
||||
DispatchMessage.sendToAllInRange(building, msg);
|
||||
DispatchManager.sendToAllInRange(building, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TrackArrowMsg;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -84,7 +84,7 @@ public class TrackJob extends AbstractEffectJob {
|
||||
|
||||
TrackArrowMsg tam = new TrackArrowMsg(rotation);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, tam);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.NPC;
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.job.AbstractScheduleJob;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.wpak.data.Power;
|
||||
|
||||
public class UsePowerJob extends AbstractScheduleJob {
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.wpakpowers.WpakPowerManager;
|
||||
|
||||
public class WpakUsePowerJob extends AbstractScheduleJob {
|
||||
|
||||
private final PlayerCharacter pc;
|
||||
private final PerformActionMsg msg;
|
||||
private AbstractWorldObject target;
|
||||
|
||||
public WpakUsePowerJob(PlayerCharacter pc, PerformActionMsg msg, AbstractWorldObject tar) {
|
||||
super();
|
||||
this.pc = pc;
|
||||
this.msg = msg;
|
||||
this.target = tar;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
WpakPowerManager.finishUsePower(this.msg, this.pc,this.target);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
//cast stopped early, reset recycle timer
|
||||
PowersManager.finishRecycleTime(this.msg, this.pc, true);
|
||||
}
|
||||
}
|
||||
@@ -25,24 +25,25 @@ import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class WorkOrder implements Delayed {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class defines a Forge rolling request made through a
|
||||
// vendor; then passed to the ForgeManager singleton
|
||||
// for completion.
|
||||
// Class defines a Forge rolling request made through a vendor
|
||||
// interaction; submitted to the ForgeManager singleton for completion.
|
||||
//
|
||||
// A workOrder once created will last until all items are
|
||||
// either completed or junked. They are persisted in the
|
||||
// table dyn_workorders.
|
||||
// A workOrder once created will last until all items are either
|
||||
// completed or junked. They are persisted in the table dyn_workorders.
|
||||
|
||||
public int workOrderID;
|
||||
public NPC vendor;
|
||||
public int slots_used;
|
||||
public AtomicInteger slots_used = new AtomicInteger(0);
|
||||
public int total_to_produce;
|
||||
public int total_produced;
|
||||
public boolean multiple_slot_request;
|
||||
@@ -54,8 +55,7 @@ public class WorkOrder implements Delayed {
|
||||
public int suffixToken;
|
||||
public long rollingDuration;
|
||||
public long completionTime;
|
||||
public boolean runCompleted = false;
|
||||
public boolean runCanceled = false;
|
||||
public AtomicBoolean runCompleted = new AtomicBoolean(false);
|
||||
|
||||
// This collection is serialized to the vendor rolling window in ManageNPCMsg.
|
||||
|
||||
@@ -72,7 +72,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
this.workOrderID = jsonWorkOrder.getInt("workOrderID");
|
||||
this.vendor = NPC.getNPC(jsonWorkOrder.getInt("vendor"));
|
||||
this.slots_used = jsonWorkOrder.getInt("slots_used");
|
||||
this.slots_used.set(jsonWorkOrder.getInt("slots_used"));
|
||||
this.total_to_produce = jsonWorkOrder.getInt("total_to_produce");
|
||||
this.total_produced = jsonWorkOrder.getInt("total_produced");
|
||||
this.multiple_slot_request = jsonWorkOrder.getBoolean("multiple_slot_request");
|
||||
@@ -80,10 +80,14 @@ public class WorkOrder implements Delayed {
|
||||
this.item_name_override = jsonWorkOrder.getString("item_name_override");
|
||||
this.prefixToken = jsonWorkOrder.getInt("prefixToken");
|
||||
this.suffixToken = jsonWorkOrder.getInt("suffixToken");
|
||||
this.slots_used = jsonWorkOrder.getInt("slots_used");
|
||||
this.rollingDuration = jsonWorkOrder.getLong("rollingDuration");
|
||||
this.completionTime = jsonWorkOrder.getLong("completionTime");
|
||||
this.runCompleted = jsonWorkOrder.getBoolean("runCompleted");
|
||||
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
|
||||
|
||||
// Vendor sanity check. Might have been deleted
|
||||
|
||||
if (this.vendor == null)
|
||||
return;
|
||||
|
||||
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
|
||||
|
||||
@@ -108,6 +112,7 @@ public class WorkOrder implements Delayed {
|
||||
for (Object o : tokenList) {
|
||||
int prefix = ((JSONArray) o).getInt(0);
|
||||
int suffix = ((JSONArray) o).getInt(1);
|
||||
|
||||
Item cookingItem = ForgeManager.forgeItem(this);
|
||||
cookingItem.prefixToken = prefix;
|
||||
cookingItem.suffixToken = suffix;
|
||||
@@ -130,7 +135,8 @@ public class WorkOrder implements Delayed {
|
||||
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
|
||||
return 30; //30: That person cannot carry that item
|
||||
|
||||
if (!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||
if ((workOrder.prefixToken != 0 || workOrder.suffixToken != 0) &&
|
||||
!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||
return 59; //59: This hireling does not have this formula
|
||||
|
||||
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
|
||||
@@ -147,53 +153,46 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
public static boolean withdrawWorkOrderCost(WorkOrder workOrder) {
|
||||
|
||||
HashMap<mbEnums.ResourceType, Integer> modified_production_cost = new HashMap<>(workOrder.production_cost_total);
|
||||
|
||||
if (workOrder.vendor.building.getCity() == null)
|
||||
return false;
|
||||
|
||||
int strongbox = workOrder.vendor.building.getStrongboxValue();
|
||||
|
||||
// Strongbox can cover total gold cost;
|
||||
|
||||
if (workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
// Early exit if strongbox can cover gold only roll.
|
||||
|
||||
if (workOrder.production_cost_total.size() == 1 && workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
workOrder.vendor.building.setStrongboxValue(strongbox - workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD));
|
||||
workOrder.production_cost_total.put(mbEnums.ResourceType.GOLD, 0);
|
||||
|
||||
// Early exit for Strongbox covering gold only rolls
|
||||
|
||||
if (workOrder.production_cost_total.size() == 1)
|
||||
return true;
|
||||
} else {
|
||||
int remainingAmount = workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - strongbox;
|
||||
workOrder.vendor.building.setStrongboxValue(0);
|
||||
workOrder.production_cost_total.put(mbEnums.ResourceType.GOLD, workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - remainingAmount);
|
||||
return true;
|
||||
}
|
||||
|
||||
// There is an overflow at this point and a warehouse is required
|
||||
// Warehouse is required after this point
|
||||
|
||||
Warehouse warehouse = workOrder.vendor.building.getCity().warehouse;
|
||||
|
||||
if (warehouse == null)
|
||||
return false;
|
||||
|
||||
// Take from strongbox first and deduct from production cost total
|
||||
|
||||
if (workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
workOrder.vendor.building.setStrongboxValue(strongbox - workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD));
|
||||
modified_production_cost.put(mbEnums.ResourceType.GOLD, 0);
|
||||
} else {
|
||||
int overflowAmount = workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - strongbox;
|
||||
workOrder.vendor.building.setStrongboxValue(0);
|
||||
modified_production_cost.put(mbEnums.ResourceType.GOLD, overflowAmount);
|
||||
}
|
||||
|
||||
// Deduct total production cost from warehouse
|
||||
|
||||
workOrder.production_cost_total.forEach((key, value) -> warehouse.resources.put(key, warehouse.resources.get(key) - value));
|
||||
modified_production_cost.forEach((key, value) -> warehouse.resources.put(key, warehouse.resources.get(key) - value));
|
||||
DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit unit) {
|
||||
long timeRemaining = completionTime - System.currentTimeMillis();
|
||||
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Delayed o) {
|
||||
return Long.compare(this.completionTime, ((WorkOrder) o).completionTime);
|
||||
}
|
||||
|
||||
public static JSONObject toJson(WorkOrder workOrder) {
|
||||
|
||||
@@ -203,7 +202,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
jsonWorkOrder.put("workOrderID", workOrder.workOrderID);
|
||||
jsonWorkOrder.put("vendor", workOrder.vendor.getObjectUUID());
|
||||
jsonWorkOrder.put("slots_used", workOrder.slots_used);
|
||||
jsonWorkOrder.put("slots_used", workOrder.slots_used.get());
|
||||
jsonWorkOrder.put("total_to_produce", workOrder.total_to_produce);
|
||||
jsonWorkOrder.put("total_produced", workOrder.total_produced);
|
||||
jsonWorkOrder.put("multiple_slot_request", workOrder.multiple_slot_request);
|
||||
@@ -215,7 +214,7 @@ public class WorkOrder implements Delayed {
|
||||
jsonWorkOrder.put("suffixToken", workOrder.suffixToken);
|
||||
jsonWorkOrder.put("rollingDuration", workOrder.rollingDuration);
|
||||
jsonWorkOrder.put("completionTime", workOrder.completionTime);
|
||||
jsonWorkOrder.put("runCompleted", workOrder.runCompleted);
|
||||
jsonWorkOrder.put("runCompleted", workOrder.runCompleted.get());
|
||||
|
||||
ArrayList<Integer[]> cookingTokens = new ArrayList<>();
|
||||
|
||||
@@ -235,7 +234,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
String outSTring = "\r\nwordOrderID: " + this.workOrderID + "\r\n" +
|
||||
"vendor: " + this.vendor.getObjectUUID() + "\r\n" +
|
||||
"slots_used: " + this.slots_used + "\r\n" +
|
||||
"slots_used: " + this.slots_used.get() + "\r\n" +
|
||||
"total_to_produce: " + this.total_to_produce + "\r\n" +
|
||||
"total_produced: " + this.total_produced + "\r\n" +
|
||||
"templateID: " + this.templateID + "\r\n" +
|
||||
@@ -244,12 +243,40 @@ public class WorkOrder implements Delayed {
|
||||
"suffixToken: " + this.suffixToken + "\r\n" +
|
||||
"rollingDuration: " + duration + "\r\n" +
|
||||
"completionTime: " + localDateTime + "\r\n" +
|
||||
"runCompleted: " + this.runCompleted + "\r\n" +
|
||||
"runCanceled: " + this.runCanceled + "\r\n" +
|
||||
"runCompleted: " + this.runCompleted.get() + "\r\n" +
|
||||
"productionCost: " + this.production_cost.toString() + "\r\n" +
|
||||
"totalProductionCost:: " + this.production_cost_total.toString();
|
||||
|
||||
return outSTring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit unit) {
|
||||
long timeRemaining = completionTime - System.currentTimeMillis();
|
||||
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Delayed o) {
|
||||
return Long.compare(this.completionTime, ((WorkOrder) o).completionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
|
||||
WorkOrder otherWorkOrder = (WorkOrder) obj;
|
||||
return workOrderID == otherWorkOrder.workOrderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(workOrderID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+693
-575
File diff suppressed because it is too large
Load Diff
+155
-103
@@ -8,6 +8,7 @@
|
||||
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
@@ -15,9 +16,8 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.Threads.Respawner;
|
||||
import engine.mobileAI.Threads.ReSpawner;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.objects.*;
|
||||
@@ -30,6 +30,7 @@ import org.pmw.tinylog.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -37,6 +38,13 @@ import static engine.math.FastMath.sqr;
|
||||
|
||||
public class MobAI {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements mobile AI mechanics for Magicbane.
|
||||
//
|
||||
// Controls all mob actions from regular mobs to pets and guards.
|
||||
// Initiates in the "DetermineAction" method and branches from there
|
||||
//
|
||||
// CombatManager.class implements shared combat routines for all avatars.
|
||||
|
||||
private static void attackTarget(Mob mob, AbstractWorldObject target) {
|
||||
|
||||
@@ -50,8 +58,7 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) &&
|
||||
!mob.canSee((AbstractCharacter) target)) {
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && !mob.canSee((AbstractCharacter) target)) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -93,7 +100,10 @@ public class MobAI {
|
||||
public static void attackPlayer(Mob mob, PlayerCharacter target) {
|
||||
|
||||
try {
|
||||
|
||||
if (target == null || !target.isAlive() || !target.isActive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
if (!mob.canSee(target)) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -115,11 +125,11 @@ public class MobAI {
|
||||
if (mob.isMoving() && mob.getRange() > 20)
|
||||
return;
|
||||
|
||||
CombatManager.combatCycle(mob, mob.combatTarget);
|
||||
CombatManager.combatCycle(mob, target);
|
||||
}
|
||||
|
||||
if (target.getPet() != null)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist)
|
||||
target.getPet().setCombatTarget(mob);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -154,7 +164,7 @@ public class MobAI {
|
||||
if (mob.isSiege()) {
|
||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
ppm.setRange(50);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -165,13 +175,14 @@ public class MobAI {
|
||||
public static void attackMob(Mob mob, Mob target) {
|
||||
|
||||
try {
|
||||
if (mob == null || target == null)
|
||||
return;
|
||||
|
||||
if (mob.getRange() >= 30 && mob.isMoving())
|
||||
return;
|
||||
|
||||
//no weapons, default mob attack speed 3 seconds.
|
||||
|
||||
|
||||
CombatManager.combatCycle(mob, target);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -188,10 +199,9 @@ public class MobAI {
|
||||
// early exit while waiting to patrol again.
|
||||
// Minions are force marched if captain is alive
|
||||
|
||||
boolean forced = mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive();
|
||||
boolean forced = mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive();
|
||||
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000L) > System.currentTimeMillis())
|
||||
if (!forced)
|
||||
return;
|
||||
|
||||
@@ -210,6 +220,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
assert mob.patrolPoints != null;
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
mob.lastPatrolPointIndex = 0;
|
||||
|
||||
@@ -229,6 +240,7 @@ public class MobAI {
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDCAPTAIN))
|
||||
for (Integer minionUUID : mob.minions) {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
assert minion != null;
|
||||
if (minion.isAlive() && minion.combatTarget == null)
|
||||
MobAI.patrol(minion);
|
||||
}
|
||||
@@ -252,7 +264,7 @@ public class MobAI {
|
||||
if (mob == null)
|
||||
return false;
|
||||
|
||||
if (mob.isPlayerGuard() == true) {
|
||||
if (mob.isPlayerGuard()) {
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDWALLARCHER))
|
||||
return false; //wall archers don't cast
|
||||
@@ -263,14 +275,13 @@ public class MobAI {
|
||||
|
||||
// exception allowing werewolf and werebear guard captains to cast
|
||||
|
||||
if (mbEnums.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980103 && contractID != 980104)
|
||||
if (!mbEnums.MinionType.ContractToMinionMap.get(contractID).isMage() && contractID != 980103 && contractID != 980104)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mobile has no powers defined in mobbase or contract..
|
||||
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() &&
|
||||
PowersManager.getPowersForRune(contractID).isEmpty())
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() && PowersManager.getPowersForRune(contractID).isEmpty())
|
||||
return false;
|
||||
|
||||
if (mob.nextCastTime == 0)
|
||||
@@ -370,7 +381,7 @@ public class MobAI {
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
@@ -426,7 +437,7 @@ public class MobAI {
|
||||
|
||||
ChatManager.chatSayInfo(null, mob.getName() + " calls for help!");
|
||||
|
||||
Zone mobCamp = mob.getParentZone();
|
||||
Zone mobCamp = mob.parentZone;
|
||||
|
||||
for (Mob helper : mobCamp.zoneMobSet) {
|
||||
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {
|
||||
@@ -454,7 +465,7 @@ public class MobAI {
|
||||
if (mob == null)
|
||||
return;
|
||||
|
||||
if (mob.getTimestamps().containsKey("lastExecution") == false)
|
||||
if (!mob.getTimestamps().containsKey("lastExecution"))
|
||||
mob.getTimestamps().put("lastExecution", System.currentTimeMillis());
|
||||
|
||||
if (System.currentTimeMillis() < mob.getTimeStamp("lastExecution"))
|
||||
@@ -474,11 +485,11 @@ public class MobAI {
|
||||
if (mob.despawned && mob.isPlayerGuard()) {
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION)) {
|
||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned) {
|
||||
|
||||
//minions don't respawn while guard captain is dead
|
||||
|
||||
if (mob.isAlive() == false) {
|
||||
if (!mob.isAlive()) {
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
@@ -519,12 +530,12 @@ public class MobAI {
|
||||
}
|
||||
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.PET) == false)
|
||||
if (!mob.agentType.equals(mbEnums.AIAgentType.PET))
|
||||
checkToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
|
||||
if (mob.getCombatTarget().isAlive() == false) {
|
||||
if (!mob.getCombatTarget().isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -533,12 +544,12 @@ public class MobAI {
|
||||
|
||||
PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.playerAgroMap.containsKey(target.getObjectUUID()) == false) {
|
||||
if (!mob.playerAgroMap.containsKey(target.getObjectUUID())) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.canSee((PlayerCharacter) mob.getCombatTarget()) == false) {
|
||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -579,9 +590,9 @@ public class MobAI {
|
||||
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
for (Entry<Integer, Float> playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
int playerID = (int) playerEntry.getKey();
|
||||
int playerID = playerEntry.getKey();
|
||||
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID);
|
||||
|
||||
//Player is null, let's remove them from the list.
|
||||
@@ -605,12 +616,12 @@ public class MobAI {
|
||||
|
||||
// No aggro for this race type
|
||||
|
||||
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.race.getRaceType().getMonsterType()) == true)
|
||||
if (!aiAgent.notEnemy.isEmpty() && aiAgent.notEnemy.contains(loadedPlayer.race.getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
//mob has enemies and this player race is not it
|
||||
|
||||
if (aiAgent.enemy.size() > 0 && aiAgent.enemy.contains(loadedPlayer.race.getRaceType().getMonsterType()) == false)
|
||||
if (!aiAgent.enemy.isEmpty() && !aiAgent.enemy.contains(loadedPlayer.race.getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
||||
@@ -651,49 +662,44 @@ public class MobAI {
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
switch (mob.behaviourType) {
|
||||
if (mob.behaviourType == mbEnums.MobBehaviourType.Pet1) {
|
||||
if (mob.guardCaptain == null)
|
||||
return;
|
||||
|
||||
case Pet1:
|
||||
//mob no longer has its owner loaded, translate pet to owner
|
||||
|
||||
if (mob.guardCaptain == null)
|
||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||
MovementManager.translocate(mob, mob.guardCaptain.getLoc());
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//move back to owner
|
||||
|
||||
if (mob.getRange() * mob.getRange() >= mob.loc.distanceSquared(mob.guardCaptain.loc))
|
||||
return;
|
||||
|
||||
//mob no longer has its owner loaded, translate pet to owner
|
||||
mob.destination = mob.guardCaptain.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5, false);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
} else {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||
MovementManager.translocate(mob, mob.guardCaptain.getLoc());
|
||||
return;
|
||||
}
|
||||
if (!mob.isMoving()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
// Minions only patrol on their own if captain is dead.
|
||||
|
||||
//move back to owner
|
||||
|
||||
if (mob.getRange() * mob.getRange() >= mob.loc.distanceSquared(mob.guardCaptain.loc))
|
||||
return;
|
||||
|
||||
mob.destination = mob.guardCaptain.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5, false);
|
||||
if (!mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION))
|
||||
patrol(mob);
|
||||
else if (!mob.guardCaptain.isAlive())
|
||||
patrol(mob);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
default:
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
if (!mob.isMoving()) {
|
||||
|
||||
// Minions only patrol on their own if captain is dead.
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) == false)
|
||||
patrol(mob);
|
||||
else if (mob.guardCaptain.isAlive() == false)
|
||||
patrol(mob);
|
||||
} else
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
} else {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
break;
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
} else {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
@@ -718,7 +724,6 @@ public class MobAI {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//No items in inventory.
|
||||
} else {
|
||||
@@ -727,20 +732,18 @@ public class MobAI {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnDelay * 1000L)) {
|
||||
aiAgent.respawnTime = aiAgent.deathTime + (aiAgent.spawnDelay * 1000L);
|
||||
Respawner.respawnQueue.put(aiAgent);
|
||||
ReSpawner.respawnQueue.put(aiAgent);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
||||
@@ -752,14 +755,13 @@ public class MobAI {
|
||||
|
||||
//checks if mob can attack based on attack timer and range
|
||||
|
||||
if (mob.isAlive() == false)
|
||||
if (!mob.isAlive())
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
||||
mob.agentType.equals(mbEnums.AIAgentType.PET) == false) {
|
||||
if (mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && !MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) && !mob.agentType.equals(mbEnums.AIAgentType.PET)) {
|
||||
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -782,7 +784,7 @@ public class MobAI {
|
||||
|
||||
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
|
||||
if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
|
||||
if (current == null || !current.equals(mob.getGuild().getOwnedCity())) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
@@ -796,18 +798,18 @@ public class MobAI {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
|
||||
PowersManager.useMobPower(minion, minion, recall, 40);
|
||||
assert minion != null;
|
||||
minion.setCombatTarget(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||
} else if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||
mob.playerAgroMap.put(playerEntry, 0f);
|
||||
mob.playerAgroMap.replaceAll((e, v) -> 0f);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
@@ -818,9 +820,9 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.getTimestamps().containsKey("lastChase") == false)
|
||||
if (!mob.getTimestamps().containsKey("lastChase"))
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
|
||||
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase") + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
|
||||
return;
|
||||
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
@@ -868,7 +870,7 @@ public class MobAI {
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
|
||||
//don't attack other guards
|
||||
if (aggroMob.isGuard() == true)
|
||||
if (aggroMob.isGuard())
|
||||
continue;
|
||||
|
||||
//don't attack pets
|
||||
@@ -919,7 +921,7 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||
if (mob.guardCaptain == null && !mob.isNecroPet() && !mob.isSiege())
|
||||
if (ZoneManager.seaFloor.zoneMobSet.contains(mob))
|
||||
mob.killCharacter("no owner");
|
||||
|
||||
@@ -930,7 +932,7 @@ public class MobAI {
|
||||
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
if (!mob.getTimestamps().containsKey("HEALTHRECOVERED"))
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
@@ -951,26 +953,67 @@ public class MobAI {
|
||||
private static void hamletGuardLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
//safehold guard
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
safeGuardAggro(mob);
|
||||
else if (mob.getCombatTarget().isAlive() == false)
|
||||
safeGuardAggro(mob);
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||
//lore guard aggro to kill members of opposing charters
|
||||
if (mob.getCombatTarget() == null || !mob.combatTarget.isAlive())
|
||||
hamletGuardAggro(mob);
|
||||
else if (!mob.getCombatTarget().isAlive())
|
||||
hamletGuardAggro(mob);
|
||||
} else {
|
||||
//safehold guard
|
||||
|
||||
if (mob.getCombatTarget() == null || !mob.combatTarget.isAlive())
|
||||
safeGuardAggro(mob);
|
||||
else if (!mob.getCombatTarget().isAlive())
|
||||
safeGuardAggro(mob);
|
||||
}
|
||||
checkForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void hamletGuardAggro(Mob mob) {
|
||||
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
||||
if (realm.getRealmName().equals("Uthgaard")) {
|
||||
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
||||
for (AbstractWorldObject awo : loadedMobs) {
|
||||
Mob targetMob = (Mob) awo;
|
||||
if (targetMob.equals(mob))
|
||||
continue;
|
||||
if (!targetMob.isAlive() || targetMob.despawned)
|
||||
continue;
|
||||
if (targetMob.isPet())
|
||||
continue;
|
||||
mob.combatTarget = targetMob;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
for (AbstractWorldObject awo : loadedPlayers) {
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
if (!pc.isAlive() || !pc.isActive())
|
||||
continue;
|
||||
if (pc.guild.equals(Guild.getErrantGuild())) {
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
if (pc.guild.charter.equals(mob.guild.charter))
|
||||
continue;
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void defaultLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
|
||||
//check for players that can be aggroed if mob is agressive and has no target
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
|
||||
if (mob.getCombatTarget() != null && !mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()))
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
@@ -1015,18 +1058,16 @@ public class MobAI {
|
||||
|
||||
// Defer to captain if possible for current target
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive()
|
||||
&& mob.guardCaptain.combatTarget != null) {
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive() && mob.guardCaptain.combatTarget != null) {
|
||||
mob.setCombatTarget(mob.guardCaptain.combatTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
for (Entry<Integer, Float> playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
int playerID = (int) playerEntry.getKey();
|
||||
int playerID = playerEntry.getKey();
|
||||
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID);
|
||||
|
||||
//Player is null, let's remove them from the list.
|
||||
@@ -1050,7 +1091,7 @@ public class MobAI {
|
||||
|
||||
// No aggro for this player
|
||||
|
||||
if (guardCanAggro(mob, loadedPlayer) == false)
|
||||
if (!guardCanAggro(mob, loadedPlayer))
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer) && mob.getCombatTarget() == null) {
|
||||
@@ -1084,7 +1125,12 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()) == true)
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && !target.guild.equals(Guild.getErrantGuild())) {
|
||||
if (mob.guild.charter.equals(target.guild.charter))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mob.guardedCity != null && mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
@@ -1092,8 +1138,8 @@ public class MobAI {
|
||||
|
||||
//first check condemn list for aggro allowed (allies button is checked)
|
||||
|
||||
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
||||
for (Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
if (Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().reverseKOS) {
|
||||
for (Entry<Integer, Condemned> entry : Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
@@ -1115,7 +1161,7 @@ public class MobAI {
|
||||
|
||||
//allies button is not checked
|
||||
|
||||
for (Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
for (Entry<Integer, Condemned> entry : Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
@@ -1146,7 +1192,7 @@ public class MobAI {
|
||||
//early exit for a mob who is already moving to a patrol point
|
||||
//while mob moving, update lastPatrolTime so that when they stop moving the 10 second timer can begin
|
||||
|
||||
if (mob.isMoving() == true) {
|
||||
if (mob.isMoving()) {
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
@@ -1174,7 +1220,8 @@ public class MobAI {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (minion.despawned == false) {
|
||||
assert minion != null;
|
||||
if (!minion.despawned) {
|
||||
if (MovementUtilities.canMove(minion)) {
|
||||
Vector3f minionOffset = mbEnums.FormationType.getOffset(2, mob.minions.indexOf(minionUUID) + 3);
|
||||
minion.updateLocation();
|
||||
@@ -1196,19 +1243,24 @@ public class MobAI {
|
||||
float CurrentHateValue = 0;
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
|
||||
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID());
|
||||
|
||||
AbstractWorldObject mostHatedTarget = null;
|
||||
|
||||
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
|
||||
for (Entry<Integer, Float> playerEntry : mob.playerAgroMap.entrySet()) {
|
||||
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getPlayerCharacter((int) playerEntry.getKey());
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getPlayerCharacter(playerEntry.getKey());
|
||||
|
||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||
continue;
|
||||
|
||||
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && !potentialTarget.guild.equals(Guild.getErrantGuild())) {
|
||||
if (mob.guild.charter.equals(potentialTarget.guild.charter))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mob.playerAgroMap.get(potentialTarget.getObjectUUID()) > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID());
|
||||
mostHatedTarget = potentialTarget;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,23 +13,21 @@ public class MobAIThread implements Runnable {
|
||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||
public static int AI_PATROL_DIVISOR = 15;
|
||||
public static float AI_CAST_FREQUENCY;
|
||||
// Thread constructor
|
||||
|
||||
public MobAIThread() {
|
||||
Logger.info(" MobAIThread thread has started!");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//cache config value for mobile casting delay
|
||||
|
||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||
AI_BASE_AGGRO_RANGE = (int) (60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||
|
||||
while (true) {
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
|
||||
for (Zone zone : ZoneManager.getAllZones())
|
||||
for (Mob mob : zone.zoneMobSet)
|
||||
try {
|
||||
if (mob != null)
|
||||
MobAI.determineAction(mob);
|
||||
@@ -37,8 +35,6 @@ public class MobAIThread implements Runnable {
|
||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -15,17 +15,18 @@ import org.pmw.tinylog.Logger;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
|
||||
public enum Respawner implements Runnable {
|
||||
public enum ReSpawner implements Runnable {
|
||||
|
||||
// MB Dev Notes:
|
||||
//
|
||||
// Thread acts as a throttle for messages to the client. Mobiles are
|
||||
// respawned over a short time so as not to flood the client when
|
||||
// an entire camp respawns at once.
|
||||
// respawned over a short time so as not to flood client when
|
||||
// entire camp respawns at once. Client has a tendency to drop
|
||||
// messages when given too much to digest.
|
||||
|
||||
RESPAWNER;
|
||||
|
||||
public static BlockingQueue<Mob> respawnQueue = new DelayQueue();
|
||||
public static final BlockingQueue<Mob> respawnQueue = new DelayQueue<>();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.mobileAI.utilities;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
@@ -68,8 +67,9 @@ public class MovementUtilities {
|
||||
float zoneRange = 250;
|
||||
|
||||
if (agent.getParentZone() != null) {
|
||||
if (agent.getParentZone().bounds != null)
|
||||
if (agent.getParentZone().bounds != null) {
|
||||
zoneRange = agent.getParentZone().bounds.getHalfExtents().x * 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (zoneRange > 300)
|
||||
@@ -252,7 +252,7 @@ public class MovementUtilities {
|
||||
|
||||
try {
|
||||
MovementManager.movement(msg, agent);
|
||||
} catch (MsgSendException e) {
|
||||
} catch (Exception e) {
|
||||
// TODO Figure out how we want to handle the msg send exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.NotYetConnectedException;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -41,8 +40,6 @@ public abstract class AbstractConnection implements
|
||||
protected long lastKeepAliveTime = System.currentTimeMillis();
|
||||
protected long lastOpcode = -1;
|
||||
protected ConcurrentLinkedQueue<ByteBuffer> outbox = new ConcurrentLinkedQueue<>();
|
||||
protected ByteBuffer outBuf = null;
|
||||
protected ConcurrentHashMap<Long, Byte> cacheList;
|
||||
protected long nextWriteTime = 0L;
|
||||
|
||||
//Opcode tracking
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.net;
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -95,7 +94,7 @@ public abstract class AbstractNetMsg {
|
||||
* @throws Exception
|
||||
*/
|
||||
protected abstract void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException;
|
||||
;
|
||||
|
||||
/**
|
||||
* Attempts to serialize this NetMsg into a ByteBuffer. ByteBuffer is
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.net;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -21,12 +22,11 @@ import java.util.regex.Pattern;
|
||||
// All outgoing Protocol messages to the player are managed through the MessageDispatcher.class.
|
||||
// All incoming Protocol messages from the player are managed by the Protocol.class.
|
||||
//
|
||||
// A DispatchMessage is configured (Protocol messsage) and wrapped in a Dispatch (distribution list).
|
||||
// A Dispatch can be submitted to the MessageDispatcher for delivery from any thread.
|
||||
// A Dispatch is configured wrapping a Protocol message and a distribution list is built.
|
||||
//
|
||||
// Dispatches are interleaved between channels. This is to ensure
|
||||
// a combat or movement message is not delayed by spam clicking a
|
||||
// larger message. Choose your channel wisely.
|
||||
// The system interleaves dispatches between two channels. This is to ensure that
|
||||
// a critical combat or movement message will not be delayed by spam clicking a larger
|
||||
// message with no temporal immediacy. Pick the correct channel will this in mind.
|
||||
|
||||
public class MessageDispatcher implements Runnable {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class MessageDispatcher implements Runnable {
|
||||
this.messageDispatch = _messageQueue[dispatchChannel.getChannelID()].poll();
|
||||
|
||||
if (this.messageDispatch != null) {
|
||||
DispatchMessage.serializeDispatch(this.messageDispatch);
|
||||
DispatchManager.serializeDispatch(this.messageDispatch);
|
||||
shouldBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
@@ -22,7 +21,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Instance variables
|
||||
|
||||
public AbandonAssetMsgHandler() {
|
||||
super(AbandonAssetMsg.class);
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +47,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
PlayerCharacter player;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.Protocol;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -22,11 +21,11 @@ import static engine.gameManager.ChatManager.FLOOD_TIME_THRESHOLD;
|
||||
public class AbstractChatMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AbstractChatMsgHandler() {
|
||||
super(AbstractChatMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
|
||||
@@ -10,10 +9,8 @@ import engine.net.client.msg.ClientNetMsg;
|
||||
*/
|
||||
|
||||
public abstract class AbstractClientMsgHandler {
|
||||
private final Class<? extends ClientNetMsg> handler;
|
||||
|
||||
public AbstractClientMsgHandler(Class<? extends ClientNetMsg> handler) {
|
||||
this.handler = handler;
|
||||
public AbstractClientMsgHandler() {
|
||||
}
|
||||
|
||||
public boolean handleNetMsg(ClientNetMsg msg) {
|
||||
@@ -22,7 +19,7 @@ public abstract class AbstractClientMsgHandler {
|
||||
|
||||
try {
|
||||
executionSucceded = _handleNetMsg(msg, (ClientConnection) msg.getOrigin());
|
||||
} catch (MsgSendException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
executionSucceded = false;
|
||||
}
|
||||
@@ -30,5 +27,5 @@ public abstract class AbstractClientMsgHandler {
|
||||
return executionSucceded;
|
||||
}
|
||||
|
||||
protected abstract boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin) throws MsgSendException;
|
||||
protected abstract boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin);
|
||||
}
|
||||
|
||||
@@ -9,16 +9,11 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -32,11 +27,11 @@ import org.joda.time.DateTime;
|
||||
public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptInviteToGuildHandler() {
|
||||
super(AcceptInviteToGuildMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
AcceptInviteToGuildMsg msg;
|
||||
@@ -86,9 +81,9 @@ public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
||||
player.resetGuildStatuses();
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
DispatchManager.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
|
||||
player.incVer();
|
||||
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.GuildState;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -31,11 +30,11 @@ import java.util.ArrayList;
|
||||
public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptSubInviteHandler() {
|
||||
super(AcceptSubInviteMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
|
||||
PlayerCharacter sourcePlayer;
|
||||
@@ -98,7 +97,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
msg.setUnknown02(1);
|
||||
msg.setResponse("Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
||||
dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
ChatManager.chatSystemInfo(sourcePlayer, "Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
||||
return true;
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AcceptTradeRequestMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -28,11 +27,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptTradeRequestMsgHandler() {
|
||||
super(AcceptTradeRequestMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -92,10 +91,10 @@ public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
UpdateVaultMsg uvmTarget = new UpdateVaultMsg(targetAccount);
|
||||
|
||||
dispatch = Dispatch.borrow(source, uvmSource);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
dispatch = Dispatch.borrow(target, uvmTarget);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
source.charItemManager.setVaultOpen(false);
|
||||
toTradeWith.setVaultOpen(false);
|
||||
@@ -118,10 +117,10 @@ public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
toTradeWith.tradeID = msg.getUnknown01();
|
||||
|
||||
dispatch = Dispatch.borrow(source, otwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
dispatch = Dispatch.borrow(target, otwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ItemType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ActivateNPCMessage;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +21,11 @@ import java.util.ArrayList;
|
||||
public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ActivateNPCMsgHandler() {
|
||||
super(ActivateNPCMessage.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ActivateNPCMessage msg;
|
||||
PlayerCharacter player;
|
||||
@@ -66,7 +64,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
anm.setSize(ItemLists.size());
|
||||
anm.setItemList(ItemLists);
|
||||
Dispatch dispatch = Dispatch.borrow(player, anm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
if (msg.getUnknown01() == 0) {
|
||||
@@ -125,7 +123,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
mca1.setAssetName1(building.getName());
|
||||
mca1.setUnknown54(1);
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AddGoldToTradeWindowMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -27,11 +26,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AddGoldToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AddGoldToTradeWindowMsgHandler() {
|
||||
super(AddGoldToTradeWindowMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter source = origin.getPlayerCharacter();
|
||||
|
||||
@@ -95,13 +94,13 @@ public class AddGoldToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
source.charItemManager.modifyCommitToTrade();
|
||||
|
||||
dispatch = Dispatch.borrow(source, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(source, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(other, utwmOther);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AddItemToTradeWindowMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -25,11 +24,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AddItemToTradeWindowMsgHandler() {
|
||||
super(AddItemToTradeWindowMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -81,7 +80,7 @@ public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (!tradingWith.hasRoomTrade(item.template.item_wt)) {
|
||||
dispatch = Dispatch.borrow(source, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,12 +92,12 @@ public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
source.charItemManager.addItemToTrade(item);
|
||||
|
||||
dispatch = Dispatch.borrow(other, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
source.charItemManager.modifyCommitToTrade();
|
||||
|
||||
dispatch = Dispatch.borrow(other, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.AllianceType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AllianceChangeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -21,7 +20,7 @@ import engine.objects.PlayerCharacter;
|
||||
public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AllianceChangeMsgHandler() {
|
||||
super(AllianceChangeMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void MakeEnemy(Guild fromGuild, Guild toGuild, AllianceChangeMsg msg, ClientConnection origin) {
|
||||
@@ -40,20 +39,20 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
if (!Guild.sameGuild(origin.getPlayerCharacter().getGuild(), fromGuild)) {
|
||||
msg.setMsgType(AllianceChangeMsg.ERROR_NOT_SAME_GUILD);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GuildStatusController.isInnerCouncil(origin.getPlayerCharacter().getGuildStatus()) && !GuildStatusController.isGuildLeader(origin.getPlayerCharacter().getGuildStatus())) {
|
||||
msg.setMsgType(AllianceChangeMsg.ERROR_NOT_AUTHORIZED);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
@@ -72,7 +71,7 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
@@ -91,13 +90,13 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -142,7 +141,7 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
msg.setMsgType(AllianceChangeMsg.INFO_SUCCESS);
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AllyEnemyListMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -19,7 +18,7 @@ import engine.objects.PlayerCharacter;
|
||||
public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AllyEnemyListMsgHandler() {
|
||||
super(AllyEnemyListMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void showAllyEnemyList(Guild fromGuild, Guild toGuild, AllyEnemyListMsg msg, ClientConnection origin) {
|
||||
@@ -35,7 +34,7 @@ public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
if (toGuild == null)
|
||||
return;
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
// UpdateClientAlliancesMsg ucam = new UpdateClientAlliancesMsg();
|
||||
//
|
||||
@@ -46,7 +45,7 @@ public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.group.AppointGroupLeaderMsg;
|
||||
@@ -26,11 +25,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class AppointGroupLeaderHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AppointGroupLeaderHandler() {
|
||||
super(AppointGroupLeaderMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
AppointGroupLeaderMsg msg = (AppointGroupLeaderMsg) baseMsg;
|
||||
|
||||
PlayerCharacter source = SessionManager.getPlayerCharacter(origin);
|
||||
@@ -52,7 +51,7 @@ public class AppointGroupLeaderHandler extends AbstractClientMsgHandler {
|
||||
AppointGroupLeaderMsg reply = new AppointGroupLeaderMsg();
|
||||
reply.setResponse(1);
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), reply);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcLoginNotifyMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.HotzoneChangeMsg;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
@@ -23,11 +20,11 @@ import org.pmw.tinylog.Logger;
|
||||
public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcLoginNotifyMsgHandler() {
|
||||
super(ArcLoginNotifyMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
@@ -69,7 +66,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Send branch string if available from ConfigManager.
|
||||
|
||||
if (ConfigManager.currentRepoBranch != "")
|
||||
if (!ConfigManager.currentRepoBranch.equals(""))
|
||||
ChatManager.sendSystemMessage(player, ConfigManager.currentRepoBranch);
|
||||
|
||||
// Set player mask for QT
|
||||
@@ -130,7 +127,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
if (player.getPet() != null) {
|
||||
PetMsg pm = new PetMsg(5, player.getPet());
|
||||
Dispatch dispatch = Dispatch.borrow(player, pm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//Send current hotzone
|
||||
@@ -138,7 +135,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
if (ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(mbEnums.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
Dispatch dispatch = Dispatch.borrow(player, hcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
if (player.getGuild() != null && !player.getGuild().isEmptyGuild()) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcMineChangeProductionMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -21,11 +20,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcMineChangeProductionMsgHandler() {
|
||||
super(ArcMineChangeProductionMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
ArcMineChangeProductionMsg changeProductionMsg = (ArcMineChangeProductionMsg) baseMsg;
|
||||
@@ -51,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
//make sure valid resource
|
||||
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.hashLookup.get(changeProductionMsg.getResourceHash());
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.resourceHashLookup.get(changeProductionMsg.getResourceHash());
|
||||
|
||||
if (resource == null)
|
||||
return true;
|
||||
@@ -60,7 +59,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
mine.changeProductionType(resource);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, changeProductionMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcMineWindowAvailableTimeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +22,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcMineWindowAvailableTimeHandler() {
|
||||
super(ArcMineWindowAvailableTimeMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ArcMineWindowAvailableTimeMsg msg = (ArcMineWindowAvailableTimeMsg) baseMsg;
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
@@ -55,7 +54,7 @@ public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler
|
||||
ArcMineWindowAvailableTimeMsg outMsg = new ArcMineWindowAvailableTimeMsg(treeOfLife, 10);
|
||||
outMsg.configure();
|
||||
dispatch = Dispatch.borrow(playerCharacter, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcOwnedMinesListMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -20,11 +19,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcOwnedMinesListHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcOwnedMinesListHandler() {
|
||||
super(ArcOwnedMinesListMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
ArcOwnedMinesListMsg msg = (ArcOwnedMinesListMsg) baseMsg;
|
||||
@@ -37,7 +36,7 @@ public class ArcOwnedMinesListHandler extends AbstractClientMsgHandler {
|
||||
|
||||
msg.setMineList(Mine.getMinesForGuild(playerCharacter.getGuild().getObjectUUID()));
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
@@ -22,11 +21,11 @@ import org.pmw.tinylog.Logger;
|
||||
public class ArcSiegeSpireMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcSiegeSpireMsgHandler() {
|
||||
super(ArcSiegeSpireMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
Building spire;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcViewAssetTransactionsMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +22,11 @@ import engine.objects.Warehouse;
|
||||
public class ArcViewAssetTransactionsMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcViewAssetTransactionsMsgHandler() {
|
||||
super(ArcViewAssetTransactionsMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
ArcViewAssetTransactionsMsg msg;
|
||||
@@ -55,7 +54,7 @@ public class ArcViewAssetTransactionsMsgHandler extends AbstractClientMsgHandler
|
||||
newMsg.configure();
|
||||
|
||||
dispatch = Dispatch.borrow(player, newMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.SupportMsgType;
|
||||
import engine.mbEnums.TaxType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
@@ -22,7 +21,7 @@ import org.pmw.tinylog.Logger;
|
||||
public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AssetSupportMsgHandler() {
|
||||
super(AssetSupportMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void protectAsset(AssetSupportMsg msg, Building targetBuilding, NPC vendor, ClientConnection origin) {
|
||||
@@ -96,7 +95,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
outMsg = new ManageNPCMsg(vendor);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
private static void unprotectAsset(Building targetBuilding, NPC vendor, ClientConnection origin) {
|
||||
@@ -123,7 +122,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -179,7 +178,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
outMsg.configure();
|
||||
|
||||
dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
break;
|
||||
|
||||
case REMOVETAX:
|
||||
@@ -202,7 +201,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
mca.setAssetName1(targetBuilding.getName());
|
||||
mca.setUnknown54(1);
|
||||
dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
case ACCEPTTAX: //AcceptTax
|
||||
@@ -226,12 +225,12 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
mca.setUnknown54(1);
|
||||
|
||||
dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
dispatch = Dispatch.borrow(player, baseMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.mbEnums;
|
||||
@@ -22,11 +21,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AttackCmdMsgHandler() {
|
||||
super(AttackCmdMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
|
||||
@@ -68,12 +67,6 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
||||
return true; // cannot attack a null target
|
||||
}
|
||||
|
||||
// No point in setting combat target to someone you are already fighting
|
||||
|
||||
if (playerCharacter.isCombat() && playerCharacter.getCombatTarget() != null &&
|
||||
playerCharacter.getCombatTarget().equals(target))
|
||||
return true;
|
||||
|
||||
//set sources target
|
||||
|
||||
playerCharacter.setCombatTarget(target);
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -31,11 +30,11 @@ import org.joda.time.DateTime;
|
||||
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public BanishUnbanishHandler() {
|
||||
super(BanishUnbanishMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
BanishUnbanishMsg msg = (BanishUnbanishMsg) baseMsg;
|
||||
Dispatch dispatch;
|
||||
|
||||
@@ -115,7 +114,7 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
targetName + " has been banished from " + guild.getName() + '.');
|
||||
GuildListMsg guildListMsg = new GuildListMsg(guild);
|
||||
dispatch = Dispatch.borrow(source, guildListMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
} else {
|
||||
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
|
||||
}
|
||||
|
||||
@@ -9,15 +9,10 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -32,11 +27,11 @@ import java.util.ArrayList;
|
||||
public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public BreakFealtyHandler() {
|
||||
super(BreakFealtyMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
BreakFealtyMsg bfm;
|
||||
PlayerCharacter player;
|
||||
@@ -97,7 +92,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
//Update Map.
|
||||
|
||||
@@ -164,7 +159,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
//Update Map.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user