Compare commits
1189 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adfbf87056 | |||
| d80231eef0 | |||
| 3395efee49 | |||
| 7acaccc77d | |||
| 5aa01d94fd | |||
| 7b405bbbf3 | |||
| 504e26114e | |||
| 4e5e49606c | |||
| f62f11a66c | |||
| 7911a17f0c | |||
| 5c8c4fc817 | |||
| 854d0a8a68 | |||
| 61fca2c742 | |||
| b752006d6f | |||
| f9c0a9c3b5 | |||
| 71300f189d | |||
| d3fe643223 | |||
| 0cf4b5416d | |||
| a98de7b6fc | |||
| efa7e6a03a | |||
| 407fe9d583 | |||
| 36d8a6bdbd | |||
| cdd746e0df | |||
| 4e1621db99 | |||
| e5622a47c0 | |||
| 46170e3ab7 | |||
| 01533b1056 | |||
| 87e24c16d9 | |||
| 572bff8d6b | |||
| 52d37296a7 | |||
| f682f9a5ae | |||
| 2f3b9e0fb2 | |||
| cfc36c0c27 | |||
| 0e431aa726 | |||
| 25ab3747eb | |||
| 7526cc808c | |||
| 019c254ac1 | |||
| 8cd613c597 | |||
| 5f16289052 | |||
| 2768980f6e | |||
| 3a2b138deb | |||
| 3f1385dd33 | |||
| a70585448f | |||
| d4e38c113b | |||
| d7b18dc457 | |||
| 7b909e1044 | |||
| 4fd1a1a146 | |||
| 9934e60fa4 | |||
| b74105137e | |||
| 301014f06f | |||
| a37825168b | |||
| 093bc5e97e | |||
| f0ac342b1f | |||
| 8997701d8a | |||
| ce403a6bd8 | |||
| bf712accf9 | |||
| 1825035739 | |||
| 5a5fd8155c | |||
| 56bc38ab73 | |||
| 01fd6997a8 | |||
| 41f77364aa | |||
| 1acb74ade1 | |||
| 35ba4bbeec | |||
| a162377685 | |||
| 5a1806d11b | |||
| 80c11db80b | |||
| fbec206389 | |||
| 7b9d9d64bb | |||
| e86097d732 | |||
| a103e7c7cd | |||
| f653376c22 | |||
| 4bc19235a6 | |||
| 06e41d5b94 | |||
| 8083f39ba1 | |||
| 162a049f30 | |||
| 0486fa52e4 | |||
| 0e9390ef53 | |||
| f47a9772d7 | |||
| 08060cf06f | |||
| 25fed51523 | |||
| 8c39ede852 | |||
| 692c6a268c | |||
| 415ec5f5d4 | |||
| 0c1431e60d | |||
| df07c80b1b | |||
| 94253f547d | |||
| 2640927b85 | |||
| fc06ea97bd | |||
| 561b80b1aa | |||
| 230679cef9 | |||
| 8e43f17da0 | |||
| a109e9864f | |||
| 5d367a737c | |||
| 2b7cc2bdd7 | |||
| 60c80ceee8 | |||
| 1cf9831e20 | |||
| 08f0fc1743 | |||
| 2aa9f9c134 | |||
| 3ee0ec1342 | |||
| 85a179ad47 | |||
| 03e6c591ff | |||
| 03c226f76e | |||
| 59bf787581 | |||
| 61bb7be6b1 | |||
| 84c29a1222 | |||
| 02d8bf4f5c | |||
| eba8beb8f5 | |||
| 3dcffa3042 | |||
| 04991c94ba | |||
| ee8e4f8a2e | |||
| 594509e0ad | |||
| d57eb295e9 | |||
| b8a1081544 | |||
| 045b101d7b | |||
| 76ae0f4b59 | |||
| 2cfbd77e2f | |||
| 768e209b2b | |||
| eb621f184d | |||
| ebf7130b63 | |||
| a65ecfeb65 | |||
| 1b384a6d11 | |||
| cde9901bb6 | |||
| 7f452d18bc | |||
| ce7b9ff96f | |||
| 3ff9115052 | |||
| 6c78e7d9fa | |||
| 6514fd8dc3 | |||
| a741bb3482 | |||
| def5ceee46 | |||
| aff2a8fa0e | |||
| 27d869276a | |||
| 7e3a8a7a40 | |||
| c33cd9773f | |||
| 2d246a6773 | |||
| fa5980bc6a | |||
| 17f18b83f4 | |||
| 507ec302e7 | |||
| 5cfbd9998c | |||
| 68ae9c1b97 | |||
| 5397833dea | |||
| 4598709ba1 | |||
| ac92d69914 | |||
| a1f233723f | |||
| 063f3081b5 | |||
| 72ce1e0694 | |||
| 0004215605 | |||
| c0a50544d7 | |||
| a130240339 | |||
| 54cd1c59f7 | |||
| a7ed30130d | |||
| 4e2add4d64 | |||
| 6a62f93cba | |||
| f523e4832e | |||
| 28b0fd6fd4 | |||
| 0f703785f3 | |||
| ded3e16d48 | |||
| 678f5463ea | |||
| 575d21a786 | |||
| 4fa5ccf416 | |||
| eba905b15d | |||
| 14ccb1f80b | |||
| 9d140be510 | |||
| eb78716401 | |||
| 3074b77471 | |||
| 53b7aca0ce | |||
| 083349b75b | |||
| ae3423b99b | |||
| 5439df5653 | |||
| e7e32ca4ef | |||
| e971674465 | |||
| 943d274e5f | |||
| d0bb761344 | |||
| a8ba5ae62b | |||
| 97c0b0bbee | |||
| 67e0766894 | |||
| 3fc5fa71a4 | |||
| 4fc7c90c15 | |||
| e50c519eec | |||
| 57016da1d0 | |||
| 8d1c6cc082 | |||
| 2fb889272b | |||
| 4194aa09d1 | |||
| 0004bb63b0 | |||
| d7eef4c623 | |||
| 0fa042cece | |||
| 6a0599a972 | |||
| cef2a7c188 | |||
| ab2659d01f | |||
| 601ed40eb2 | |||
| 2bb414fc33 | |||
| ecc14fc3af | |||
| ea38c3bef7 | |||
| bf990a886c | |||
| 22d08b51b7 | |||
| 551361e10a | |||
| 99b9444ba8 | |||
| c390ebe0c6 | |||
| 513118d42c | |||
| b0c43a5258 | |||
| eca71fa685 | |||
| f01fb6f848 | |||
| 0f18258d1b | |||
| abc4a227a9 | |||
| 1c368003ae | |||
| ee34f9e8ec | |||
| d511eda713 | |||
| 4b20b0efe3 | |||
| 5c731894b1 | |||
| 6ff26f6a25 | |||
| b041326e23 | |||
| c8d355636b | |||
| fa0dfadc8b | |||
| 8f7208ff34 | |||
| 61c4cb1361 | |||
| 0590ae64e7 | |||
| 7fa8c3bfff | |||
| 82c4e3169e | |||
| 84f9d54ec0 | |||
| 3e71cf4b45 | |||
| 68b9651f94 | |||
| 50171e4600 | |||
| 9d7f2f39fe | |||
| a30c041a17 | |||
| 756e20633f | |||
| 12c1cde069 | |||
| 2e0ffe67fa | |||
| 0c0f0aa54d | |||
| 538e452377 | |||
| 264ce39552 | |||
| b8bd71616b | |||
| b2f3e7a635 | |||
| e38324af63 | |||
| 5db5a26037 | |||
| 9b22287ede | |||
| 98c5b0e9ec | |||
| 0b74537bee | |||
| 5f930b0482 | |||
| aa0afa533d | |||
| e06657e53f | |||
| a960e5ab04 | |||
| 4a9a496a5d | |||
| f3bfdd8a36 | |||
| b76a384e1f | |||
| 3c70a09e12 | |||
| ee9b64285e | |||
| 7848233396 | |||
| 2e05ba243f | |||
| b789c773b4 | |||
| 023fd547fd | |||
| 288c941d69 | |||
| 6b2569873c | |||
| 836c076884 | |||
| e4b0823911 | |||
| 3fdafe176b | |||
| c54b0470fa | |||
| ac2403362e | |||
| 13bf6e6f5a | |||
| 131592090f | |||
| 412fec17a6 | |||
| 995949c1ba | |||
| fce3fa8004 | |||
| bb0803bf19 | |||
| c091026114 | |||
| c90461afe0 | |||
| d9032f750f | |||
| 55058b4ce1 | |||
| 5ff19e58a5 | |||
| e831f447ae | |||
| dd8699ad32 | |||
| 109ddde0a8 | |||
| f78baf229d | |||
| 22f498a6f8 | |||
| ebaf68bca4 | |||
| 8b98a3f2a1 | |||
| d9549c227a | |||
| c5c4c62208 | |||
| 2ceaece7d9 | |||
| b9b04c2b9f | |||
| 789e177d67 | |||
| 3168f12af1 | |||
| e93f84d1c7 | |||
| e323c80fba | |||
| 57122e5b74 | |||
| a1dbb42b4d | |||
| a489aecb86 | |||
| 6ed4faded2 | |||
| f676b14351 | |||
| 97fa583f65 | |||
| 92f53b00b8 | |||
| f2d28fd7af | |||
| 4646d03bdd | |||
| b6eb587a82 | |||
| 9dd2a79be8 | |||
| 2e37bd2472 | |||
| f9797a38b8 | |||
| 20a42ab3e5 | |||
| a7062eff3a | |||
| 6806ae3dc0 | |||
| b665d46dc3 | |||
| 0b68ae3960 | |||
| ef38e93c11 | |||
| 4f7c34aec9 | |||
| 7595f7dfb5 | |||
| 96b4e1c639 | |||
| efab8eefba | |||
| b0f8c758e5 | |||
| 6ee194924c | |||
| 784767dc4e | |||
| 15d2f2b9d8 | |||
| 56b89b7080 | |||
| 32d9322189 | |||
| ca8c4338b2 | |||
| 6a4a550f63 | |||
| 24d5fb2259 | |||
| f3d4a2becc | |||
| e1018a48f0 | |||
| 50d75eecc6 | |||
| 406c864b17 | |||
| f616937236 | |||
| e47bd6fba0 | |||
| 7f830a18cd | |||
| 7bf5279ad3 | |||
| df5c607375 | |||
| 87290baa52 | |||
| 8bf47fb4fe | |||
| b20de1657c | |||
| a5af5d9ec8 | |||
| b3bffed179 | |||
| f349e0dda8 | |||
| 76d723669a | |||
| 5537934f88 | |||
| e2aa7b54a4 | |||
| 6f028ab8c8 | |||
| 658b442b36 | |||
| f6fbc6fecb | |||
| c6f451bce1 | |||
| 3500bf0ede | |||
| 04d9b76938 | |||
| 68088a3399 | |||
| 20cb8ef94d | |||
| caf708bed6 | |||
| 75691aaab9 | |||
| 83e8a8a218 | |||
| a9dc7b1c5b | |||
| d8d017669a | |||
| 7d1d8891ff | |||
| ffdf374cd6 | |||
| 54b7fc2212 | |||
| 5476d238fa | |||
| 8e85136dc5 | |||
| 82daff3b6e | |||
| 642270aacf | |||
| 3048f86f5b | |||
| 84e74c5052 | |||
| 4dc0f52295 | |||
| 58652ee32f | |||
| 1a4d888304 | |||
| f11fcc535a | |||
| 70f331d025 | |||
| 8a1cd316fe | |||
| d7dfab5e74 | |||
| 436d0cec9b | |||
| 266e4214d4 | |||
| 08aa431f5d | |||
| b98e7cda15 | |||
| d05dbef71d | |||
| 5736f0a7a3 | |||
| ec90ef6174 | |||
| fa440e2885 | |||
| 9ea44d7e1c | |||
| 22326802b3 | |||
| 531662e012 | |||
| 8eaaabb4d4 | |||
| 37af60781d | |||
| 29c68110cf | |||
| 1306ea3c5c | |||
| 527acb8e52 | |||
| 744b508fea | |||
| ea97eb56a6 | |||
| 8d91f200e7 | |||
| d9775dbf4e | |||
| 507769c6b6 | |||
| aae9e38f36 | |||
| 2cd3d028a9 | |||
| c5bb051e64 | |||
| 6a33651782 | |||
| 1d2e4bbda7 | |||
| f1a8f6024d | |||
| 0829a60f35 | |||
| f39434a248 | |||
| 808a60c86c | |||
| 22da19085d | |||
| 5304919e2a | |||
| 093fe0f261 | |||
| ab32ad1538 | |||
| 0a39102b08 | |||
| 91247c58a6 | |||
| bcf4aef5a0 | |||
| ffd248cfd4 | |||
| 2d3b74e688 | |||
| db94673256 | |||
| 4d118cf634 | |||
| e464f30445 | |||
| 67e4011c65 | |||
| 839be1f28f | |||
| 8ae4a67635 | |||
| e228ff8715 | |||
| c4a4a8659a | |||
| b26134ec72 | |||
| 8656d6bfb9 | |||
| 2ffd354f38 | |||
| 441b2fe42a | |||
| 2885457ea6 | |||
| 1763266972 | |||
| 2e5fa69942 | |||
| e1e9bc026a | |||
| 74d5ab7fea | |||
| e8e84e00af | |||
| a7b3fba018 | |||
| 5cdf1d5599 | |||
| e6dd2b22d8 | |||
| df6c3addcf | |||
| e9d5c3db0e | |||
| 36f12f9c97 | |||
| 55213c409b | |||
| d9474afa34 | |||
| 9c8b690739 | |||
| d20a2129aa | |||
| 704375099b | |||
| bf9ac7accb | |||
| b2cf15139a | |||
| 4352e95f82 | |||
| fb7a98761f | |||
| 5d0f79892c | |||
| d3f9b53810 | |||
| 7632dc783a | |||
| 61f28a588b | |||
| e448c9a0d3 | |||
| 155bbfbf4e | |||
| cf0b9a0ae0 | |||
| 2b65e23b48 | |||
| d363a9fc1b | |||
| a99b0072e0 | |||
| f940d05d12 | |||
| 8d80e0a46e | |||
| 37fec69462 | |||
| 09a196149e | |||
| bb8e8780bd | |||
| bade2162a6 | |||
| 4e2578f3e0 | |||
| 62e13ade01 | |||
| acea3875a1 | |||
| 354f10ddee | |||
| 5e6d298ca0 | |||
| 9019b0ad29 | |||
| b2112f2b01 | |||
| 9e652761b8 | |||
| fe54085cc6 | |||
| ef05e5c524 | |||
| d11c6988cc | |||
| 39de8439ba | |||
| 15635534b0 | |||
| 5b547611a5 | |||
| 11e6b793d5 | |||
| b9507381ed | |||
| 3bd50a1ad1 | |||
| e6452955b6 | |||
| 14397d1550 | |||
| 8267cbd8f0 | |||
| 1ff2dc6733 | |||
| 04d88d0523 | |||
| 5e8b4e0e61 | |||
| 151230c611 | |||
| 52750e6d6b | |||
| 8ff112b802 | |||
| 88516d2857 | |||
| 9bf7c088cf | |||
| b0542a5bc3 | |||
| ac06e7723f | |||
| 12608d8d32 | |||
| 8018f1323d | |||
| 90874b01a7 | |||
| 6685fc9b02 | |||
| ad52546e0c | |||
| 2518b1421c | |||
| 551418c293 | |||
| 524ebbbdd7 | |||
| 40d0e765fe | |||
| 53b2f476e2 | |||
| d6a952f182 | |||
| 4eff5ad84e | |||
| 0d93850813 | |||
| 129eb1b818 | |||
| 0d8b8504b4 | |||
| a8cd6f4f74 | |||
| d1f8e0a97e | |||
| c0a7ddc711 | |||
| c80b9013d2 | |||
| c1de1f148b | |||
| f36e2f19b8 | |||
| d46b2dc298 | |||
| 6c1e2f1280 | |||
| f952785c8e | |||
| 8a769c60f2 | |||
| 7fcbfba7e0 | |||
| 9be32a3ebf | |||
| cc8f817006 | |||
| 8f88da6016 | |||
| 4f441340ea | |||
| 6259cd7803 | |||
| 608324c500 | |||
| 42362dca90 | |||
| 20bebafc89 | |||
| bd2547046a | |||
| 3666331de8 | |||
| dc6bce6f53 | |||
| 5e1ebeb4df | |||
| e1e722f09f | |||
| 4988f92d03 | |||
| e95005199c | |||
| e05d0d8daa | |||
| 141a65d48e | |||
| d2cbfd491a | |||
| 5f71ff2db5 | |||
| 2ea38519e4 | |||
| 4fac0c3921 | |||
| 6a021f938d | |||
| 544e715905 | |||
| b3b6a9a913 | |||
| d487a9d1ab | |||
| 28bf0413cc | |||
| 0e44293231 | |||
| 45a0747176 | |||
| 7e29ecde9b | |||
| 8000d523f1 | |||
| ca09587d87 | |||
| 726d68df31 | |||
| 250e3407fa | |||
| fcd37cbae2 | |||
| 70e76d9a1a | |||
| 6a3bd89095 | |||
| 4ccf03dfd3 | |||
| f845c0ad80 | |||
| 165752f6d6 | |||
| c0ee8b82f8 | |||
| cc1e0d8986 | |||
| 7f6fbd2bff | |||
| 92d8ed9e3f | |||
| 45b2443982 | |||
| 3775fb336b | |||
| f7a8ca33fc | |||
| c45265b085 | |||
| 79400b6b0e | |||
| 2bff826a10 | |||
| d5fc87c233 | |||
| 78a0416b19 | |||
| eb5bc14974 | |||
| 7e99e8c7a4 | |||
| 9b0f4d5aef | |||
| b58049968f | |||
| 9bf0d3f7d1 | |||
| 8300c47e4a | |||
| c73fcc19f2 | |||
| f93573177a | |||
| fe9c6437d8 | |||
| c110ffc4b1 | |||
| 7af63d1519 | |||
| 31ba1f2c4c | |||
| 33afd13a8c | |||
| b341ffacbf | |||
| 0d1d1f0f37 | |||
| 3f59ed48d2 | |||
| de832ff497 | |||
| 1aef82f422 | |||
| 065a1c9ceb | |||
| ff219ce696 | |||
| 8bd406bcf4 | |||
| 7b70b680f0 | |||
| c3586a70fd | |||
| cc7d741681 | |||
| ce0dfdabfb | |||
| 737327fa8a | |||
| b1e79284e4 | |||
| 29b5955e9e | |||
| 3986dc0686 | |||
| 59190e33c9 | |||
| 091b1a1d5b | |||
| cb0ba901de | |||
| 14ba9d0f7f | |||
| ec9bc437f3 | |||
| 930aa73657 | |||
| cf2bf2dacf | |||
| 5a8508c16c | |||
| 5bcc0ed84d | |||
| 4795a315ad | |||
| 6559f232a3 | |||
| db8b33a621 | |||
| 781a4ee16d | |||
| 7ce94a5166 | |||
| a487a7bd2f | |||
| f0fedcc049 | |||
| 3a63f98ac3 | |||
| 4c994e6e55 | |||
| 1c93846ed3 | |||
| 3ef444c128 | |||
| eaaba8ab0c | |||
| 1daa45d604 | |||
| cf7e19bfde | |||
| 6a76cc7a29 | |||
| fff16d2211 | |||
| a2df7cda22 | |||
| 5858fa4de4 | |||
| fb6ec0caf4 | |||
| 944bcb7e84 | |||
| 4274e6a148 | |||
| 5e629e7890 | |||
| e991a01b50 | |||
| 7a1700cec3 | |||
| 79eb5b9cdf | |||
| 7886aa6041 | |||
| b928bedeb6 | |||
| beb2b47162 | |||
| 2cc37481ca | |||
| 5ac62d60be | |||
| 6fb1e2e5f1 | |||
| 385695a610 | |||
| 838776c471 | |||
| 44743b772b | |||
| 88f67efd51 | |||
| a04bdc147f | |||
| 145d9bafa0 | |||
| d2c00cce70 | |||
| 602f8bc843 | |||
| 89cb808481 | |||
| 4d290c9064 | |||
| 9ee60c9361 | |||
| 77cc91319a | |||
| ee4009bf8d | |||
| ff1c0bd347 | |||
| e1add3c7e6 | |||
| bf06734a9b | |||
| 5ed21f9b76 | |||
| e689cb541a | |||
| da32765902 | |||
| 9392ceda61 | |||
| 694b10d3b2 | |||
| 6b3c64faea | |||
| ab17dd08cd | |||
| f889bcf927 | |||
| 34024c9fb4 | |||
| 9d5e16aa5c | |||
| f1a2bea67c | |||
| 5d4192bbcf | |||
| ea6ea4b0ee | |||
| 7f4d47505e | |||
| f9a3b17677 | |||
| d0374a2dea | |||
| cb89cc17be | |||
| d506807a8f | |||
| 1a0fc309f9 | |||
| 5ed7662798 | |||
| e3d6a32554 | |||
| 6f990d488f | |||
| 610de198e9 | |||
| 928be0facb | |||
| 80799753be | |||
| f9d2232a9b | |||
| cbd8685d4b | |||
| 274cf08dad | |||
| 2cbe5f38cd | |||
| 3d4058ad01 | |||
| 761ec6f4af | |||
| 5900068898 | |||
| 13f5e3eff2 | |||
| db9e950558 | |||
| 3f93bf08fb | |||
| 65eebcbb5d | |||
| 6ed3495780 | |||
| 06049a7135 | |||
| 12e073ca46 | |||
| 4ee4054ab3 | |||
| 11664a9218 | |||
| d414c19904 | |||
| 279a0aed91 | |||
| c6e0e36531 | |||
| 10b9f19036 | |||
| ad661ea464 | |||
| affe6b08ab | |||
| 1b2c218e83 | |||
| 9e96add299 | |||
| 9f9c3ba7f1 | |||
| d15b8a5246 | |||
| c1e1c730bb | |||
| a53c68054d | |||
| 99a79df02d | |||
| 1a0f318968 | |||
| 6ac65c73d5 | |||
| dc5a778610 | |||
| 20d9a232cc | |||
| 280bd61e2a | |||
| dadfc15d39 | |||
| 1764041272 | |||
| b9ef4eee63 | |||
| 823061c699 | |||
| 6809988e9c | |||
| a1a3ea6234 | |||
| 3684296959 | |||
| 68c8d91871 | |||
| 7655b67338 | |||
| 68aef50283 | |||
| 6494e07e9e | |||
| 859de1004e | |||
| 0afc8a2dc5 | |||
| f73184ac1e | |||
| 52b66be43b | |||
| bd208bd1ab | |||
| f7952008cd | |||
| a0c82d3f3f | |||
| dd01fd1688 | |||
| d2dc95c169 | |||
| 53f7165e24 | |||
| c90a250ba7 | |||
| e80dd66809 | |||
| 95558371df | |||
| 085f79cefd | |||
| a17b9fdd13 | |||
| 73b6854266 | |||
| fe8d512596 | |||
| ef8754c018 | |||
| 483ccbff00 | |||
| 07f736b8e6 | |||
| cd1de763e3 | |||
| d6d4008348 | |||
| 4bbbbf9fa2 | |||
| a3d29bb8f0 | |||
| 0d58aee2fe | |||
| bc5d0cc4a9 | |||
| 59c3bea2d6 | |||
| 13163ddb7e | |||
| 02a9256950 | |||
| d31d6c1f95 | |||
| bc099e9dc0 | |||
| 79bf0523a5 | |||
| a0d2ccb5ab | |||
| df54840a88 | |||
| 4b62517d99 | |||
| 0ce9ec3ae2 | |||
| 5279fa8fbe | |||
| 0d75e6db9b | |||
| ffb541a12e | |||
| 5fdaa11367 | |||
| 6b339da061 | |||
| f454fb5e1c | |||
| 5db8c47aa8 | |||
| e7571f3e83 | |||
| d9b513e88c | |||
| 7dcde390cd | |||
| 6a750f4eb2 | |||
| c6d24d25cc | |||
| c19ec913cb | |||
| 438ea04a1a | |||
| d7044c1663 | |||
| 3497d275a8 | |||
| 6fd61889a8 | |||
| 85983954de | |||
| 1e9eec2c48 | |||
| bd97745ed1 | |||
| 34d450fecf | |||
| be107c0858 | |||
| 8289786099 | |||
| 56f159d50a | |||
| 61961bab05 | |||
| e0387dce00 | |||
| 46b3db033b | |||
| bf9fdae58b | |||
| 7b8cafc8ac | |||
| 7793fab5d2 | |||
| 1ddcda5c5d | |||
| 9714393538 | |||
| d46f369599 | |||
| 2dfd2a53c2 | |||
| e3675ec9a4 | |||
| cb2ed0c766 | |||
| 6638fdcaff | |||
| d0b4634429 | |||
| 1fdf1f1339 | |||
| 6290c6d0af | |||
| 26a3ea4b18 | |||
| c7b2245005 | |||
| 5ba06796b1 | |||
| e359b1dfdf | |||
| cbc8216fe0 | |||
| da238b9986 | |||
| 897ddfe77a | |||
| 80f2db794f | |||
| 913a2601d5 | |||
| 40c27eef79 | |||
| df45e00fbd | |||
| a323f1ffb7 | |||
| ea6092db8a | |||
| 8c6eb48876 | |||
| 37d2f8a8ad | |||
| f18acf3e68 | |||
| 3fb08ca2c3 | |||
| 83be09d643 | |||
| 6de8249fb0 | |||
| 013ddcff66 | |||
| 8ece4caf1c | |||
| a94b12e8cd | |||
| c38103068e | |||
| f8caaf0e99 | |||
| ee809ddb37 | |||
| 227bd0523e | |||
| c096b29521 | |||
| 6a0520b126 | |||
| 240373898a | |||
| d33ad0cdef | |||
| a3a3070158 | |||
| b717c3d550 | |||
| 9aa5820ac2 | |||
| 1ac65dd9bd | |||
| 797a6951a8 | |||
| 7268de6e1e | |||
| fc602ce9f4 | |||
| 403bff27b4 | |||
| 44b9ba911d | |||
| c24f8fc85b | |||
| 75c56cbeee | |||
| 15f42c9658 | |||
| 525d0c21bb | |||
| cbf05cfe5b | |||
| aaa506a581 | |||
| a2fbfad00e | |||
| 031c52e25a | |||
| 693dfd827c | |||
| d26a2d35bf | |||
| 9839de128c | |||
| 12872ee51e | |||
| 2af08d6823 | |||
| f646075311 | |||
| dfca767476 | |||
| fd7b5952c2 | |||
| 4b46eddc47 | |||
| e26121177f | |||
| 91eb0c314f | |||
| 1d7a2d4eae | |||
| e4235d4d75 | |||
| 41a83115be | |||
| 3ce887cb34 | |||
| 874eb6189e | |||
| 5c5c491597 | |||
| ff78c1443c | |||
| cdc1c2d776 | |||
| a004c247ab | |||
| 048e90fb8f | |||
| c1498145e6 | |||
| 7654d5183a | |||
| 9b7fc0a93b | |||
| 200318ddcf | |||
| 1fdd0a1b32 | |||
| 8869772fa4 | |||
| 96bc894962 | |||
| 5a9f5f2eca | |||
| bd9dbcbb42 | |||
| f8269bb764 | |||
| c215047c00 | |||
| a313e3f364 | |||
| b34be1184e | |||
| e23c5527da | |||
| 847e62dd27 | |||
| f5d83aa259 | |||
| 4a5c0ae5a0 | |||
| b4a4323906 | |||
| 48fc5af5f7 | |||
| a1753a28ec | |||
| fa4039cf63 | |||
| 4b0814c0a1 | |||
| 78d0b06b36 | |||
| 426bdf5df3 | |||
| 5dbad7ebd0 | |||
| 6ef33c5b7f | |||
| 3737a6eace | |||
| 967e129724 | |||
| e9d549377e | |||
| 924b8af827 | |||
| 045ee73b61 | |||
| 5d9d13ce07 | |||
| 5a1347ec50 | |||
| c705f45856 | |||
| 83fc129d05 | |||
| d7cde3a77f | |||
| afb1ad8e94 | |||
| 15a79ee9bd | |||
| 68794c170b | |||
| a9d84749ba | |||
| dd5fc323ef | |||
| cf1547d077 | |||
| 9664c99e06 | |||
| 17b7fb6999 | |||
| 21a4db8a81 | |||
| eabdabcfcd | |||
| c548383a4c | |||
| 7337f4be1e | |||
| d84f223b9d | |||
| 5431112186 | |||
| ff743151c6 | |||
| b923392b53 | |||
| 15d272c621 | |||
| eefa50b2c3 | |||
| ecc7a152f7 | |||
| 7bf31f9a47 | |||
| 7dc970ff53 | |||
| 97d71ec361 | |||
| 003b939d33 | |||
| 9989cbff24 | |||
| 426ef989f8 | |||
| ca6e079053 | |||
| 13644fd308 | |||
| 1ec76ae3fc | |||
| 51d75146cc | |||
| bc4222646d | |||
| c3e206e3b1 | |||
| 04147e11cc | |||
| 545cb4cddf | |||
| 0f948d4e2a | |||
| 5fb3e0fe14 | |||
| fb87dfd91e | |||
| be8967b05f | |||
| 8acfff7faa | |||
| 18e1f4bd28 | |||
| 74f88a6643 | |||
| 47fe764cb0 | |||
| 9e53770e6c | |||
| a9cc001791 | |||
| c24913d124 | |||
| 63bf0b6070 | |||
| 50792327a4 | |||
| 46e67be8ca | |||
| e7c3ba5eba | |||
| ea86ab2300 | |||
| 501e8c937f | |||
| cae5c36d84 | |||
| 1b92fa76e1 | |||
| bbdb683061 | |||
| 2d04547c74 | |||
| 5192c801f7 | |||
| d966d50bd5 | |||
| 7e20db33f2 | |||
| 669ee7215b | |||
| 6fa00a43a4 | |||
| 4edf740179 | |||
| c7abb4c920 | |||
| df3964110a | |||
| 96231260bc | |||
| 967303d2de | |||
| 955481773d | |||
| d66a7049e8 | |||
| e73b8d2826 | |||
| ea23003807 | |||
| 23f41f8ae7 | |||
| 3f416f83d3 | |||
| 931d1992b6 | |||
| fd927a7052 | |||
| dd46224afe | |||
| be2b29ccc7 | |||
| c93e3bc947 | |||
| 7d49395c41 | |||
| f4c9e6d7b8 | |||
| b7a907c8c8 | |||
| 36485a0f01 | |||
| efec1b4444 | |||
| bdf6500260 | |||
| db4eb0579e | |||
| 76f33534d4 | |||
| 39fea5bc2f | |||
| 660d5c1270 | |||
| 781e2fc9b2 | |||
| c2a2464fe8 | |||
| beb3c15eb3 | |||
| 553010bb7b | |||
| 8d12bbf453 | |||
| fa7588826a | |||
| 332f191e19 | |||
| 8151382a6b | |||
| ae44a21be1 | |||
| b0ff0995de | |||
| e711095ecd | |||
| 08de97a2a8 | |||
| 5eb6302d2a | |||
| 2e346ae7fd | |||
| 1285d12915 | |||
| 8b5cb9258e | |||
| ef3e3a0392 | |||
| 8fca6572f9 | |||
| 33eaf0e583 | |||
| 16acd1c08c | |||
| a8e8804ce3 | |||
| b8c0f997f6 | |||
| 11e63f38b1 | |||
| ff36d8f3db | |||
| 975542d8af | |||
| d71a9415b4 | |||
| e948da95b5 | |||
| 9a6510c320 | |||
| 57ff1ede97 | |||
| 7c0f2563f7 | |||
| d11a954b40 | |||
| f354339af1 | |||
| 89658bb77a | |||
| 1ff0238b6e | |||
| e777434d57 | |||
| ee6efc30a3 | |||
| 0758bb5f38 | |||
| 299d5725a6 | |||
| d7c9b31ec7 | |||
| 6c78bee5c1 | |||
| dba0cbd5f9 | |||
| 0752e780f2 | |||
| c43919ce01 | |||
| 0d95510b72 | |||
| 60fb2571a2 | |||
| 90cbe90492 | |||
| 95c203b0ed | |||
| 449c5c5c77 | |||
| 9aff208403 | |||
| 4318849127 | |||
| 29e8cdf699 | |||
| 4427dbdcad | |||
| af4c3819b9 | |||
| 39379e1ac0 | |||
| 71eeb3f6b8 | |||
| d409ef49af | |||
| e7a80e9280 | |||
| 65c2d2ea0b | |||
| 92666dca21 | |||
| 3e1a79c248 | |||
| 73a1ce083a | |||
| 22dacebc5e | |||
| 80d0948e24 | |||
| 58b427b977 | |||
| a4cab3565a | |||
| 205c9580e3 | |||
| 70a0ed135b | |||
| f556181d77 | |||
| d48e26904e | |||
| 19232ac405 | |||
| 9ee2ccc8af | |||
| 7079bb6a63 | |||
| 0ab5827ee5 | |||
| c5443f622c | |||
| e4aa276cca | |||
| 90ff2d679e | |||
| da26c35d5a | |||
| 779e3da74e | |||
| e358c08773 | |||
| 2945fa3a47 | |||
| ab1541e741 | |||
| 3aeaa709a5 | |||
| 91e627df6b | |||
| d0795e9e1c | |||
| 0e12dd4874 | |||
| 25c0e48181 | |||
| 0d43c3620d | |||
| 2f6137f8df | |||
| 2843b86a93 | |||
| 8235de07ff | |||
| e2f9a4c7f0 | |||
| 55c6e3cf93 | |||
| 11c154e564 | |||
| 7fc0d27c3c | |||
| 1ac76cfcd8 | |||
| c8ed04aaaf | |||
| 6641651f3c | |||
| dbf164bfb2 | |||
| 8a617c3008 | |||
| a50a2430ba | |||
| 5c3c552288 | |||
| 69fdddfc71 | |||
| db5b988275 | |||
| 4284757035 | |||
| b93a47acc0 | |||
| d59f9857ce | |||
| 8ce212b74b | |||
| e78aea5735 | |||
| 9a3c5c3f40 | |||
| 60ca3f9c34 | |||
| e7e740dff1 | |||
| 8343a98d77 | |||
| 5862039a00 | |||
| 8af989b75f | |||
| 08d0e5ff75 | |||
| 5196d10e5c | |||
| 3392ec463d | |||
| 33529404cf | |||
| 00e7a36013 | |||
| 3060b394ab | |||
| a43d9022fe | |||
| 6abdc68ca5 | |||
| 61c66b0e96 | |||
| 36cc23457a | |||
| d573b238de | |||
| 8afe25fe85 | |||
| f80647ff0d | |||
| 7e64cbabf8 | |||
| 14a06410ae | |||
| 85c2a4f4f0 | |||
| da9e211ec7 | |||
| a81070c471 | |||
| e3ad7efa4f | |||
| a4dafd7155 | |||
| 645aec853e | |||
| d8d5e4a3c4 | |||
| 7a48c04057 | |||
| 64aaaa707e | |||
| 445d40dc5f | |||
| ebdcb531f2 | |||
| c9cdb891d6 | |||
| f5c6c002a8 | |||
| d171c6bb9a | |||
| 1c81a4faed | |||
| e7d1d5cb71 | |||
| 060d831d50 | |||
| 316bd6dd01 | |||
| 34081e5903 | |||
| e2d843b65e | |||
| a796f5fe4b | |||
| 51ee41c773 | |||
| 7e5ed3efe5 | |||
| 8dd25ac315 | |||
| 1cdaa58e7a | |||
| fa3aa24a3d | |||
| 091431d95b | |||
| 1ecf0122ab | |||
| 79980a1725 | |||
| 8badcc3f6e | |||
| 4d6e57257c | |||
| a7a93b8500 | |||
| 85cc34fb4c | |||
| 772a996b6e | |||
| e67eff822d | |||
| c39ed6120f | |||
| c38f4e6543 | |||
| 098433b697 | |||
| c8e20c905b | |||
| bd2446ba0a | |||
| c179e4aaf3 | |||
| 2f8de2a919 | |||
| 338110973d | |||
| 3c9c4495bc | |||
| 93476f782c | |||
| 3aec6ee578 | |||
| 3bca76d4c8 | |||
| b9d6f35aac | |||
| 9b6959414a | |||
| 400dd6aa5e | |||
| 14af2f6efd | |||
| 0a2de9e0d5 | |||
| 89bfad78a6 | |||
| 52486fa278 | |||
| dc0e14eb21 | |||
| 70278374e7 | |||
| ac3588c76a | |||
| ab335aef2a | |||
| 719c855bdb | |||
| f283e50018 | |||
| 99b952ee28 | |||
| 24639b62c0 | |||
| 573cc531bf | |||
| 29e24bae93 | |||
| 22e4cc07c0 | |||
| 9264347698 | |||
| 579c26ac59 | |||
| ef577dd313 | |||
| 62c7e52487 | |||
| 3534ac6477 | |||
| 1738f7b311 | |||
| eb25caec81 | |||
| a6c60e2c04 | |||
| adafbdf6d3 | |||
| 7eab14938d | |||
| 039e55673b | |||
| ec3a9b6cb4 | |||
| 17a6494b2b | |||
| 0b05c7074f | |||
| 876ccc7cbf | |||
| bdf14b8f24 | |||
| 43375a6f5b | |||
| e00328ae13 | |||
| 07c553294b |
+509
-556
File diff suppressed because it is too large
Load Diff
@@ -1,706 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.InterestManagement;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector2f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractWorldObject;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import engine.util.MapLoader;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class HeightMap {
|
|
||||||
|
|
||||||
// Class variables
|
|
||||||
|
|
||||||
// Heightmap data for all zones.
|
|
||||||
|
|
||||||
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
|
||||||
|
|
||||||
// Bootstrap Tracking
|
|
||||||
|
|
||||||
public static int heightMapsCreated = 0;
|
|
||||||
public static HeightMap PlayerCityHeightMap;
|
|
||||||
|
|
||||||
// Heightmap data for this heightmap
|
|
||||||
|
|
||||||
public BufferedImage heightmapImage;
|
|
||||||
|
|
||||||
private int heightMapID;
|
|
||||||
private int maxHeight;
|
|
||||||
private int fullExtentsX;
|
|
||||||
private int fullExtentsY;
|
|
||||||
|
|
||||||
private float bucketWidthX;
|
|
||||||
private float bucketWidthY;
|
|
||||||
private int zoneLoadID;
|
|
||||||
private float seaLevel = 0;
|
|
||||||
private float outsetX;
|
|
||||||
private float outsetZ;
|
|
||||||
private int[][] pixelColorValues;
|
|
||||||
|
|
||||||
public HeightMap(ResultSet rs) throws SQLException {
|
|
||||||
|
|
||||||
this.heightMapID = rs.getInt("heightMapID");
|
|
||||||
this.maxHeight = rs.getInt("maxHeight");
|
|
||||||
int halfExtentsX = rs.getInt("xRadius");
|
|
||||||
int halfExtentsY = rs.getInt("zRadius");
|
|
||||||
this.zoneLoadID = rs.getInt("zoneLoadID");
|
|
||||||
this.seaLevel = rs.getFloat("seaLevel");
|
|
||||||
this.outsetX = rs.getFloat("outsetX");
|
|
||||||
this.outsetZ = rs.getFloat("outsetZ");
|
|
||||||
|
|
||||||
|
|
||||||
// Cache the full extents to avoid the calculation
|
|
||||||
|
|
||||||
this.fullExtentsX = halfExtentsX * 2;
|
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
|
||||||
|
|
||||||
this.heightmapImage = null;
|
|
||||||
File imageFile = new File(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/" + this.heightMapID + ".bmp");
|
|
||||||
|
|
||||||
// early exit if no image file was found. Will log in caller.
|
|
||||||
|
|
||||||
if (!imageFile.exists())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// load the heightmap image.
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.heightmapImage = ImageIO.read(imageFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
|
||||||
|
|
||||||
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
|
||||||
|
|
||||||
float numOfBuckets = this.heightmapImage.getWidth() - 1;
|
|
||||||
float calculatedWidth = this.fullExtentsX / numOfBuckets;
|
|
||||||
this.bucketWidthX = calculatedWidth;
|
|
||||||
this.bucketWidthY = this.bucketWidthX; // This makes no sense.
|
|
||||||
|
|
||||||
// Generate pixel array from image data
|
|
||||||
|
|
||||||
generatePixelData();
|
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
|
||||||
|
|
||||||
heightMapsCreated++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Created for PlayerCities
|
|
||||||
public HeightMap() {
|
|
||||||
|
|
||||||
this.heightMapID = 999999;
|
|
||||||
this.maxHeight = 5; // for real...
|
|
||||||
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents;
|
|
||||||
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents;
|
|
||||||
this.zoneLoadID = 0;
|
|
||||||
this.seaLevel = 0;
|
|
||||||
this.outsetX = 128;
|
|
||||||
this.outsetZ = 128;
|
|
||||||
|
|
||||||
|
|
||||||
// Cache the full extents to avoid the calculation
|
|
||||||
|
|
||||||
this.fullExtentsX = halfExtentsX * 2;
|
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
|
||||||
|
|
||||||
|
|
||||||
// load the heightmap image.
|
|
||||||
|
|
||||||
|
|
||||||
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
|
||||||
|
|
||||||
this.heightmapImage = null;
|
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
|
||||||
|
|
||||||
this.bucketWidthX = 1;
|
|
||||||
this.bucketWidthY = 1;
|
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
|
||||||
|
|
||||||
for (int y = 0; y <= this.fullExtentsY; y++) {
|
|
||||||
for (int x = 0; x <= this.fullExtentsX; x++) {
|
|
||||||
pixelColorValues[x][y] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HeightMap(Zone zone) {
|
|
||||||
|
|
||||||
this.heightMapID = 999999;
|
|
||||||
this.maxHeight = 0;
|
|
||||||
int halfExtentsX = (int) zone.getBounds().getHalfExtents().x;
|
|
||||||
int halfExtentsY = (int) zone.getBounds().getHalfExtents().y;
|
|
||||||
this.zoneLoadID = 0;
|
|
||||||
this.seaLevel = 0;
|
|
||||||
this.outsetX = 0;
|
|
||||||
this.outsetZ = 0;
|
|
||||||
|
|
||||||
// Cache the full extents to avoid the calculation
|
|
||||||
|
|
||||||
this.fullExtentsX = halfExtentsX * 2;
|
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
|
||||||
|
|
||||||
|
|
||||||
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
|
||||||
|
|
||||||
this.heightmapImage = null;
|
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
|
||||||
|
|
||||||
this.bucketWidthX = 1;
|
|
||||||
this.bucketWidthY = 1;
|
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
|
||||||
|
|
||||||
for (int y = 0; y <= this.fullExtentsY; y++) {
|
|
||||||
for (int x = 0; x <= this.fullExtentsX; x++) {
|
|
||||||
pixelColorValues[x][y] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GeneratePlayerCityHeightMap() {
|
|
||||||
|
|
||||||
HeightMap.PlayerCityHeightMap = new HeightMap();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GenerateCustomHeightMap(Zone zone) {
|
|
||||||
|
|
||||||
HeightMap heightMap = new HeightMap(zone);
|
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), heightMap);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
|
||||||
|
|
||||||
Zone nextZone = zone;
|
|
||||||
|
|
||||||
if (zone.getHeightMap() != null)
|
|
||||||
return zone;
|
|
||||||
|
|
||||||
if (zone.equals(ZoneManager.getSeaFloor()))
|
|
||||||
return zone;
|
|
||||||
|
|
||||||
while (nextZone.getHeightMap() == null)
|
|
||||||
nextZone = nextZone.getParent();
|
|
||||||
|
|
||||||
return nextZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getWorldHeight(AbstractWorldObject worldObject) {
|
|
||||||
|
|
||||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(worldObject.getLoc());
|
|
||||||
|
|
||||||
if (currentZone == null)
|
|
||||||
return worldObject.getAltitude();
|
|
||||||
|
|
||||||
currentZone = getNextZoneWithTerrain(currentZone);
|
|
||||||
|
|
||||||
if (currentZone == ZoneManager.getSeaFloor())
|
|
||||||
return currentZone.getAbsY() + worldObject.getAltitude();
|
|
||||||
|
|
||||||
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
|
||||||
HeightMap heightMap = currentZone.getHeightMap();
|
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), currentZone);
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldObject.getLoc(), currentZone);
|
|
||||||
|
|
||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), parentZone);
|
|
||||||
|
|
||||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
|
||||||
|
|
||||||
float worldAltitude = currentZone.getWorldAltitude();
|
|
||||||
|
|
||||||
float realWorldAltitude = interaltitude + worldAltitude;
|
|
||||||
|
|
||||||
//OUTSET
|
|
||||||
|
|
||||||
if (parentZone != null) {
|
|
||||||
|
|
||||||
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
|
||||||
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
|
||||||
|
|
||||||
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
|
||||||
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
|
||||||
|
|
||||||
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
|
||||||
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
|
||||||
|
|
||||||
if (bucketScaleX <= 0.40000001)
|
|
||||||
bucketScaleX = heightMap.outsetZ / parentXRadius;
|
|
||||||
|
|
||||||
if (bucketScaleX > 0.40000001)
|
|
||||||
bucketScaleX = 0.40000001f;
|
|
||||||
|
|
||||||
if (bucketScaleZ <= 0.40000001)
|
|
||||||
bucketScaleZ = heightMap.outsetX / parentZRadius;
|
|
||||||
|
|
||||||
if (bucketScaleZ > 0.40000001)
|
|
||||||
bucketScaleZ = 0.40000001f;
|
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
|
||||||
float weight;
|
|
||||||
|
|
||||||
double scale;
|
|
||||||
|
|
||||||
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
|
||||||
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getWorldAltitude();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
|
||||||
|
|
||||||
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getWorldAltitude();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return realWorldAltitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
|
||||||
|
|
||||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
|
||||||
|
|
||||||
if (currentZone == null)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
currentZone = getNextZoneWithTerrain(currentZone);
|
|
||||||
|
|
||||||
if (currentZone == ZoneManager.getSeaFloor())
|
|
||||||
return currentZone.getAbsY();
|
|
||||||
|
|
||||||
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
|
||||||
HeightMap heightMap = currentZone.getHeightMap();
|
|
||||||
|
|
||||||
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
|
||||||
return currentZone.getAbsY();
|
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
|
||||||
|
|
||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
|
||||||
|
|
||||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
|
||||||
|
|
||||||
float worldAltitude = currentZone.getWorldAltitude();
|
|
||||||
|
|
||||||
float realWorldAltitude = interaltitude + worldAltitude;
|
|
||||||
|
|
||||||
//OUTSET
|
|
||||||
|
|
||||||
if (parentZone != null) {
|
|
||||||
|
|
||||||
// if (currentZone.getHeightMap() != null && parentZone.getHeightMap() != null && parentZone.getParent() != null && parentZone.getParent().getHeightMap() != null)
|
|
||||||
// return realWorldAltitude;
|
|
||||||
|
|
||||||
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
|
||||||
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
|
||||||
|
|
||||||
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
|
||||||
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
|
||||||
|
|
||||||
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
|
||||||
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
|
||||||
float weight;
|
|
||||||
|
|
||||||
double scale;
|
|
||||||
|
|
||||||
|
|
||||||
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
|
||||||
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getWorldAltitude();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
|
||||||
|
|
||||||
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getWorldAltitude();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return realWorldAltitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
|
||||||
|
|
||||||
Vector2f parentLoc;
|
|
||||||
float outsetALt = 0;
|
|
||||||
|
|
||||||
if (zone.getParent() == null || zone.getParent().getHeightMap() == null)
|
|
||||||
return interpolatedAltitude + zone.getWorldAltitude();
|
|
||||||
|
|
||||||
if (zone.getParent() != null && zone.getParent().getHeightMap() != null) {
|
|
||||||
|
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent());
|
|
||||||
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone);
|
|
||||||
|
|
||||||
float parentXRadius = zone.getBounds().getHalfExtents().x;
|
|
||||||
float parentZRadius = zone.getBounds().getHalfExtents().y;
|
|
||||||
|
|
||||||
float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius;
|
|
||||||
float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius;
|
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
|
||||||
|
|
||||||
float weight;
|
|
||||||
double scale;
|
|
||||||
|
|
||||||
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
|
||||||
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
|
||||||
|
|
||||||
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
|
||||||
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
|
|
||||||
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent()));
|
|
||||||
|
|
||||||
parentCenterAltitude += zone.getYCoord();
|
|
||||||
parentCenterAltitude += interpolatedAltitude;
|
|
||||||
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += zone.getParent().getAbsY();
|
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
|
||||||
|
|
||||||
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone));
|
|
||||||
|
|
||||||
parentCenterAltitude += zone.getYCoord();
|
|
||||||
parentCenterAltitude += interpolatedAltitude;
|
|
||||||
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += zone.getParent().getAbsY();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return outsetALt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
|
||||||
|
|
||||||
int floorX = (int) gridSquare.x;
|
|
||||||
int floorY = (int) gridSquare.y;
|
|
||||||
|
|
||||||
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadAlHeightMaps() {
|
|
||||||
|
|
||||||
// Load the heightmaps into staging hashmap keyed by HashMapID
|
|
||||||
|
|
||||||
DbManager.HeightMapQueries.LOAD_ALL_HEIGHTMAPS();
|
|
||||||
|
|
||||||
//generate static player city heightmap.
|
|
||||||
|
|
||||||
HeightMap.GeneratePlayerCityHeightMap();
|
|
||||||
|
|
||||||
|
|
||||||
// Clear all heightmap image data as it's no longer needed.
|
|
||||||
|
|
||||||
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
|
||||||
heightMap.heightmapImage = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
|
||||||
|
|
||||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
|
||||||
|
|
||||||
if (localAltitude < zone.getSeaLevel())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0)
|
|
||||||
zoneLoc.setX(0);
|
|
||||||
|
|
||||||
if (zoneLoc.x > this.fullExtentsX - 1)
|
|
||||||
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0)
|
|
||||||
zoneLoc.setY(0);
|
|
||||||
|
|
||||||
if (zoneLoc.y > this.fullExtentsY - 1)
|
|
||||||
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
|
||||||
|
|
||||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
|
||||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
|
||||||
|
|
||||||
return new Vector2f(xBucket, yBucket);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
|
||||||
|
|
||||||
Vector2f gridSquare;
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
|
||||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
|
||||||
|
|
||||||
//flip the Y so it grabs from the bottom left instead of top left.
|
|
||||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
|
||||||
int gridY = (int) (gridSquare.y);
|
|
||||||
|
|
||||||
if (gridX > maxX)
|
|
||||||
gridX = maxX;
|
|
||||||
if (gridY > maxY)
|
|
||||||
gridY = maxY;
|
|
||||||
|
|
||||||
float offsetX = (gridSquare.x - gridX);
|
|
||||||
float offsetY = gridSquare.y - gridY;
|
|
||||||
|
|
||||||
//get height of the 4 vertices.
|
|
||||||
|
|
||||||
float topLeftHeight = 0;
|
|
||||||
float topRightHeight = 0;
|
|
||||||
float bottomLeftHeight = 0;
|
|
||||||
float bottomRightHeight = 0;
|
|
||||||
|
|
||||||
int nextY = gridY + 1;
|
|
||||||
int nextX = gridX + 1;
|
|
||||||
|
|
||||||
if (nextY > maxY)
|
|
||||||
nextY = gridY;
|
|
||||||
|
|
||||||
if (nextX > maxX)
|
|
||||||
nextX = gridX;
|
|
||||||
|
|
||||||
topLeftHeight = pixelColorValues[gridX][gridY];
|
|
||||||
topRightHeight = pixelColorValues[nextX][gridY];
|
|
||||||
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
|
||||||
bottomRightHeight = pixelColorValues[nextX][nextY];
|
|
||||||
|
|
||||||
float interpolatedHeight;
|
|
||||||
|
|
||||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
|
||||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
|
||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
|
||||||
|
|
||||||
return interpolatedHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
|
||||||
|
|
||||||
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
|
||||||
|
|
||||||
Vector2f gridSquare;
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
//flip the Y so it grabs from the bottom left instead of top left.
|
|
||||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
|
||||||
int gridY = (int) (gridSquare.y);
|
|
||||||
|
|
||||||
float offsetX = (gridSquare.x - gridX);
|
|
||||||
float offsetY = gridSquare.y - gridY;
|
|
||||||
|
|
||||||
//get height of the 4 vertices.
|
|
||||||
|
|
||||||
float topLeftHeight = pixelColorValues[gridX][gridY];
|
|
||||||
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
|
||||||
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
|
||||||
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
|
||||||
|
|
||||||
float interpolatedHeight;
|
|
||||||
|
|
||||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
|
||||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
|
||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
|
||||||
|
|
||||||
return interpolatedHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generatePixelData() {
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
// Generate altitude lookup table for this heightmap
|
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
|
||||||
|
|
||||||
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
|
||||||
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
|
||||||
|
|
||||||
color = new Color(this.heightmapImage.getRGB(x, y));
|
|
||||||
pixelColorValues[x][y] = color.getRed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getScaledHeightForColor(float color) {
|
|
||||||
|
|
||||||
return (color / 256) * this.maxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getBucketWidthX() {
|
|
||||||
return bucketWidthX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getBucketWidthY() {
|
|
||||||
return bucketWidthY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeightMapID() {
|
|
||||||
return heightMapID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage getHeightmapImage() {
|
|
||||||
return heightmapImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSeaLevel() {
|
|
||||||
return seaLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,10 @@ import engine.net.AbstractNetMsg;
|
|||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.*;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
|
import engine.net.client.msg.UnloadObjectsMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -137,7 +140,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.getHidden())
|
if (pcc.getSeeInvis() < pc.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
if (!cc.sendMsg(uom)) {
|
||||||
@@ -337,7 +340,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (loadedPlayer.safemodeInvis())
|
if (loadedPlayer.safemodeInvis())
|
||||||
@@ -369,7 +372,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
else if (loadedPlayer.safemodeInvis())
|
else if (loadedPlayer.safemodeInvis())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
@@ -434,7 +437,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// dont load if invis
|
// dont load if invis
|
||||||
|
|
||||||
if (player.getSeeInvis() < awopc.getHidden())
|
if (player.getSeeInvis() < awopc.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -464,7 +467,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (awonpc.despawned == true)
|
if (awonpc.despawned == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
@@ -477,7 +480,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (!awonpc.isAlive())
|
if (!awonpc.isAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
@@ -518,10 +521,10 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// Update loaded upbjects lists
|
// Update loaded upbjects lists
|
||||||
|
|
||||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
|
||||||
player.setDirtyLoad(true);
|
player.setDirtyLoad(true);
|
||||||
updateStaticList(player, origin);
|
updateStaticList(player, origin);
|
||||||
updateMobileList(player, origin);
|
updateMobileList(player, origin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.InterestManagement;
|
||||||
|
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static java.lang.Math.PI;
|
||||||
|
|
||||||
|
public class Terrain {
|
||||||
|
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
||||||
|
public short[][] terrain_pixel_data;
|
||||||
|
public Vector2f terrain_size = new Vector2f();
|
||||||
|
public Vector2f cell_size = new Vector2f();
|
||||||
|
public Vector2f cell_count = new Vector2f();
|
||||||
|
public float terrain_scale;
|
||||||
|
public Vector2f blend_values = new Vector2f();
|
||||||
|
public Vector2f blend_ratio = new Vector2f();
|
||||||
|
public int heightmap;
|
||||||
|
Zone zone;
|
||||||
|
|
||||||
|
public Terrain(Zone zone) {
|
||||||
|
|
||||||
|
this.zone = zone;
|
||||||
|
this.heightmap = this.zone.template.terrain_image;
|
||||||
|
|
||||||
|
// Configure PLANAR zones to use the same 16x16 pixel image
|
||||||
|
// that all similar terrains share. (See JSON)
|
||||||
|
|
||||||
|
if (this.zone.template.terrain_type.equals("PLANAR"))
|
||||||
|
this.heightmap = 1006300; // all 0
|
||||||
|
|
||||||
|
// Load pixel data for this terrain from cache
|
||||||
|
|
||||||
|
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap);
|
||||||
|
|
||||||
|
if (terrain_pixel_data == null)
|
||||||
|
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName);
|
||||||
|
|
||||||
|
// Configure terrain based on zone properties
|
||||||
|
|
||||||
|
this.terrain_size.x = this.zone.major_radius * 2;
|
||||||
|
this.terrain_size.y = this.zone.minor_radius * 2;
|
||||||
|
|
||||||
|
this.cell_count.x = this.terrain_pixel_data.length - 1;
|
||||||
|
this.cell_count.y = this.terrain_pixel_data[0].length - 1;
|
||||||
|
|
||||||
|
this.cell_size.x = terrain_size.x / this.cell_count.x;
|
||||||
|
this.cell_size.y = terrain_size.y / this.cell_count.y;
|
||||||
|
|
||||||
|
// Blending configuration. These ratios are used to calculate
|
||||||
|
// the blending area between child and parent terrains when
|
||||||
|
// they are stitched together.
|
||||||
|
|
||||||
|
this.blend_values.x = this.zone.template.max_blend;
|
||||||
|
this.blend_values.y = this.zone.template.min_blend;
|
||||||
|
|
||||||
|
Vector2f major_blend = new Vector2f(this.blend_values.x / this.zone.major_radius,
|
||||||
|
this.blend_values.y / this.zone.major_radius);
|
||||||
|
|
||||||
|
Vector2f minor_blend = new Vector2f(this.blend_values.x / this.zone.minor_radius,
|
||||||
|
this.blend_values.y / this.zone.minor_radius);
|
||||||
|
|
||||||
|
if (major_blend.y > 0.4f)
|
||||||
|
blend_ratio.x = major_blend.y;
|
||||||
|
else
|
||||||
|
blend_ratio.x = Math.min(major_blend.x, 0.4f);
|
||||||
|
|
||||||
|
if (minor_blend.y > 0.4f)
|
||||||
|
blend_ratio.y = minor_blend.y;
|
||||||
|
else
|
||||||
|
blend_ratio.y = Math.min(minor_blend.x, 0.4f);
|
||||||
|
|
||||||
|
// Scale coefficient for this terrain
|
||||||
|
|
||||||
|
this.terrain_scale = this.zone.template.terrain_max_y / 255f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||||
|
|
||||||
|
// Not all zones have a terrain. Some are for display only
|
||||||
|
// and heights returned are from the parent heightmap. This
|
||||||
|
// is controlled in the JSON via the has_terrain_gen field.
|
||||||
|
|
||||||
|
Zone terrain_zone = zone;
|
||||||
|
|
||||||
|
if (zone == null)
|
||||||
|
return ZoneManager.seaFloor;
|
||||||
|
|
||||||
|
if (zone.terrain != null)
|
||||||
|
return zone;
|
||||||
|
|
||||||
|
if (zone.equals(ZoneManager.seaFloor))
|
||||||
|
return zone;
|
||||||
|
|
||||||
|
while (terrain_zone.terrain == null)
|
||||||
|
terrain_zone = terrain_zone.parent;
|
||||||
|
|
||||||
|
return terrain_zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
||||||
|
|
||||||
|
// Retrieve the next zone with a terrain defined.
|
||||||
|
|
||||||
|
Zone terrainZone = getNextZoneWithTerrain(zone);
|
||||||
|
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
||||||
|
|
||||||
|
// Transform world loc into zone space coordinate system
|
||||||
|
|
||||||
|
Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone);
|
||||||
|
Vector2f parentLoc = ZoneManager.worldToTerrainSpace(world_loc, parentZone);
|
||||||
|
|
||||||
|
// Offset from origin needed for blending function
|
||||||
|
|
||||||
|
Vector2f terrainOffset = ZoneManager.worldToZoneOffset(world_loc, terrainZone);
|
||||||
|
|
||||||
|
// Interpolate height for this position in both terrains
|
||||||
|
|
||||||
|
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc);
|
||||||
|
interpolatedChildHeight += terrainZone.global_height;
|
||||||
|
|
||||||
|
float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
interpolatedParentTerrainHeight += parentZone.global_height;
|
||||||
|
|
||||||
|
// Blend between terrains
|
||||||
|
|
||||||
|
float blendCoefficient = terrainZone.terrain.getTerrainBlendCoefficient(terrainOffset);
|
||||||
|
|
||||||
|
float terrainHeight = interpolatedChildHeight * blendCoefficient;
|
||||||
|
terrainHeight += interpolatedParentTerrainHeight * (1 - blendCoefficient);
|
||||||
|
|
||||||
|
return terrainHeight;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getWorldHeight(Vector3fImmutable world_loc) {
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(world_loc);
|
||||||
|
|
||||||
|
return getWorldHeight(currentZone, world_loc);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2f getTerrainCell(Vector2f terrain_loc) {
|
||||||
|
|
||||||
|
// Calculate terrain cell with offset
|
||||||
|
|
||||||
|
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.y);
|
||||||
|
|
||||||
|
// Clamp values when standing directly on pole
|
||||||
|
|
||||||
|
terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x));
|
||||||
|
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
|
||||||
|
|
||||||
|
return terrain_cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector2f terrain_loc) {
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
// Early exit for guild zones
|
||||||
|
|
||||||
|
if (this.zone.guild_zone)
|
||||||
|
return 5.0f;
|
||||||
|
|
||||||
|
// Determine terrain and offset from top left vertex
|
||||||
|
|
||||||
|
Vector2f terrain_cell = getTerrainCell(terrain_loc);
|
||||||
|
|
||||||
|
int pixel_x = (int) Math.floor(terrain_cell.x);
|
||||||
|
int pixel_y = (int) Math.floor(terrain_cell.y);
|
||||||
|
|
||||||
|
Vector2f pixel_offset = new Vector2f(terrain_cell.x % 1, terrain_cell.y % 1);
|
||||||
|
|
||||||
|
// 4 surrounding vertices from the pixel array.
|
||||||
|
|
||||||
|
short top_left_pixel = terrain_pixel_data[pixel_x][pixel_y];
|
||||||
|
short top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y];
|
||||||
|
short bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1];
|
||||||
|
short bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1];
|
||||||
|
|
||||||
|
// Interpolate between the 4 vertices
|
||||||
|
|
||||||
|
interpolatedHeight = top_left_pixel * (1 - pixel_offset.x) * (1 - pixel_offset.y);
|
||||||
|
interpolatedHeight += top_right_pixel * (1 - pixel_offset.y) * (pixel_offset.x);
|
||||||
|
interpolatedHeight += (bottom_left_pixel * (1 - pixel_offset.x) * pixel_offset.y);
|
||||||
|
interpolatedHeight += (bottom_right_pixel * pixel_offset.y * pixel_offset.x);
|
||||||
|
|
||||||
|
interpolatedHeight *= this.terrain_scale; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTerrainBlendCoefficient(Vector2f zone_offset) {
|
||||||
|
|
||||||
|
// Normalize terrain offset
|
||||||
|
|
||||||
|
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.template.major_radius,
|
||||||
|
Math.abs(zone_offset.y) / this.zone.template.minor_radius);
|
||||||
|
|
||||||
|
float blendCoefficient;
|
||||||
|
|
||||||
|
if (normalizedOffset.x <= 1 - blend_ratio.x || normalizedOffset.x <= normalizedOffset.y) {
|
||||||
|
|
||||||
|
if (normalizedOffset.y < 1 - blend_ratio.y)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
blendCoefficient = (normalizedOffset.y - (1 - blend_ratio.y)) / blend_ratio.y;
|
||||||
|
} else
|
||||||
|
blendCoefficient = (normalizedOffset.x - (1 - blend_ratio.x)) / blend_ratio.x;
|
||||||
|
|
||||||
|
blendCoefficient = (float) Math.atan((0.5f - blendCoefficient) * PI);
|
||||||
|
|
||||||
|
return (blendCoefficient + 1) * 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
package engine.ZergMehcanics;
|
|
||||||
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ZergManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class MineAntiZerg {
|
|
||||||
|
|
||||||
public static HashMap<Mine,HashMap<PlayerCharacter,Long>> leaveTimers = new HashMap<>();
|
|
||||||
public static HashMap<Mine,ArrayList<PlayerCharacter>> currentPlayers = new HashMap<>();
|
|
||||||
|
|
||||||
public static void runMines(){
|
|
||||||
for(Mine mine : Mine.getMines()){
|
|
||||||
|
|
||||||
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
|
||||||
|
|
||||||
if(tower == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!mine.isActive)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
logPlayersPresent(tower,mine);
|
|
||||||
|
|
||||||
auditPlayersPresent(tower,mine);
|
|
||||||
|
|
||||||
auditPlayers(mine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPlayersPresent(Building tower, Mine mine){
|
|
||||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> playersPresent = new ArrayList<>();
|
|
||||||
for(AbstractWorldObject player : loadedPlayers){
|
|
||||||
playersPresent.add((PlayerCharacter)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayers.put(mine,playersPresent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void auditPlayersPresent(Building tower, Mine mine){
|
|
||||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
|
||||||
if(!loadedPlayers.contains(player)){
|
|
||||||
toRemove.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayers.get(mine).removeAll(toRemove);
|
|
||||||
|
|
||||||
for(PlayerCharacter player : toRemove){
|
|
||||||
if(leaveTimers.containsKey(mine)){
|
|
||||||
leaveTimers.get(mine).put(player,System.currentTimeMillis());
|
|
||||||
}else{
|
|
||||||
HashMap<PlayerCharacter,Long> leaveTime = new HashMap<>();
|
|
||||||
leaveTime.put(player,System.currentTimeMillis());
|
|
||||||
leaveTimers.put(mine,leaveTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toRemove.clear();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
|
||||||
long timeGone = System.currentTimeMillis() - leaveTimers.get(mine).get(player);
|
|
||||||
if(timeGone > 180000L) {//3 minutes
|
|
||||||
toRemove.add(player);
|
|
||||||
player.ZergMultiplier = 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(PlayerCharacter player : toRemove) {
|
|
||||||
leaveTimers.get(mine).remove(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void auditPlayers(Mine mine){
|
|
||||||
|
|
||||||
HashMap<Guild,ArrayList<PlayerCharacter>> playersByNation = new HashMap<>();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
|
||||||
if(playersByNation.containsKey(player.guild.getNation())){
|
|
||||||
playersByNation.get(player.guild.getNation()).add(player);
|
|
||||||
}else{
|
|
||||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
|
||||||
players.add(player);
|
|
||||||
playersByNation.put(player.guild.getNation(),players);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
|
||||||
if(playersByNation.containsKey(player.guild.getNation())){
|
|
||||||
playersByNation.get(player.guild.getNation()).add(player);
|
|
||||||
}else{
|
|
||||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
|
||||||
players.add(player);
|
|
||||||
playersByNation.put(player.guild.getNation(),players);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Guild nation : playersByNation.keySet()){
|
|
||||||
for(PlayerCharacter player : playersByNation.get(nation)){
|
|
||||||
player.ZergMultiplier = ZergManager.getCurrentMultiplier(playersByNation.get(nation).size(), mine.capSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -67,7 +67,7 @@ public class CityRecord extends DataRecord {
|
|||||||
cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
|
cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
|
||||||
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
|
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
|
||||||
|
|
||||||
cityRecord.zoneHash = cityRecord.city.getParent().getHash();
|
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
||||||
|
|
||||||
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
||||||
cityRecord.establishedDatetime = cityRecord.city.established;
|
cityRecord.establishedDatetime = cityRecord.city.established;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||||
guildRecord.guildName = guildRecord.guild.getName();
|
guildRecord.guildName = guildRecord.guild.getName();
|
||||||
guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
guildRecord.charterName = Enum.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
||||||
|
|
||||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class MineRecord extends DataRecord {
|
|||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
mineRecord.zoneHash = mine.getParentZone().getHash();
|
mineRecord.zoneHash = mine.getParentZone().hash;
|
||||||
|
|
||||||
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
player = (PlayerCharacter) character;
|
player = (PlayerCharacter) character;
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class PvpRecord extends DataRecord {
|
|||||||
outStatement.setInt(8, this.victim.getLevel());
|
outStatement.setInt(8, this.victim.getLevel());
|
||||||
|
|
||||||
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
|
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
|
||||||
outStatement.setString(10, zone.getName());
|
outStatement.setString(10, zone.zoneName);
|
||||||
outStatement.setFloat(11, this.location.getX());
|
outStatement.setFloat(11, this.location.getX());
|
||||||
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
|
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
|
||||||
outStatement.setBoolean(13, this.pvpExp);
|
outStatement.setBoolean(13, this.pvpExp);
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.net.DispatchMessage;
|
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -79,24 +77,18 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SET_TRASH(String machineID, String type) {
|
public void SET_TRASH(String machineID) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO dyn_trash(`machineID`, `count`)"
|
||||||
"INSERT INTO dyn_trash(`machineID`, `count`, `type`)"
|
+ " VALUES (?, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
||||||
+ " VALUES (?, 1, ?) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
|
||||||
|
|
||||||
preparedStatement.setString(1, machineID);
|
preparedStatement.setString(1, machineID);
|
||||||
preparedStatement.setString(2, type);
|
|
||||||
preparedStatement.execute();
|
preparedStatement.execute();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, "Account: " + machineID + " has been kicked from game for cheating");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> GET_TRASH_LIST() {
|
public ArrayList<String> GET_TRASH_LIST() {
|
||||||
|
|||||||
@@ -10,13 +10,17 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.objects.Bane;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.objects.Building;
|
||||||
import engine.objects.*;
|
import engine.objects.City;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class dbBaneHandler extends dbHandlerBase {
|
public class dbBaneHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -85,139 +89,6 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean SET_BANE_TIME_NEW(int hour, int cityUUID) {
|
|
||||||
hour += 12; // Adjust hour
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
|
||||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `time_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
// Retrieve placementDate and liveDate
|
|
||||||
getStatement.setInt(1, cityUUID);
|
|
||||||
try (ResultSet rs = getStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
|
|
||||||
// Explicitly check if liveDate is null
|
|
||||||
DateTime toSet;
|
|
||||||
if (liveDateTimestamp == null) {
|
|
||||||
// If liveDate is null, default to placementDate
|
|
||||||
toSet = placementDate;
|
|
||||||
} else {
|
|
||||||
// If liveDate is not null, use it
|
|
||||||
DateTime liveDate = new DateTime(liveDateTimestamp.getTime());
|
|
||||||
toSet = liveDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust the time
|
|
||||||
toSet = toSet.withHourOfDay(hour).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
|
|
||||||
|
|
||||||
// Update liveDate and time_set flag
|
|
||||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
|
||||||
updateStatement.setInt(2, 1); // time_set flag
|
|
||||||
updateStatement.setInt(3, cityUUID);
|
|
||||||
|
|
||||||
updateStatement.execute();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean SET_BANE_DAY_NEW(int dayOffset, int cityUUID) {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
|
||||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `day_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
// Retrieve placementDate and liveDate
|
|
||||||
getStatement.setInt(1, cityUUID);
|
|
||||||
try (ResultSet rs = getStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
|
|
||||||
// Explicitly check if liveDate is null
|
|
||||||
DateTime liveDate;
|
|
||||||
if (liveDateTimestamp == null) {
|
|
||||||
// If liveDate is null, default to placementDate
|
|
||||||
liveDate = placementDate;
|
|
||||||
} else {
|
|
||||||
// If liveDate is not null, use it
|
|
||||||
liveDate = new DateTime(liveDateTimestamp.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the new liveDate while preserving the time component
|
|
||||||
DateTime updatedDate = placementDate.plusDays(dayOffset)
|
|
||||||
.withHourOfDay(liveDate.getHourOfDay())
|
|
||||||
.withMinuteOfHour(liveDate.getMinuteOfHour())
|
|
||||||
.withSecondOfMinute(liveDate.getSecondOfMinute())
|
|
||||||
.withMillisOfSecond(liveDate.getMillisOfSecond());
|
|
||||||
|
|
||||||
// Update liveDate and day_set flag
|
|
||||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(updatedDate.getMillis()));
|
|
||||||
updateStatement.setInt(2, 1); // day_set flag
|
|
||||||
updateStatement.setInt(3, cityUUID);
|
|
||||||
|
|
||||||
updateStatement.execute();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean SET_BANE_CAP_NEW(int count, int cityUUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, count);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, 1);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, count);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean REMOVE_BANE(Bane bane) {
|
public boolean REMOVE_BANE(Bane bane) {
|
||||||
|
|
||||||
if (bane == null)
|
if (bane == null)
|
||||||
@@ -236,25 +107,4 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getLiveDate(int cityUUID) {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
statement.setInt(1, cityUUID);
|
|
||||||
|
|
||||||
try (ResultSet rs = statement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
if (liveDateTimestamp != null) {
|
|
||||||
return new DateTime(liveDateTimestamp.getTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return null; // Return null if liveDate is not found or an error occurs
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.Boon;
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class dbBoonHandler extends dbHandlerBase {
|
|
||||||
|
|
||||||
public dbBoonHandler() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<Boon> GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) {
|
|
||||||
|
|
||||||
ArrayList<Boon> boons = new ArrayList<>();
|
|
||||||
Boon thisBoon;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, itemBaseUUID);
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
thisBoon = new Boon(rs);
|
|
||||||
boons.add(thisBoon);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return boons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,6 +13,7 @@ import engine.Enum;
|
|||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
import engine.Enum.ProtectionState;
|
import engine.Enum.ProtectionState;
|
||||||
import engine.Enum.TaxType;
|
import engine.Enum.TaxType;
|
||||||
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
@@ -27,6 +28,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class dbBuildingHandler extends dbHandlerBase {
|
public class dbBuildingHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -88,14 +90,12 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return removeFromBuildings(b);
|
return removeFromBuildings(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Building> GET_ALL_BUILDINGS_FOR_ZONE(Zone zone) {
|
public ArrayList<Building> GET_ALL_BUILDINGS() {
|
||||||
|
|
||||||
ArrayList<Building> buildings = new ArrayList<>();
|
ArrayList<Building> buildings = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, zone.getObjectUUID());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
buildings = getObjectsFromRs(rs, 1000);
|
buildings = getObjectsFromRs(rs, 1000);
|
||||||
@@ -425,26 +425,28 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ALL_FRIENDS_FOR_BUILDING(Building building) {
|
public void LOAD_BUILDING_FRIENDS() {
|
||||||
|
|
||||||
if (building == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends` WHERE `buildingUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends`")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, building.getObjectUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
BuildingFriends friend = new BuildingFriends(rs);
|
BuildingFriends friend = new BuildingFriends(rs);
|
||||||
switch (friend.getFriendType()) {
|
|
||||||
|
// Create map if it does not yet exist
|
||||||
|
|
||||||
|
if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID))
|
||||||
|
BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>());
|
||||||
|
|
||||||
|
switch (friend.friendType) {
|
||||||
case 7:
|
case 7:
|
||||||
building.getFriends().put(friend.getPlayerUID(), friend);
|
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
case 9:
|
case 9:
|
||||||
building.getFriends().put(friend.getGuildUID(), friend);
|
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.guildUID, friend);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -455,26 +457,29 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ALL_CONDEMNED_FOR_BUILDING(Building building) {
|
public void LOAD_BUILDING_CONDEMNED() {
|
||||||
|
|
||||||
if (building == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned` WHERE `buildingUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned`")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, building.getObjectUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
Condemned condemned = new Condemned(rs);
|
Condemned condemned = new Condemned(rs);
|
||||||
switch (condemned.getFriendType()) {
|
|
||||||
|
// Create map if it does not yet exist
|
||||||
|
|
||||||
|
if (!BuildingManager._buildingCondemned.containsKey(condemned.buildingUUID))
|
||||||
|
BuildingManager._buildingCondemned.put(condemned.buildingUUID, new ConcurrentHashMap<>());
|
||||||
|
|
||||||
|
switch (condemned.friendType) {
|
||||||
case 2:
|
case 2:
|
||||||
building.getCondemned().put(condemned.getPlayerUID(), condemned);
|
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.playerUID, condemned);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
building.getCondemned().put(condemned.getGuildUID(), condemned);
|
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.guildUID, condemned);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,35 +489,27 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Vector3fImmutable> LOAD_PATROL_POINTS(Building building) {
|
public void LOAD_BARRACKS_PATROL_POINTS() {
|
||||||
|
|
||||||
if (building == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
ArrayList<Vector3fImmutable> patrolPoints = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points` WHERE `buildingUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points`")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, building.getObjectUUID());
|
|
||||||
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
float x1 = rs.getFloat("patrolX");
|
|
||||||
float y1 = rs.getFloat("patrolY");
|
int buildingUUID = rs.getInt("buildingUID");
|
||||||
float z1 = rs.getFloat("patrolZ");
|
|
||||||
Vector3fImmutable patrolPoint = new Vector3fImmutable(x1, y1, z1);
|
if (!BuildingManager._buildingPatrolPoints.containsKey(buildingUUID))
|
||||||
patrolPoints.add(patrolPoint);
|
BuildingManager._buildingPatrolPoints.put(buildingUUID, new ArrayList<>());
|
||||||
|
|
||||||
|
Vector3fImmutable patrolPoint = new Vector3fImmutable(rs.getFloat("patrolX"), rs.getFloat("patrolY"), rs.getFloat("patrolZ"));
|
||||||
|
BuildingManager._buildingPatrolPoints.get(buildingUUID).add(patrolPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return patrolPoints;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) {
|
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) {
|
||||||
@@ -722,10 +719,10 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
|
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setBoolean(1, active);
|
preparedStatement.setBoolean(1, active);
|
||||||
preparedStatement.setInt(2, condemn.getParent());
|
preparedStatement.setInt(2, condemn.buildingUUID);
|
||||||
preparedStatement.setInt(3, condemn.getPlayerUID());
|
preparedStatement.setInt(3, condemn.playerUID);
|
||||||
preparedStatement.setInt(4, condemn.getGuildUID());
|
preparedStatement.setInt(4, condemn.guildUID);
|
||||||
preparedStatement.setInt(5, condemn.getFriendType());
|
preparedStatement.setInt(5, condemn.friendType);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.Building;
|
||||||
|
import engine.objects.City;
|
||||||
|
import engine.objects.Zone;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -31,16 +34,19 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
case "zone":
|
case "zone":
|
||||||
Zone zone = new Zone(rs);
|
Zone zone = new Zone(rs);
|
||||||
DbManager.addToCache(zone);
|
DbManager.addToCache(zone);
|
||||||
|
zone.runAfterLoad();
|
||||||
list.add(zone);
|
list.add(zone);
|
||||||
break;
|
break;
|
||||||
case "building":
|
case "building":
|
||||||
Building building = new Building(rs);
|
Building building = new Building(rs);
|
||||||
DbManager.addToCache(building);
|
DbManager.addToCache(building);
|
||||||
|
building.runAfterLoad();
|
||||||
list.add(building);
|
list.add(building);
|
||||||
break;
|
break;
|
||||||
case "city":
|
case "city":
|
||||||
City city = new City(rs);
|
City city = new City(rs);
|
||||||
DbManager.addToCache(city);
|
DbManager.addToCache(city);
|
||||||
|
city.runAfterLoad();
|
||||||
list.add(city);
|
list.add(city);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -92,24 +98,13 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return objectList;
|
return objectList;
|
||||||
}
|
}
|
||||||
public Integer GET_CAPITAL_CITY_COUNT() {
|
|
||||||
|
|
||||||
int cityCount = 0;
|
public ArrayList<City> GET_ALL_CITIES() {
|
||||||
for(Realm realm : Realm._realms.values()){
|
|
||||||
if(realm.isRuled())
|
|
||||||
cityCount ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cityCount;
|
|
||||||
}
|
|
||||||
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
|
||||||
|
|
||||||
ArrayList<City> cityList = new ArrayList<>();
|
ArrayList<City> cityList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`parent`=?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, objectUUID);
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
cityList = getObjectsFromRs(rs, 100);
|
cityList = getObjectsFromRs(rs, 100);
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ package engine.db.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Contract;
|
import engine.objects.Contract;
|
||||||
import engine.objects.ItemBase;
|
import engine.objects.Item;
|
||||||
import engine.objects.MobEquipment;
|
import engine.objects.MobLoot;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -63,33 +63,12 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
//handle item base
|
int templateID = rs.getInt("templateID");
|
||||||
int itemBaseID = rs.getInt("itembaseID");
|
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(itemBaseID);
|
Item item = new Item(templateID);
|
||||||
|
item.objectUUID = MobLoot.lastNegativeID.decrementAndGet();
|
||||||
|
contract.getSellInventory().add(item);
|
||||||
|
|
||||||
if (ib != null) {
|
|
||||||
|
|
||||||
MobEquipment me = new MobEquipment(ib, 0, 0);
|
|
||||||
contract.getSellInventory().add(me);
|
|
||||||
|
|
||||||
//handle magic effects
|
|
||||||
String prefix = rs.getString("prefix");
|
|
||||||
int pRank = rs.getInt("pRank");
|
|
||||||
String suffix = rs.getString("suffix");
|
|
||||||
int sRank = rs.getInt("sRank");
|
|
||||||
|
|
||||||
if (prefix != null) {
|
|
||||||
me.setPrefix(prefix, pRank);
|
|
||||||
me.setIsID(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (suffix != null) {
|
|
||||||
me.setSuffix(suffix, sRank);
|
|
||||||
me.setIsID(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -98,54 +77,32 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
||||||
|
|
||||||
if(!contract.getName().contains("Sage")) {
|
try (Connection connection = DbManager.getConnection();
|
||||||
try (Connection connection = DbManager.getConnection();
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int type = rs.getInt("type");
|
int type = rs.getInt("type");
|
||||||
int value = rs.getInt("value");
|
int value = rs.getInt("value");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
contract.getBuyItemType().add(value);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
contract.getBuySkillToken().add(value);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
contract.getBuyUnknownToken().add(value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
int value = rs.getInt("value");
|
|
||||||
if(!contract.getBuySkillToken().contains(value))
|
|
||||||
contract.getBuySkillToken().add(value);
|
|
||||||
|
|
||||||
if(!contract.getBuyItemType().contains(value))
|
|
||||||
contract.getBuyItemType().add(value);
|
contract.getBuyItemType().add(value);
|
||||||
|
break;
|
||||||
if(!contract.getBuyUnknownToken().contains(value))
|
case 2:
|
||||||
|
contract.getBuySkillToken().add(value);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
contract.getBuyUnknownToken().add(value);
|
contract.getBuyUnknownToken().add(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -695,24 +695,4 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO uncomment this when finished with guild history warehouse integration
|
|
||||||
// public HashMap<Integer, GuildRecord> GET_WAREHOUSE_GUILD_HISTORY(){
|
|
||||||
//
|
|
||||||
// HashMap<Integer, GuildRecord> tempMap = new HashMap<>();
|
|
||||||
// prepareCallable("SELECT * FROM `warehouse_guildhistory` WHERE `eventType` = 'CREATE'");
|
|
||||||
// try {
|
|
||||||
// ResultSet rs = executeQuery();
|
|
||||||
//
|
|
||||||
// while (rs.next()) {
|
|
||||||
// GuildRecord guildRecord = new GuildRecord(rs);
|
|
||||||
// tempMap.put(guildRecord.guildID, guildRecord);
|
|
||||||
// }
|
|
||||||
// }catch (Exception e){
|
|
||||||
// Logger.error(e);
|
|
||||||
// }
|
|
||||||
// return tempMap;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public abstract class dbHandlerBase {
|
|||||||
try {
|
try {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||||
|
|
||||||
DbManager.addToCache(abstractGameObject);
|
DbManager.addToCache(abstractGameObject);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -56,28 +57,12 @@ public abstract class dbHandlerBase {
|
|||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
try {
|
|
||||||
if (rs.getInt("capSize") == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
//not a mine
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DbManager.inCache(localObjectType, id)) {
|
if (DbManager.inCache(localObjectType, id)) {
|
||||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||||
} else {
|
} else {
|
||||||
try{
|
|
||||||
if(rs.getInt("mineLiveHour") == 1)
|
|
||||||
continue;
|
|
||||||
}catch(Exception e){
|
|
||||||
//not a mine
|
|
||||||
}
|
|
||||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||||
DbManager.addToCache(toAdd);
|
DbManager.addToCache(toAdd);
|
||||||
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
objectList.add((T) toAdd);
|
objectList.add((T) toAdd);
|
||||||
|
|
||||||
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package engine.db.handlers;
|
|
||||||
|
|
||||||
import engine.InterestManagement.HeightMap;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class dbHeightMapHandler extends dbHandlerBase {
|
|
||||||
|
|
||||||
public dbHeightMapHandler() {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ALL_HEIGHTMAPS() {
|
|
||||||
|
|
||||||
HeightMap thisHeightmap;
|
|
||||||
HeightMap.heightMapsCreated = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_heightmap INNER JOIN static_zone_size ON static_zone_size.loadNum = static_zone_heightmap.zoneLoadID")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
thisHeightmap = new HeightMap(rs);
|
|
||||||
|
|
||||||
if (thisHeightmap.getHeightmapImage() == null) {
|
|
||||||
Logger.info("Imagemap for " + thisHeightmap.getHeightMapID() + " was null");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.ItemBase;
|
|
||||||
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.HashMap;
|
|
||||||
|
|
||||||
public class dbItemBaseHandler extends dbHandlerBase {
|
|
||||||
|
|
||||||
public static final HashMap<Integer,Float> dexReductions = new HashMap<>();
|
|
||||||
public dbItemBaseHandler() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, itemBase.getUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
if (rs.getBoolean("fromUse"))
|
|
||||||
itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains"));
|
|
||||||
else
|
|
||||||
itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains"));
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
|
||||||
if(dexReductions.containsKey(itemBase.getUUID())){
|
|
||||||
itemBase.dexReduction = dexReductions.get(itemBase.getUUID());
|
|
||||||
}else{
|
|
||||||
itemBase.dexReduction = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
|
||||||
|
|
||||||
ArrayList<Integer> tempList = new ArrayList<>();
|
|
||||||
ArrayList<Integer> tempListOff = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, itemBase.getUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
int animation = rs.getInt("animation");
|
|
||||||
boolean rightHand = rs.getBoolean("rightHand");
|
|
||||||
|
|
||||||
if (rightHand)
|
|
||||||
tempList.add(animation);
|
|
||||||
else
|
|
||||||
tempListOff.add(animation);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
itemBase.setAnimations(tempList);
|
|
||||||
itemBase.setOffHandAnimations(tempListOff);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ALL_ITEMBASES() {
|
|
||||||
|
|
||||||
ItemBase itemBase;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
recordsRead++;
|
|
||||||
itemBase = new ItemBase(rs);
|
|
||||||
ItemBase.addToCache(itemBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty`")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
// Check if a result was found
|
|
||||||
if (rs.next()) {
|
|
||||||
int ID = rs.getInt("ID");
|
|
||||||
float factor = rs.getInt("item_bulk_factor");
|
|
||||||
dexReductions.put(ID,factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
|
||||||
int runeSetID;
|
|
||||||
int runeBaseID;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
runeSetID = rs.getInt("runeSet");
|
|
||||||
runeBaseID = rs.getInt("runeBase");
|
|
||||||
|
|
||||||
if (runeSets.get(runeSetID) == null) {
|
|
||||||
ArrayList<Integer> runeList = new ArrayList<>();
|
|
||||||
runeList.add(runeBaseID);
|
|
||||||
runeSets.put(runeSetID, runeList);
|
|
||||||
} else {
|
|
||||||
ArrayList<Integer> runeList = runeSets.get(runeSetID);
|
|
||||||
runeList.add(runeSetID);
|
|
||||||
runeSets.put(runeSetID, runeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return runeSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
|
|
||||||
return runeSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,12 +9,16 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.ItemContainerType;
|
import engine.Enum.ItemContainerType;
|
||||||
import engine.Enum.ItemType;
|
import engine.Enum.ItemType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterItemManager;
|
import engine.objects.CharacterItemManager;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
|
import engine.objects.ItemTemplate;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -52,46 +56,56 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item ADD_ITEM(Item toAdd) {
|
public Item PERSIST(Item toAdd) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, toAdd.getOwnerID());
|
preparedStatement.setInt(1, toAdd.ownerID);
|
||||||
preparedStatement.setInt(2, toAdd.getItemBaseID());
|
preparedStatement.setInt(2, toAdd.templateID);
|
||||||
preparedStatement.setInt(3, toAdd.getChargesRemaining());
|
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining);
|
||||||
preparedStatement.setInt(4, toAdd.getDurabilityCurrent());
|
preparedStatement.setInt(4, (short) toAdd.combat_health_current);
|
||||||
preparedStatement.setInt(5, toAdd.getDurabilityMax());
|
|
||||||
|
|
||||||
if (toAdd.getNumOfItems() < 1)
|
if (toAdd.getNumOfItems() < 1)
|
||||||
preparedStatement.setInt(6, 1);
|
preparedStatement.setInt(5, 1);
|
||||||
else
|
else
|
||||||
preparedStatement.setInt(6, toAdd.getNumOfItems());
|
preparedStatement.setInt(5, toAdd.getNumOfItems());
|
||||||
|
|
||||||
switch (toAdd.containerType) {
|
switch (toAdd.containerType) {
|
||||||
case INVENTORY:
|
case INVENTORY:
|
||||||
preparedStatement.setString(7, "inventory");
|
preparedStatement.setString(6, "inventory");
|
||||||
break;
|
break;
|
||||||
case EQUIPPED:
|
case EQUIPPED:
|
||||||
preparedStatement.setString(7, "equip");
|
preparedStatement.setString(6, "equip");
|
||||||
break;
|
break;
|
||||||
case BANK:
|
case BANK:
|
||||||
preparedStatement.setString(7, "bank");
|
preparedStatement.setString(6, "bank");
|
||||||
break;
|
break;
|
||||||
case VAULT:
|
case VAULT:
|
||||||
preparedStatement.setString(7, "vault");
|
preparedStatement.setString(6, "vault");
|
||||||
break;
|
break;
|
||||||
case FORGE:
|
case FORGE:
|
||||||
preparedStatement.setString(7, "forge");
|
preparedStatement.setString(6, "forge");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
preparedStatement.setString(7, "none"); //Shouldn't be here
|
preparedStatement.setString(6, "none"); //Shouldn't be here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
preparedStatement.setByte(8, toAdd.getEquipSlot());
|
if (toAdd.equipSlot.equals(Enum.EquipSlotType.NONE))
|
||||||
preparedStatement.setInt(9, toAdd.getFlags());
|
preparedStatement.setString(7, "");
|
||||||
preparedStatement.setString(10, toAdd.getCustomName());
|
else
|
||||||
|
preparedStatement.setString(7, toAdd.equipSlot.name());
|
||||||
|
|
||||||
|
String flagString = "";
|
||||||
|
|
||||||
|
for (Enum.ItemFlags itemflag : toAdd.flags)
|
||||||
|
flagString += itemflag.toString() + ";";
|
||||||
|
|
||||||
|
flagString = flagString.replaceAll(";$", "");
|
||||||
|
|
||||||
|
preparedStatement.setString(8, flagString);
|
||||||
|
preparedStatement.setString(9, toAdd.name);
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -134,13 +148,9 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next()) {
|
if (rs.next())
|
||||||
try {
|
worked = rs.getBoolean("result");
|
||||||
worked = rs.getBoolean("result");
|
|
||||||
}catch(Exception e){
|
|
||||||
worked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
@@ -152,7 +162,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
ArrayList<Item> itemList;
|
ArrayList<Item> itemList;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`item_container`='equip';")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`container`='equip';")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, targetId);
|
preparedStatement.setLong(1, targetId);
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
@@ -167,6 +177,45 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return itemList;
|
return itemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LOAD_ITEM_TEMPLATES() {
|
||||||
|
|
||||||
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;");
|
||||||
|
ResultSet rs = preparedStatement.executeQuery()) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int templateID = rs.getInt("id");
|
||||||
|
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template"));
|
||||||
|
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
|
||||||
|
itemTemplate.template_id = templateID;
|
||||||
|
ItemTemplate.templates.put(templateID, itemTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_TEMPLATE_MODTABLES() {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_vendor_items`;");
|
||||||
|
ResultSet rs = preparedStatement.executeQuery()) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int templateID = rs.getInt("templateID");
|
||||||
|
int modTable = rs.getInt("modTable");
|
||||||
|
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||||
|
template.modTable = modTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public Item GET_ITEM(final int itemUUID) {
|
public Item GET_ITEM(final int itemUUID) {
|
||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
@@ -246,7 +295,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean MOVE_GOLD(final Item from, final Item to, final int amt) {
|
public boolean MOVE_GOLD(final Item from, final Item to, final int amt) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
|
||||||
|
|
||||||
int newFromAmt = from.getNumOfItems() - amt;
|
int newFromAmt = from.getNumOfItems() - amt;
|
||||||
int newToAmt = to.getNumOfItems() + amt;
|
int newToAmt = to.getNumOfItems() + amt;
|
||||||
@@ -272,11 +321,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
for (Item item : inventory) {
|
for (Item item : inventory) {
|
||||||
|
|
||||||
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
if (item.template.item_type.equals(ItemType.GOLD))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`item_container`='none' WHERE `object`.`UID`=?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`container`='none' WHERE `object`.`UID`=?;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, item.getObjectUUID());
|
preparedStatement.setLong(1, item.getObjectUUID());
|
||||||
worked = (preparedStatement.executeUpdate() > 0);
|
worked = (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -292,12 +341,12 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<Integer> GET_ITEMS_FOR_VENDOR(final int vendorID) {
|
public HashSet<Integer> GET_VENDOR_CAN_ROLL_LIST(final int vendorID) {
|
||||||
|
|
||||||
HashSet<Integer> itemSet = new HashSet<>();
|
HashSet<Integer> itemSet = new HashSet<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT ID FROM static_itembase WHERE vendorType = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT templateID FROM static_vendor_items WHERE vendorType = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, vendorID);
|
preparedStatement.setInt(1, vendorID);
|
||||||
|
|
||||||
@@ -315,8 +364,8 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
||||||
public boolean UPDATE_OWNER(final Item item, int newOwnerID, boolean ownerNPC, boolean ownerPlayer,
|
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
|
||||||
boolean ownerAccount, ItemContainerType containerType, int slot) {
|
ItemContainerType containerType, Enum.EquipSlotType slot) {
|
||||||
|
|
||||||
boolean worked = false;
|
boolean worked = false;
|
||||||
|
|
||||||
@@ -350,7 +399,12 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setString(3, "none"); //Shouldn't be here
|
preparedStatement.setString(3, "none"); //Shouldn't be here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
preparedStatement.setInt(4, slot);
|
|
||||||
|
if (slot.equals(Enum.EquipSlotType.NONE))
|
||||||
|
preparedStatement.setString(4, "");
|
||||||
|
else
|
||||||
|
preparedStatement.setString(4, slot.name());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
@@ -366,11 +420,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean SET_DURABILITY(final Item item, int value) {
|
public boolean SET_DURABILITY(final Item item, int value) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityCurrent`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `combat_health_current`=? WHERE `UID`=? AND `combat_health_current`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
preparedStatement.setInt(1, value);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
preparedStatement.setInt(3, item.getDurabilityCurrent());
|
preparedStatement.setInt(3, (short) item.combat_health_current);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -383,7 +437,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_FORGE_TO_INVENTORY(final Item item) {
|
public boolean UPDATE_FORGE_TO_INVENTORY(final Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_container` = ? WHERE `UID` = ? AND `item_container` = 'forge';")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `container` = ? WHERE `UID` = ? AND `container` = 'forge';")) {
|
||||||
|
|
||||||
preparedStatement.setString(1, "inventory");
|
preparedStatement.setString(1, "inventory");
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -416,11 +470,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
*/
|
*/
|
||||||
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
|
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
|
||||||
|
|
||||||
if (!item.getItemBase().getType().equals(ItemType.GOLD))
|
if (!item.template.item_type.equals(ItemType.GOLD))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=? WHERE `UID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, newValue);
|
preparedStatement.setInt(1, newValue);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -437,9 +491,9 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_REMAINING_CHARGES(final Item item) {
|
public boolean UPDATE_REMAINING_CHARGES(final Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_chargesRemaining` = ? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `chargesRemaining` = ? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, item.getChargesRemaining());
|
preparedStatement.setInt(1, (byte) item.chargesRemaining);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -457,7 +511,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean ZERO_ITEM_STACK(Item item) {
|
public boolean ZERO_ITEM_STACK(Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=0 WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=0 WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, item.getObjectUUID());
|
preparedStatement.setLong(1, item.getObjectUUID());
|
||||||
|
|
||||||
@@ -472,9 +526,16 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_FLAGS(Item item) {
|
public boolean UPDATE_FLAGS(Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_flags`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `flags`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, item.getFlags());
|
String flagString = "";
|
||||||
|
|
||||||
|
for (Enum.ItemFlags itemflag : item.flags)
|
||||||
|
flagString += itemflag.toString() + ";";
|
||||||
|
|
||||||
|
flagString = flagString.replaceAll(";$", "");
|
||||||
|
|
||||||
|
preparedStatement.setString(1, flagString);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -487,8 +548,13 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public boolean UPDATE_VALUE(Item item, int value) {
|
public boolean UPDATE_VALUE(Item item, int value) {
|
||||||
|
|
||||||
|
// Write 0 if we will not modify the value from template
|
||||||
|
|
||||||
|
if (item.value == item.template.item_value)
|
||||||
|
value = 0;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_value`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `value`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
preparedStatement.setInt(1, value);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -501,17 +567,24 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
public boolean UPDATE_EQUIP_SLOT(Item item) {
|
||||||
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
|
||||||
return false;
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `equipSlot`=? WHERE `UID` = ?")) {
|
||||||
preparedStatement.setInt(1, newValue);
|
|
||||||
|
if (item.equipSlot.equals(Enum.EquipSlotType.NONE))
|
||||||
|
preparedStatement.setString(1, "");
|
||||||
|
else
|
||||||
|
preparedStatement.setString(1, item.equipSlot.name());
|
||||||
|
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import engine.Enum;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.MineProduction;
|
import engine.objects.MineProduction;
|
||||||
import engine.objects.Resource;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -84,7 +83,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CHANGE_RESOURCE(Mine mine, Resource resource) {
|
public boolean CHANGE_RESOURCE(Mine mine, Enum.ResourceType resource) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -28,31 +27,27 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob ADD_MOB(Mob toAdd) {
|
public Mob PERSIST(Mob toAdd) {
|
||||||
|
|
||||||
Mob mobile = null;
|
Mob mobile = null;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||||
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
preparedStatement.setInt(2, toAdd.loadID);
|
||||||
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
preparedStatement.setInt(3, toAdd.guildUUID);
|
||||||
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
||||||
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
||||||
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
||||||
preparedStatement.setInt(7, 0);
|
preparedStatement.setInt(7, 0);
|
||||||
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
||||||
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
preparedStatement.setInt(9, toAdd.spawnDelay);
|
||||||
|
preparedStatement.setInt(10, toAdd.contractUUID);
|
||||||
if (toAdd.getContract() != null)
|
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||||
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
preparedStatement.setInt(12, toAdd.level);
|
||||||
else
|
preparedStatement.setString(13, toAdd.firstName);
|
||||||
preparedStatement.setInt(10, 0);
|
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
||||||
|
|
||||||
preparedStatement.setInt(11, toAdd.getBuildingID());
|
|
||||||
preparedStatement.setInt(12, toAdd.getLevel());
|
|
||||||
preparedStatement.setString(13, toAdd.getFirstName());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -69,6 +64,23 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return mobile;
|
return mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Mob> GET_ALL_MOBS() {
|
||||||
|
|
||||||
|
ArrayList<Mob> mobileList = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
mobileList = getObjectsFromRs(rs, 1000);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mobileList;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
@@ -106,17 +118,17 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_PATROL_POINTS(Mob captain) {
|
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, captain.getObjectUUID());
|
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String name = rs.getString("name");
|
String minionName = rs.getString("minionName");
|
||||||
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return;
|
return;
|
||||||
@@ -131,15 +143,13 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
public boolean ADD_GUARD_MINION(final long captainUID, final String minionName) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setInt(2, mobBaseID);
|
preparedStatement.setString(2, minionName);
|
||||||
preparedStatement.setString(3, name);
|
|
||||||
preparedStatement.setInt(4, slot);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -149,14 +159,13 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
public boolean REMOVE_GUARD_MINION(final long captainUID, final String minionName) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setInt(2, mobBaseID);
|
preparedStatement.setString(2, minionName);
|
||||||
preparedStatement.setInt(3, slot);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -166,24 +175,19 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean REMOVE_ALL_MINIONS(final long captainUID) {
|
||||||
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
|
||||||
|
|
||||||
ArrayList<Mob> mobileList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=?;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, zone.getObjectUUID());
|
preparedStatement.setLong(1, captainUID);
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
mobileList = getObjectsFromRs(rs, 1000);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mobileList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob GET_MOB(final int objectUUID) {
|
public Mob GET_MOB(final int objectUUID) {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import engine.math.Vector3fImmutable;
|
|||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
import engine.objects.NPCProfits;
|
import engine.objects.NPCProfits;
|
||||||
import engine.objects.ProducedItem;
|
import engine.objects.ProducedItem;
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class dbNPCHandler extends dbHandlerBase {
|
public class dbNPCHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -32,6 +32,45 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
||||||
|
int runeSetID;
|
||||||
|
int runeBaseID;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
runeSetID = rs.getInt("runeSet");
|
||||||
|
runeBaseID = rs.getInt("runeBase");
|
||||||
|
|
||||||
|
if (runeSets.get(runeSetID) == null) {
|
||||||
|
ArrayList<Integer> runeList = new ArrayList<>();
|
||||||
|
runeList.add(runeBaseID);
|
||||||
|
runeSets.put(runeSetID, runeList);
|
||||||
|
} else {
|
||||||
|
ArrayList<Integer> runeList = runeSets.get(runeSetID);
|
||||||
|
runeList.add(runeSetID);
|
||||||
|
runeSets.put(runeSetID, runeList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return runeSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
|
||||||
|
return runeSets;
|
||||||
|
}
|
||||||
|
|
||||||
public NPC PERSIST(NPC toAdd) {
|
public NPC PERSIST(NPC toAdd) {
|
||||||
|
|
||||||
NPC npc = null;
|
NPC npc = null;
|
||||||
@@ -94,14 +133,12 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) {
|
public ArrayList<NPC> GET_ALL_NPCS() {
|
||||||
|
|
||||||
ArrayList<NPC> npcList = new ArrayList<>();
|
ArrayList<NPC> npcList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, zone.getObjectUUID());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
npcList = getObjectsFromRs(rs, 1000);
|
npcList = getObjectsFromRs(rs, 1000);
|
||||||
@@ -131,32 +168,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int BANE_COMMANDER_EXISTS(final int objectUUID) {
|
|
||||||
|
|
||||||
int uid = 0;
|
|
||||||
|
|
||||||
String query = "SELECT `UID` FROM `obj_npc` WHERE `npc_buildingID` = ? LIMIT 1;";
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, objectUUID);
|
|
||||||
|
|
||||||
try (ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
// Retrieve the UID column value
|
|
||||||
uid = rs.getInt("UID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
||||||
|
|
||||||
int rowCount;
|
int rowCount;
|
||||||
@@ -202,18 +213,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSpecialPricing(final NPC npc){
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
|
||||||
preparedStatement.setInt(1, npc.getSpecialPrice());
|
|
||||||
preparedStatement.setInt(2, npc.getDBID());
|
|
||||||
|
|
||||||
preparedStatement.executeUpdate();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void updateDatabase(final NPC npc) {
|
public void updateDatabase(final NPC npc) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
@@ -346,14 +345,14 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
+ NPC._pirateNames.size() + " mobBases");
|
+ NPC._pirateNames.size() + " mobBases");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long templateID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `templateID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, ID);
|
preparedStatement.setLong(1, ID);
|
||||||
preparedStatement.setLong(2, npcUID);
|
preparedStatement.setLong(2, npcUID);
|
||||||
preparedStatement.setLong(3, itemBaseID);
|
preparedStatement.setLong(3, templateID);
|
||||||
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
||||||
preparedStatement.setBoolean(5, isRandom);
|
preparedStatement.setBoolean(5, isRandom);
|
||||||
preparedStatement.setString(6, prefix);
|
preparedStatement.setString(6, prefix);
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.AbstractWorldObject;
|
import engine.objects.*;
|
||||||
import engine.objects.Heraldry;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.PlayerFriends;
|
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -45,8 +42,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setLong(1, toAdd.getAccount().getObjectUUID());
|
preparedStatement.setLong(1, toAdd.getAccount().getObjectUUID());
|
||||||
preparedStatement.setString(2, toAdd.getFirstName());
|
preparedStatement.setString(2, toAdd.getFirstName());
|
||||||
preparedStatement.setString(3, toAdd.getLastName());
|
preparedStatement.setString(3, toAdd.getLastName());
|
||||||
preparedStatement.setInt(4, toAdd.getRace().getRaceRuneID());
|
preparedStatement.setInt(4, toAdd.race.getRaceRuneID());
|
||||||
preparedStatement.setInt(5, toAdd.getBaseClass().getObjectUUID());
|
preparedStatement.setInt(5, toAdd.baseClass.getObjectUUID());
|
||||||
preparedStatement.setInt(6, toAdd.getStrMod());
|
preparedStatement.setInt(6, toAdd.getStrMod());
|
||||||
preparedStatement.setInt(7, toAdd.getDexMod());
|
preparedStatement.setInt(7, toAdd.getDexMod());
|
||||||
preparedStatement.setInt(8, toAdd.getConMod());
|
preparedStatement.setInt(8, toAdd.getConMod());
|
||||||
|
|||||||
@@ -13,17 +13,12 @@ import engine.Enum;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PreparedStatementShared;
|
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.MobPowerEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class dbPowerHandler extends dbHandlerBase {
|
public class dbPowerHandler extends dbHandlerBase {
|
||||||
@@ -34,16 +29,17 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addAllSourceTypes() {
|
public static void addAllSourceTypes() {
|
||||||
PreparedStatementShared ps = null;
|
|
||||||
try {
|
try (Connection connection = DbManager.getConnection();
|
||||||
ps = new PreparedStatementShared("SELECT * FROM static_power_sourcetype");
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) {
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
String IDString, source;
|
String IDString, source;
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
IDString = rs.getString("IDString");
|
IDString = rs.getString("IDString");
|
||||||
int token = DbManager.hasher.SBStringHash(IDString);
|
int token = DbManager.hasher.SBStringHash(IDString);
|
||||||
|
|
||||||
|
|
||||||
source = rs.getString("source").replace("-", "").trim();
|
source = rs.getString("source").replace("-", "").trim();
|
||||||
Enum.EffectSourceType effectSourceType = Enum.EffectSourceType.GetEffectSourceType(source);
|
Enum.EffectSourceType effectSourceType = Enum.EffectSourceType.GetEffectSourceType(source);
|
||||||
|
|
||||||
@@ -52,19 +48,18 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
} finally {
|
|
||||||
ps.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addAllAnimationOverrides() {
|
public static void addAllAnimationOverrides() {
|
||||||
PreparedStatementShared ps = null;
|
|
||||||
try {
|
try (Connection connection = DbManager.getConnection();
|
||||||
ps = new PreparedStatementShared("SELECT * FROM static_power_animation_override");
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_animation_override")) {
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
String IDString;
|
String IDString;
|
||||||
int animation;
|
int animation;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
@@ -78,51 +73,10 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
PowersManager.AnimationOverrides.put(IDString, animation);
|
PowersManager.AnimationOverrides.put(IDString, animation);
|
||||||
|
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
} finally {
|
|
||||||
ps.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
|
|
||||||
MobPowerEntry mobPowerEntry;
|
|
||||||
|
|
||||||
int mobbaseID;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
mobbaseID = rs.getInt("mobbaseUUID");
|
|
||||||
mobPowerEntry = new MobPowerEntry(rs);
|
|
||||||
|
|
||||||
if (mobPowers.get(mobbaseID) == null) {
|
|
||||||
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
|
|
||||||
powerList.add(mobPowerEntry);
|
|
||||||
mobPowers.put(mobbaseID, powerList);
|
|
||||||
} else {
|
|
||||||
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
|
|
||||||
powerList.add(mobPowerEntry);
|
|
||||||
mobPowers.put(mobbaseID, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return mobPowers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
|
||||||
return mobPowers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
|
import engine.powers.RunePowerEntry;
|
||||||
|
import engine.powers.RuneSkillAdjustEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -27,6 +29,84 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
|
||||||
|
RunePowerEntry runePowerEntry;
|
||||||
|
|
||||||
|
int rune_id;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
rune_id = rs.getInt("rune_id");
|
||||||
|
runePowerEntry = new RunePowerEntry(rs);
|
||||||
|
|
||||||
|
if (mobPowers.get(rune_id) == null) {
|
||||||
|
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
|
||||||
|
runePowerList.add(runePowerEntry);
|
||||||
|
mobPowers.put(rune_id, runePowerList);
|
||||||
|
} else {
|
||||||
|
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
|
||||||
|
powerList.add(runePowerEntry);
|
||||||
|
mobPowers.put(rune_id, powerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
|
||||||
|
RuneSkillAdjustEntry runeSkillAdjustEntry;
|
||||||
|
|
||||||
|
int rune_id;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
rune_id = rs.getInt("rune_id");
|
||||||
|
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
|
||||||
|
|
||||||
|
if (runeSkillAdjusts.get(rune_id) == null) {
|
||||||
|
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
|
||||||
|
skillAdjustList.add(runeSkillAdjustEntry);
|
||||||
|
runeSkillAdjusts.put(rune_id, skillAdjustList);
|
||||||
|
} else {
|
||||||
|
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
|
||||||
|
powerList.add(runeSkillAdjustEntry);
|
||||||
|
runeSkillAdjusts.put(rune_id, powerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return runeSkillAdjusts;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
|
||||||
|
return runeSkillAdjusts;
|
||||||
|
}
|
||||||
|
|
||||||
public void GET_RUNE_REQS(final RuneBase rb) {
|
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -9,14 +9,19 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.Enum.TransactionType;
|
import engine.Enum.TransactionType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.objects.Building;
|
||||||
import engine.objects.*;
|
import engine.objects.City;
|
||||||
|
import engine.objects.Transaction;
|
||||||
|
import engine.objects.Warehouse;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -31,463 +36,10 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
private static final ConcurrentHashMap<Integer, String> columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private static final ConcurrentHashMap<Integer, String> columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
|
|
||||||
public dbWarehouseHandler() {
|
public dbWarehouseHandler() {
|
||||||
this.localClass = Warehouse.class;
|
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Enum.ResourceType resource, int amount, DateTime date) {
|
||||||
String type = rs.getString("type");
|
|
||||||
switch (type) {
|
|
||||||
case "building":
|
|
||||||
Building building = new Building(rs);
|
|
||||||
DbManager.addToCache(building);
|
|
||||||
list.add(building);
|
|
||||||
break;
|
|
||||||
case "warehouse":
|
|
||||||
Warehouse warehouse = new Warehouse(rs);
|
|
||||||
DbManager.addToCache(warehouse);
|
|
||||||
list.add(warehouse);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
|
||||||
Vector3fImmutable location, float meshScale, int currentHP,
|
|
||||||
ProtectionState protectionState, int currentGold, int rank,
|
|
||||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
|
||||||
|
|
||||||
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `WAREHOUSE_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,? ,?, ?);")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, parentZoneID);
|
|
||||||
preparedStatement.setInt(2, OwnerUUID);
|
|
||||||
preparedStatement.setString(3, name);
|
|
||||||
preparedStatement.setInt(4, meshUUID);
|
|
||||||
preparedStatement.setFloat(5, location.x);
|
|
||||||
preparedStatement.setFloat(6, location.y);
|
|
||||||
preparedStatement.setFloat(7, location.z);
|
|
||||||
preparedStatement.setFloat(8, meshScale);
|
|
||||||
preparedStatement.setInt(9, currentHP);
|
|
||||||
preparedStatement.setString(10, protectionState.name());
|
|
||||||
preparedStatement.setInt(11, currentGold);
|
|
||||||
preparedStatement.setInt(12, rank);
|
|
||||||
|
|
||||||
if (upgradeDate != null)
|
|
||||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
|
||||||
else
|
|
||||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
|
||||||
|
|
||||||
preparedStatement.setInt(14, blueprintUUID);
|
|
||||||
preparedStatement.setFloat(15, w);
|
|
||||||
preparedStatement.setFloat(16, rotY);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
ResultSet rs = preparedStatement.getResultSet();
|
|
||||||
|
|
||||||
while (rs.next())
|
|
||||||
addObject(warehouseList, rs);
|
|
||||||
|
|
||||||
while (preparedStatement.getMoreResults()) {
|
|
||||||
rs = preparedStatement.getResultSet();
|
|
||||||
|
|
||||||
while (rs.next())
|
|
||||||
addObject(warehouseList, rs);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return warehouseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateLocks(final Warehouse wh, long locks) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, locks);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateGold(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateStone(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateTruesteel(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateIron(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateAdamant(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateLumber(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateOak(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateBronzewood(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateMandrake(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateCoal(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateAgate(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateDiamond(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateOnyx(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateAzoth(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateOrichalk(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateAntimony(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateSulfur(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateQuicksilver(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateGalvor(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateWormwood(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateObsidian(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateBloodstone(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateMithril(final Warehouse wh, int amount) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
|
||||||
preparedStatement.setInt(2, wh.getUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||||
@@ -532,24 +84,74 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
return transactionsList;
|
return transactionsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ALL_WAREHOUSES() {
|
public void DELETE_WAREHOUSE(Warehouse warehouse) {
|
||||||
|
|
||||||
Warehouse warehouse;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_warehouse` WHERE `cityUUID` = ?;")) {
|
||||||
|
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
|
||||||
|
preparedStatement.executeUpdate();
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
warehouse = new Warehouse(rs);
|
|
||||||
warehouse.runAfterLoad();
|
|
||||||
warehouse.loadAllTransactions();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_WAREHOUSE(Warehouse warehouse) {
|
||||||
|
|
||||||
|
JSONObject warehouseJSON = new JSONObject();
|
||||||
|
|
||||||
|
JSONObject resources = new JSONObject(warehouse.resources);
|
||||||
|
warehouseJSON.put("resources", resources);
|
||||||
|
|
||||||
|
JSONArray locks = new JSONArray();
|
||||||
|
|
||||||
|
for (Enum.ResourceType resource : warehouse.locked)
|
||||||
|
locks.add(resource.name());
|
||||||
|
|
||||||
|
warehouseJSON.put("locked", locks);
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse` (`cityUUID`, `warehouse`) VALUES (?, ?) " +
|
||||||
|
"ON DUPLICATE KEY UPDATE `warehouse` = VALUES(`warehouse`)")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
|
||||||
|
preparedStatement.setString(2, warehouseJSON.toString());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_WAREHOUSES() {
|
||||||
|
|
||||||
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_warehouse`;");
|
||||||
|
ResultSet rs = preparedStatement.executeQuery()) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int cityUID = rs.getInt("cityUUID");
|
||||||
|
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("warehouse"));
|
||||||
|
City city = City.getCity(cityUID);
|
||||||
|
city.warehouse = new Warehouse(jsonObject);
|
||||||
|
city.warehouse.city = city;
|
||||||
|
|
||||||
|
// Locate warehouse building
|
||||||
|
for (Building building : city.parentZone.zoneBuildingSet) {
|
||||||
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE)) {
|
||||||
|
city.warehouse.building = building;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ package engine.db.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
import engine.objects.ZoneTemplate;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -29,25 +29,21 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Zone> GET_ALL_NODES(Zone zone) {
|
public ArrayList<Zone> GET_ALL_ZONES() {
|
||||||
ArrayList<Zone> wsmList = new ArrayList<>();
|
|
||||||
wsmList.addAll(zone.getNodes());
|
ArrayList<Zone> zoneList = new ArrayList<>();
|
||||||
if (zone.absX == 0.0f) {
|
|
||||||
zone.absX = zone.getXCoord();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
zoneList = getObjectsFromRs(rs, 2000);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
if (zone.absY == 0.0f) {
|
|
||||||
zone.absY = zone.getYCoord();
|
return zoneList;
|
||||||
}
|
|
||||||
if (zone.absZ == 0.0f) {
|
|
||||||
zone.absZ = zone.getZCoord();
|
|
||||||
}
|
|
||||||
for (Zone child : zone.getNodes()) {
|
|
||||||
child.absX = child.getXCoord() + zone.absX;
|
|
||||||
child.absY = child.getYCoord() + zone.absY;
|
|
||||||
child.absZ = child.getZCoord() + zone.absZ;
|
|
||||||
wsmList.addAll(this.GET_ALL_NODES(child));
|
|
||||||
}
|
|
||||||
return wsmList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Zone GET_BY_UID(long ID) {
|
public Zone GET_BY_UID(long ID) {
|
||||||
@@ -72,43 +68,38 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Zone> GET_MAP_NODES(final int objectUUID) {
|
public void LOAD_ALL_ZONE_TEMPLATES() {
|
||||||
|
|
||||||
ArrayList<Zone> zoneList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_templates")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, objectUUID);
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
zoneList = getObjectsFromRs(rs, 2000);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return zoneList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ZONE_EXTENTS() {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_zone_size`;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
Vector2f zoneSize = new Vector2f();
|
ZoneTemplate zoneTemplate = new ZoneTemplate(rs);
|
||||||
int loadNum = rs.getInt("loadNum");
|
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
||||||
zoneSize.x = rs.getFloat("xRadius");
|
|
||||||
zoneSize.y = rs.getFloat("zRadius");
|
|
||||||
ZoneManager._zone_size_data.put(loadNum, zoneSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add player city
|
||||||
|
|
||||||
|
ZoneTemplate zoneTemplate = new ZoneTemplate();
|
||||||
|
|
||||||
|
zoneTemplate.templateID = 0;
|
||||||
|
zoneTemplate.sea_level_type = "PARENT";
|
||||||
|
zoneTemplate.sea_level = 0;
|
||||||
|
zoneTemplate.max_blend = 128;
|
||||||
|
zoneTemplate.min_blend = 128;
|
||||||
|
zoneTemplate.terrain_max_y = 5;
|
||||||
|
zoneTemplate.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||||
|
zoneTemplate.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||||
|
zoneTemplate.terrain_type = "PLANAR";
|
||||||
|
|
||||||
|
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean DELETE_ZONE(final Zone zone) {
|
public boolean DELETE_ZONE(final Zone zone) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item gold = pc.getCharItemManager().getGoldInventory();
|
Item gold = pc.charItemManager.getGoldInventory();
|
||||||
int curAmt;
|
int curAmt;
|
||||||
if (gold == null)
|
if (gold == null)
|
||||||
curAmt = 0;
|
curAmt = 0;
|
||||||
@@ -54,13 +54,13 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
if (!pc.charItemManager.addGoldToInventory(amt, true)) {
|
||||||
throwbackError(pc, "Failed to add gold to inventory");
|
throwbackError(pc, "Failed to add gold to inventory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||||
pc.getCharItemManager().updateInventory();
|
pc.charItemManager.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,18 +9,16 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.*;
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Zone;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class AddMobCmd extends AbstractDevCmd {
|
public class AddMobCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public AddMobCmd() {
|
public AddMobCmd() {
|
||||||
@@ -37,27 +35,8 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
if (words[0].equals("all")) {
|
|
||||||
|
|
||||||
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
|
|
||||||
MobBase mb = (MobBase) mobbaseAGO;
|
|
||||||
int loadID = mb.getObjectUUID();
|
|
||||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
|
||||||
null, true, zone, null, 0, "", 1);
|
|
||||||
if (mob != null) {
|
|
||||||
mob.updateDatabase();
|
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
|
||||||
} else {
|
|
||||||
throwbackError(pc, "Failed to create mob of type " + loadID);
|
|
||||||
Logger.error("Failed to create mob of type "
|
|
||||||
+ loadID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int loadID;
|
int loadID;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loadID = Integer.parseInt(words[0]);
|
loadID = Integer.parseInt(words[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -71,20 +50,19 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
throwbackError(pc, "Failed to find zone to place mob in.");
|
throwbackError(pc, "Failed to find zone to place mob in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.isPlayerCity()) {
|
if (zone.guild_zone) {
|
||||||
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, true, zone, null, 0, "", 1);
|
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -32,6 +31,7 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
int contractID;
|
int contractID;
|
||||||
String name = "";
|
String name = "";
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
if (words.length < 2) {
|
if (words.length < 2) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
@@ -39,54 +39,59 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
try {
|
try {
|
||||||
contractID = Integer.parseInt(words[0]);
|
contractID = Integer.parseInt(words[0]);
|
||||||
level = Integer.parseInt(words[1]);
|
level = Integer.parseInt(words[1]);
|
||||||
|
|
||||||
for (int i = 2; i < words.length; i++) {
|
for (int i = 2; i < words.length; i++) {
|
||||||
name += words[i];
|
name += words[i];
|
||||||
if (i + 1 < words.length)
|
if (i + 1 < words.length)
|
||||||
name += "";
|
name += "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throwbackError(pc,
|
throwbackError(pc,
|
||||||
"Failed to parse supplied contractID or level to an Integer.");
|
"Failed to parse supplied contractID or level to an Integer.");
|
||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
|
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
|
||||||
|
|
||||||
if (contract == null || level < 1 || level > 75) {
|
if (contract == null || level < 1 || level > 75) {
|
||||||
throwbackError(pc,
|
throwbackError(pc,
|
||||||
"Invalid addNPC Command. Need contract ID, and level");
|
"Invalid addNPC Command. Need contract ID, and level");
|
||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a random name
|
// Pick a random name
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
name = NPCManager.getPirateName(contract.getMobbaseID());
|
name = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
throwbackError(pc, "Failed to find zone to place npc in.");
|
throwbackError(pc, "Failed to find zone to place npc in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Building building = null;
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
if (target.getObjectType() == GameObjectType.Building) {
|
if (target.getObjectType() == GameObjectType.Building) {
|
||||||
building = (Building)target;
|
Building parentBuilding = (Building) target;
|
||||||
|
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
NPC created;
|
|
||||||
Guild guild = null;
|
NPC npc = NPC.createNPC(name, contractID,
|
||||||
Vector3fImmutable loc;
|
pc.getLoc(), null, zone, (short) level, null);
|
||||||
if(building != null){
|
|
||||||
guild = building.getGuild();
|
if (npc != null) {
|
||||||
loc = building.loc;
|
WorldGrid.addObject(npc, pc);
|
||||||
} else{
|
ChatManager.chatSayInfo(pc,
|
||||||
loc = pc.loc;
|
"NPC with ID " + npc.getDBID() + " added");
|
||||||
|
this.setResult(String.valueOf(npc.getDBID()));
|
||||||
|
} else {
|
||||||
|
throwbackError(pc, "Failed to create npc of contract type "
|
||||||
|
+ contractID);
|
||||||
|
Logger.error(
|
||||||
|
"Failed to create npc of contract type " + contractID);
|
||||||
}
|
}
|
||||||
created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
|
|
||||||
created.bindLoc = loc;
|
|
||||||
if(building != null) {
|
|
||||||
created.buildingUUID = building.getObjectUUID();
|
|
||||||
created.building = building;
|
|
||||||
NPCManager.slotCharacterInBuilding(created);
|
|
||||||
}
|
|
||||||
created.setLoc(created.bindLoc);
|
|
||||||
created.updateDatabase();
|
|
||||||
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.ModType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.net.ItemProductionManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
|
||||||
import engine.powers.poweractions.AbstractPowerAction;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
public class AuditFailedItemsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public AuditFailedItemsCmd() {
|
|
||||||
super("faileditems");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
|
|
||||||
if (ItemProductionManager.FailedItems.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Logger.info("Auditing Item production Failed Items");
|
|
||||||
|
|
||||||
String newLine = "\r\n";
|
|
||||||
String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
|
|
||||||
|
|
||||||
for (ProducedItem failedItem : ItemProductionManager.FailedItems) {
|
|
||||||
|
|
||||||
String npcName = "";
|
|
||||||
String playerName = "";
|
|
||||||
String contractName = "";
|
|
||||||
|
|
||||||
String prefix = "";
|
|
||||||
String suffix = "";
|
|
||||||
String itemName = "";
|
|
||||||
NPC npc = NPC.getFromCache(failedItem.getNpcUID());
|
|
||||||
|
|
||||||
if (npc == null) {
|
|
||||||
npcName = "null";
|
|
||||||
contractName = "null";
|
|
||||||
} else {
|
|
||||||
npcName = npc.getName();
|
|
||||||
if (npc.getContract() != null)
|
|
||||||
contractName = npc.getContract().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
|
|
||||||
|
|
||||||
if (roller == null)
|
|
||||||
playerName = "null";
|
|
||||||
else
|
|
||||||
playerName = roller.getName();
|
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
|
|
||||||
|
|
||||||
if (ib != null) {
|
|
||||||
itemName = ib.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failedItem.isRandom() == false) {
|
|
||||||
if (failedItem.getPrefix().isEmpty() == false) {
|
|
||||||
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
|
|
||||||
if (pa != null) {
|
|
||||||
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
|
|
||||||
if (aem.modType.equals(ModType.ItemName)) {
|
|
||||||
prefix = aem.getString1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failedItem.getSuffix().isEmpty() == false) {
|
|
||||||
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
|
|
||||||
if (pa != null) {
|
|
||||||
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
|
|
||||||
if (aem.modType.equals(ModType.ItemName)) {
|
|
||||||
suffix = aem.getString1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
prefix = "random";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
auditFailedItem += newLine;
|
|
||||||
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
|
|
||||||
|
|
||||||
}
|
|
||||||
Logger.info(auditFailedItem);
|
|
||||||
ItemProductionManager.FailedItems.clear();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /bounds'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Audits all the mobs in a zone.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.InterestManagement.HeightMap;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector2f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
|
|
||||||
public class AuditHeightMapCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public AuditHeightMapCmd() {
|
|
||||||
super("auditheightmap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
int count = Integer.parseInt(words[0]);
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
|
|
||||||
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
|
||||||
|
|
||||||
|
|
||||||
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
|
||||||
|
|
||||||
if (currentZone != null && currentZone.getHeightMap() != null) {
|
|
||||||
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
|
||||||
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
long end = System.currentTimeMillis();
|
|
||||||
|
|
||||||
long delta = end - start;
|
|
||||||
|
|
||||||
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /auditmobs [zone.UUID]'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Audits all the mobs in a zone.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
|
|
||||||
public class AuditMobsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public AuditMobsCmd() {
|
|
||||||
super("auditmobs");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//get Zone to check mobs against
|
|
||||||
|
|
||||||
Zone zone;
|
|
||||||
|
|
||||||
if (words.length == 2) {
|
|
||||||
if (words[0].equals("all")) {
|
|
||||||
int plusplus = 0;
|
|
||||||
int count = Integer.parseInt(words[1]);
|
|
||||||
for (Zone zoneMicro : ZoneManager.getAllZones()) {
|
|
||||||
int size = zoneMicro.zoneMobSet.size();
|
|
||||||
|
|
||||||
if (size >= count) {
|
|
||||||
plusplus++;
|
|
||||||
throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
|
||||||
System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
throwbackInfo(pcSender, " there are " + plusplus + " zones with at least " + count + " mobs in each.");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (words.length > 1) {
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
} else if (words.length == 1) {
|
|
||||||
int uuid;
|
|
||||||
try {
|
|
||||||
uuid = Integer.parseInt(words[0]);
|
|
||||||
zone = ZoneManager.getZoneByUUID(uuid);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
|
||||||
|
|
||||||
if (zone == null) {
|
|
||||||
throwbackError(pcSender, "Unable to find the zone");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//get list of mobs for zone
|
|
||||||
|
|
||||||
if (zone.zoneMobSet.isEmpty()) {
|
|
||||||
throwbackError(pcSender, "No mobs found for this zone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConcurrentHashMap<Integer, Mob> spawnMap = Mob.getSpawnMap();
|
|
||||||
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
|
|
||||||
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
|
|
||||||
|
|
||||||
throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
|
|
||||||
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
|
||||||
|
|
||||||
|
|
||||||
//mob not found in spawn map, check respawn
|
|
||||||
boolean inRespawn = false;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /auditmobs [zone.UUID]'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Audits all the mobs in a zone.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.util.MiscUtils;
|
|
||||||
|
|
||||||
public class ChangeNameCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public ChangeNameCmd() {
|
|
||||||
super("changename");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
Vector3fImmutable loc = null;
|
|
||||||
|
|
||||||
// Arg Count Check
|
|
||||||
if (words.length < 2) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String oldFirst = words[0];
|
|
||||||
String newFirst = words[1];
|
|
||||||
String newLast = "";
|
|
||||||
if (words.length > 2) {
|
|
||||||
newLast = words[2];
|
|
||||||
for (int i = 3; i < words.length; i++)
|
|
||||||
newLast += ' ' + words[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
//verify new name length
|
|
||||||
if (newFirst.length() < 3) {
|
|
||||||
this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//verify old name length
|
|
||||||
if (newLast.length() > 50) {
|
|
||||||
this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if firstname is valid
|
|
||||||
if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
|
|
||||||
this.throwbackError(pc, "Error: First name is not allowed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//get the world ID we're modifying for
|
|
||||||
|
|
||||||
//test if first name is unique, unless new and old first name are equal.
|
|
||||||
if (!(oldFirst.equals(newFirst))) {
|
|
||||||
if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
|
|
||||||
this.throwbackError(pc, "Error: First name is not unique.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//tests passed, update name in database
|
|
||||||
if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
|
|
||||||
this.throwbackError(pc, "Error: Database failed to update the name.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Finally update player ingame
|
|
||||||
PlayerCharacter pcTar = null;
|
|
||||||
try {
|
|
||||||
pcTar = SessionManager
|
|
||||||
.getPlayerCharacterByLowerCaseName(words[0]);
|
|
||||||
pcTar.setFirstName(newFirst);
|
|
||||||
pcTar.setLastName(newLast);
|
|
||||||
this.setTarget(pcTar); //for logging
|
|
||||||
|
|
||||||
//specify if last name is ascii characters only
|
|
||||||
String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
|
|
||||||
pcTar.setAsciiLastName(lastAscii.equals(newLast));
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.throwbackError(pc, "Database was updated but ingame character failed to update.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
|
|
||||||
this.throwbackInfo(pc, out);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Changes the name of a player";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./changename oldFirstName newFirstName newLastName'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class CombatMessageCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public CombatMessageCmd() {
|
|
||||||
super("cm");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
if (args.length != 1) {
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int num = 0;
|
|
||||||
try {
|
|
||||||
num = Integer.parseInt(args[0]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TargetedActionMsg.un2cnt = num;
|
|
||||||
throwbackInfo(pcSender, "CombatMessage set to " + num);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /cm [cmNumber]'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Sets the combat message to the supplied integer value";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.ItemBase;
|
|
||||||
import engine.objects.ItemFactory;
|
import engine.objects.ItemFactory;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
@@ -27,28 +26,20 @@ public class CreateItemCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
if (words.length < 2) {
|
if (words.length < 2) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int id;
|
|
||||||
id = ItemBase.getIDByName(words[0]);
|
|
||||||
|
|
||||||
if (id == 0)
|
int templateID = Integer.parseInt(words[0]);
|
||||||
id = Integer.parseInt(words[0]);
|
|
||||||
if (id == 7) {
|
|
||||||
this.throwbackInfo(pc, "use /addgold to add gold.....");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int size = 1;
|
int size = 1;
|
||||||
|
|
||||||
if (words.length < 3) {
|
if (words.length == 2)
|
||||||
size = Integer.parseInt(words[1]);
|
size = Integer.parseInt(words[1]);
|
||||||
}
|
|
||||||
|
|
||||||
ItemFactory.fillInventory(pc, id, size);
|
|
||||||
|
|
||||||
|
ItemFactory.fillInventory(pc, templateID, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,7 +49,7 @@ public class CreateItemCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /createitem <ItembaseID> <quantity>'";
|
return "' /createitem <templateID> <quantity>'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.jobs.DebugTimerJob;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class DebugCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
|
|
||||||
public DebugCmd() {
|
|
||||||
super("debug");
|
|
||||||
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
|
|
||||||
if (toggle) {
|
|
||||||
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
|
|
||||||
pc.renewTimer(name, dtj, duration);
|
|
||||||
} else
|
|
||||||
pc.cancelTimer(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (words.length < 2) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pc == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
|
|
||||||
|
|
||||||
String command = words[0].toLowerCase();
|
|
||||||
boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
|
|
||||||
|
|
||||||
switch (command) {
|
|
||||||
case "magictrek":
|
|
||||||
pc.RUN_MAGICTREK = toggle;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "combat":
|
|
||||||
pc.setDebug(64, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "health":
|
|
||||||
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "mana":
|
|
||||||
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "stamina":
|
|
||||||
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "spells":
|
|
||||||
pc.setDebug(16, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "damageabsorber":
|
|
||||||
pc.setDebug(2, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "recast":
|
|
||||||
case "recycle":
|
|
||||||
pc.setDebug(4, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "seeinvis":
|
|
||||||
pc.setDebug(8, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "movement":
|
|
||||||
pc.setDebug(1, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "noaggro":
|
|
||||||
pc.setDebug(32, toggle);
|
|
||||||
|
|
||||||
break;
|
|
||||||
// case "loot":
|
|
||||||
// MBServerStatics.debugLoot = toggle;
|
|
||||||
// break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
String output = "Debug for " + command + " not found.";
|
|
||||||
throwbackError(pc, output);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
setTarget(pc); //for logging
|
|
||||||
|
|
||||||
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Runs debug commands";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./Debug command on/off'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.Mob;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class DespawnCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public DespawnCmd() {
|
|
||||||
super("debugmob");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
|
|
||||||
if (pc == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Mob mob = null;
|
|
||||||
|
|
||||||
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
|
|
||||||
mob = (Mob) target;
|
|
||||||
|
|
||||||
if (mob == null)
|
|
||||||
mob = Mob.getFromCache(Integer.parseInt(words[1]));
|
|
||||||
|
|
||||||
if (mob == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (words[0].equalsIgnoreCase("respawn")) {
|
|
||||||
mob.respawn();
|
|
||||||
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
|
|
||||||
} else if (words[0].equalsIgnoreCase("despawn")) {
|
|
||||||
mob.despawn();
|
|
||||||
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Gets distance from a target.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /distance'";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.AbstractWorldObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class DistanceCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public DistanceCmd() {
|
|
||||||
super("distance");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
|
|
||||||
// Arg Count Check
|
|
||||||
if (words.length != 1) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pc == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target == null || !(target instanceof AbstractWorldObject)) {
|
|
||||||
throwbackError(pc, "No target found.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractWorldObject awoTarget = (AbstractWorldObject) target;
|
|
||||||
|
|
||||||
Vector3fImmutable pcLoc = pc.getLoc();
|
|
||||||
Vector3fImmutable tarLoc = awoTarget.getLoc();
|
|
||||||
String out = "Distance: " + pcLoc.distance(tarLoc) +
|
|
||||||
"\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
|
|
||||||
"\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
|
|
||||||
throwbackInfo(pc, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Gets distance from a target.";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /distance'";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,61 +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.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class EffectCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public EffectCmd() {
|
|
||||||
super("effect");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
int ID = 0;
|
|
||||||
int token = 0;
|
|
||||||
|
|
||||||
if (args.length != 2) {
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ID = Integer.parseInt(args[0]);
|
|
||||||
token = Integer.parseInt(args[1]);
|
|
||||||
|
|
||||||
EffectsBase eb = PowersManager.setEffectToken(ID, token);
|
|
||||||
if (eb == null) {
|
|
||||||
throwbackError(pcSender, "Unable to find EffectsBase " + ID
|
|
||||||
+ " to modify.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ChatManager.chatSayInfo(pcSender,
|
|
||||||
"EffectsBase with ID " + ID + " changed token to " + token);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /effect EffectsBaseID Token'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
public class EnchantCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public EnchantCmd() {
|
|
||||||
super("enchant");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
int rank = 0;
|
|
||||||
if (words.length < 1) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
rank = Integer.parseInt(words[0]);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Item item;
|
|
||||||
if (target == null || target instanceof Item)
|
|
||||||
item = (Item) target;
|
|
||||||
else {
|
|
||||||
throwbackError(pc, "Must have an item targeted");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterItemManager cim = pc.getCharItemManager();
|
|
||||||
if (cim == null) {
|
|
||||||
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (words[0].equals("clear")) {
|
|
||||||
item.clearEnchantments();
|
|
||||||
cim.updateInventory();
|
|
||||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
|
||||||
} else {
|
|
||||||
int cnt = words.length;
|
|
||||||
for (int i = 1; i < cnt; i++) {
|
|
||||||
String enchant = words[i];
|
|
||||||
boolean valid = true;
|
|
||||||
for (Effect eff : item.getEffects().values()) {
|
|
||||||
if (eff.getEffectsBase().getIDString().equals(enchant)) {
|
|
||||||
throwbackError(pc, "This item already has that enchantment");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (valid) {
|
|
||||||
item.addPermanentEnchantmentForDev(enchant, rank);
|
|
||||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
|
||||||
} else
|
|
||||||
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
|
|
||||||
}
|
|
||||||
cim.updateInventory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Enchants an item with a prefix and suffix";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
public class GateInfoCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GateInfoCmd() {
|
|
||||||
super("gateinfo");
|
|
||||||
}
|
|
||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter player, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
Building targetBuilding;
|
|
||||||
String outString;
|
|
||||||
Runegate runeGate;
|
|
||||||
Blueprint blueprint;
|
|
||||||
String newline = "\r\n ";
|
|
||||||
targetBuilding = (Building) target;
|
|
||||||
|
|
||||||
if (targetBuilding.getObjectType() != GameObjectType.Building) {
|
|
||||||
throwbackInfo(player, "GateInfo: target must be a Building");
|
|
||||||
throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
|
|
||||||
|
|
||||||
if (blueprint == null ||
|
|
||||||
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)) {
|
|
||||||
throwbackInfo(player, "showgate: target must be a Runegate");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
|
||||||
|
|
||||||
outString = "RungateType: " + runeGate.gateBuilding.getName();
|
|
||||||
outString += newline;
|
|
||||||
|
|
||||||
outString += "Portal State:";
|
|
||||||
outString += newline;
|
|
||||||
|
|
||||||
for (Portal portal : runeGate.getPortals()) {
|
|
||||||
|
|
||||||
outString += "Portal: " + portal.portalType.name();
|
|
||||||
outString += " Active: " + portal.isActive();
|
|
||||||
outString += " Dest: " + portal.targetGate.getName();
|
|
||||||
outString += newline;
|
|
||||||
outString += " Origin: " + portal.getPortalLocation().x + 'x';
|
|
||||||
outString += " " + portal.getPortalLocation().y + 'y';
|
|
||||||
outString += newline;
|
|
||||||
|
|
||||||
Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
|
|
||||||
outString += " Offset: " + offset.x + "x " + offset.z + 'y';
|
|
||||||
outString += newline;
|
|
||||||
outString += newline;
|
|
||||||
|
|
||||||
}
|
|
||||||
outString += newline;
|
|
||||||
throwbackInfo(player, outString);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Displays a runegate's gate status";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
|
|
||||||
|
|
||||||
return "/gateinfo <target runegate> \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.net.client.ClientConnection;
|
|
||||||
import engine.net.client.msg.VendorDialogMsg;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class GetBankCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GetBankCmd() {
|
|
||||||
super("getbank");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
|
||||||
if (cc == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
VendorDialogMsg.getBank(pcSender, null, cc);
|
|
||||||
this.setTarget(pcSender); //for logging
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /getbank'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Opens bank window";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,11 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.InterestManagement.HeightMap;
|
import engine.InterestManagement.Terrain;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -22,205 +21,79 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public GetHeightCmd() {
|
public GetHeightCmd() {
|
||||||
super("getHeight");
|
super("getHeight");
|
||||||
this.addCmdString("height");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
boolean end = true;
|
Zone currentZone;
|
||||||
|
Zone parentZone;
|
||||||
|
Zone heightmapZone;
|
||||||
|
|
||||||
float height = HeightMap.getWorldHeight(pc);
|
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
||||||
|
heightmapZone = Terrain.getNextZoneWithTerrain(currentZone);
|
||||||
|
parentZone = Terrain.getNextZoneWithTerrain(currentZone.parent);
|
||||||
|
|
||||||
this.throwbackInfo(pc, "Altitude : " + height);
|
Vector2f childZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
|
||||||
|
Vector2f childZoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
|
||||||
|
Vector2f normalizedOffset = new Vector2f(Math.abs(childZoneOffset.x) / heightmapZone.template.major_radius,
|
||||||
|
Math.abs(childZoneOffset.y) / heightmapZone.template.minor_radius);
|
||||||
|
Vector2f parentZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), parentZone);
|
||||||
|
|
||||||
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
|
float childHeight = heightmapZone.terrain.getInterpolatedTerrainHeight(childZoneLoc);
|
||||||
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
|
childHeight = childHeight + heightmapZone.global_height;
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
float parentHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentZoneLoc);
|
||||||
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
|
parentHeight += parentZone.global_height;
|
||||||
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
|
|
||||||
|
|
||||||
if (end)
|
float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
|
||||||
return;
|
|
||||||
|
|
||||||
Vector2f gridSquare;
|
Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc);
|
||||||
Vector2f gridOffset;
|
Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1);
|
||||||
Vector2f parentGrid;
|
|
||||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
|
||||||
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
terrainCell.x = (float) Math.floor(terrainCell.x);
|
||||||
|
terrainCell.y = (float) Math.floor(terrainCell.y);
|
||||||
if (currentZone == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Zone parentZone = currentZone.getParent();
|
|
||||||
|
|
||||||
HeightMap heightMap = currentZone.getHeightMap();
|
|
||||||
|
|
||||||
|
|
||||||
//find the next parents heightmap if the currentzone heightmap is null.
|
short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y];
|
||||||
while (heightMap == null) {
|
short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y];
|
||||||
|
short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y + 1];
|
||||||
|
short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y + 1];
|
||||||
|
|
||||||
if (currentZone == ZoneManager.getSeaFloor()) {
|
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
|
||||||
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
|
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
|
||||||
break;
|
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName);
|
||||||
}
|
|
||||||
|
|
||||||
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
|
this.throwbackInfo(playerCharacter, "Player loc: " + "[" + playerCharacter.loc.x + "]" + "[" + playerCharacter.loc.y + "]" + "[" + playerCharacter.loc.z + "]");
|
||||||
this.throwbackInfo(pc, "Using parent zone instead: ");
|
|
||||||
currentZone = currentZone.getParent();
|
|
||||||
heightMap = currentZone.getHeightMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
this.throwbackInfo(playerCharacter, "Terrain Cell : " + "[" + terrainCell.x + "]" + "[" + terrainCell.y + "]");
|
||||||
|
this.throwbackInfo(playerCharacter, "Cell Offset : " + "[" + cell_offset.x + "]" + "[" + cell_offset.y + "]");
|
||||||
|
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]");
|
||||||
|
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]");
|
||||||
|
|
||||||
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
|
this.throwbackInfo(playerCharacter, "Child Zone Offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]");
|
||||||
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
|
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
|
||||||
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
|
this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend);
|
||||||
return;
|
this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y);
|
||||||
}
|
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset));
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
|
this.throwbackInfo(playerCharacter, "------------");
|
||||||
|
|
||||||
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
|
|
||||||
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
|
||||||
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
|
||||||
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
|
||||||
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
|
|
||||||
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
|
|
||||||
|
|
||||||
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
|
|
||||||
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
|
|
||||||
|
|
||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
|
||||||
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
|
||||||
} else
|
|
||||||
parentGrid = new Vector2f(-1, -1);
|
|
||||||
|
|
||||||
gridSquare = heightMap.getGridSquare(zoneLoc);
|
|
||||||
gridOffset = HeightMap.getGridOffset(gridSquare);
|
|
||||||
|
|
||||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, currentZone.getName());
|
|
||||||
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
|
|
||||||
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
|
|
||||||
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
|
|
||||||
|
|
||||||
if (parentGrid.x != -1) {
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
|
|
||||||
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
|
|
||||||
}
|
|
||||||
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
|
|
||||||
|
|
||||||
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
|
|
||||||
|
|
||||||
//OUTSET
|
|
||||||
if (parentZone != null) {
|
|
||||||
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
|
||||||
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
|
||||||
|
|
||||||
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
|
||||||
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
|
||||||
|
|
||||||
float bucketScaleX = 100 / parentXRadius;
|
|
||||||
float bucketScaleZ = 200 / parentZRadius;
|
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
|
||||||
float weight;
|
|
||||||
|
|
||||||
double scale;
|
|
||||||
|
|
||||||
|
|
||||||
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
|
||||||
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
|
|
||||||
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getAbsY();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
|
||||||
|
|
||||||
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
|
||||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
|
||||||
|
|
||||||
float scaleChild = (float) ((scale + 1) * .5);
|
|
||||||
float scaleParent = 1 - scaleChild;
|
|
||||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
|
||||||
|
|
||||||
parentCenterAltitude += currentZone.getYCoord();
|
|
||||||
parentCenterAltitude += interaltitude;
|
|
||||||
float firstScale = parentAltitude * scaleParent;
|
|
||||||
float secondScale = parentCenterAltitude * scaleChild;
|
|
||||||
float outsetALt = firstScale + secondScale;
|
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().getAbsY();
|
|
||||||
realWorldAltitude = outsetALt;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float strMod = pc.statStrBase - 40;
|
|
||||||
|
|
||||||
strMod *= .00999999998f;
|
|
||||||
|
|
||||||
strMod += 1f;
|
|
||||||
|
|
||||||
float radius = 0;
|
|
||||||
switch (pc.getRaceID()) {
|
|
||||||
case 2017:
|
|
||||||
radius = 3.1415927f;
|
|
||||||
case 2000:
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
strMod *= 1.5707964f;
|
|
||||||
|
|
||||||
strMod += 3.1415927f;
|
|
||||||
|
|
||||||
strMod -= .5f;
|
|
||||||
|
|
||||||
|
|
||||||
realWorldAltitude += strMod;
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
|
||||||
|
|
||||||
|
this.throwbackInfo(playerCharacter, "Child Height at loc: " + Math.ceil(childHeight));
|
||||||
|
this.throwbackInfo(playerCharacter, "Parent Height at loc: " + Math.ceil(parentHeight));
|
||||||
|
this.throwbackInfo(playerCharacter, "Blended Height (Ceil): " + blendedHeight + " (" + Math.ceil(blendedHeight) + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Temporarily Changes SubRace";
|
return "Queries heightmap engine";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /subrace mobBaseID";
|
return "' /getheight";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class GetMemoryCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GetMemoryCmd() {
|
|
||||||
super("getmemory");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMemoryOutput(long memory) {
|
|
||||||
String out = "";
|
|
||||||
if (memory > 1073741824)
|
|
||||||
return (memory / 1073741824) + "GB";
|
|
||||||
else if (memory > 1048576)
|
|
||||||
return (memory / 1048576) + "MB";
|
|
||||||
else if (memory > 1024)
|
|
||||||
return (memory / 1048576) + "KB";
|
|
||||||
else
|
|
||||||
return memory + "B";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
|
|
||||||
String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
|
|
||||||
String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
|
|
||||||
|
|
||||||
String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
|
|
||||||
throwbackInfo(pcSender, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /getmemory'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "lists memory usage";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -48,7 +48,7 @@ public class GetOffsetCmd extends AbstractDevCmd {
|
|||||||
float difY = pcSender.getLoc().y - zone.absY;
|
float difY = pcSender.getLoc().y - zone.absY;
|
||||||
float difZ = pcSender.getLoc().z - zone.absZ;
|
float difZ = pcSender.getLoc().z - zone.absZ;
|
||||||
|
|
||||||
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
|
throwbackInfo(pcSender, zone.zoneName + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ package engine.devcmd.cmds;
|
|||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.VendorDialogMsg;
|
import engine.net.client.handlers.VendorDialogMsgHandler;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public class GetVaultCmd extends AbstractDevCmd {
|
|||||||
if (cc == null)
|
if (cc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VendorDialogMsg.getVault(pcSender, null, cc);
|
VendorDialogMsgHandler.getVault(pcSender, null, cc);
|
||||||
this.setTarget(pcSender); //for logging
|
this.setTarget(pcSender); //for logging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class GetZoneCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GetZoneCmd() {
|
|
||||||
super("getzone");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (words.length != 1) {
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Zone> allIn = new ArrayList<>();
|
|
||||||
switch (words[0].toLowerCase()) {
|
|
||||||
case "all":
|
|
||||||
throwbackInfo(pcSender, "All zones currently in");
|
|
||||||
allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
|
|
||||||
break;
|
|
||||||
case "smallest":
|
|
||||||
throwbackInfo(pcSender, "Smallest zone currently in");
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
|
||||||
allIn.add(zone);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Zone zone : allIn)
|
|
||||||
throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /getzone smallest/all'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "lists what zones a player is in";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.ItemContainerType;
|
|
||||||
import engine.Enum.ItemType;
|
|
||||||
import engine.Enum.OwnerType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class GimmeCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GimmeCmd() {
|
|
||||||
super("gimme");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
int amt = 0;
|
|
||||||
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
|
|
||||||
amt = 10000000 - currentGold;
|
|
||||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
|
||||||
throwbackError(pc, "Failed to add gold to inventory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
|
||||||
|
|
||||||
if(pc.level < 75) {
|
|
||||||
pc.setLevel((short) 75);
|
|
||||||
ChatManager.chatSayInfo(pc, "Level set to 75");
|
|
||||||
}
|
|
||||||
pc.getCharItemManager().updateInventory();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Round up current gold in inventory to 10,000,000";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./gimme";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.Building;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class GotoBoundsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GotoBoundsCmd() {
|
|
||||||
super("gotobounds");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
String corner = words[0];
|
|
||||||
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
|
|
||||||
|
|
||||||
if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
|
|
||||||
this.throwbackError(player, "No Building Selected");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Building building = (Building) target;
|
|
||||||
|
|
||||||
if (building.getBounds() == null) {
|
|
||||||
this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float x = building.getBounds().getHalfExtents().x;
|
|
||||||
float z = building.getBounds().getHalfExtents().y;
|
|
||||||
|
|
||||||
if (building.getBlueprint() != null) {
|
|
||||||
x = building.getBlueprint().getExtents().x;
|
|
||||||
z = building.getBlueprint().getExtents().y;
|
|
||||||
}
|
|
||||||
|
|
||||||
float topLeftX = building.getLoc().x - x;
|
|
||||||
float topLeftY = building.getLoc().z - z;
|
|
||||||
|
|
||||||
float topRightX = building.getLoc().x + x;
|
|
||||||
float topRightY = building.getLoc().z - z;
|
|
||||||
|
|
||||||
float bottomLeftX = building.getLoc().x - x;
|
|
||||||
float bottomLeftY = building.getLoc().z + z;
|
|
||||||
|
|
||||||
float bottomRightX = building.getLoc().x + x;
|
|
||||||
float bottomRightY = building.getLoc().z + z;
|
|
||||||
|
|
||||||
|
|
||||||
switch (corner) {
|
|
||||||
case "topleft":
|
|
||||||
targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
|
|
||||||
break;
|
|
||||||
case "topright":
|
|
||||||
targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
|
|
||||||
break;
|
|
||||||
case "bottomleft":
|
|
||||||
targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
|
|
||||||
break;
|
|
||||||
case "bottomright":
|
|
||||||
targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
targetLoc = Vector3fImmutable.transform(building.getLoc(), targetLoc, building.getBounds().getRotationDegrees());
|
|
||||||
|
|
||||||
// Teleport player
|
|
||||||
|
|
||||||
if (targetLoc == Vector3fImmutable.ZERO) {
|
|
||||||
this.throwbackError(player, "Failed to locate UUID");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.teleport(targetLoc);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Teleports player to a UUID";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /gotoobj <UID>'";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd {
|
|||||||
continue;
|
continue;
|
||||||
Zone zone = city.getParent();
|
Zone zone = city.getParent();
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (zone.isNPCCity() || zone.isPlayerCity())
|
if (zone.isNPCCity || zone.guild_zone)
|
||||||
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||||
else
|
else
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
@@ -97,10 +97,10 @@ public class GotoCmd extends AbstractDevCmd {
|
|||||||
Zone zone = (Zone) zoneAgo;
|
Zone zone = (Zone) zoneAgo;
|
||||||
if (zone == null)
|
if (zone == null)
|
||||||
continue;
|
continue;
|
||||||
if (!zone.getName().equalsIgnoreCase(cityName))
|
if (!zone.zoneName.equalsIgnoreCase(cityName))
|
||||||
continue;
|
continue;
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (zone.isNPCCity() || zone.isPlayerCity())
|
if (zone.isNPCCity || zone.guild_zone)
|
||||||
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||||
else
|
else
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ./hotzone <- display the current hotzone & time remaining
|
||||||
|
* ./hotzone random <- change hotzone to random new zone
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HotzoneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public HotzoneCmd() {
|
||||||
|
super("hotzone");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
StringBuilder data = new StringBuilder();
|
||||||
|
String outString;
|
||||||
|
|
||||||
|
for (String s : words) {
|
||||||
|
data.append(s);
|
||||||
|
data.append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
String input = data.toString().trim();
|
||||||
|
|
||||||
|
if (input.length() == 0) {
|
||||||
|
outString = "Current hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
|
||||||
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
|
throwbackInfo(playerCharacter, outString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.equalsIgnoreCase("random")) {
|
||||||
|
ZoneManager.generateAndSetRandomHotzone();
|
||||||
|
outString = "New hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
|
||||||
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
|
throwbackInfo(playerCharacter, outString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.equalsIgnoreCase("reset")) {
|
||||||
|
ZoneManager.resetHotZones();
|
||||||
|
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "'./hotzone [random]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,13 +15,9 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.Enum.TargetColor;
|
import engine.Enum.TargetColor;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.powers.PowersBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import engine.util.StringUtils;
|
import engine.util.StringUtils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -257,9 +253,9 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
|
output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "RaceType: " + targetPC.getRace().getRaceType().name();
|
output += "RaceType: " + targetPC.race.getRaceType().name();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Race: " + targetPC.getRace().getName();
|
output += "Race: " + targetPC.race.getName();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Safe:" + targetPC.inSafeZone();
|
output += "Safe:" + targetPC.inSafeZone();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -282,7 +278,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "Account ID: UNKNOWN";
|
output += "Account ID: UNKNOWN";
|
||||||
|
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
|
output += "Inventory Weight:" + (targetPC.charItemManager.getInventoryWeight() + targetPC.charItemManager.getEquipWeight());
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
|
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -295,7 +291,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "inFloor :" + targetPC.getInFloorID();
|
output += "inFloor :" + targetPC.getInFloorID();
|
||||||
output += newline;
|
output += newline;
|
||||||
|
|
||||||
BaseClass baseClass = targetPC.getBaseClass();
|
BaseClass baseClass = targetPC.baseClass;
|
||||||
|
|
||||||
if (baseClass != null)
|
if (baseClass != null)
|
||||||
output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
|
output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
|
||||||
@@ -335,18 +331,13 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "Movement State: " + targetPC.getMovementState().name();
|
output += "Movement State: " + targetPC.getMovementState().name();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Movement Speed: " + targetPC.getSpeed();
|
output += "Movement Speed: " + targetPC.getSpeed();
|
||||||
output += newline;
|
|
||||||
output += "Altitude : " + targetPC.getLoc().y;
|
output += "Altitude : " + targetPC.getLoc().y;
|
||||||
output += newline;
|
|
||||||
output += "Swimming : " + targetPC.isSwimming();
|
output += "Swimming : " + targetPC.isSwimming();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "isMoving : " + targetPC.isMoving();
|
output += "isMoving : " + targetPC.isMoving();
|
||||||
output += newline;
|
|
||||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier + newline;
|
|
||||||
output += "Hidden : " + targetPC.getHidden() + newline;
|
|
||||||
output += "Target Loc: " + targetPC.loc + newline;
|
|
||||||
output += "Player Loc: " + pc.loc + newline;
|
|
||||||
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -396,7 +387,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
|
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().templateID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +440,9 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "isSummonedPet: true";
|
output += "isSummonedPet: true";
|
||||||
else
|
else
|
||||||
output += "isSummonedPet: false";
|
output += "isSummonedPet: false";
|
||||||
PlayerCharacter owner = targetMob.getOwner();
|
|
||||||
|
|
||||||
|
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
output += " owner: " + owner.getObjectUUID();
|
output += " owner: " + owner.getObjectUUID();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -480,7 +473,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "EquipSet: " + targetMob.equipmentSetID;
|
output += "EquipSet: " + targetMob.equipmentSetID;
|
||||||
output += newline;
|
output += newline;
|
||||||
try {
|
try {
|
||||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
|
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//who cares
|
//who cares
|
||||||
}
|
}
|
||||||
@@ -501,31 +494,28 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "No building found." + newline;
|
output += "No building found." + newline;
|
||||||
}
|
}
|
||||||
|
int max = (int) (4.882 * targetMob.level + 121.0);
|
||||||
output += "Damage: " + targetMob.mobBase.getDamageMin() + " - " + targetMob.mobBase.getDamageMax() + newline;
|
if (max > 321) {
|
||||||
output += "ATR: " + targetMob.mobBase.getAttackRating() + newline;
|
max = 321;
|
||||||
output += "DEF: " + targetMob.defenseRating + newline;
|
|
||||||
output += "RANGE: " + targetMob.getRange() + newline;
|
|
||||||
output += "Effects:" + newline;
|
|
||||||
for(MobBaseEffects mbe : targetMob.mobBase.mobbaseEffects){
|
|
||||||
EffectsBase eb = PowersManager.getEffectByToken(mbe.getToken());
|
|
||||||
output += eb.getName() + newline;
|
|
||||||
}
|
}
|
||||||
|
int min = (int) (4.469 * targetMob.level - 3.469);
|
||||||
|
output += "Min Loot Roll = " + min;
|
||||||
|
output += "Max Loot Roll = " + max;
|
||||||
break;
|
break;
|
||||||
case Item: //intentional passthrough
|
case Item: //intentional passthrough
|
||||||
case MobLoot:
|
case MobLoot:
|
||||||
Item item = (Item) target;
|
Item item = (Item) target;
|
||||||
ItemBase itemBase = item.getItemBase();
|
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||||
output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
|
output += StringUtils.addWS("Template: " + template.template_id, 20);
|
||||||
output += "Weight: " + itemBase.getWeight();
|
output += "Weight: " + template.item_wt;
|
||||||
output += newline;
|
output += newline;
|
||||||
DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
|
DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
|
||||||
output += StringUtils.addWS("Qty: "
|
output += StringUtils.addWS("Qty: "
|
||||||
+ df.format(item.getNumOfItems()), 20);
|
+ df.format(item.getNumOfItems()), 20);
|
||||||
output += "Charges: " + item.getChargesRemaining()
|
output += "Charges: " + (byte) item.chargesRemaining
|
||||||
+ '/' + item.getChargesMax();
|
+ '/' + item.template.item_initial_charges;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Name: " + itemBase.getName();
|
output += "Name: " + template.item_base_name;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += item.getContainerInfo();
|
output += item.getContainerInfo();
|
||||||
|
|
||||||
@@ -541,13 +531,6 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Corpse:
|
|
||||||
Corpse corpse = (Corpse)target;
|
|
||||||
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
|
|
||||||
output += "Despawn in: " + timeLeft;
|
|
||||||
output += newline;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throwbackInfo(pc, output);
|
throwbackInfo(pc, output);
|
||||||
|
|||||||
@@ -111,12 +111,12 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity()) {
|
if (!zone.guild_zone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.getPlayerCityUUID());
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
@@ -167,7 +167,7 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stone.addEffectBit((1 << 19));
|
stone.addEffectBit((1 << 19));
|
||||||
stone.setRank((byte) rank);
|
BuildingManager.setRank(stone, (byte) rank);
|
||||||
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
||||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
||||||
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.ItemContainerType;
|
|
||||||
import engine.Enum.ItemType;
|
import engine.Enum.ItemType;
|
||||||
import engine.Enum.OwnerType;
|
import engine.Enum.OwnerType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
@@ -17,8 +16,6 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*/
|
*/
|
||||||
@@ -32,48 +29,6 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
if (words[0].equals("resources")) {
|
|
||||||
for (int ibID : Warehouse.getMaxResources().keySet()) {
|
|
||||||
if (ibID == 7)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(ibID);
|
|
||||||
|
|
||||||
short weight = ib.getWeight();
|
|
||||||
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
|
|
||||||
throwbackError(pc, "Not enough room in inventory for any more of this item");
|
|
||||||
|
|
||||||
pc.getCharItemManager().updateInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean worked = false;
|
|
||||||
Item item = new Item(ib, pc.getObjectUUID(),
|
|
||||||
OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
|
|
||||||
true, false, ItemContainerType.INVENTORY, (byte) 0,
|
|
||||||
new ArrayList<>(), "");
|
|
||||||
|
|
||||||
item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
|
|
||||||
|
|
||||||
try {
|
|
||||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
|
||||||
worked = true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item == null || !worked) {
|
|
||||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//add item to inventory
|
|
||||||
pc.getCharItemManager().addItemToInventory(item);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (words.length < 3 || words.length > 5) {
|
if (words.length < 3 || words.length > 5) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
@@ -103,16 +58,23 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
numItems = (numItems > 5000) ? 5000 : numItems;
|
numItems = (numItems > 5000) ? 5000 : numItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
int itembaseID;
|
int templateID;
|
||||||
|
ItemTemplate template;
|
||||||
try {
|
try {
|
||||||
itembaseID = Integer.parseInt(words[0]);
|
templateID = Integer.parseInt(words[0]);
|
||||||
} catch (NumberFormatException e) {
|
template = ItemTemplate.templates.get(words[0].toLowerCase());
|
||||||
itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
|
|
||||||
if (itembaseID == 0) {
|
if (template == null) {
|
||||||
throwbackError(pc, "Supplied type " + words[0]
|
throwbackError(pc, "Supplied type " + words[0]
|
||||||
+ " failed to parse to an Integer");
|
+ " failed to parse to an Integer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (template.item_type == ItemType.GOLD) {
|
||||||
|
this.throwbackInfo(pc, "use /addgold to add gold.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throwbackError(pc,
|
throwbackError(pc,
|
||||||
"An unknown exception occurred when trying to use createitem command for type "
|
"An unknown exception occurred when trying to use createitem command for type "
|
||||||
@@ -120,10 +82,6 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itembaseID == 7) {
|
|
||||||
this.throwbackInfo(pc, "use /addgold to add gold.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
@@ -174,57 +132,54 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ItemBase ib = ItemBase.getItemBase(itembaseID);
|
template = ItemTemplate.templates.get(templateID);
|
||||||
if (ib == null) {
|
|
||||||
throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
|
if (template == null) {
|
||||||
|
throwbackError(pc, "Unable to find template " + templateID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((numItems > 1)
|
if ((numItems > 1)
|
||||||
&& (ib.getType().equals(ItemType.RESOURCE) == false)
|
&& (template.item_type.equals(ItemType.RESOURCE) == false)
|
||||||
&& (ib.getType().equals(ItemType.OFFERING)) == false)
|
&& (template.item_type.equals(ItemType.OFFERING)) == false)
|
||||||
numItems = 1;
|
numItems = 1;
|
||||||
|
|
||||||
CharacterItemManager cim = pc.getCharItemManager();
|
CharacterItemManager cim = pc.charItemManager;
|
||||||
|
|
||||||
if (cim == null) {
|
if (cim == null) {
|
||||||
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte charges = (byte) ib.getNumCharges();
|
|
||||||
short dur = (short) ib.getDurability();
|
|
||||||
|
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
for (int i = 0; i < quantity; i++) {
|
for (int i = 0; i < quantity; i++) {
|
||||||
short weight = ib.getWeight();
|
|
||||||
|
int weight = template.item_wt;
|
||||||
|
|
||||||
if (!cim.hasRoomInventory(weight)) {
|
if (!cim.hasRoomInventory(weight)) {
|
||||||
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
|
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
cim.updateInventory();
|
cim.updateInventory();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean worked = false;
|
Item item = new Item(templateID);
|
||||||
Item item = new Item(ib, pc.getObjectUUID(),
|
item.ownerID = pc.getObjectUUID();
|
||||||
OwnerType.PlayerCharacter, charges, charges, dur, dur,
|
item.ownerType = OwnerType.PlayerCharacter;
|
||||||
true, false, ItemContainerType.INVENTORY, (byte) 0,
|
|
||||||
new ArrayList<>(), "");
|
|
||||||
if (numItems > 1)
|
if (numItems > 1)
|
||||||
item.setNumOfItems(numItems);
|
item.setNumOfItems(numItems);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
item = DbManager.ItemQueries.PERSIST(item);
|
||||||
worked = true;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
|
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null || !worked) {
|
|
||||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//create prefix
|
//create prefix
|
||||||
if (!prefix.isEmpty())
|
if (!prefix.isEmpty())
|
||||||
item.addPermanentEnchantmentForDev(prefix, 0);
|
item.addPermanentEnchantmentForDev(prefix, 0);
|
||||||
@@ -243,12 +198,12 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Creates an item of type 'itembaseID' with a prefix and suffix";
|
return "Creates an item of type templateID with a prefix and suffix";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "'./makeitem itembaseID PrefixID SuffixID [quantity] [numResources]'";
|
return "'./makeitem templateID PrefixID SuffixID [quantity] [numResources]'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.workthreads.HalfHourlyJobThread;
|
|
||||||
import engine.workthreads.HourlyJobThread;
|
import engine.workthreads.HourlyJobThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,10 +41,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
|||||||
String trigger = args[0];
|
String trigger = args[0];
|
||||||
switch (trigger) {
|
switch (trigger) {
|
||||||
case "true":
|
case "true":
|
||||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
HourlyJobThread.mineWindowOpen(mine);
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
HalfHourlyJobThread.mineWindowClose(mine);
|
HourlyJobThread.mineWindowClose(mine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -47,13 +47,17 @@ public class PrintBankCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||||
ArrayList<Item> list = cim.getBank();
|
ArrayList<Item> list = cim.getBank();
|
||||||
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
|
|
||||||
for (Item item : list) {
|
for (Item item : list) {
|
||||||
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
|
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||||
|
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
Item gold = cim.getGoldBank();
|
Item gold = cim.getGoldBank();
|
||||||
|
|
||||||
if (gold != null)
|
if (gold != null)
|
||||||
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
|
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ public class PrintBonusesCmd extends AbstractDevCmd {
|
|||||||
if (target instanceof Item) {
|
if (target instanceof Item) {
|
||||||
type = "Item";
|
type = "Item";
|
||||||
tar = (Item) target;
|
tar = (Item) target;
|
||||||
name = ((Item) tar).getItemBase().getName();
|
ItemTemplate template = ItemTemplate.templates.get(((Item) tar).templateID);
|
||||||
|
name = template.item_base_name;
|
||||||
} else if (target instanceof AbstractCharacter) {
|
} else if (target instanceof AbstractCharacter) {
|
||||||
tar = (AbstractCharacter) target;
|
tar = (AbstractCharacter) target;
|
||||||
name = ((AbstractCharacter) tar).getFirstName();
|
name = ((AbstractCharacter) tar).getFirstName();
|
||||||
|
|||||||
+19
-16
@@ -9,46 +9,49 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DecachePlayerCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public DecachePlayerCmd() {
|
public class PrintEffectsCmd extends AbstractDevCmd {
|
||||||
super("decacheplayer");
|
|
||||||
|
public PrintEffectsCmd() {
|
||||||
|
super("printeffects");
|
||||||
|
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (words.length < 1) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
int objectUUID = Integer.parseInt(words[0]);
|
AbstractCharacter tar;
|
||||||
|
|
||||||
if (DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
|
if (target != null && target instanceof AbstractCharacter) {
|
||||||
this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
|
tar = (AbstractCharacter) target;
|
||||||
PlayerCharacter.getFromCache(objectUUID).removeFromCache();
|
|
||||||
} else {
|
String newline = "\r\n ";
|
||||||
this.sendHelp(pc);
|
String output = "Effects For Character: " + tar.getName() + newline;
|
||||||
|
|
||||||
|
for (String effect : tar.effects.keySet()) {
|
||||||
|
output += effect + newline;
|
||||||
|
}
|
||||||
|
throwbackInfo(pc, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "No player found. Please make sure the table ID is correct.";
|
return "Returns the player's current stats";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /decacheplayer <UUID>'";
|
return "' /printstats'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
@@ -63,9 +64,9 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.Mob) {
|
if (tar.getObjectType() == GameObjectType.Mob) {
|
||||||
Mob tarMob = (Mob) tar;
|
Mob tarMob = (Mob) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (int slot : tarMob.getEquip().keySet()) {
|
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||||
MobEquipment equip = tarMob.getEquip().get(slot);
|
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||||
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
|
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -73,19 +74,20 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.NPC) {
|
if (tar.getObjectType() == GameObjectType.NPC) {
|
||||||
NPC tarMob = (NPC) tar;
|
NPC tarMob = (NPC) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (int slot : tarMob.getEquip().keySet()) {
|
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||||
MobEquipment equip = tarMob.getEquip().get(slot);
|
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||||
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
|
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||||
ConcurrentHashMap<Integer, Item> list = cim.getEquipped();
|
ConcurrentHashMap<Enum.EquipSlotType, Item> list = cim.getEquipped();
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (Integer slot : list.keySet()) {
|
|
||||||
|
for (Enum.EquipSlotType slot : list.keySet()) {
|
||||||
Item item = list.get(slot);
|
Item item = list.get(slot);
|
||||||
throwbackInfo(pc, " " + item.getItemBase().getName() + ", slot: " + slot);
|
throwbackInfo(pc, " " + item.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class PrintInventoryCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterItemManager cim = tar.getCharItemManager();
|
CharacterItemManager cim = tar.charItemManager;
|
||||||
inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
|
inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
|
||||||
gold = cim.getGoldInventory();
|
gold = cim.getGoldInventory();
|
||||||
throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
|
throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
|
||||||
@@ -75,14 +75,18 @@ public class PrintInventoryCmd extends AbstractDevCmd {
|
|||||||
int goldCount = 0;
|
int goldCount = 0;
|
||||||
|
|
||||||
for (Item item : inventory) {
|
for (Item item : inventory) {
|
||||||
if (item.getItemBase().getType().equals(ItemType.GOLD) == false) {
|
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||||
|
|
||||||
|
if (item.template.item_type.equals(ItemType.GOLD) == false) {
|
||||||
|
|
||||||
String chargeInfo = "";
|
String chargeInfo = "";
|
||||||
byte chargeMax = item.getChargesMax();
|
int chargeMax = template.item_initial_charges;
|
||||||
|
|
||||||
if (chargeMax > 0) {
|
if (chargeMax > 0) {
|
||||||
byte charges = item.getChargesRemaining();
|
int charges = item.chargesRemaining;
|
||||||
chargeInfo = " charges: " + charges + '/' + chargeMax;
|
chargeInfo = " charges: " + charges + '/' + chargeMax;
|
||||||
}
|
}
|
||||||
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
|
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems() + chargeInfo);
|
||||||
} else
|
} else
|
||||||
goldCount += item.getNumOfItems();
|
goldCount += item.getNumOfItems();
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-22
@@ -10,48 +10,49 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.CharacterRune;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class DebugMeleeSyncCmd extends AbstractDevCmd {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public DebugMeleeSyncCmd() {
|
public class PrintRunesCmd extends AbstractDevCmd {
|
||||||
super("debugmeleesync");
|
|
||||||
|
public PrintRunesCmd() {
|
||||||
|
super("printrunes");
|
||||||
|
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
// Arg Count Check
|
|
||||||
if (words.length != 1) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String s = words[0].toLowerCase();
|
AbstractCharacter tar;
|
||||||
|
|
||||||
if (s.equals("on")) {
|
if (target != null && target instanceof AbstractCharacter) {
|
||||||
pc.setDebug(64, true);
|
tar = (AbstractCharacter) target;
|
||||||
ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
|
|
||||||
} else if (s.equals("off")) {
|
String newline = "\r\n ";
|
||||||
pc.setDebug(64, false);
|
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
|
||||||
ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
|
|
||||||
} else {
|
for (CharacterRune rune : ((AbstractCharacter) target).runes) {
|
||||||
this.sendUsage(pc);
|
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
|
||||||
|
}
|
||||||
|
throwbackInfo(pc, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Turns on/off melee sync debugging.";
|
return "Returns the player's current stats";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "'./debugmeleesync on|off'";
|
return "' /printstats'";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,8 +49,6 @@ public class PrintSkillsCmd extends AbstractDevCmd {
|
|||||||
+ skill.getModifiedAmount() + '('
|
+ skill.getModifiedAmount() + '('
|
||||||
+ skill.getTotalSkillPercet() + " )");
|
+ skill.getTotalSkillPercet() + " )");
|
||||||
}
|
}
|
||||||
//throwbackInfo(pc, "= = = = = NEW CALCULATIONS = = = = =");
|
|
||||||
// PlayerCombatStats.PrintSkillsToClient(pc);
|
|
||||||
} else
|
} else
|
||||||
throwbackInfo(pc, "Skills not found for player");
|
throwbackInfo(pc, "Skills not found for player");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -24,17 +21,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public PrintStatsCmd() {
|
public PrintStatsCmd() {
|
||||||
super("printstats");
|
super("printstats");
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,50 +44,32 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
|
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
||||||
String newOut = "Server stats for Player " + tar.getFirstName() + newline;
|
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||||
newOut += "HEALTH: " + tar.getHealth() + " / " + tar.getHealthMax() + newline;
|
out += "Stats Base (Modified)" + newline;
|
||||||
newOut += "MANA: " + tar.getMana() + " / " + tar.getManaMax() + newline;
|
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||||
newOut += "STAMINA: " + tar.getStamina() + " / " + tar.getStaminaMax() + newline;
|
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||||
newOut += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||||
newOut += "Stats Base (Modified)" + newline;
|
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||||
newOut += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||||
newOut += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
throwbackInfo(pc, out);
|
||||||
newOut += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
|
||||||
newOut += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
|
||||||
newOut += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
|
||||||
newOut += "Move Speed: " + tar.getSpeed() + newline;
|
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||||
newOut += "Health Regen: " + tar.combatStats.healthRegen + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||||
newOut += "Mana Regen: " + tar.combatStats.manaRegen + newline;
|
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||||
newOut += "Stamina Regen: " + tar.combatStats.staminaRegen + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
newOut += "DEFENSE: " + tar.combatStats.defense + newline;
|
throwbackInfo(pc, out);
|
||||||
newOut += "HAND ONE" + newline;
|
|
||||||
newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
|
|
||||||
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
|
|
||||||
newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
|
|
||||||
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
|
|
||||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
|
|
||||||
newOut += "HAND TWO" + newline;
|
|
||||||
newOut += "ATR: " + tar.combatStats.atrHandTwo + newline;
|
|
||||||
newOut += "MIN: " + tar.combatStats.minDamageHandTwo + newline;
|
|
||||||
newOut += "MAX: " + tar.combatStats.maxDamageHandTwo + newline;
|
|
||||||
newOut += "RANGE: " + tar.combatStats.rangeHandTwo + newline;
|
|
||||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandTwo + newline;
|
|
||||||
newOut += "=== POWERS ===" + newline;
|
|
||||||
for(CharacterPower power : pc.getPowers().values()){
|
|
||||||
if(power.getPower().requiresHitRoll) {
|
|
||||||
newOut += power.getPower().name + " ATR: " + Math.round(PlayerCombatStats.getSpellAtr(pc,power.getPower())) + newline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, newOut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
||||||
|
|
||||||
MobBase mb = tar.getMobBase();
|
MobBase mb = tar.getMobBase();
|
||||||
|
|
||||||
if (mb == null)
|
if (mb == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
String out = "Server stats for Mob " + mb.getFirstName() + newline;
|
String out = "Server stats for Mob " + mb.getFirstName() + newline;
|
||||||
out += "Stats Base (Modified)" + newline;
|
out += "Stats Base (Modified)" + newline;
|
||||||
@@ -117,23 +85,21 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
out += "Defense: " + tar.getDefenseRating() + newline;
|
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||||
|
|
||||||
//get weapons
|
//get weapons
|
||||||
HashMap<Integer, MobEquipment> equip = tar.getEquip();
|
|
||||||
ItemBase main = null;
|
|
||||||
|
|
||||||
if (equip != null)
|
if (tar.charItemManager.equipped.isEmpty() == false)
|
||||||
main = getWeaponBase(1, equip);
|
if (tar.charItemManager.equipped.get(Enum.EquipSlotType.LHELD) != null && !ItemTemplate.isShield(tar.charItemManager.equipped.get(Enum.EquipSlotType.LHELD))) {
|
||||||
ItemBase off = null;
|
//off hand weapon
|
||||||
|
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
||||||
|
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
||||||
|
out += "Range: " + tar.rangeHandTwo + newline;
|
||||||
|
out += "Attack Speed: " + tar.speedHandTwo + newline;
|
||||||
|
} else {
|
||||||
|
out += "Attack Rating: " + tar.atrHandOne + newline;
|
||||||
|
out += "Damage: " + tar.minDamageHandOne + " - " + tar.maxDamageHandOne + newline;
|
||||||
|
out += "Range: " + tar.rangeHandOne + newline;
|
||||||
|
out += "Attack Speed: " + tar.speedHandOne + newline;
|
||||||
|
}
|
||||||
|
|
||||||
if (equip != null)
|
|
||||||
getWeaponBase(2, equip);
|
|
||||||
if (main == null && off == null) {
|
|
||||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
|
|
||||||
} else {
|
|
||||||
if (main != null)
|
|
||||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
|
|
||||||
if (off != null)
|
|
||||||
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
|
|
||||||
}
|
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
|
|
||||||
throwbackInfo(pc, out);
|
throwbackInfo(pc, out);
|
||||||
|
|||||||
@@ -46,11 +46,12 @@ public class PrintVaultCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
|
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||||
ArrayList<Item> list = cim.getVault();
|
ArrayList<Item> list = cim.getVault();
|
||||||
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (Item item : list) {
|
for (Item item : list) {
|
||||||
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
|
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||||
|
throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems());
|
||||||
}
|
}
|
||||||
Item gold = cim.getGoldVault();
|
Item gold = cim.getGoldVault();
|
||||||
if (gold != null)
|
if (gold != null)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
|
private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
|
||||||
|
|
||||||
if (!zone.isPlayerCity())
|
if (!zone.guild_zone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Building building : zone.zoneBuildingSet) {
|
for (Building building : zone.zoneBuildingSet) {
|
||||||
@@ -59,22 +59,25 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(GameObjectType.NPC,
|
DbManager.removeFromCache(GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : mobA.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -151,10 +154,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -163,10 +167,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : mobA.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ public class RealmInfoCmd extends AbstractDevCmd {
|
|||||||
outString += ")";
|
outString += ")";
|
||||||
outString += newline;
|
outString += newline;
|
||||||
|
|
||||||
outString += " Zone: " + serverZone.getName();
|
outString += " Zone: " + serverZone.zoneName;
|
||||||
|
|
||||||
outString += newline;
|
outString += newline;
|
||||||
|
|
||||||
if (serverZone.getParent() != null)
|
if (serverZone.parent != null)
|
||||||
outString += " Parent: " + serverZone.getParent().getName();
|
outString += " Parent: " + serverZone.parent.zoneName;
|
||||||
else
|
else
|
||||||
outString += "Parent: NONE";
|
outString += "Parent: NONE";
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,8 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class RegionCmd extends AbstractDevCmd {
|
public class RegionCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -25,42 +23,28 @@ public class RegionCmd extends AbstractDevCmd {
|
|||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
String newline = "\r\n ";
|
||||||
|
String output;
|
||||||
|
output = "Target Region Information:" + newline;
|
||||||
|
|
||||||
if (pc.region == null) {
|
Building building = BuildingManager.getBuildingAtLocation(((AbstractCharacter) target).loc);
|
||||||
|
if (building == null) {
|
||||||
|
this.throwbackInfo(pc, "No Building At This Location.");
|
||||||
|
}
|
||||||
|
Regions region = ((AbstractCharacter) target).region;
|
||||||
|
if (region == null) {
|
||||||
this.throwbackInfo(pc, "No Region Found.");
|
this.throwbackInfo(pc, "No Region Found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (region != null) {
|
||||||
String newLine = System.getProperty("line.separator");
|
output += "Player Info: " + ((AbstractCharacter) target).getName() + newline;
|
||||||
String result = "";
|
output += "Region Building: " + building.getName() + newline;
|
||||||
result += (pc.region.getClass().getSimpleName());
|
output += "Region Height: " + region.lerpY((AbstractCharacter) target) + newline;
|
||||||
result += (" {");
|
output += "is Stairs: " + region.isStairs() + newline;
|
||||||
result += (newLine);
|
output += "is Outside: " + region.isOutside();
|
||||||
Field[] fields = pc.region.getClass().getDeclaredFields();
|
this.throwbackInfo(pc, output);
|
||||||
|
|
||||||
//print field names paired with their values
|
|
||||||
for (Field field : fields) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
result += (" ");
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (field.getName().contains("Furniture"))
|
|
||||||
continue;
|
|
||||||
result += (field.getName());
|
|
||||||
result += (": ");
|
|
||||||
//requires access to private field:
|
|
||||||
result += (field.get(pc.region).toString());
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
System.out.println(ex);
|
|
||||||
}
|
|
||||||
result.trim();
|
|
||||||
result += (newLine);
|
|
||||||
}
|
}
|
||||||
result += ("}");
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, result.toString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ public class RemoveBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity()) {
|
if (!zone.guild_zone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.getPlayerCityUUID());
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
import engine.Enum.BuildingGroup;
|
||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
@@ -131,56 +130,23 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
building.disableSpire(false);
|
building.disableSpire(false);
|
||||||
|
|
||||||
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
|
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
|
||||||
City city = City.getCity(building.getParentZone().getPlayerCityUUID());
|
City city = City.getCity(building.getParentZone().playerCityUUID);
|
||||||
if (city != null) {
|
|
||||||
city.setWarehouseBuildingID(0);
|
|
||||||
}
|
|
||||||
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DbManager.WarehouseQueries.DELETE_WAREHOUSE(city.warehouse);
|
||||||
|
city.warehouse = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//remove cached shrines.
|
//remove cached shrines.
|
||||||
if ((building.getBlueprintUUID() != 0)
|
if ((building.getBlueprintUUID() != 0)
|
||||||
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
||||||
Shrine.RemoveShrineFromCacheByBuilding(building);
|
Shrine.RemoveShrineFromCacheByBuilding(building);
|
||||||
|
|
||||||
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
// Remove hirelings for this building
|
||||||
NPC npc = null;
|
|
||||||
Mob mobA = null;
|
|
||||||
|
|
||||||
if (ac.getObjectType() == GameObjectType.NPC)
|
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
|
||||||
npc = (NPC) ac;
|
BuildingManager.removeHireling(building, abstractCharacter);
|
||||||
else if (ac.getObjectType() == GameObjectType.Mob)
|
|
||||||
mobA = (Mob) ac;
|
|
||||||
|
|
||||||
if (npc != null) {
|
|
||||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
|
||||||
WorldGrid.removeObject(mob, pc);
|
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
}
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
|
||||||
DbManager.removeFromCache(npc);
|
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
|
||||||
WorldGrid.removeObject(npc, pc);
|
|
||||||
} else if (mobA != null) {
|
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
|
||||||
WorldGrid.removeObject(mob, pc);
|
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
}
|
|
||||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
|
||||||
DbManager.removeFromCache(mobA);
|
|
||||||
WorldGrid.RemoveWorldObject(mobA);
|
|
||||||
WorldGrid.removeObject(mobA, pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Zone zone = building.getParentZone();
|
Zone zone = building.getParentZone();
|
||||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||||
DbManager.removeFromCache(building);
|
DbManager.removeFromCache(building);
|
||||||
@@ -209,11 +175,13 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
if (mob.getParentZone() != null)
|
WorldGrid.removeObject(minionMob, pc);
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
|
if (minionMob.getParentZone() != null)
|
||||||
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class ResetLevelCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public ResetLevelCmd() {
|
|
||||||
super("resetlevel");
|
|
||||||
}
|
|
||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter player, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
player.ResetLevel(Short.parseShort(args[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Resets character level to `level`. All training points are reset. Player must relog for changes to update.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
|
|
||||||
|
|
||||||
return "/resetlevel <level>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -41,12 +41,12 @@ public class SetBaneActiveCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity()) {
|
if (!zone.guild_zone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.getPlayerCityUUID());
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public class SetForceRenameCityCmd extends AbstractDevCmd {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return;
|
return;
|
||||||
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
||||||
if (zone.getPlayerCityUUID() == 0)
|
if (zone.playerCityUUID == 0)
|
||||||
return;
|
return;
|
||||||
City city = City.getCity(zone.getPlayerCityUUID());
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return;
|
return;
|
||||||
city.setForceRename(rename);
|
city.setForceRename(rename);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level < 1 || level > 80) {
|
if (level < 1 || level > 75) {
|
||||||
this.sendHelp(pc);
|
this.sendHelp(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
|
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.MaintenanceManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.Building;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class SetMaintCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SetMaintCmd() {
|
|
||||||
super("setMaint");
|
|
||||||
this.addCmdString("setmaint");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
if (!target.getObjectType().equals(Enum.GameObjectType.Building)) {
|
|
||||||
ChatManager.chatSayInfo(player, "Target is not a valid building");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Building targetBuilding = (Building) target;
|
|
||||||
|
|
||||||
if (targetBuilding.getProtectionState().equals(Enum.ProtectionState.NPC)) {
|
|
||||||
ChatManager.chatSayInfo(player, "Target is not a valid building");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MaintenanceManager.setMaintDateTime(targetBuilding, LocalDateTime.now().minusDays(1).withHour(13).withMinute(0).withSecond(0).withNano(0));
|
|
||||||
ChatManager.chatSayInfo(player, "Maint will run for UUID: " + targetBuilding.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Sets the Rank of either the targets object or the object specified by ID.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.Building;
|
|
||||||
import engine.objects.Mine;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class SetMineExpansion extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SetMineExpansion() {
|
|
||||||
super("setexpansion");
|
|
||||||
this.addCmdString("setexpansion");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
|
|
||||||
if (target.getObjectType() != GameObjectType.Building)
|
|
||||||
return;
|
|
||||||
Building mineBuilding = BuildingManager.getBuilding(target.getObjectUUID());
|
|
||||||
if (mineBuilding == null)
|
|
||||||
return;
|
|
||||||
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
|
|
||||||
if (mine == null)
|
|
||||||
return;
|
|
||||||
int bit = 2;
|
|
||||||
switch (args[0].toUpperCase()) {
|
|
||||||
case "ON":
|
|
||||||
|
|
||||||
bit |= mine.getFlags();
|
|
||||||
if (!DbManager.MineQueries.SET_FLAGS(mine, bit))
|
|
||||||
return;
|
|
||||||
mine.setFlags(bit);
|
|
||||||
ChatManager.chatSystemInfo(pcSender, mine.getZoneName() + "'s " + mine.getMineType().name + " is now an expansion mine.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "OFF":
|
|
||||||
bit &= ~mine.getFlags();
|
|
||||||
if (!DbManager.MineQueries.SET_FLAGS(mine, bit))
|
|
||||||
return;
|
|
||||||
mine.setFlags(bit);
|
|
||||||
ChatManager.chatSystemInfo(pcSender, mine.getZoneName() + "'s " + mine.getMineType().name + " is no longer an expansion mine.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /setmineexpansion on|off";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "enables or disables an expansion type for a mine.";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class SetMineTypeCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SetMineTypeCmd() {
|
|
||||||
super("setminetype");
|
|
||||||
this.addCmdString("setminetype");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
MineProduction mineType = MineProduction.valueOf(args[0].toUpperCase());
|
|
||||||
if (mineType == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (target.getObjectType() != GameObjectType.Building)
|
|
||||||
return;
|
|
||||||
Building mineBuilding = BuildingManager.getBuilding(target.getObjectUUID());
|
|
||||||
if (mineBuilding == null)
|
|
||||||
return;
|
|
||||||
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
|
|
||||||
if (mine == null)
|
|
||||||
return;
|
|
||||||
if (!DbManager.MineQueries.CHANGE_TYPE(mine, mineType))
|
|
||||||
return;
|
|
||||||
mine.setMineType(mineType.name());
|
|
||||||
ChatManager.chatSystemInfo(pcSender, "The mine in " + mine.getZoneName() + " is now a(n) " + mine.getMineType().name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /setminetype gold|ore|magic|lumber";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Changes the mine type of the current mine.";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.MobBase;
|
|
||||||
import engine.objects.NPC;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public static int lastEquipSetID = 0;
|
|
||||||
|
|
||||||
public SetNpcEquipSetCmd() {
|
|
||||||
super("setEquipSet");
|
|
||||||
this.addCmdString("equipset");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
// Arg Count Check
|
|
||||||
if (words.length != 1) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.getObjectType() != GameObjectType.NPC) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NPC npc = (NPC) target;
|
|
||||||
|
|
||||||
if (words[0].equalsIgnoreCase("next")) {
|
|
||||||
|
|
||||||
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID = 1;
|
|
||||||
else
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID++;
|
|
||||||
|
|
||||||
boolean complete = false;
|
|
||||||
|
|
||||||
while (complete == false) {
|
|
||||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
|
||||||
|
|
||||||
if (!complete) {
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID++;
|
|
||||||
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (complete) {
|
|
||||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
|
||||||
WorldGrid.updateObject(npc);
|
|
||||||
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (words[0].equalsIgnoreCase("last")) {
|
|
||||||
|
|
||||||
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID = 1222;
|
|
||||||
else
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID--;
|
|
||||||
|
|
||||||
boolean complete = false;
|
|
||||||
|
|
||||||
while (complete == false) {
|
|
||||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
|
||||||
|
|
||||||
if (!complete) {
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID--;
|
|
||||||
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID = 1222;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (complete) {
|
|
||||||
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
|
|
||||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
|
||||||
WorldGrid.updateObject(npc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int equipSetID = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
equipSetID = Integer.parseInt(words[0]);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.throwbackError(pc, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!NPC.UpdateEquipSetID(npc, equipSetID)) {
|
|
||||||
this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
|
|
||||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
|
||||||
WorldGrid.updateObject(npc);
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Sets slot position for an NPC to 'slot'";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /changeslot slot'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.MobBase;
|
|
||||||
import engine.objects.NPC;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class SetNpcMobbaseCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SetNpcMobbaseCmd() {
|
|
||||||
super("setmobbase");
|
|
||||||
this.addCmdString("npcmobbase");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
// Arg Count Check
|
|
||||||
if (words.length != 1) {
|
|
||||||
this.sendUsage(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.getObjectType() != GameObjectType.NPC) {
|
|
||||||
this.sendUsage(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NPC npc = (NPC) target;
|
|
||||||
|
|
||||||
int mobBaseID = Integer.parseInt(words[0]);
|
|
||||||
|
|
||||||
if (MobBase.getMobBase(mobBaseID) == null) {
|
|
||||||
this.throwbackError(player, "Cannot find Mobbase for ID " + mobBaseID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NPC.UpdateRaceID(npc, mobBaseID);
|
|
||||||
|
|
||||||
WorldGrid.updateObject(npc);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Sets mobbase override for an NPC";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /setmobbase mobBaseID'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -57,7 +57,7 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
Blueprint blueprint = targetBuilding.getBlueprint();
|
Blueprint blueprint = targetBuilding.getBlueprint();
|
||||||
|
|
||||||
if (blueprint == null) {
|
if (blueprint == null) {
|
||||||
targetBuilding.setRank(targetRank);
|
BuildingManager.setRank(targetBuilding, targetRank);
|
||||||
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
|
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -68,9 +68,8 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the current targetRank
|
// Set the current targetRank
|
||||||
int lastMeshID = targetBuilding.getMeshUUID();
|
|
||||||
targetBuilding.setRank(targetRank);
|
|
||||||
|
|
||||||
|
BuildingManager.setRank(targetBuilding, targetRank);
|
||||||
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
|
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -114,7 +113,7 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// Set the current targetRank
|
// Set the current targetRank
|
||||||
int lastMeshID = targetBuilding.getMeshUUID();
|
int lastMeshID = targetBuilding.getMeshUUID();
|
||||||
targetBuilding.setRank(targetRank);
|
BuildingManager.setRank(targetBuilding, targetRank);
|
||||||
|
|
||||||
if (lastMeshID != targetBuilding.getMeshUUID())
|
if (lastMeshID != targetBuilding.getMeshUUID())
|
||||||
targetBuilding.refresh(true);
|
targetBuilding.refresh(true);
|
||||||
|
|||||||
@@ -67,119 +67,6 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
building.removeAllVisualEffects();
|
building.removeAllVisualEffects();
|
||||||
building.addEffectBit(1 << Integer.parseInt(words[0]));
|
building.addEffectBit(1 << Integer.parseInt(words[0]));
|
||||||
building.updateEffects();
|
building.updateEffects();
|
||||||
//63535 38751
|
|
||||||
// Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
|
||||||
// //CityZoneMsg czm = new CityZoneMsg(3, zone.getLoc().x, zone.getLoc().y, zone.getLoc().z, "balls", zone, 0, 0);
|
|
||||||
// pc.getClientConnection().sendMsg(new DeleteItemMsg(zone.getObjectType().ordinal(), zone.getObjectUUID()));
|
|
||||||
|
|
||||||
// UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(new ArrayList<>(), new ArrayList<>(), null, true);
|
|
||||||
// pc.getClientConnection().sendMsg(updateInventoryMsg);
|
|
||||||
|
|
||||||
//pc.getCharItemManager().updateInventory();
|
|
||||||
|
|
||||||
|
|
||||||
// Mob mob = (Mob)target;
|
|
||||||
//
|
|
||||||
// if (mob == null)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// MobLoot mobLoot = new MobLoot(mob, ItemBase.getItemBase(Integer.parseInt(words[0])), false);
|
|
||||||
//
|
|
||||||
// mob.getCharItemManager().addItemToInventory(mobLoot);
|
|
||||||
|
|
||||||
|
|
||||||
// if (target.getObjectType() != GameObjectType.Building)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// Building warehouseBuilding = (Building)target;
|
|
||||||
//
|
|
||||||
// if (Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID()) == null)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
|
|
||||||
//
|
|
||||||
// for (int ibID: Warehouse.getMaxResources().keySet()){
|
|
||||||
// ItemBase ib = ItemBase.getItemBase(ibID);
|
|
||||||
// warehouse.depositFromMine(null, ib, Warehouse.getMaxResources().get(ibID));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// int raceID = Integer.parseInt(words[0]);
|
|
||||||
//
|
|
||||||
// UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, raceID);
|
|
||||||
//
|
|
||||||
// pc.getClientConnection().sendMsg(ucm);
|
|
||||||
|
|
||||||
// LoadCharacterMsg lcm = new LoadCharacterMsg((AbstractCharacter)null,false);
|
|
||||||
// try {
|
|
||||||
// DispatchMessage.sendToAllInRange(pc, lcm);
|
|
||||||
// } catch (MsgSendException e) {
|
|
||||||
// // TODO Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// ModifyHealthMsg mhm =new ModifyHealthMsg(pc, pc, -50f, 0f, 0f, 0, null, 9999, 0);
|
|
||||||
// mhm.setOmitFromChat(1);
|
|
||||||
// pc.getClientConnection().sendMsg(mhm);
|
|
||||||
//
|
|
||||||
// int temp = 0;
|
|
||||||
// boolean start = false;
|
|
||||||
//
|
|
||||||
// for (EffectsBase eb: EffectsBase.getAllEffectsBase()){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (!pc.getClientConnection().isConnected()){
|
|
||||||
// Logger.info("", "PLAYER DC!" + eb.getIDString());
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// eb = PowersManager.getEffectByIDString("WLR-018A");
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// NoTimeJob ntj = new NoTimeJob(pc, "NONE", eb, 40);
|
|
||||||
// pc.addEffect(String.valueOf(eb.getUUID()), 1000, ntj, eb, 40);
|
|
||||||
// eb.sendEffectNoPower(ntj, 1000, pc.getClientConnection());
|
|
||||||
//
|
|
||||||
// ThreadUtils.sleep(500);
|
|
||||||
// pc.clearEffects();
|
|
||||||
//
|
|
||||||
// //WorldServer.updateObject((AbstractWorldObject)target, pc);
|
|
||||||
// this.throwbackInfo(pc, eb.getIDString());
|
|
||||||
// break;
|
|
||||||
// //ThreadUtils.sleep(500);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
|
|
||||||
// if (eb.getToken() == 0)
|
|
||||||
// continue;
|
|
||||||
// int token = eb.getToken();
|
|
||||||
// ApplyEffectMsg pum = new ApplyEffectMsg();
|
|
||||||
// pum.setEffectID(token);
|
|
||||||
// pum.setSourceType(pc.getObjectType().ordinal());
|
|
||||||
// pum.setSourceID(pc.getObjectUUID());
|
|
||||||
// pum.setTargetType(pc.getObjectType().ordinal());
|
|
||||||
// pum.setTargetID(pc.getObjectUUID());
|
|
||||||
// pum.setNumTrains(40);
|
|
||||||
// pum.setDuration(-1);
|
|
||||||
//// pum.setDuration((pb.isChant()) ? (int)pb.getChantDuration() : ab.getDurationInSeconds(trains));
|
|
||||||
// pum.setPowerUsedID(0);
|
|
||||||
// // pum.setPowerUsedName("Inflict Poison");
|
|
||||||
// this.throwbackInfo(pc, eb.getName() + "Token = " + eb.getToken());
|
|
||||||
// pc.getClientConnection().sendMsg(pum);
|
|
||||||
// ThreadUtils.sleep(200);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
// UpdateObjectMsg uom = new UpdateObjectMsg(pc, 4);
|
|
||||||
// try {
|
|
||||||
// Location.sendToAllInRange(pc, uom);
|
|
||||||
// } catch (MsgSendException e) {
|
|
||||||
// // TODO Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.LootManager;
|
import engine.gameManager.LootManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
@@ -11,8 +10,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class SimulateBootyCmd extends AbstractDevCmd {
|
public class SimulateBootyCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public int simCount = 250;
|
|
||||||
public SimulateBootyCmd() {
|
public SimulateBootyCmd() {
|
||||||
super("bootysim");
|
super("bootysim");
|
||||||
}
|
}
|
||||||
@@ -27,61 +24,8 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
|
|
||||||
String output;
|
String output;
|
||||||
if(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
|
||||||
int ATR = Integer.parseInt(words[0]);
|
|
||||||
int DEF = Integer.parseInt(words[1]);
|
|
||||||
int attacks = Integer.parseInt(words[2]);
|
|
||||||
|
|
||||||
int hits = 0;
|
output = "Booty Simulation:" + newline;
|
||||||
int misses = 0;
|
|
||||||
int defaultHits = 0;
|
|
||||||
int defualtMisses = 0;
|
|
||||||
|
|
||||||
float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
|
|
||||||
float convertedChance = chance * 100;
|
|
||||||
output = "" + newline;
|
|
||||||
output += "DEF VS ATR SIMULATION: " + attacks + " ATTACKS SIMULATED" + newline;
|
|
||||||
output += "DEF = " + DEF + newline;
|
|
||||||
output += "ATR = " + ATR + newline;
|
|
||||||
output += "CHANCE TO LAND HIT: " + convertedChance + "%" + newline;
|
|
||||||
if(convertedChance < 5){
|
|
||||||
output += "CHANCE ADJUSTED TO 5.0%" + newline;
|
|
||||||
convertedChance = 5.0f;
|
|
||||||
}
|
|
||||||
if(convertedChance > 95){
|
|
||||||
output += "CHANCE ADJUSTED TO 95.0%" + newline;
|
|
||||||
convertedChance = 95.0f;
|
|
||||||
}
|
|
||||||
for(int i = 0; i < attacks; i++){
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
|
||||||
|
|
||||||
if(roll <= convertedChance){
|
|
||||||
hits += 1;
|
|
||||||
}else{
|
|
||||||
misses += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float totalHits = defaultHits + hits;
|
|
||||||
float totalMisses = defualtMisses + misses;
|
|
||||||
float hitPercent = Math.round(totalHits / attacks * 100);
|
|
||||||
float missPercent = Math.round(totalMisses / attacks * 100);
|
|
||||||
|
|
||||||
output += "HITS LANDED: " + (defaultHits + hits) + "(" + Math.round(hitPercent) + "%)" + newline;
|
|
||||||
output += "HITS MISSED: " + (defualtMisses + misses) + "(" + Math.round(missPercent) + "%)";
|
|
||||||
|
|
||||||
throwbackInfo(playerCharacter,output);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
simCount = Integer.parseInt(words[0]);
|
|
||||||
}catch(Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
output = "Booty Simulation: Rolls:" + simCount + newline;
|
|
||||||
|
|
||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output += "Name: " + mob.getName() + newline;
|
output += "Name: " + mob.getName() + newline;
|
||||||
@@ -89,10 +33,11 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (mob.bootySet != 0) {
|
if (mob.bootySet != 0) {
|
||||||
for (BootySetEntry entry : LootManager._bootySetMap.get(mob.bootySet)) {
|
for (BootySetEntry entry : LootManager._bootySetMap.get(mob.bootySet)) {
|
||||||
ItemBase item = ItemBase.getItemBase(entry.itemBase);
|
|
||||||
if (item != null) {
|
ItemTemplate template = ItemTemplate.templates.get(entry.templateID);
|
||||||
output += "[" + entry.bootyType + "] " + item.getName() + " [Chance] " + entry.dropChance + newline;
|
|
||||||
}
|
if (template != null)
|
||||||
|
output += "[" + entry.bootyType + "] " + template.item_base_name + " [Chance] " + entry.dropChance + newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +45,6 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
ArrayList<Item> Resources = new ArrayList<Item>();
|
ArrayList<Item> Resources = new ArrayList<Item>();
|
||||||
ArrayList<Item> Runes = new ArrayList<Item>();
|
ArrayList<Item> Runes = new ArrayList<Item>();
|
||||||
ArrayList<Item> Contracts = new ArrayList<Item>();
|
ArrayList<Item> Contracts = new ArrayList<Item>();
|
||||||
ArrayList<Item> GuardContracts = new ArrayList<Item>();
|
|
||||||
ArrayList<Item> Offerings = new ArrayList<Item>();
|
ArrayList<Item> Offerings = new ArrayList<Item>();
|
||||||
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
||||||
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
||||||
@@ -108,17 +52,14 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
int failures = 0;
|
int failures = 0;
|
||||||
int goldAmount = 0;
|
int goldAmount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < simCount; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mob.loadInventory();
|
mob.loadInventory();
|
||||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
for (Item lootItem : mob.charItemManager.getInventory()) {
|
||||||
switch (lootItem.getItemBase().getType()) {
|
switch (lootItem.template.item_type) {
|
||||||
case CONTRACT: //CONTRACT
|
case EMPLOYMENTCONTRACT: //CONTRACT
|
||||||
if(lootItem.getName().contains("Captain"))
|
Contracts.add(lootItem);
|
||||||
GuardContracts.add(lootItem);
|
|
||||||
else
|
|
||||||
Contracts.add(lootItem);
|
|
||||||
break;
|
break;
|
||||||
case OFFERING: //OFFERING
|
case OFFERING: //OFFERING
|
||||||
Offerings.add(lootItem);
|
Offerings.add(lootItem);
|
||||||
@@ -130,7 +71,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
Runes.add(lootItem);
|
Runes.add(lootItem);
|
||||||
break;
|
break;
|
||||||
case WEAPON: //WEAPON
|
case WEAPON: //WEAPON
|
||||||
if (lootItem.getItemBase().isGlass())
|
if (lootItem.getName().toUpperCase().contains("GLASS"))
|
||||||
GlassItems.add(lootItem);
|
GlassItems.add(lootItem);
|
||||||
else
|
else
|
||||||
OtherDrops.add(lootItem);
|
OtherDrops.add(lootItem);
|
||||||
@@ -146,19 +87,19 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
failures++;
|
failures++;
|
||||||
}
|
}
|
||||||
if (mob.getEquip() != null) {
|
if (mob.charItemManager.equipped.isEmpty() == false) {
|
||||||
for (MobEquipment me : mob.getEquip().values()) {
|
for (Item me : mob.charItemManager.equipped.values()) {
|
||||||
|
|
||||||
if (me.getDropChance() == 0)
|
if (me.drop_chance == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(99) + 1;
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(99) + 1;
|
||||||
float dropChance = me.getDropChance() * 100;
|
float dropChance = me.drop_chance * 100;
|
||||||
|
|
||||||
if (equipmentRoll > (dropChance))
|
if (equipmentRoll > (dropChance))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
MobLoot ml = new MobLoot(mob, me.template, false);
|
||||||
|
|
||||||
if (ml != null)
|
if (ml != null)
|
||||||
EquipmentDrops.add(ml);
|
EquipmentDrops.add(ml);
|
||||||
@@ -190,17 +131,9 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int baseBound = 100000;
|
|
||||||
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
|
|
||||||
int totalRange = baseBound + levelPenalty;
|
|
||||||
if(mob.level >= 50){
|
|
||||||
totalRange = baseBound;
|
|
||||||
}
|
|
||||||
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
|
|
||||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||||
output += "GUARD CONTRACTS DROPS: " + GuardContracts.size() + newline;
|
|
||||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
if (stringIndex == -1)
|
if (stringIndex == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Validate we have a corrent building group name
|
// Validate we have a correct building group name
|
||||||
|
|
||||||
for (BuildingGroup group : BuildingGroup.values()) {
|
for (BuildingGroup group : BuildingGroup.values()) {
|
||||||
if (group.name().equals(userInput[0].toUpperCase()))
|
if (group.name().equals(userInput[0].toUpperCase()))
|
||||||
@@ -114,8 +114,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
||||||
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,8 +124,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
contract.getAllowedBuildings().remove(buildingGroup);
|
contract.getAllowedBuildings().remove(buildingGroup);
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
||||||
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,14 +136,14 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Sets a building slot on a targeted npc";
|
return "Toggles a building group on a targeted npc";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class methods
|
// Class methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
String usage = "/npcslot [BuildingType] on-off \n";
|
String usage = "/npcslot [BuildingGroup] on-off \n";
|
||||||
|
|
||||||
for (BuildingGroup group : BuildingGroup.values()) {
|
for (BuildingGroup group : BuildingGroup.values()) {
|
||||||
usage += group.name() + ' ';
|
usage += group.name() + ' ';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -110,7 +111,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, true, serverZone, null, 0, "", 1);
|
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import engine.devcmd.AbstractDevCmd;
|
|||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.client.msg.RecvSummonsRequestMsg;
|
import engine.net.client.msg.RecvSummonsMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -40,8 +40,8 @@ public class SummonCmd extends AbstractDevCmd {
|
|||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
String location = "Somewhere";
|
String location = "Somewhere";
|
||||||
if (zone != null)
|
if (zone != null)
|
||||||
location = zone.getName();
|
location = zone.zoneName;
|
||||||
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
|
RecvSummonsMsg rsrm = new RecvSummonsMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
|
||||||
location, false);
|
location, false);
|
||||||
toSummon.getClientConnection().sendMsg(rsrm);
|
toSummon.getClientConnection().sendMsg(rsrm);
|
||||||
|
|
||||||
|
|||||||
@@ -73,44 +73,41 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
output = "Target Information:" + newline;
|
output = "Target Information:" + newline;
|
||||||
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "name: " + zone.getName();
|
output += "name: " + zone.zoneName;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "loadNum: " + zone.getLoadNum();
|
output += "loadNum: " + zone.templateID;
|
||||||
if (zone.getParent() != null) {
|
if (zone.parent != null) {
|
||||||
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
|
output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30);
|
||||||
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
|
output += "Parentabs: x: " + zone.parent.absX + ", y: " + zone.parent.absY + ", z: " + zone.parent.absZ;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
output += StringUtils.addWS(", parent: none", 30);
|
output += StringUtils.addWS(", parent: none", 30);
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
|
output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
|
output += "offset: x: " + zone.xOffset + ", y: " + zone.yOffset + ", z: " + zone.zOffset;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
||||||
output += newline;
|
output += newline;
|
||||||
|
|
||||||
if (zone.getHeightMap() != null) {
|
if (zone.terrain != null) {
|
||||||
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
|
output += "Terrain image: " + zone.template.terrain_image;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
|
|
||||||
output += newline;
|
|
||||||
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
|
||||||
|
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
||||||
output += newline;
|
output += newline;
|
||||||
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Sea Level = " + zone.getSeaLevel();
|
output += "Sea Level = " + zone.sea_level;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "World Altitude = " + zone.getWorldAltitude();
|
output += "World Altitude = " + zone.global_height;
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|
||||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||||
|
|
||||||
output += newline;
|
output += newline;
|
||||||
output += (city == null) ? "None" : city.getParent().getName();
|
output += (city == null) ? "None" : city.getParent().zoneName;
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
|
|
||||||
@@ -123,14 +120,14 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
} else {
|
} else {
|
||||||
output = "children:";
|
output = "children:";
|
||||||
|
|
||||||
ArrayList<Zone> nodes = zone.getNodes();
|
ArrayList<Zone> nodes = zone.nodes;
|
||||||
|
|
||||||
if (nodes.isEmpty())
|
if (nodes.isEmpty())
|
||||||
output += " none";
|
output += " none";
|
||||||
|
|
||||||
for (Zone child : nodes) {
|
for (Zone child : nodes) {
|
||||||
output += newline;
|
output += newline;
|
||||||
output += child.getName() + " (" + child.getLoadNum() + ')';
|
output += child.zoneName + " (" + child.templateID + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ZoneSetCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
|
throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.templateID + ") " + zone.getObjectUUID());
|
||||||
|
|
||||||
// NPC
|
// NPC
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,17 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mobileAI.MobAI;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.powers.RunePowerEntry;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -56,36 +61,95 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + newline;
|
output += mob.getName() + newline;
|
||||||
if (mob.BehaviourType != null) {
|
output += mob.agentType.toString() + newline;
|
||||||
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
|
||||||
if (mob.BehaviourType.BehaviourHelperType != null) {
|
int contractID = 0;
|
||||||
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
|
|
||||||
|
if (mob.isPlayerGuard() == true) {
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||||
|
contractID = mob.guardCaptain.contract.getContractID();
|
||||||
|
else
|
||||||
|
contractID = mob.contract.getContractID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contractID != 0) {
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||||
|
output += "Captain Contract: " + contractID + newline;
|
||||||
|
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
||||||
|
} else
|
||||||
|
output += "Contract: " + contractID + newline;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mob.behaviourType != null) {
|
||||||
|
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||||
|
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||||
|
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
|
||||||
} else {
|
} else {
|
||||||
output += "Behaviour Helper Type: NULL" + newline;
|
output += "Behaviour Helper Type: NULL" + newline;
|
||||||
}
|
|
||||||
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
|
||||||
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
|
||||||
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
|
||||||
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
|
||||||
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
|
||||||
} else {
|
|
||||||
output += "BehaviourType: NULL" + newline;
|
|
||||||
}
|
}
|
||||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
|
||||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
||||||
|
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
||||||
|
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
||||||
|
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
||||||
|
} else {
|
||||||
|
output += "BehaviourType: NULL" + newline;
|
||||||
|
}
|
||||||
|
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||||
|
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
||||||
if (mob.playerAgroMap.size() > 0) {
|
if (mob.playerAgroMap.size() > 0) {
|
||||||
output += "Players Loaded:" + newline;
|
output += "Players Loaded:" + newline;
|
||||||
}
|
}
|
||||||
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
||||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
|
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
||||||
}
|
}
|
||||||
if (mob.getCombatTarget() != null)
|
if (mob.getCombatTarget() != null)
|
||||||
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
||||||
else
|
else
|
||||||
output += "Current Target: NULL" + newline;
|
output += "Current Target: NULL" + newline;
|
||||||
|
|
||||||
for (int token : mob.mobPowers.keySet())
|
if (mob.guardedCity != null)
|
||||||
output += token + newline;
|
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||||
|
output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline;
|
||||||
|
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
||||||
|
output += "Powers:" + newline;
|
||||||
|
|
||||||
|
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||||
|
|
||||||
|
// Additional powers may come from the contract ID. This is to support
|
||||||
|
// powers for player guards irrespective of the mobbase used.
|
||||||
|
|
||||||
|
if (mob.isPlayerGuard()) {
|
||||||
|
|
||||||
|
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
||||||
|
|
||||||
|
if (mob.contract != null)
|
||||||
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||||
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||||
|
|
||||||
|
powerEntries.addAll(contractEntries);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RunePowerEntry runePowerEntry : powerEntries)
|
||||||
|
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
|
||||||
|
|
||||||
|
// List outlaws defined for this player guard's city
|
||||||
|
|
||||||
|
if (mob.isPlayerGuard()) {
|
||||||
|
|
||||||
|
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
|
||||||
|
|
||||||
|
if (outlaws.isEmpty() == false)
|
||||||
|
output += "Outlaws: " + newline;
|
||||||
|
|
||||||
|
for (Integer outlawUUID : outlaws)
|
||||||
|
output += outlawUUID + newline;
|
||||||
|
}
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, output);
|
throwbackInfo(playerCharacter, output);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.Building;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
public class convertLoc extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public convertLoc() {
|
|
||||||
super("convertLoc");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
|
|
||||||
if (target == null) {
|
|
||||||
Vector3fImmutable convertLoc = ZoneManager.findSmallestZone(pc.getLoc()).getLoc().subtract(pc.getLoc());
|
|
||||||
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertLoc));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (target.getObjectType() != GameObjectType.Building)
|
|
||||||
return;
|
|
||||||
Building toConvert = (Building) target;
|
|
||||||
Vector3fImmutable convertedLoc = ZoneManager.convertWorldToLocal(toConvert, pc.getLoc());
|
|
||||||
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Temporarily Changes SubRace";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.exception.MsgSendException;
|
|
||||||
import engine.math.Vector3f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class ArenaManager {
|
|
||||||
private static final List<Arena> activeArenas = new ArrayList<>();
|
|
||||||
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
|
|
||||||
public static Long pulseDelay = 180000L;
|
|
||||||
public static Long lastExecution = 0L;
|
|
||||||
|
|
||||||
public static void pulseArenas() {
|
|
||||||
if(lastExecution == 0L){
|
|
||||||
lastExecution = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(activeArenas.isEmpty() && playerQueue.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Iterator<Arena> iterator = activeArenas.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Arena arena = iterator.next();
|
|
||||||
if (arena.checkToComplete()) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lastExecution + pulseDelay > System.currentTimeMillis())
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastExecution = System.currentTimeMillis();
|
|
||||||
|
|
||||||
while (playerQueue.size() > 1) {
|
|
||||||
createArena();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void joinQueue(PlayerCharacter player) {
|
|
||||||
if (!playerQueue.contains(player)) {
|
|
||||||
playerQueue.add(player);
|
|
||||||
}
|
|
||||||
for(PlayerCharacter pc : playerQueue){
|
|
||||||
if(pc.equals(player))
|
|
||||||
continue;
|
|
||||||
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void leaveQueue(PlayerCharacter player) {
|
|
||||||
playerQueue.remove(player);
|
|
||||||
for(PlayerCharacter pc : playerQueue){
|
|
||||||
if(pc.equals(player))
|
|
||||||
continue;
|
|
||||||
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void createArena() {
|
|
||||||
if (playerQueue.size() > 1) {
|
|
||||||
|
|
||||||
Collections.shuffle(playerQueue);
|
|
||||||
Arena newArena = new Arena();
|
|
||||||
|
|
||||||
//set starting time
|
|
||||||
newArena.startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
//decide an arena location
|
|
||||||
newArena.loc = selectRandomArenaLocation();
|
|
||||||
|
|
||||||
// Assign players to the arena
|
|
||||||
newArena.player1 = playerQueue.remove(0);
|
|
||||||
newArena.player2 = playerQueue.remove(0);
|
|
||||||
|
|
||||||
// Teleport players to the arena location
|
|
||||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
|
||||||
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
|
||||||
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
|
||||||
|
|
||||||
// Add the new arena to the active arenas list
|
|
||||||
activeArenas.add(newArena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
|
|
||||||
if (winner != null && loser != null) {
|
|
||||||
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
|
|
||||||
arena.player1.getName(), arena.player2.getName(), winner.getName());
|
|
||||||
} else {
|
|
||||||
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
|
|
||||||
arena.player1.getName(), arena.player2.getName());
|
|
||||||
}
|
|
||||||
// Teleport players to the arena location
|
|
||||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
|
||||||
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
|
||||||
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
activeArenas.remove(arena);
|
|
||||||
|
|
||||||
if(winner != null){
|
|
||||||
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
|
|
||||||
//handle prize distribution
|
|
||||||
//ItemBase specialLoot = ItemBase.getItemBase(866);
|
|
||||||
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
|
|
||||||
//promoted.setNumOfItems(21235);
|
|
||||||
//promoted.setName("Special Banker(21235)");
|
|
||||||
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
|
|
||||||
//winner.getCharItemManager().addItemToInventory(promoted);
|
|
||||||
//winner.getCharItemManager().updateInventory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector3fImmutable selectRandomArenaLocation() {
|
|
||||||
boolean locSet = false;
|
|
||||||
Vector3fImmutable loc = Vector3fImmutable.ZERO;
|
|
||||||
|
|
||||||
while (!locSet) {
|
|
||||||
try {
|
|
||||||
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
|
|
||||||
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
|
|
||||||
float y = 0; // Y coordinate is always 0
|
|
||||||
|
|
||||||
loc = new Vector3fImmutable(x, y, z * -1);
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
|
|
||||||
if(inRange.isEmpty() && !isUnderWater(loc))
|
|
||||||
locSet = true;
|
|
||||||
//}
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isUnderWater(Vector3fImmutable loc) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(loc);
|
|
||||||
|
|
||||||
if (zone.getSeaLevel() != 0) {
|
|
||||||
|
|
||||||
float localAltitude = loc.y;
|
|
||||||
if (localAltitude < zone.getSeaLevel())
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (loc.y < 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,10 +19,7 @@ import engine.job.JobScheduler;
|
|||||||
import engine.jobs.UpgradeBuildingJob;
|
import engine.jobs.UpgradeBuildingJob;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.client.ClientConnection;
|
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.net.client.msg.ManageCityAssetsMsg;
|
|
||||||
import engine.net.client.msg.PlaceAssetMsg;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -30,7 +27,9 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public enum BuildingManager {
|
public enum BuildingManager {
|
||||||
@@ -40,6 +39,10 @@ public enum BuildingManager {
|
|||||||
public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>();
|
public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>();
|
public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>();
|
||||||
|
|
||||||
|
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
|
||||||
|
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
|
||||||
|
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
|
||||||
|
|
||||||
public static int getAvailableSlot(Building building) {
|
public static int getAvailableSlot(Building building) {
|
||||||
|
|
||||||
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
|
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
|
||||||
@@ -104,7 +107,6 @@ public enum BuildingManager {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
if (building.getRank() == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -112,26 +114,25 @@ public enum BuildingManager {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
//individual friend.
|
//individual friend.
|
||||||
if (building.getFriends().get(player.getObjectUUID()) != null)
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Admin's can access stuff
|
//Admins can access stuff
|
||||||
|
|
||||||
if (player.isCSR())
|
if (player.isCSR())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Guild stuff
|
//Guild stuff
|
||||||
|
|
||||||
|
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 8)
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 9
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
||||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -207,41 +208,47 @@ public enum BuildingManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemBase elanIB = ItemBase.getItemBase(1705032);
|
ItemTemplate template = ItemTemplate.templates.get(1705032); // Elan Stone
|
||||||
|
|
||||||
if (elanIB == null)
|
if (!player.charItemManager.hasRoomInventory(template.item_wt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!player.getCharItemManager().hasRoomInventory(elanIB.getWeight()))
|
if (!Item.MakeItemForPlayer(template.template_id, player, amount))
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!Item.MakeItemForPlayer(elanIB, player, amount))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
shrine.setFavors(0);
|
shrine.setFavors(0);
|
||||||
break;
|
break;
|
||||||
case WAREHOUSE:
|
case WAREHOUSE:
|
||||||
|
|
||||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
City city = building.getCity();
|
||||||
|
|
||||||
|
if (city == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Warehouse warehouse = city.warehouse;
|
||||||
|
|
||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (ItemBase resourceBase : ItemBase.getResourceList()) {
|
for (Enum.ResourceType resourceType : EnumSet.allOf(Enum.ResourceType.class)) {
|
||||||
if (!player.getCharItemManager().hasRoomInventory(resourceBase.getWeight())) {
|
|
||||||
|
if (!player.charItemManager.hasRoomInventory(resourceType.template.item_wt)) {
|
||||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (warehouse.getResources().get(resourceBase) == null)
|
|
||||||
|
if (warehouse.resources.get(resourceType) == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int resourceAmount = warehouse.getResources().get(resourceBase);
|
int resourceAmount = warehouse.resources.get(resourceType);
|
||||||
|
|
||||||
if (resourceAmount <= 0)
|
if (resourceAmount <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (warehouse.loot(player, resourceBase, resourceAmount, true))
|
if (Warehouse.loot(warehouse, player, resourceType, resourceAmount, true)) {
|
||||||
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
|
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceType.name());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -308,6 +315,72 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeHireling(Building building, AbstractCharacter hireling) {
|
||||||
|
|
||||||
|
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
|
||||||
|
Mob guardCaptain = (Mob) hireling;
|
||||||
|
|
||||||
|
// Clear minions from database if a guard captain
|
||||||
|
|
||||||
|
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||||
|
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear minions from world
|
||||||
|
|
||||||
|
for (Integer minionUUID : hireling.minions) {
|
||||||
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
|
DbManager.removeFromCache(minionMob);
|
||||||
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
|
WorldGrid.unloadObject(minionMob);
|
||||||
|
|
||||||
|
if (minionMob.getParentZone() != null)
|
||||||
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove hireling from building
|
||||||
|
|
||||||
|
building.getHirelings().remove(hireling);
|
||||||
|
|
||||||
|
// Remove from zone mob set
|
||||||
|
|
||||||
|
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
|
||||||
|
Mob hirelingMob = (Mob) hireling;
|
||||||
|
|
||||||
|
if (hirelingMob.getParentZone() != null)
|
||||||
|
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
||||||
|
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||||
|
|
||||||
|
NPC hirelingNPC = (NPC) hireling;
|
||||||
|
|
||||||
|
if (hirelingNPC.getParentZone() != null)
|
||||||
|
if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC))
|
||||||
|
hirelingNPC.getParentZone().zoneNPCSet.remove(hireling);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unload hireling from world
|
||||||
|
|
||||||
|
DbManager.removeFromCache(hireling);
|
||||||
|
WorldGrid.RemoveWorldObject(hireling);
|
||||||
|
WorldGrid.removeObject(hireling);
|
||||||
|
|
||||||
|
// Delete hireling from database
|
||||||
|
|
||||||
|
if (hireling.getObjectType().equals(GameObjectType.Mob))
|
||||||
|
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
||||||
|
else
|
||||||
|
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void cleanupHirelings(Building building) {
|
public static void cleanupHirelings(Building building) {
|
||||||
|
|
||||||
// Early exit: Cannot have hirelings in a building
|
// Early exit: Cannot have hirelings in a building
|
||||||
@@ -320,42 +393,18 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (building.getRank() < 1) {
|
if (building.getRank() < 1) {
|
||||||
|
|
||||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
||||||
|
BuildingManager.removeHireling(building, slottedNPC);
|
||||||
|
|
||||||
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
|
|
||||||
((NPC) slottedNPC).remove();
|
|
||||||
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
|
|
||||||
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete hireling if building has deranked.
|
// Delete hireling if building has deranked.
|
||||||
|
|
||||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||||
|
|
||||||
NPC npc = null;
|
|
||||||
Mob mob = null;
|
|
||||||
|
|
||||||
if (hireling.getObjectType() == Enum.GameObjectType.NPC)
|
|
||||||
npc = (NPC) hireling;
|
|
||||||
else if (hireling.getObjectType() == Enum.GameObjectType.Mob)
|
|
||||||
mob = (Mob) hireling;
|
|
||||||
|
|
||||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||||
|
BuildingManager.removeHireling(building, hireling);
|
||||||
if (npc != null) {
|
|
||||||
if (!npc.remove())
|
|
||||||
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
|
||||||
+ "from Building " + building.getObjectUUID());
|
|
||||||
else
|
|
||||||
building.getHirelings().remove(npc);
|
|
||||||
} else if (mob != null) {
|
|
||||||
if (!NPCManager.removeMobileFromBuilding(mob, building))
|
|
||||||
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
|
||||||
+ "from Building " + building.getObjectUUID());
|
|
||||||
else
|
|
||||||
building.getHirelings().remove(npc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,18 +487,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||||
|
|
||||||
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BANESTONE))
|
|
||||||
{
|
|
||||||
Guild playerNation = player.guild.getNation();
|
|
||||||
City banedCity = ZoneManager.getCityAtLocation(building.loc);
|
|
||||||
if(banedCity != null){
|
|
||||||
if(banedCity.getGuild().getNation().equals(playerNation)){
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Nation Members and Guild members are not hostile.
|
//Nation Members and Guild members are not hostile.
|
||||||
// if (building.getGuild() != null){
|
// if (building.getGuild() != null){
|
||||||
// if (pc.getGuild() != null)
|
// if (pc.getGuild() != null)
|
||||||
@@ -464,18 +501,18 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|
||||||
if (condemn != null && condemn.isActive())
|
if (condemn != null && condemn.active)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (player.getGuild() != null) {
|
if (player.getGuild() != null) {
|
||||||
|
|
||||||
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
||||||
|
|
||||||
if (guildCondemn != null && guildCondemn.isActive())
|
if (guildCondemn != null && guildCondemn.active)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
||||||
return nationCondemn != null && nationCondemn.isActive() && nationCondemn.getFriendType() == Condemned.NATION;
|
return nationCondemn != null && nationCondemn.active && nationCondemn.friendType == Condemned.NATION;
|
||||||
} else {
|
} else {
|
||||||
//TODO ADD ERRANT KOS CHECK
|
//TODO ADD ERRANT KOS CHECK
|
||||||
}
|
}
|
||||||
@@ -483,18 +520,18 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|
||||||
if (condemn != null && condemn.isActive())
|
if (condemn != null && condemn.active)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (player.getGuild() != null) {
|
if (player.getGuild() != null) {
|
||||||
|
|
||||||
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
||||||
|
|
||||||
if (guildCondemn != null && guildCondemn.isActive())
|
if (guildCondemn != null && guildCondemn.active)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
||||||
return nationCondemn == null || !nationCondemn.isActive() || nationCondemn.getFriendType() != Condemned.NATION;
|
return nationCondemn == null || !nationCondemn.active || nationCondemn.friendType != Condemned.NATION;
|
||||||
} else {
|
} else {
|
||||||
//TODO ADD ERRANT KOS CHECK
|
//TODO ADD ERRANT KOS CHECK
|
||||||
}
|
}
|
||||||
@@ -513,7 +550,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
NPC npc = null;
|
NPC npc = null;
|
||||||
|
|
||||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building);
|
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
||||||
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -532,74 +569,73 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL)){
|
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||||
if(contract.getContractID() == 850) {
|
|
||||||
boolean hasRunemaster = false;
|
|
||||||
for (AbstractCharacter npc : building.getHirelings().keySet()) {
|
|
||||||
|
|
||||||
if (npc.getObjectType() != GameObjectType.NPC)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(npc.contractUUID == 850)
|
|
||||||
hasRunemaster = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasRunemaster)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int maxSlots = building.getBlueprint().getMaxSlots();
|
|
||||||
if(building.getBlueprint().getBuildingGroup() != null) {
|
|
||||||
maxSlots = building.getBlueprint().getSlotsForRank(building.getRank());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSlots == building.getHirelings().size())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
if (item.getChargesRemaining() > 0)
|
if ((byte) item.chargesRemaining > 0)
|
||||||
rank = item.getChargesRemaining() * 10;
|
rank = (byte) item.chargesRemaining * 10;
|
||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mob;
|
Mob mobile;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
||||||
|
|
||||||
if (mob == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mob.setLoc(mob.getLoc());
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
|
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
||||||
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
|
// Spawn new mobile
|
||||||
|
|
||||||
|
mobile.setLoc(mobile.getLoc());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||||
|
|
||||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
||||||
|
|
||||||
if (mob == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mob.setLoc(mob.getLoc());
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
|
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
||||||
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
|
// Spawn new mobile
|
||||||
|
|
||||||
|
mobile.setLoc(mobile.getLoc());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contract.getContractID() == 910) {
|
if (contract.getContractID() == 910) {
|
||||||
|
|
||||||
//guard dog
|
//guard dog
|
||||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
||||||
|
|
||||||
if (mob == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mob.setLoc(mob.getLoc());
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
|
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
||||||
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
|
// Spawn new mobile
|
||||||
|
|
||||||
|
mobile.setLoc(mobile.getLoc());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -746,80 +782,109 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processRedeedNPC(NPC npc, Building building, ClientConnection origin) {
|
public static void rebuildMine(Building mineBuilding) {
|
||||||
|
setRank(mineBuilding, 1);
|
||||||
|
mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank);
|
||||||
|
|
||||||
// Member variable declaration
|
// New rank mean new max hit points.
|
||||||
PlayerCharacter player;
|
|
||||||
Contract contract;
|
|
||||||
CharacterItemManager itemMan;
|
|
||||||
ItemBase itemBase;
|
|
||||||
Item item;
|
|
||||||
|
|
||||||
npc.lock.writeLock().lock();
|
mineBuilding.healthMax = mineBuilding.getBlueprint().getMaxHealth(mineBuilding.rank);
|
||||||
|
mineBuilding.setCurrentHitPoints(mineBuilding.healthMax);
|
||||||
|
mineBuilding.getBounds().setBounds(mineBuilding);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
public static void setRank(Building building, int rank) {
|
||||||
|
|
||||||
|
int newMeshUUID;
|
||||||
|
boolean success;
|
||||||
|
|
||||||
|
|
||||||
if (building == null)
|
// If this building has no blueprint then set rank and exit immediatly.
|
||||||
return;
|
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
|
||||||
itemMan = player.getCharItemManager();
|
|
||||||
|
|
||||||
contract = npc.getContract();
|
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
||||||
|
building.rank = rank;
|
||||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
DbManager.BuildingQueries.CHANGE_RANK(building.getObjectUUID(), rank);
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!building.getHirelings().containsKey(npc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!npc.remove()) {
|
|
||||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
building.getHirelings().remove(npc);
|
|
||||||
|
|
||||||
itemBase = ItemBase.getItemBase(contract.getContractID());
|
|
||||||
|
|
||||||
if (itemBase == null) {
|
|
||||||
Logger.error("Could not find Contract for npc: " + npc.getObjectUUID());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean itemWorked = false;
|
|
||||||
|
|
||||||
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) npc.getRank() - 1), (byte) ((byte) npc.getRank() - 1),
|
|
||||||
(short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0,
|
|
||||||
new ArrayList<>(), "");
|
|
||||||
item.setNumOfItems(1);
|
|
||||||
item.containerType = Enum.ItemContainerType.INVENTORY;
|
|
||||||
|
|
||||||
try {
|
|
||||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
|
||||||
itemWorked = true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
if (itemWorked) {
|
|
||||||
itemMan.addItemToInventory(item);
|
|
||||||
itemMan.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg();
|
|
||||||
mca.actionType = NPC.SVR_CLOSE_WINDOW;
|
|
||||||
mca.setTargetType(building.getObjectType().ordinal());
|
|
||||||
mca.setTargetID(building.getObjectUUID());
|
|
||||||
origin.sendMsg(mca);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
} finally {
|
|
||||||
npc.lock.writeLock().unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete any upgrade jobs before doing anything else. It won't quite work
|
||||||
|
// if in a few lines we happen to delete this building.
|
||||||
|
|
||||||
|
JobContainer jc = building.getTimers().get("UPGRADE");
|
||||||
|
|
||||||
|
if (jc != null) {
|
||||||
|
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
|
||||||
|
Logger.error("failed to cancel existing upgrade job.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt write to database, or delete the building
|
||||||
|
// if we are destroying it.
|
||||||
|
|
||||||
|
if (rank == -1)
|
||||||
|
success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||||
|
else
|
||||||
|
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
||||||
|
|
||||||
|
if (success == false) {
|
||||||
|
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
building.isDeranking.compareAndSet(false, true);
|
||||||
|
|
||||||
|
// Change the building's rank
|
||||||
|
|
||||||
|
building.rank = rank;
|
||||||
|
|
||||||
|
// New rank means new mesh
|
||||||
|
newMeshUUID = building.getBlueprint().getMeshForRank(building.rank);
|
||||||
|
|
||||||
|
if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) && (building.rank == 8))
|
||||||
|
newMeshUUID = Realm.getRealmMesh(building.getCity());
|
||||||
|
|
||||||
|
building.meshUUID = newMeshUUID;
|
||||||
|
|
||||||
|
// New rank mean new max hitpoints.
|
||||||
|
|
||||||
|
building.healthMax = building.getBlueprint().getMaxHealth(building.rank);
|
||||||
|
building.setCurrentHitPoints(building.healthMax);
|
||||||
|
|
||||||
|
if (building.getUpgradeDateTime() != null)
|
||||||
|
setUpgradeDateTime(building, null, 0);
|
||||||
|
|
||||||
|
// If we destroyed this building make sure to turn off
|
||||||
|
// protection
|
||||||
|
|
||||||
|
if (building.rank == -1)
|
||||||
|
building.protectionState = Enum.ProtectionState.NONE;
|
||||||
|
|
||||||
|
// update object to clients
|
||||||
|
|
||||||
|
building.refresh(true);
|
||||||
|
|
||||||
|
if (building.getBounds() != null)
|
||||||
|
building.getBounds().setBounds(building);
|
||||||
|
|
||||||
|
// Cleanup hirelings resulting from rank change
|
||||||
|
|
||||||
|
cleanupHirelings(building);
|
||||||
|
|
||||||
|
building.isDeranking.compareAndSet(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Building getBuildingAtLocation(Vector3fImmutable loc) {
|
||||||
|
|
||||||
|
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc, 64, MBServerStatics.MASK_BUILDING)) {
|
||||||
|
Building building = (Building) awo;
|
||||||
|
|
||||||
|
if (building == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (Bounds.collide(loc, building.getBounds()))
|
||||||
|
return building;
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,11 @@ import engine.net.Dispatch;
|
|||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.MessageDispatcher;
|
import engine.net.MessageDispatcher;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
||||||
import engine.net.client.msg.chat.*;
|
import engine.net.client.msg.chat.*;
|
||||||
import engine.net.client.msg.commands.ClientAdminCommandMsg;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import engine.session.Session;
|
|
||||||
import engine.util.KeyCloneAudit;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -43,8 +40,8 @@ public enum ChatManager {
|
|||||||
// (FLOOD_TIME_THRESHOLD) ms will flag as a flood message
|
// (FLOOD_TIME_THRESHOLD) ms will flag as a flood message
|
||||||
// Example, set to 3 & 2000 to flag the 3rd message within 2000 ms.
|
// Example, set to 3 & 2000 to flag the 3rd message within 2000 ms.
|
||||||
|
|
||||||
private static final int FLOOD_QTY_THRESHOLD = 3;
|
public static final int FLOOD_QTY_THRESHOLD = 3;
|
||||||
private static final int FLOOD_TIME_THRESHOLD = 2000;
|
public static final int FLOOD_TIME_THRESHOLD = 2000;
|
||||||
private static final String FLOOD_USER_ERROR = "You talk too much!";
|
private static final String FLOOD_USER_ERROR = "You talk too much!";
|
||||||
private static final String SILENCED = "You find yourself mute!";
|
private static final String SILENCED = "You find yourself mute!";
|
||||||
private static final String UNKNOWN_COMMAND = "No such command.";
|
private static final String UNKNOWN_COMMAND = "No such command.";
|
||||||
@@ -52,78 +49,6 @@ public enum ChatManager {
|
|||||||
/**
|
/**
|
||||||
* This method used when handling a ChatMsg received from the network.
|
* This method used when handling a ChatMsg received from the network.
|
||||||
*/
|
*/
|
||||||
public static void handleChatMsg(Session sender, AbstractChatMsg msg) {
|
|
||||||
|
|
||||||
if (msg == null) {
|
|
||||||
Logger.warn(
|
|
||||||
"null message: ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender == null) {
|
|
||||||
Logger.warn(
|
|
||||||
"null sender: ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerCharacter pc = sender.getPlayerCharacter();
|
|
||||||
|
|
||||||
if (pc == null) {
|
|
||||||
Logger.warn(
|
|
||||||
"invalid sender: ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Protocol protocolMsg = msg.getProtocolMsg();
|
|
||||||
|
|
||||||
// Flood control, implemented per channel
|
|
||||||
|
|
||||||
boolean isFlood = false;
|
|
||||||
long curMsgTime = System.currentTimeMillis();
|
|
||||||
long checkTime = pc.chatFloodTime(protocolMsg.opcode, curMsgTime, FLOOD_QTY_THRESHOLD - 1);
|
|
||||||
|
|
||||||
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
|
|
||||||
isFlood = true;
|
|
||||||
|
|
||||||
if(KeyCloneAudit.auditChatMsg(pc,msg.getMessage())){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (protocolMsg) {
|
|
||||||
case CHATSAY:
|
|
||||||
ChatManager.chatSay(pc, msg.getMessage(), isFlood);
|
|
||||||
return;
|
|
||||||
case CHATCSR:
|
|
||||||
ChatManager.chatCSR(msg);
|
|
||||||
return;
|
|
||||||
case CHATTELL:
|
|
||||||
ChatTellMsg ctm = (ChatTellMsg) msg;
|
|
||||||
ChatManager.chatTell(pc, ctm.getTargetName(), ctm.getMessage(), isFlood);
|
|
||||||
return;
|
|
||||||
case CHATSHOUT:
|
|
||||||
ChatManager.chatShout(pc, msg.getMessage(), isFlood);
|
|
||||||
return;
|
|
||||||
case CHATGUILD:
|
|
||||||
ChatManager.chatGuild(pc, (ChatGuildMsg) msg);
|
|
||||||
return;
|
|
||||||
case CHATGROUP:
|
|
||||||
ChatManager.chatGroup(pc, (ChatGroupMsg) msg);
|
|
||||||
return;
|
|
||||||
case CHATIC:
|
|
||||||
ChatManager.chatIC(pc, (ChatICMsg) msg);
|
|
||||||
return;
|
|
||||||
case LEADERCHANNELMESSAGE:
|
|
||||||
ChatManager.chatGlobal(pc, msg.getMessage(), isFlood);
|
|
||||||
return;
|
|
||||||
case GLOBALCHANNELMESSAGE:
|
|
||||||
case CHATPVP:
|
|
||||||
case CHATCITY:
|
|
||||||
case CHATINFO:
|
|
||||||
case SYSTEMBROADCASTCHANNEL:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Channels
|
* Channels
|
||||||
@@ -170,7 +95,7 @@ public enum ChatManager {
|
|||||||
|
|
||||||
PlayerBonuses bonus = pc.getBonuses();
|
PlayerBonuses bonus = pc.getBonuses();
|
||||||
|
|
||||||
if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.None)) {
|
if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.NONE)) {
|
||||||
ChatManager.chatSayError(pc, SILENCED);
|
ChatManager.chatSayError(pc, SILENCED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -195,7 +120,7 @@ public enum ChatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ChatManager.isDevCommand(text) == true) {
|
if (ChatManager.isDevCommand(text) == true) {
|
||||||
ChatManager.processDevCommand(player, text);
|
ClientAdminCommandMsgHandler.processDevCommand(player, text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +205,7 @@ public enum ChatManager {
|
|||||||
PlayerCharacter pcSender = null;
|
PlayerCharacter pcSender = null;
|
||||||
|
|
||||||
if (sender.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (sender.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
pcSender = (PlayerCharacter) sender;
|
pcSender = sender;
|
||||||
|
|
||||||
if (isFlood) {
|
if (isFlood) {
|
||||||
ChatManager.chatSayError(pcSender, FLOOD_USER_ERROR);
|
ChatManager.chatSayError(pcSender, FLOOD_USER_ERROR);
|
||||||
@@ -417,7 +342,7 @@ public enum ChatManager {
|
|||||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
|
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
|
||||||
.getCharter() : 0); // Charter?
|
.getCharter() : 0); // Charter?
|
||||||
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
||||||
chatGuildMsg.setUnknown06(sender.getRace().getRaceType().getCharacterSex().equals(Enum.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(Enum.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
||||||
|
|
||||||
// Send dispatch to each player
|
// Send dispatch to each player
|
||||||
|
|
||||||
@@ -602,7 +527,6 @@ public enum ChatManager {
|
|||||||
distroList.remove(awo);
|
distroList.remove(awo);
|
||||||
else if (awo.getObjectUUID() == tar.getObjectUUID())
|
else if (awo.getObjectUUID() == tar.getObjectUUID())
|
||||||
distroList.remove(awo);
|
distroList.remove(awo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String textToThief = "";
|
String textToThief = "";
|
||||||
@@ -612,20 +536,20 @@ public enum ChatManager {
|
|||||||
if (item != null) //Steal
|
if (item != null) //Steal
|
||||||
if (success) {
|
if (success) {
|
||||||
String name = "";
|
String name = "";
|
||||||
if (item.getItemBase() != null)
|
if (item.template.item_type.equals(Enum.ItemType.GOLD))
|
||||||
if (item.getItemBase().getUUID() == 7)
|
name = amount + " gold ";
|
||||||
name = amount + " gold ";
|
else {
|
||||||
else {
|
String vowels = "aeiou";
|
||||||
String vowels = "aeiou";
|
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
|
||||||
String iName = item.getItemBase().getName();
|
String iName = template.item_base_name;
|
||||||
if (iName.length() > 0)
|
if (iName.length() > 0)
|
||||||
if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0)
|
if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0)
|
||||||
name = "an " + iName + ' ';
|
name = "an " + iName + ' ';
|
||||||
else
|
else
|
||||||
name = "a " + iName + ' ';
|
name = "a " + iName + ' ';
|
||||||
}
|
}
|
||||||
textToThief = "You have stolen " + name + "from " + tar.getFirstName() + '!';
|
textToThief = "You have stolen " + name + "from " + tar.getFirstName() + '!';
|
||||||
textToVictim = sender.getFirstName() + "is caught with thier hands in your pocket!";
|
textToVictim = sender.getFirstName() + "is caught with their hands in your pocket!";
|
||||||
//textToOthers = sender.getFirstName() + " steals " + name + "from " + target.getFirstName() + ".";
|
//textToOthers = sender.getFirstName() + " steals " + name + "from " + target.getFirstName() + ".";
|
||||||
} else
|
} else
|
||||||
textToThief = "Your attempt at stealing failed..."; //textToVictim = sender.getFirstName() + " fails to steal from you.";
|
textToThief = "Your attempt at stealing failed..."; //textToVictim = sender.getFirstName() + " fails to steal from you.";
|
||||||
@@ -645,6 +569,7 @@ public enum ChatManager {
|
|||||||
//Send msg to thief
|
//Send msg to thief
|
||||||
HashSet<AbstractWorldObject> senderList = new HashSet<>();
|
HashSet<AbstractWorldObject> senderList = new HashSet<>();
|
||||||
senderList.add(sender);
|
senderList.add(sender);
|
||||||
|
|
||||||
if (!textToThief.isEmpty())
|
if (!textToThief.isEmpty())
|
||||||
ChatManager.chatSystemSend(senderList, textToThief, 1, 2);
|
ChatManager.chatSystemSend(senderList, textToThief, 1, 2);
|
||||||
|
|
||||||
@@ -678,22 +603,6 @@ public enum ChatManager {
|
|||||||
sendInfoMsgToPlayer(pc, text, 1);
|
sendInfoMsgToPlayer(pc, text, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatCommanderError(PlayerCharacter pc, String text) {
|
|
||||||
sendErrorMsgToPlayer(pc, text, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatNationError(PlayerCharacter pc, String text) {
|
|
||||||
sendErrorMsgToPlayer(pc, text, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatLeaderError(PlayerCharacter pc, String text) {
|
|
||||||
sendErrorMsgToPlayer(pc, text, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatShoutError(PlayerCharacter pc, String text) {
|
|
||||||
sendErrorMsgToPlayer(pc, text, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatInfoError(PlayerCharacter pc, String text) {
|
public static void chatInfoError(PlayerCharacter pc, String text) {
|
||||||
sendErrorMsgToPlayer(pc, text, 10);
|
sendErrorMsgToPlayer(pc, text, 10);
|
||||||
}
|
}
|
||||||
@@ -718,35 +627,16 @@ public enum ChatManager {
|
|||||||
sendErrorMsgToPlayer(pc, text, 16);
|
sendErrorMsgToPlayer(pc, text, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatEmoteError(PlayerCharacter pc, String text) {
|
|
||||||
sendErrorMsgToPlayer(pc, text, 17);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatTellError(PlayerCharacter pc, String text) {
|
public static void chatTellError(PlayerCharacter pc, String text) {
|
||||||
sendErrorMsgToPlayer(pc, text, 19);
|
sendErrorMsgToPlayer(pc, text, 19);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Info Message to channels
|
// Send Info Message to channels
|
||||||
public static void chatCommanderInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 3, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatNationInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 5, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatNationInfo(Guild nation, String text) {
|
public static void chatNationInfo(Guild nation, String text) {
|
||||||
chatSystemGuild(nation, text, 5, 2);
|
chatSystemGuild(nation, text, 5, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatLeaderInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 6, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatShoutInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 7, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatInfoInfo(PlayerCharacter pc, String text) {
|
public static void chatInfoInfo(PlayerCharacter pc, String text) {
|
||||||
chatSystem(pc, text, 10, 2);
|
chatSystem(pc, text, 10, 2);
|
||||||
}
|
}
|
||||||
@@ -755,30 +645,14 @@ public enum ChatManager {
|
|||||||
chatSystem(pc, text, 12, 2);
|
chatSystem(pc, text, 12, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatICInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 13, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatGroupInfo(PlayerCharacter pc, String text) {
|
public static void chatGroupInfo(PlayerCharacter pc, String text) {
|
||||||
chatSystem(pc, text, 14, 2);
|
chatSystem(pc, text, 14, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatCityInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 15, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatSayInfo(PlayerCharacter pc, String text) {
|
public static void chatSayInfo(PlayerCharacter pc, String text) {
|
||||||
chatSystem(pc, text, 16, 2);
|
chatSystem(pc, text, 16, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatEmoteInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 17, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatTellInfo(PlayerCharacter pc, String text) {
|
|
||||||
chatSystem(pc, text, 19, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chatGroupInfoCanSee(PlayerCharacter pc, String text) {
|
public static void chatGroupInfoCanSee(PlayerCharacter pc, String text) {
|
||||||
HashSet<AbstractWorldObject> distroList = null;
|
HashSet<AbstractWorldObject> distroList = null;
|
||||||
|
|
||||||
@@ -793,7 +667,7 @@ public enum ChatManager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
else {
|
else {
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
if (pcc.getSeeInvis() < pc.getHidden())
|
if (pcc.getSeeInvis() < pc.hidden)
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -862,11 +736,6 @@ public enum ChatManager {
|
|||||||
DispatchMessage.dispatchMsgToAll(msg);
|
DispatchMessage.dispatchMsgToAll(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chatInfo(String text) {
|
|
||||||
HashSet<AbstractWorldObject> distroList = ChatManager.getAllPlayers(null);
|
|
||||||
chatSystemSend(distroList, text, 1, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
||||||
String text = "The " + target.getName() + " attacks " + source.getName();
|
String text = "The " + target.getName() + " attacks " + source.getName();
|
||||||
ChatSystemMsg msg = new ChatSystemMsg(null, text);
|
ChatSystemMsg msg = new ChatSystemMsg(null, text);
|
||||||
@@ -1144,94 +1013,4 @@ public enum ChatManager {
|
|||||||
return text.equalsIgnoreCase("lua_population()");
|
return text.equalsIgnoreCase("lua_population()");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean processDevCommand(AbstractWorldObject sender, String text) {
|
|
||||||
|
|
||||||
if (sender.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
||||||
|
|
||||||
PlayerCharacter pcSender = (PlayerCharacter) sender;
|
|
||||||
|
|
||||||
// first remove the DEV_CMD_PREFIX
|
|
||||||
String[] words = text.split(MBServerStatics.DEV_CMD_PREFIX, 2);
|
|
||||||
|
|
||||||
if (words[1].length() == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// next get the command
|
|
||||||
String[] commands = words[1].split(" ", 2);
|
|
||||||
String cmd = commands[0].toLowerCase();
|
|
||||||
String cmdArgument = "";
|
|
||||||
|
|
||||||
if (commands.length > 1)
|
|
||||||
cmdArgument = commands[1].trim();
|
|
||||||
|
|
||||||
AbstractGameObject target = pcSender.getLastTarget();
|
|
||||||
// return DevCmd.processDevCommand(pcSender, cmd, cmdArgument,
|
|
||||||
// target);
|
|
||||||
return DevCmdManager.handleDevCmd(pcSender, cmd,
|
|
||||||
cmdArgument, target);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process an Admin Command, which is a preset command sent from the client
|
|
||||||
*/
|
|
||||||
public static void HandleClientAdminCmd(ClientAdminCommandMsg data,
|
|
||||||
ClientConnection cc) {
|
|
||||||
|
|
||||||
PlayerCharacter pcSender = SessionManager.getPlayerCharacter(cc);
|
|
||||||
|
|
||||||
if (pcSender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Account acct = SessionManager.getAccount(pcSender);
|
|
||||||
|
|
||||||
if (acct == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// require minimal access to continue
|
|
||||||
// specific accessLevel checks performed by the DevCmdManager
|
|
||||||
if (acct.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
|
||||||
Logger.warn(pcSender.getFirstName() + " Attempted to use a client admin command");
|
|
||||||
//wtf? ChatManager.chatSystemInfo(pcSender, "CHEATER!!!!!!!!!!!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// First remove the initial slash
|
|
||||||
String d = data.getMsgCommand();
|
|
||||||
String[] words = d.split("/", 2);
|
|
||||||
|
|
||||||
if (words[1].length() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Next get the command
|
|
||||||
String[] commands = words[1].split(" ", 2);
|
|
||||||
String cmd = commands[0].toLowerCase();
|
|
||||||
String cmdArgument = "";
|
|
||||||
|
|
||||||
if (commands.length > 1)
|
|
||||||
cmdArgument = commands[1].trim();
|
|
||||||
|
|
||||||
AbstractGameObject target = data.getTarget();
|
|
||||||
|
|
||||||
// Map to a DevCmd
|
|
||||||
String devCmd = "";
|
|
||||||
|
|
||||||
if (cmd.compareTo("goto") == 0)
|
|
||||||
devCmd = "goto";
|
|
||||||
else if (cmd.compareTo("suspend") == 0)
|
|
||||||
devCmd = "suspend";
|
|
||||||
else if (cmd.compareTo("getinfo") == 0)
|
|
||||||
devCmd = "info";
|
|
||||||
else if (devCmd.isEmpty()) {
|
|
||||||
Logger.info("Unhandled admin command was used: /"
|
|
||||||
+ cmd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DevCmdManager.handleDevCmd(pcSender, devCmd, cmdArgument,
|
|
||||||
target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,6 @@ package engine.gameManager;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.net.NetMsgHandler;
|
|
||||||
import engine.server.login.LoginServer;
|
import engine.server.login.LoginServer;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -30,6 +29,7 @@ public enum ConfigManager {
|
|||||||
|
|
||||||
MB_BIND_ADDR,
|
MB_BIND_ADDR,
|
||||||
MB_EXTERNAL_ADDR,
|
MB_EXTERNAL_ADDR,
|
||||||
|
|
||||||
// Database connection config
|
// Database connection config
|
||||||
|
|
||||||
MB_DATABASE_ADDRESS,
|
MB_DATABASE_ADDRESS,
|
||||||
@@ -65,8 +65,8 @@ public enum ConfigManager {
|
|||||||
MB_WORLD_MAINTENANCE,
|
MB_WORLD_MAINTENANCE,
|
||||||
MB_WORLD_GREETING,
|
MB_WORLD_GREETING,
|
||||||
MB_WORLD_KEYCLONE_MAX,
|
MB_WORLD_KEYCLONE_MAX,
|
||||||
MB_WORLD_TESTMODE,
|
|
||||||
MB_USE_RUINS,
|
MB_USE_RUINS,
|
||||||
|
MB_RULESET,
|
||||||
|
|
||||||
// Mobile AI modifiers
|
// Mobile AI modifiers
|
||||||
MB_AI_CAST_FREQUENCY,
|
MB_AI_CAST_FREQUENCY,
|
||||||
@@ -98,8 +98,7 @@ public enum ConfigManager {
|
|||||||
MB_MAGICBOT_FORTOFIX,
|
MB_MAGICBOT_FORTOFIX,
|
||||||
MB_MAGICBOT_RECRUIT,
|
MB_MAGICBOT_RECRUIT,
|
||||||
MB_MAGICBOT_MAGICBOX,
|
MB_MAGICBOT_MAGICBOX,
|
||||||
MB_MAGICBOT_ADMINLOG,
|
MB_MAGICBOT_ADMINLOG;
|
||||||
MB_WORLD_BOXLIMIT;
|
|
||||||
|
|
||||||
// Map to hold our config pulled in from the environment
|
// Map to hold our config pulled in from the environment
|
||||||
// We also use the config to point to the current message pump
|
// We also use the config to point to the current message pump
|
||||||
@@ -108,7 +107,6 @@ public enum ConfigManager {
|
|||||||
public static final String DEFAULT_DATA_DIR = "mb.data/";
|
public static final String DEFAULT_DATA_DIR = "mb.data/";
|
||||||
public static Map<String, String> configMap = new HashMap(System.getenv());
|
public static Map<String, String> configMap = new HashMap(System.getenv());
|
||||||
public static Enum.ServerType serverType = Enum.ServerType.NONE;
|
public static Enum.ServerType serverType = Enum.ServerType.NONE;
|
||||||
public static NetMsgHandler handler;
|
|
||||||
public static WorldServer worldServer;
|
public static WorldServer worldServer;
|
||||||
public static LoginServer loginServer;
|
public static LoginServer loginServer;
|
||||||
public static Map<ConfigManager, Pattern> regex = new HashMap<>();
|
public static Map<ConfigManager, Pattern> regex = new HashMap<>();
|
||||||
@@ -136,7 +134,6 @@ public enum ConfigManager {
|
|||||||
File file = new File("mbbranch.sh");
|
File file = new File("mbbranch.sh");
|
||||||
|
|
||||||
if (file.exists() && !file.isDirectory()) {
|
if (file.exists() && !file.isDirectory()) {
|
||||||
|
|
||||||
String[] command = {"./mbbranch.sh"};
|
String[] command = {"./mbbranch.sh"};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public enum DbManager {
|
public enum DbManager {
|
||||||
@@ -47,7 +48,6 @@ public enum DbManager {
|
|||||||
public static final dbEffectsResourceCostHandler EffectsResourceCostsQueries = new dbEffectsResourceCostHandler();
|
public static final dbEffectsResourceCostHandler EffectsResourceCostsQueries = new dbEffectsResourceCostHandler();
|
||||||
public static final dbGuildHandler GuildQueries = new dbGuildHandler();
|
public static final dbGuildHandler GuildQueries = new dbGuildHandler();
|
||||||
public static final dbItemHandler ItemQueries = new dbItemHandler();
|
public static final dbItemHandler ItemQueries = new dbItemHandler();
|
||||||
public static final dbItemBaseHandler ItemBaseQueries = new dbItemBaseHandler();
|
|
||||||
public static final dbKitHandler KitQueries = new dbKitHandler();
|
public static final dbKitHandler KitQueries = new dbKitHandler();
|
||||||
public static final dbLootHandler LootQueries = new dbLootHandler();
|
public static final dbLootHandler LootQueries = new dbLootHandler();
|
||||||
public static final dbMenuHandler MenuQueries = new dbMenuHandler();
|
public static final dbMenuHandler MenuQueries = new dbMenuHandler();
|
||||||
@@ -68,9 +68,7 @@ public enum DbManager {
|
|||||||
public static final dbZoneHandler ZoneQueries = new dbZoneHandler();
|
public static final dbZoneHandler ZoneQueries = new dbZoneHandler();
|
||||||
public static final dbRealmHandler RealmQueries = new dbRealmHandler();
|
public static final dbRealmHandler RealmQueries = new dbRealmHandler();
|
||||||
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
|
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
|
||||||
public static final dbBoonHandler BoonQueries = new dbBoonHandler();
|
|
||||||
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
|
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
|
||||||
public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
|
|
||||||
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
|
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
|
||||||
|
|
||||||
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
|
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
|
||||||
@@ -267,6 +265,40 @@ public enum DbManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <E extends java.lang.Enum<E>> EnumSet<E> parseEnumSet(String mysqlSet, Class<E> enumClass) {
|
||||||
|
|
||||||
|
// Create empty output set of the passed Enum class
|
||||||
|
|
||||||
|
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
||||||
|
|
||||||
|
// Early exit for empty sets
|
||||||
|
|
||||||
|
if (mysqlSet.isEmpty())
|
||||||
|
return enumSet;
|
||||||
|
|
||||||
|
// Split set string and trim each element
|
||||||
|
|
||||||
|
String[] elements = mysqlSet.split(";");
|
||||||
|
|
||||||
|
for (String element : elements) {
|
||||||
|
|
||||||
|
element = element.trim();
|
||||||
|
|
||||||
|
// Parse the element into an enum; add to the output set
|
||||||
|
|
||||||
|
try {
|
||||||
|
E enumConstant = java.lang.Enum.valueOf(enumClass, element);
|
||||||
|
enumSet.add(enumConstant);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(" Parse error: " + mysqlSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the output set
|
||||||
|
|
||||||
|
return enumSet;
|
||||||
|
}
|
||||||
|
|
||||||
public static void printCacheCount(PlayerCharacter pc) {
|
public static void printCacheCount(PlayerCharacter pc) {
|
||||||
ChatManager.chatSystemInfo(pc, "Cache Lists");
|
ChatManager.chatSystemInfo(pc, "Cache Lists");
|
||||||
|
|
||||||
@@ -325,4 +357,5 @@ public enum DbManager {
|
|||||||
|
|
||||||
Logger.info("Database configured with " + connectionCount + " connections");
|
Logger.info("Database configured with " + connectionCount + " connections");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ public enum DevCmdManager {
|
|||||||
private static void registerCommands() {
|
private static void registerCommands() {
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
DevCmdManager.registerDevCmd(new DistanceCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new HelpCmd());
|
DevCmdManager.registerDevCmd(new HelpCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new PrintRunesCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
||||||
@@ -72,13 +72,11 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
||||||
DevCmdManager.registerDevCmd(new EffectCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
||||||
DevCmdManager.registerDevCmd(new DebugCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
|
DevCmdManager.registerDevCmd(new HotzoneCmd());
|
||||||
DevCmdManager.registerDevCmd(new MineActiveCmd());
|
DevCmdManager.registerDevCmd(new MineActiveCmd());
|
||||||
// Dev
|
// Dev
|
||||||
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
|
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
|
||||||
@@ -89,12 +87,9 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new RotateCmd());
|
DevCmdManager.registerDevCmd(new RotateCmd());
|
||||||
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
||||||
DevCmdManager.registerDevCmd(new SysMsgCmd());
|
DevCmdManager.registerDevCmd(new SysMsgCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetBankCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new GetVaultCmd());
|
DevCmdManager.registerDevCmd(new GetVaultCmd());
|
||||||
DevCmdManager.registerDevCmd(new CombatMessageCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new RenameCmd());
|
DevCmdManager.registerDevCmd(new RenameCmd());
|
||||||
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetMemoryCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetRankCmd());
|
DevCmdManager.registerDevCmd(new SetRankCmd());
|
||||||
DevCmdManager.registerDevCmd(new MakeBaneCmd());
|
DevCmdManager.registerDevCmd(new MakeBaneCmd());
|
||||||
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
||||||
@@ -102,15 +97,9 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetInvulCmd());
|
DevCmdManager.registerDevCmd(new SetInvulCmd());
|
||||||
DevCmdManager.registerDevCmd(new MakeItemCmd());
|
DevCmdManager.registerDevCmd(new MakeItemCmd());
|
||||||
DevCmdManager.registerDevCmd(new GimmeCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new EnchantCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
||||||
// Admin
|
// Admin
|
||||||
DevCmdManager.registerDevCmd(new GetCacheCountCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new GetRuneDropRateCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new DecachePlayerCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new AuditMobsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new ChangeNameCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetGuildCmd());
|
DevCmdManager.registerDevCmd(new SetGuildCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetOwnerCmd());
|
DevCmdManager.registerDevCmd(new SetOwnerCmd());
|
||||||
DevCmdManager.registerDevCmd(new NetDebugCmd());
|
DevCmdManager.registerDevCmd(new NetDebugCmd());
|
||||||
@@ -119,31 +108,18 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
|
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SplatMobCmd());
|
DevCmdManager.registerDevCmd(new SplatMobCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotNpcCmd());
|
DevCmdManager.registerDevCmd(new SlotNpcCmd());
|
||||||
DevCmdManager.registerDevCmd(new GateInfoCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
||||||
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new RebootCmd());
|
DevCmdManager.registerDevCmd(new RebootCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetMineTypeCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetMineExpansion());
|
|
||||||
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
||||||
DevCmdManager.registerDevCmd(new GotoObj());
|
DevCmdManager.registerDevCmd(new GotoObj());
|
||||||
DevCmdManager.registerDevCmd(new convertLoc());
|
|
||||||
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
||||||
DevCmdManager.registerDevCmd(new ResetLevelCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetNpcNameCmd());
|
DevCmdManager.registerDevCmd(new SetNpcNameCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetNpcMobbaseCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new DespawnCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new BoundsCmd());
|
DevCmdManager.registerDevCmd(new BoundsCmd());
|
||||||
DevCmdManager.registerDevCmd(new GotoBoundsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new RegionCmd());
|
DevCmdManager.registerDevCmd(new RegionCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetMaintCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerDevCmd(AbstractDevCmd cmd) {
|
private static void registerDevCmd(AbstractDevCmd cmd) {
|
||||||
@@ -177,44 +153,10 @@ public enum DevCmdManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pcSender.getTimestamps().containsKey("DEVCOMMAND"))
|
|
||||||
pcSender.getTimestamps().put("DEVCOMMAND",System.currentTimeMillis() - 1500L);
|
|
||||||
else if(System.currentTimeMillis() - pcSender.getTimestamps().get("DEVCOMMAND") < 1000L)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//only admin level can run dev commands on production
|
||||||
boolean playerAllowed = false;
|
|
||||||
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||||
switch (adc.getMainCmdString()) {
|
|
||||||
case "printresists":
|
|
||||||
case "printstats":
|
|
||||||
case "printskills":
|
|
||||||
case "printpowers":
|
|
||||||
case "gimme":
|
|
||||||
case "goto":
|
|
||||||
case "teleportmode":
|
|
||||||
case "printbonuses":
|
|
||||||
playerAllowed = true;
|
|
||||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
|
||||||
target = pcSender;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
switch (adc.getMainCmdString()) {
|
|
||||||
case "printresists":
|
|
||||||
case "printstats":
|
|
||||||
case "printskills":
|
|
||||||
case "printpowers":
|
|
||||||
case "printbonuses":
|
|
||||||
//case "gimme":
|
|
||||||
playerAllowed = true;
|
|
||||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
|
||||||
target = pcSender;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
|
|
||||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,12 +303,13 @@ public enum GroupManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean goldSplit(PlayerCharacter pc, Item item, ClientConnection origin, AbstractWorldObject tar) {
|
public static boolean goldSplit(PlayerCharacter pc, Item item, ClientConnection origin, AbstractWorldObject tar) {
|
||||||
if (item == null || pc == null || tar == null || item.getItemBase() == null) {
|
|
||||||
|
if (item == null || pc == null || tar == null) {
|
||||||
Logger.error("null something");
|
Logger.error("null something");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getItemBase().getUUID() != 7) //only split goldItem
|
if (!item.template.item_type.equals(Enum.ItemType.GOLD)) //only split goldItem
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Group group = getGroup(pc);
|
Group group = getGroup(pc);
|
||||||
@@ -316,7 +317,6 @@ public enum GroupManager {
|
|||||||
if (group == null || !group.getSplitGold()) //make sure player is grouped and split is on
|
if (group == null || !group.getSplitGold()) //make sure player is grouped and split is on
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> playersSplit = new ArrayList<>();
|
ArrayList<PlayerCharacter> playersSplit = new ArrayList<>();
|
||||||
|
|
||||||
//get group members
|
//get group members
|
||||||
@@ -331,8 +331,8 @@ public enum GroupManager {
|
|||||||
playersSplit.add(groupMember);
|
playersSplit.add(groupMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//make sure more than one group member in loot range
|
||||||
|
|
||||||
//make sure more then one group member in loot range
|
|
||||||
int size = playersSplit.size();
|
int size = playersSplit.size();
|
||||||
|
|
||||||
if (size < 2)
|
if (size < 2)
|
||||||
@@ -353,22 +353,21 @@ public enum GroupManager {
|
|||||||
|
|
||||||
if (item.getObjectType() == Enum.GameObjectType.MobLoot) {
|
if (item.getObjectType() == Enum.GameObjectType.MobLoot) {
|
||||||
if (tar.getObjectType() == Enum.GameObjectType.Mob) {
|
if (tar.getObjectType() == Enum.GameObjectType.Mob) {
|
||||||
((Mob) tar).getCharItemManager().delete(item);
|
((Mob) tar).charItemManager.delete(item);
|
||||||
} else
|
} else
|
||||||
item.setNumOfItems(0);
|
item.setNumOfItems(0);
|
||||||
} else
|
} else
|
||||||
item.setNumOfItems(0);
|
item.setNumOfItems(0);
|
||||||
for (PlayerCharacter splitPlayer : playersSplit) {
|
|
||||||
|
|
||||||
|
for (PlayerCharacter splitPlayer : playersSplit) {
|
||||||
|
|
||||||
int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount;
|
int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount;
|
||||||
if (amt > 0)
|
if (amt > 0)
|
||||||
splitPlayer.getCharItemManager().addGoldToInventory(amt, false);
|
splitPlayer.charItemManager.addGoldToInventory(amt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PlayerCharacter splitPlayer : playersSplit) {
|
for (PlayerCharacter splitPlayer : playersSplit) {
|
||||||
|
|
||||||
|
|
||||||
UpdateGoldMsg ugm = new UpdateGoldMsg(splitPlayer);
|
UpdateGoldMsg ugm = new UpdateGoldMsg(splitPlayer);
|
||||||
ugm.configure();
|
ugm.configure();
|
||||||
|
|
||||||
@@ -380,7 +379,6 @@ public enum GroupManager {
|
|||||||
updateTargetGold.configure();
|
updateTargetGold.configure();
|
||||||
DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
|
|
||||||
// //TODO send group split message
|
// //TODO send group split message
|
||||||
String text = "Group Split: " + amount;
|
String text = "Group Split: " + amount;
|
||||||
ChatManager.chatGroupInfo(pc, text);
|
ChatManager.chatGroupInfo(pc, text);
|
||||||
|
|||||||
@@ -201,4 +201,13 @@ public enum GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player) {
|
||||||
|
Enum.GuildCharterType charter = guild.getGuildType();
|
||||||
|
if (charter.requiredClasses.contains(player.absPromotionClass))
|
||||||
|
if (charter.requiredRaces.contains(player.absRace))
|
||||||
|
if (charter.sexRequired.contains(player.absGender))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user