forked from MagicBane/Server
Compare commits
543 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84446eb726 | |||
| 99f5a9c606 | |||
| 235b5e7375 | |||
| 7289f9e006 | |||
| 9c1afd9441 | |||
| 56226c71eb | |||
| c1eb6796f5 | |||
| 88e16448a8 | |||
| 4cb428e993 | |||
| af9945f9db | |||
| f0594fb1b2 | |||
| a155bc0308 | |||
| dce7444483 | |||
| 76eed79b0a | |||
| f73ed17c05 | |||
| b049d21aff | |||
| f6cce5ee1f | |||
| 8038c2ebe2 | |||
| 9f51b9af57 | |||
| cbc75bf9d7 | |||
| 0ecfa546cd | |||
| b89fb0803d | |||
| 11005d58a7 | |||
| b0c6239314 | |||
| 67f66155e9 | |||
| 7fbae12e99 | |||
| 65580c0a47 | |||
| 236afe4cc6 | |||
| c23a6af28f | |||
| 2535106d2c | |||
| d8379ae5a9 | |||
| 9f13f5fc5d | |||
| 884cb30ebd | |||
| 30488e5da6 | |||
| b7e798a950 | |||
| e999ca3f68 | |||
| 039638c0d8 | |||
| f282504896 | |||
| 0062936ac6 | |||
| 19c41daa86 | |||
| d860b16cfd | |||
| e3b42a8ad9 | |||
| 20bd7a82af | |||
| e607eb8220 | |||
| 38ca49d1a5 | |||
| a21bdfe031 | |||
| f95832b87c | |||
| feff9b3540 | |||
| 78118aa08c | |||
| 3539372437 | |||
| 7c498625bd | |||
| e379016123 | |||
| afa68b840c | |||
| 1926deb7f9 | |||
| 25c1f34c23 | |||
| d0e04e53ad | |||
| e475fb5cc9 | |||
| f72f632cd8 | |||
| 02ea27fc6f | |||
| 5d338bb87c | |||
| f9f08c2886 | |||
| dcc139043d | |||
| 520219404c | |||
| f97991f00d | |||
| 7b7e1c5337 | |||
| 6e66659940 | |||
| 3d83baed78 | |||
| 049b27da96 | |||
| 6bcbe0f633 | |||
| 8c44e39275 | |||
| e36ab1f5d2 | |||
| 865c775f41 | |||
| 198778ba2d | |||
| 215aabdc5f | |||
| 8d92c8be37 | |||
| 93b3ce07f0 | |||
| f9b7c8b851 | |||
| b3cf72abdc | |||
| 65fddd06a9 | |||
| 41f4a8ff58 | |||
| a13d5018b9 | |||
| 2ac3ce5bc8 | |||
| 85514987e7 | |||
| c9eb07b5ba | |||
| 7201b61498 | |||
| 55b3161900 | |||
| 9d5c4424a1 | |||
| d507ba2339 | |||
| 4ec5103454 | |||
| 3e09cd415e | |||
| 1098265145 | |||
| df7a106237 | |||
| 00b38970a1 | |||
| c1004e5817 | |||
| 13e9738345 | |||
| 1a7c1e2544 | |||
| ff082487b5 | |||
| 14cac0d892 | |||
| a8347e0b53 | |||
| a73c3453ea | |||
| a64932b2c9 | |||
| 685297171c | |||
| 2e3e403165 | |||
| fbd910ef50 | |||
| 30129d161f | |||
| a6510af56d | |||
| 9830920635 | |||
| 93025b72cd | |||
| 22639baa4c | |||
| 1aba8dfb11 | |||
| 8b4eb96262 | |||
| cafe6cd2fe | |||
| da6140f6f4 | |||
| 3fc68ce2ff | |||
| 5e8927245b | |||
| 75de1b3ae8 | |||
| 6743114d19 | |||
| 28cca67cb3 | |||
| bad7c6e798 | |||
| ecd3b38d3a | |||
| 8f09f16603 | |||
| 80812cb402 | |||
| 66fbf7aee6 | |||
| a92c603ab2 | |||
| 365438370d | |||
| a40b8fc915 | |||
| 5d92c1c86d | |||
| c526fd8847 | |||
| cd767dc68c | |||
| e21ebc75ee | |||
| 931eaaae4a | |||
| 4d487e6bf0 | |||
| 6c45a6573a | |||
| 45b0dda7d9 | |||
| caf3bc7470 | |||
| 5259b801f7 | |||
| 77e6d0db75 | |||
| b2d7e5ec1e | |||
| 15bc99d216 | |||
| 63c6e2abd7 | |||
| 8ab97a1b36 | |||
| d1aa581879 | |||
| 5f56143c5e | |||
| 1a2b558ac3 | |||
| 4f4ff74bf1 | |||
| ded3b08080 | |||
| 14a29c8612 | |||
| e66e430d30 | |||
| c833f560c1 | |||
| 454c721842 | |||
| 26eda324dc | |||
| 16951d36a2 | |||
| e1d36125d2 | |||
| 7a3c259d2f | |||
| aa5fb2a2c5 | |||
| a92cc6506c | |||
| 3971548142 | |||
| d94de771bf | |||
| c5f47ffcd4 | |||
| b336235ad7 | |||
| eea07309aa | |||
| 5529170036 | |||
| 3d745e93b6 | |||
| 019082bec7 | |||
| 855cceea70 | |||
| 487eae85e1 | |||
| 5d188e61c0 | |||
| 546c335198 | |||
| aaecc5eda2 | |||
| d13e939ddd | |||
| afea79474e | |||
| 05f555b5b5 | |||
| 85931b6dc2 | |||
| 9f0c7f6a76 | |||
| 022c06c803 | |||
| 1b72e7d6b7 | |||
| 666ac6df5b | |||
| 36481a53d9 | |||
| 5a9901d775 | |||
| b3a24d0158 | |||
| 8890826070 | |||
| daa84a1fef | |||
| a4bd47f001 | |||
| d031f1be01 | |||
| a48abc59ce | |||
| 878f05c323 | |||
| d462711d25 | |||
| 40a0120a28 | |||
| ac812eaeae | |||
| 9965223d9b | |||
| 08b99d0d3a | |||
| 519a6a2b1e | |||
| 524f5d470b | |||
| 6631c6a5d7 | |||
| 10f95fb0d9 | |||
| a315366026 | |||
| 1901c9a679 | |||
| 415ad5402f | |||
| 9a40e12dbc | |||
| a1af663796 | |||
| 78b7ddb32a | |||
| 5e5ee4fed1 | |||
| 84c022a39b | |||
| 300741b05a | |||
| dc685a01c6 | |||
| 752f897a34 | |||
| 722cb6b1fd | |||
| 50c095cd09 | |||
| c23546eb46 | |||
| 36340c4e52 | |||
| a7ab38f40c | |||
| 0901c03b74 | |||
| 50817352c1 | |||
| ee4a7447bc | |||
| a6d3c827ad | |||
| d4ea31b91f | |||
| 210faaec6d | |||
| 16be9b9dae | |||
| 2b8f709182 | |||
| aec22d8563 | |||
| 1996d042f0 | |||
| 27b6665717 | |||
| ce20045611 | |||
| 277f8bfd69 | |||
| 1da2db856f | |||
| 33dfe1389c | |||
| 013b69405a | |||
| ca07a53835 | |||
| bbdb6ae1f6 | |||
| 4a63222318 | |||
| 1a1c552964 | |||
| 3587dc2d75 | |||
| 96eb9a3ad0 | |||
| eaa70f43c0 | |||
| a426b773d3 | |||
| 84841edda9 | |||
| d416dbe47b | |||
| 7052da7e54 | |||
| 8f2a2f0ba6 | |||
| d575ba663d | |||
| 964fe7f335 | |||
| d3e92d6576 | |||
| 9dbd6069f1 | |||
| 7ae25c9a1b | |||
| 689969a005 | |||
| b270e1ac8d | |||
| 95d38cea44 | |||
| 3ed0765fe5 | |||
| 0c90164c24 | |||
| a45fa39afc | |||
| 8959f5e1c5 | |||
| df338ab00e | |||
| ac7a2452d6 | |||
| 80104e6d07 | |||
| 8f394cd01d | |||
| e5a32c83c5 | |||
| 8dce20e69f | |||
| 3428a06bb8 | |||
| 177f9a1ff6 | |||
| 9d93944dd1 | |||
| a4cba1a352 | |||
| 17b4232d80 | |||
| 2eb58eb719 | |||
| db5a4195ad | |||
| 3fb29f8e2b | |||
| dacdb2cf35 | |||
| c8473cbe03 | |||
| e9edf8a7ea | |||
| 5a73aa3d90 | |||
| 04101c1c3e | |||
| 0c9343f24d | |||
| b71710871c | |||
| f6df6db17b | |||
| 3f8b3bc6cb | |||
| 383ef27128 | |||
| d8189768ae | |||
| a5eb2fce75 | |||
| 1fe242a284 | |||
| a4b83ca9a0 | |||
| 2365b26c1c | |||
| 8fb044f71b | |||
| 5ce42475c4 | |||
| 57b9d31fff | |||
| 7671586cb0 | |||
| a1997e31a8 | |||
| f5478e9f64 | |||
| 06abea3576 | |||
| ae6b584a5f | |||
| 9e27c69906 | |||
| 00afe27900 | |||
| 4e5c1a32d3 | |||
| d4f5043a25 | |||
| 03a5a55974 | |||
| dbab4c1212 | |||
| d186a96796 | |||
| 6880d014c3 | |||
| 6542dec358 | |||
| 1a2738c3a9 | |||
| 12118ff125 | |||
| c3a00186ff | |||
| fafa777e98 | |||
| d4da99f61c | |||
| bb293c0c02 | |||
| 1e29971b3c | |||
| 25d70cca4f | |||
| 362832a196 | |||
| ed150a5ccd | |||
| d2247b66f1 | |||
| 3b58ea716c | |||
| 368e548e46 | |||
| 6f3612d196 | |||
| 0f38146fcc | |||
| 1a13f3f096 | |||
| 9cc102ca2a | |||
| 50ff4b89bf | |||
| 9b898825ab | |||
| 5be9033c40 | |||
| 67e55ab0a0 | |||
| 227549bf22 | |||
| 19707d10a3 | |||
| 91565ced89 | |||
| 2383b00c8c | |||
| 405063f036 | |||
| d2f3c6a879 | |||
| 4f759c1bd2 | |||
| 9d7f9ce7b3 | |||
| 56f3dfce92 | |||
| 9a66f18edb | |||
| d7270ffb84 | |||
| dd834a3104 | |||
| e28ed1b882 | |||
| 2370123c72 | |||
| 8a5133f04b | |||
| a0f874b319 | |||
| 415d11ae33 | |||
| f93b1ce30e | |||
| 9fb2e4ff1b | |||
| 601d0f4324 | |||
| cbf7db3347 | |||
| 217be1d234 | |||
| 7fabd6554d | |||
| d673819796 | |||
| a963a331a2 | |||
| eda5b8995f | |||
| d5e95eedf3 | |||
| 032e703704 | |||
| ad1444f5ba | |||
| a4b30b8620 | |||
| 9c002c7bff | |||
| 90495a27d9 | |||
| 1246fa699a | |||
| 511d37f5e0 | |||
| 7a03a0eaa9 | |||
| 2f57cb613e | |||
| e386c3078a | |||
| 3802889834 | |||
| f825b2baba | |||
| 6c92abd083 | |||
| c652379a5f | |||
| 61d34ab4ad | |||
| d511641410 | |||
| c8430625bf | |||
| a418224bbb | |||
| 9e3c13dea3 | |||
| 335850f7ff | |||
| f6baf8fe83 | |||
| 4c9b82b649 | |||
| f2570992e5 | |||
| 6911d6314d | |||
| eaeea9730c | |||
| fb0790a733 | |||
| 3230cd53e1 | |||
| edbce067b8 | |||
| 83877e5107 | |||
| 3a67540212 | |||
| 1a5db96023 | |||
| ef82f9ab5b | |||
| bf7e5c6333 | |||
| 443f0f5450 | |||
| cb1dccd630 | |||
| 2e558acbee | |||
| 74162ea54c | |||
| ccbe4fba04 | |||
| 5aeddb6166 | |||
| 49df5203ae | |||
| 0cfe801d18 | |||
| 89c01e8244 | |||
| 6605e4dd61 | |||
| d6239de6fd | |||
| 99ad6f3712 | |||
| f3041e7549 | |||
| 1269031be3 | |||
| ce96274f28 | |||
| a9a9bd0a3d | |||
| 33789adadc | |||
| 15b50a75c4 | |||
| ead34dbb1f | |||
| a9b1356efa | |||
| 33e105bc7b | |||
| e5041147f4 | |||
| 576e627ad1 | |||
| 4059664354 | |||
| 974c0ca7e8 | |||
| 8e7a7b8b6d | |||
| 1e3b1db905 | |||
| 51c98746c4 | |||
| 4c21439847 | |||
| 31385ee533 | |||
| bd4e34e0e1 | |||
| 9f591b166b | |||
| 7e457fa17b | |||
| 926b9d2bae | |||
| c5822b5acf | |||
| 516b66a50a | |||
| 39305d63c7 | |||
| c0cb856961 | |||
| 2fb97a676f | |||
| cbff151dc3 | |||
| eed75fd2fd | |||
| 6374390b34 | |||
| 2185d3ef7c | |||
| 4aaa96e36c | |||
| bf86680547 | |||
| 960307e262 | |||
| eedf96cc31 | |||
| 6fb5fce4d3 | |||
| 7688d21fe6 | |||
| 23e60b36b4 | |||
| ab8fc8e0a0 | |||
| b30f04046d | |||
| 9bd03c7d43 | |||
| 78118a1ac1 | |||
| 1f863d0cce | |||
| c49204aeeb | |||
| b1de3755fd | |||
| 83a1cc5aba | |||
| 9b0b15c31e | |||
| 802651d2d4 | |||
| 52a48e5618 | |||
| 14fe248e19 | |||
| 5b81be371e | |||
| 82d67f2850 | |||
| 1c342bd566 | |||
| bb8ad3c971 | |||
| e9fef85b72 | |||
| c0d1a4f274 | |||
| 94be3335a0 | |||
| 7d03f78546 | |||
| 023f933d0b | |||
| 9995cc01b7 | |||
| fd03b263d1 | |||
| 6a09a3fd44 | |||
| 1322f8610c | |||
| 90ab6175b5 | |||
| 2e3e9ee882 | |||
| 5158329785 | |||
| b8e0165da2 | |||
| 0fa6ebc136 | |||
| 4e5e362197 | |||
| 61514fef2b | |||
| 59e593ab0d | |||
| 2c6ea98ef9 | |||
| bd3ea16b57 | |||
| 45165332f6 | |||
| d764a66e55 | |||
| ac41e64429 | |||
| 462beb30b3 | |||
| 3a89e9c087 | |||
| e71863cbd2 | |||
| 5ec0ff0598 | |||
| 2ca9b77cfb | |||
| 4f535ef5fe | |||
| a46ad71bb0 | |||
| 90d6911d41 | |||
| e13ebae0df | |||
| 3e15fc8206 | |||
| 6a400467dd | |||
| 488188e9c3 | |||
| 0d31bc4280 | |||
| 6375b4431c | |||
| 683422f8a4 | |||
| e4dbad2669 | |||
| 34721fdee8 | |||
| f27668552c | |||
| 306fdf4235 | |||
| 553b09d827 | |||
| 8ee17f0c64 | |||
| 7e5ad644d3 | |||
| 846b8a7cde | |||
| f27a4f174b | |||
| c6d4375aa8 | |||
| b9ec54c76a | |||
| b351d7c1ae | |||
| 729ebe7cd0 | |||
| f51c28e708 | |||
| 9fbf55127d | |||
| f9fd61dc6b | |||
| 4f198e1f53 | |||
| 24c85a5140 | |||
| 3e1a5f4ccd | |||
| 34e5a3878c | |||
| 663e285091 | |||
| d87c03bb79 | |||
| abc57688d3 | |||
| 29671d56fc | |||
| e8cf6a722b | |||
| 2793ec331b | |||
| 1a0b91b068 | |||
| bec6cbe6e6 | |||
| f7ab10ff07 | |||
| 9671cbdc1a | |||
| e0af1f5932 | |||
| 8cb52c6142 | |||
| e5133211a9 | |||
| 8548612a80 | |||
| 41c3193275 | |||
| 15771d2802 | |||
| b4a62e5f3e | |||
| fc7e6735a1 | |||
| aeb21c328e | |||
| 9a34b13c2e | |||
| 231feef7fe | |||
| 0e6b68139f | |||
| ef62c2bb39 | |||
| 8f68997f3c | |||
| aebe2698c3 | |||
| 54e7a8fc7f | |||
| 8b4d37c53c | |||
| fbfca46d2f | |||
| 3228f473de | |||
| 17fcf0ee40 | |||
| 395fe31e02 | |||
| e98f9cf1f7 | |||
| fe0c0f97a5 | |||
| 7e27838818 | |||
| bc8094c20c | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
+42
-26
@@ -9,15 +9,13 @@
|
|||||||
package engine;
|
package engine;
|
||||||
|
|
||||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||||
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.*;
|
||||||
import engine.objects.ItemBase;
|
|
||||||
import engine.objects.Shrine;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -139,8 +137,8 @@ public class Enum {
|
|||||||
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
||||||
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
|
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
|
||||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
|
||||||
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
||||||
@@ -172,6 +170,8 @@ public class Enum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RaceType getRaceTypebyRuneID(int runeID) {
|
public static RaceType getRaceTypebyRuneID(int runeID) {
|
||||||
|
if(runeID == 1999)
|
||||||
|
return _raceTypeByID.get(2017);
|
||||||
return _raceTypeByID.get(runeID);
|
return _raceTypeByID.get(runeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,8 +208,8 @@ public class Enum {
|
|||||||
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
||||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
|
IREKEI(6.499500105f, 14.6685f, 4.2199998f, 14.6685f, 6.3299999f, 18.379999f, 6.5f);
|
||||||
private float walkStandard;
|
private float walkStandard;
|
||||||
private float walkCombat;
|
private float walkCombat;
|
||||||
private float runStandard;
|
private float runStandard;
|
||||||
@@ -469,11 +469,14 @@ public class Enum {
|
|||||||
|
|
||||||
// 14001 does not have a banestone to bind at
|
// 14001 does not have a banestone to bind at
|
||||||
|
|
||||||
if (ruinZone.getLoadNum() == 14001)
|
if (ruinZone.getLoadNum() == 14001) {
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||||
else
|
}else {
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
//spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||||
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
//.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||||
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -776,6 +779,7 @@ public class Enum {
|
|||||||
Combat,
|
Combat,
|
||||||
Spires,
|
Spires,
|
||||||
Snare,
|
Snare,
|
||||||
|
Snared,
|
||||||
Stun,
|
Stun,
|
||||||
Blind,
|
Blind,
|
||||||
Root,
|
Root,
|
||||||
@@ -878,6 +882,7 @@ public class Enum {
|
|||||||
Siege,
|
Siege,
|
||||||
Slash,
|
Slash,
|
||||||
Snare,
|
Snare,
|
||||||
|
Snared,
|
||||||
Sorcery,
|
Sorcery,
|
||||||
Spear,
|
Spear,
|
||||||
SpearMastery,
|
SpearMastery,
|
||||||
@@ -957,6 +962,17 @@ public class Enum {
|
|||||||
Wizardry;
|
Wizardry;
|
||||||
|
|
||||||
public static SourceType GetSourceType(String modName) {
|
public static SourceType GetSourceType(String modName) {
|
||||||
|
switch(modName){
|
||||||
|
case "Slashing":
|
||||||
|
modName = "Slash";
|
||||||
|
break;
|
||||||
|
case "Crushing":
|
||||||
|
modName = "Crush";
|
||||||
|
break;
|
||||||
|
case "Piercing":
|
||||||
|
modName = "Pierce";
|
||||||
|
break;
|
||||||
|
}
|
||||||
SourceType returnMod;
|
SourceType returnMod;
|
||||||
if (modName.isEmpty())
|
if (modName.isEmpty())
|
||||||
return SourceType.None;
|
return SourceType.None;
|
||||||
@@ -1016,6 +1032,7 @@ public class Enum {
|
|||||||
Silence,
|
Silence,
|
||||||
Slash,
|
Slash,
|
||||||
Snare,
|
Snare,
|
||||||
|
Snared,
|
||||||
Stance,
|
Stance,
|
||||||
Stun,
|
Stun,
|
||||||
Summon,
|
Summon,
|
||||||
@@ -1140,6 +1157,7 @@ public class Enum {
|
|||||||
SkillDebuff,
|
SkillDebuff,
|
||||||
SlashResistanceDebuff,
|
SlashResistanceDebuff,
|
||||||
Snare,
|
Snare,
|
||||||
|
Snared,
|
||||||
StackableAttrCONBuff,
|
StackableAttrCONBuff,
|
||||||
StackableAttrDEXBuff,
|
StackableAttrDEXBuff,
|
||||||
StackableAttrSTRBuff,
|
StackableAttrSTRBuff,
|
||||||
@@ -2306,9 +2324,9 @@ public class Enum {
|
|||||||
|
|
||||||
public enum CityBoundsType {
|
public enum CityBoundsType {
|
||||||
|
|
||||||
GRID(640),
|
GRID(544),
|
||||||
ZONE(875),
|
ZONE(672),
|
||||||
PLACEMENT(876);
|
PLACEMENT(673);
|
||||||
|
|
||||||
public final float extents;
|
public final float extents;
|
||||||
|
|
||||||
@@ -2822,6 +2840,7 @@ public class Enum {
|
|||||||
|
|
||||||
public enum MobBehaviourType {
|
public enum MobBehaviourType {
|
||||||
None(null, false, false, false, false, false),
|
None(null, false, false, false, false, false),
|
||||||
|
//Power
|
||||||
Power(null, false, true, true, true, false),
|
Power(null, false, true, true, true, false),
|
||||||
PowerHelpee(Power, false, true, true, false, true),
|
PowerHelpee(Power, false, true, true, false, true),
|
||||||
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
||||||
@@ -2846,7 +2865,6 @@ public class Enum {
|
|||||||
//Independent Types
|
//Independent Types
|
||||||
SimpleStandingGuard(null, false, false, false, false, false),
|
SimpleStandingGuard(null, false, false, false, false, false),
|
||||||
Pet1(null, false, false, true, false, false),
|
Pet1(null, false, false, true, false, false),
|
||||||
SiegeEngine(null, false, false, false, false, false),
|
|
||||||
Simple(null, false, false, true, false, false),
|
Simple(null, false, false, true, false, false),
|
||||||
Helpee(null, false, true, true, false, true),
|
Helpee(null, false, true, true, false, true),
|
||||||
HelpeeWimpy(null, true, false, true, false, false),
|
HelpeeWimpy(null, true, false, true, false, false),
|
||||||
@@ -2857,12 +2875,13 @@ public class Enum {
|
|||||||
HamletGuard(null, false, true, false, false, false),
|
HamletGuard(null, false, true, false, false, false),
|
||||||
AggroWanderer(null, false, false, true, false, false);
|
AggroWanderer(null, false, false, true, false, false);
|
||||||
|
|
||||||
public final MobBehaviourType BehaviourHelperType;
|
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||||
public final boolean isWimpy;
|
public MobBehaviourType BehaviourHelperType;
|
||||||
public final boolean isAgressive;
|
public boolean isWimpy;
|
||||||
public final boolean canRoam;
|
public boolean isAgressive;
|
||||||
public final boolean callsForHelp;
|
public boolean canRoam;
|
||||||
public final boolean respondsToCallForHelp;
|
public boolean callsForHelp;
|
||||||
|
public boolean respondsToCallForHelp;
|
||||||
|
|
||||||
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
||||||
this.BehaviourHelperType = helpeebehaviourType;
|
this.BehaviourHelperType = helpeebehaviourType;
|
||||||
@@ -2877,11 +2896,8 @@ public class Enum {
|
|||||||
|
|
||||||
public enum AIAgentType {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
GUARDCAPTAIN,
|
|
||||||
GUARDMINION,
|
|
||||||
GUARDWALLARCHER,
|
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
SIEGEENGINE;
|
GUARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
import engine.util.MapLoader;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -30,7 +32,6 @@ public class HeightMap {
|
|||||||
|
|
||||||
// Class variables
|
// Class variables
|
||||||
|
|
||||||
public static float SCALEVALUE = 1.0f / 256;
|
|
||||||
// Heightmap data for all zones.
|
// Heightmap data for all zones.
|
||||||
|
|
||||||
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
||||||
@@ -44,17 +45,17 @@ public class HeightMap {
|
|||||||
|
|
||||||
public BufferedImage heightmapImage;
|
public BufferedImage heightmapImage;
|
||||||
|
|
||||||
private final int heightMapID;
|
private int heightMapID;
|
||||||
private final int maxHeight;
|
private int maxHeight;
|
||||||
private final int fullExtentsX;
|
private int fullExtentsX;
|
||||||
private final int fullExtentsY;
|
private int fullExtentsY;
|
||||||
|
|
||||||
private float bucketWidthX;
|
private float bucketWidthX;
|
||||||
private float bucketWidthY;
|
private float bucketWidthY;
|
||||||
private final int zoneLoadID;
|
private int zoneLoadID;
|
||||||
private float seaLevel = 0;
|
private float seaLevel = 0;
|
||||||
private final float outsetX;
|
private float outsetX;
|
||||||
private final float outsetZ;
|
private float outsetZ;
|
||||||
private int[][] pixelColorValues;
|
private int[][] pixelColorValues;
|
||||||
|
|
||||||
public HeightMap(ResultSet rs) throws SQLException {
|
public HeightMap(ResultSet rs) throws SQLException {
|
||||||
@@ -87,12 +88,12 @@ public class HeightMap {
|
|||||||
try {
|
try {
|
||||||
this.heightmapImage = ImageIO.read(imageFile);
|
this.heightmapImage = ImageIO.read(imageFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e);
|
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
// this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ public class HeightMap {
|
|||||||
|
|
||||||
// Generate pixel array from image data
|
// Generate pixel array from image data
|
||||||
|
|
||||||
generatePixelData(this);
|
generatePixelData();
|
||||||
|
|
||||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
|
|
||||||
@@ -122,26 +123,35 @@ public class HeightMap {
|
|||||||
this.outsetX = 128;
|
this.outsetX = 128;
|
||||||
this.outsetZ = 128;
|
this.outsetZ = 128;
|
||||||
|
|
||||||
|
|
||||||
// Cache the full extents to avoid the calculation
|
// Cache the full extents to avoid the calculation
|
||||||
|
|
||||||
this.fullExtentsX = halfExtentsX * 2;
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// load the heightmap image.
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
this.heightmapImage = null;
|
this.heightmapImage = null;
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
this.bucketWidthX = halfExtentsX;
|
this.bucketWidthX = 1;
|
||||||
this.bucketWidthY = halfExtentsY;
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX][this.fullExtentsY];
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
for (int y = 0; y < this.fullExtentsY; y++) {
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
for (int x = 0; x < this.fullExtentsX; x++) {
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
pixelColorValues[x][y] = 255;
|
pixelColorValues[x][y] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeightMap(Zone zone) {
|
public HeightMap(Zone zone) {
|
||||||
@@ -160,21 +170,26 @@ public class HeightMap {
|
|||||||
this.fullExtentsX = halfExtentsX * 2;
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
this.fullExtentsY = halfExtentsY * 2;
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
this.heightmapImage = null;
|
this.heightmapImage = null;
|
||||||
|
|
||||||
// Calculate the data we do not load from table
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
this.bucketWidthX = halfExtentsX;
|
this.bucketWidthX = 1;
|
||||||
this.bucketWidthY = halfExtentsY;
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.fullExtentsX][this.fullExtentsY];
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
for (int y = 0; y < this.fullExtentsY; y++) {
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
for (int x = 0; x < this.fullExtentsX; x++) {
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
pixelColorValues[x][y] = 0;
|
pixelColorValues[x][y] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GeneratePlayerCityHeightMap() {
|
public static void GeneratePlayerCityHeightMap() {
|
||||||
@@ -207,33 +222,31 @@ public class HeightMap {
|
|||||||
return nextZone;
|
return nextZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getWorldHeight(Zone currentZone, Vector3fImmutable worldLoc) {
|
public static float getWorldHeight(AbstractWorldObject worldObject) {
|
||||||
|
|
||||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(worldObject.getLoc());
|
||||||
|
|
||||||
if (currentZone == null)
|
if (currentZone == null)
|
||||||
return 0;
|
return worldObject.getAltitude();
|
||||||
|
|
||||||
currentZone = getNextZoneWithTerrain(currentZone);
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
if (currentZone == ZoneManager.getSeaFloor())
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
return currentZone.getAbsY();
|
return currentZone.getAbsY() + worldObject.getAltitude();
|
||||||
|
|
||||||
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
HeightMap heightMap = currentZone.getHeightMap();
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), currentZone);
|
||||||
return currentZone.getAbsY();
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldObject.getLoc(), currentZone);
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
|
||||||
|
|
||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
parentLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), parentZone);
|
||||||
|
|
||||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
float worldAltitude = currentZone.worldAltitude;
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
float realWorldAltitude = interaltitude + worldAltitude;
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
@@ -250,6 +263,18 @@ public class HeightMap {
|
|||||||
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX <= 0.40000001)
|
||||||
|
bucketScaleX = heightMap.outsetZ / parentXRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX > 0.40000001)
|
||||||
|
bucketScaleX = 0.40000001f;
|
||||||
|
|
||||||
|
if (bucketScaleZ <= 0.40000001)
|
||||||
|
bucketScaleZ = heightMap.outsetX / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleZ > 0.40000001)
|
||||||
|
bucketScaleZ = 0.40000001f;
|
||||||
|
|
||||||
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
float weight;
|
float weight;
|
||||||
@@ -273,7 +298,7 @@ public class HeightMap {
|
|||||||
float secondScale = parentCenterAltitude * scaleChild;
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
float outsetALt = firstScale + secondScale;
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().worldAltitude;
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
realWorldAltitude = outsetALt;
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
} else if (offsetZ > outsideGridSizeZ) {
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
@@ -292,7 +317,7 @@ public class HeightMap {
|
|||||||
float secondScale = parentCenterAltitude * scaleChild;
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
float outsetALt = firstScale + secondScale;
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
outsetALt += currentZone.getParent().worldAltitude;
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
realWorldAltitude = outsetALt;
|
realWorldAltitude = outsetALt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,11 +327,181 @@ public class HeightMap {
|
|||||||
|
|
||||||
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
||||||
|
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|
||||||
if (currentZone == null)
|
if (currentZone == null)
|
||||||
return 0;
|
return 0;
|
||||||
return getWorldHeight(currentZone, worldLoc);
|
|
||||||
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
|
||||||
|
if (parentZone != null) {
|
||||||
|
|
||||||
|
// if (currentZone.getHeightMap() != null && parentZone.getHeightMap() != null && parentZone.getParent() != null && parentZone.getParent().getHeightMap() != null)
|
||||||
|
// return realWorldAltitude;
|
||||||
|
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return realWorldAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
||||||
|
|
||||||
|
Vector2f parentLoc;
|
||||||
|
float outsetALt = 0;
|
||||||
|
|
||||||
|
if (zone.getParent() == null || zone.getParent().getHeightMap() == null)
|
||||||
|
return interpolatedAltitude + zone.getWorldAltitude();
|
||||||
|
|
||||||
|
if (zone.getParent() != null && zone.getParent().getHeightMap() != null) {
|
||||||
|
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent());
|
||||||
|
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone);
|
||||||
|
|
||||||
|
float parentXRadius = zone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = zone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
|
||||||
|
float weight;
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent()));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return outsetALt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||||
|
|
||||||
|
int floorX = (int) gridSquare.x;
|
||||||
|
int floorY = (int) gridSquare.y;
|
||||||
|
|
||||||
|
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +515,7 @@ public class HeightMap {
|
|||||||
|
|
||||||
HeightMap.GeneratePlayerCityHeightMap();
|
HeightMap.GeneratePlayerCityHeightMap();
|
||||||
|
|
||||||
|
|
||||||
// Clear all heightmap image data as it's no longer needed.
|
// Clear all heightmap image data as it's no longer needed.
|
||||||
|
|
||||||
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
||||||
@@ -334,25 +530,10 @@ public class HeightMap {
|
|||||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||||
|
|
||||||
return localAltitude < zone.getSeaLevel();
|
if (localAltitude < zone.getSeaLevel())
|
||||||
}
|
return true;
|
||||||
|
|
||||||
private static void generatePixelData(HeightMap heightMap) {
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
// Generate altitude lookup table for this heightmap
|
|
||||||
|
|
||||||
heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()];
|
|
||||||
|
|
||||||
for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
|
|
||||||
for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
|
|
||||||
|
|
||||||
color = new Color(heightMap.heightmapImage.getRGB(x, y));
|
|
||||||
heightMap.pixelColorValues[x][y] = color.getRed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||||
@@ -360,18 +541,14 @@ public class HeightMap {
|
|||||||
if (zoneLoc.x < 0)
|
if (zoneLoc.x < 0)
|
||||||
zoneLoc.setX(0);
|
zoneLoc.setX(0);
|
||||||
|
|
||||||
if (zoneLoc.x >= this.fullExtentsX)
|
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||||
zoneLoc.setX(this.fullExtentsX);
|
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||||
|
|
||||||
if (zoneLoc.y < 0)
|
if (zoneLoc.y < 0)
|
||||||
zoneLoc.setY(0);
|
zoneLoc.setY(0);
|
||||||
|
|
||||||
if (zoneLoc.y > this.fullExtentsY)
|
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||||
zoneLoc.setY(this.fullExtentsY);
|
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||||
|
|
||||||
// Flip Y coordinates
|
|
||||||
|
|
||||||
zoneLoc.setY(this.fullExtentsY - zoneLoc.y);
|
|
||||||
|
|
||||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||||
@@ -392,10 +569,13 @@ public class HeightMap {
|
|||||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
int gridX = (int) gridSquare.x;
|
||||||
int gridY = (int) gridSquare.y;
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
if (gridX > maxX)
|
if (gridX > maxX)
|
||||||
gridX = maxX;
|
gridX = maxX;
|
||||||
@@ -433,11 +613,76 @@ public class HeightMap {
|
|||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight * SCALEVALUE; // Scale height
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
return interpolatedHeight;
|
return interpolatedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||||
|
|
||||||
|
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||||
|
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||||
|
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generatePixelData() {
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
// Generate altitude lookup table for this heightmap
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
||||||
|
|
||||||
|
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
||||||
|
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
||||||
|
|
||||||
|
color = new Color(this.heightmapImage.getRGB(x, y));
|
||||||
|
pixelColorValues[x][y] = color.getRed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScaledHeightForColor(float color) {
|
||||||
|
|
||||||
|
return (color / 256) * this.maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public float getBucketWidthX() {
|
public float getBucketWidthX() {
|
||||||
return bucketWidthX;
|
return bucketWidthX;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ 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.LoadCharacterMsg;
|
import engine.net.client.msg.*;
|
||||||
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;
|
||||||
@@ -140,7 +137,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
if (!cc.sendMsg(uom)) {
|
||||||
@@ -340,7 +337,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (loadedPlayer.safemodeInvis())
|
if (loadedPlayer.safemodeInvis())
|
||||||
@@ -372,7 +369,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
else if (loadedPlayer.safemodeInvis())
|
else if (loadedPlayer.safemodeInvis())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
@@ -437,7 +434,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// dont load if invis
|
// dont load if invis
|
||||||
|
|
||||||
if (player.getSeeInvis() < awopc.hidden)
|
if (player.getSeeInvis() < awopc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -467,7 +464,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (awonpc.despawned == true)
|
if (awonpc.despawned == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
@@ -480,7 +477,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (!awonpc.isAlive())
|
if (!awonpc.isAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
@@ -521,10 +518,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) {
|
||||||
|
|||||||
@@ -10,17 +10,13 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Bane;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.Building;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.City;
|
import engine.objects.*;
|
||||||
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.Connection;
|
import java.sql.*;
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class dbBaneHandler extends dbHandlerBase {
|
public class dbBaneHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -89,6 +85,139 @@ 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)
|
||||||
@@ -107,4 +236,25 @@ 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.AbstractGameObject;
|
import engine.objects.*;
|
||||||
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.*;
|
||||||
@@ -95,7 +92,16 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return objectList;
|
return objectList;
|
||||||
}
|
}
|
||||||
|
public Integer GET_CAPITAL_CITY_COUNT() {
|
||||||
|
|
||||||
|
int cityCount = 0;
|
||||||
|
for(Realm realm : Realm._realms.values()){
|
||||||
|
if(realm.isRuled())
|
||||||
|
cityCount ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cityCount;
|
||||||
|
}
|
||||||
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
||||||
|
|
||||||
ArrayList<City> cityList = new ArrayList<>();
|
ArrayList<City> cityList = new ArrayList<>();
|
||||||
|
|||||||
@@ -98,32 +98,54 @@ 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) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
if(!contract.getName().contains("Sage")) {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int type = rs.getInt("type");
|
int 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);
|
contract.getBuyItemType().add(value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
contract.getBuySkillToken().add(value);
|
contract.getBuySkillToken().add(value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
contract.getBuyUnknownToken().add(value);
|
contract.getBuyUnknownToken().add(value);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int value = rs.getInt("value");
|
||||||
|
if(!contract.getBuySkillToken().contains(value))
|
||||||
|
contract.getBuySkillToken().add(value);
|
||||||
|
|
||||||
|
if(!contract.getBuyItemType().contains(value))
|
||||||
|
contract.getBuyItemType().add(value);
|
||||||
|
|
||||||
|
if(!contract.getBuyUnknownToken().contains(value))
|
||||||
|
contract.getBuyUnknownToken().add(value);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public abstract class dbHandlerBase {
|
|||||||
try {
|
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) {
|
||||||
@@ -57,12 +56,28 @@ 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)
|
||||||
|
|||||||
@@ -134,9 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next()) {
|
||||||
worked = rs.getBoolean("result");
|
try {
|
||||||
|
worked = rs.getBoolean("result");
|
||||||
|
}catch(Exception e){
|
||||||
|
worked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
@@ -496,4 +500,18 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
||||||
|
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
||||||
|
return false;
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
||||||
|
preparedStatement.setInt(1, newValue);
|
||||||
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,27 +28,31 @@ 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 PERSIST(Mob toAdd) {
|
public Mob ADD_MOB(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.parentZoneUUID);
|
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
||||||
preparedStatement.setInt(2, toAdd.loadID);
|
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
||||||
preparedStatement.setInt(3, toAdd.guildUUID);
|
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
||||||
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
||||||
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
||||||
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
||||||
preparedStatement.setInt(7, 0);
|
preparedStatement.setInt(7, 0);
|
||||||
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
||||||
preparedStatement.setInt(9, toAdd.spawnTime);
|
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
||||||
preparedStatement.setInt(10, toAdd.contractUUID);
|
|
||||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
if (toAdd.getContract() != null)
|
||||||
preparedStatement.setInt(12, toAdd.level);
|
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
||||||
preparedStatement.setString(13, toAdd.firstName);
|
else
|
||||||
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
preparedStatement.setInt(10, 0);
|
||||||
|
|
||||||
|
preparedStatement.setInt(11, toAdd.getBuildingID());
|
||||||
|
preparedStatement.setInt(12, toAdd.getLevel());
|
||||||
|
preparedStatement.setString(13, toAdd.getFirstName());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -102,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
public void LOAD_PATROL_POINTS(Mob captain) {
|
||||||
|
|
||||||
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, guardCaptain.getObjectUUID());
|
preparedStatement.setInt(1, captain.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String minionName = rs.getString("minionName");
|
String name = rs.getString("name");
|
||||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return;
|
return;
|
||||||
@@ -127,13 +131,15 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setString(3, name);
|
||||||
|
preparedStatement.setInt(4, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -143,13 +149,14 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setInt(3, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -159,20 +166,6 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_ALL_MINIONS(final long captainUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,32 @@ 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;
|
||||||
@@ -176,6 +202,18 @@ 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();
|
||||||
|
|||||||
@@ -15,9 +15,15 @@ import engine.gameManager.PowersManager;
|
|||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PreparedStatementShared;
|
import engine.objects.PreparedStatementShared;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
import engine.powers.MobPowerEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class dbPowerHandler extends dbHandlerBase {
|
public class dbPowerHandler extends dbHandlerBase {
|
||||||
@@ -80,4 +86,43 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
|
||||||
|
MobPowerEntry mobPowerEntry;
|
||||||
|
|
||||||
|
int mobbaseID;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
mobbaseID = rs.getInt("mobbaseUUID");
|
||||||
|
mobPowerEntry = new MobPowerEntry(rs);
|
||||||
|
|
||||||
|
if (mobPowers.get(mobbaseID) == null) {
|
||||||
|
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
} else {
|
||||||
|
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
import engine.powers.RunePowerEntry;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -29,84 +27,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
|
|
||||||
RunePowerEntry runePowerEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runePowerEntry = new RunePowerEntry(rs);
|
|
||||||
|
|
||||||
if (mobPowers.get(rune_id) == null) {
|
|
||||||
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
|
|
||||||
runePowerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, runePowerList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
|
|
||||||
powerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
|
|
||||||
RuneSkillAdjustEntry runeSkillAdjustEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
|
|
||||||
|
|
||||||
if (runeSkillAdjusts.get(rune_id) == null) {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
|
|
||||||
skillAdjustList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, skillAdjustList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
|
|
||||||
powerList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GET_RUNE_REQS(final RuneBase rb) {
|
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
@@ -44,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
MobBase mb = (MobBase) mobbaseAGO;
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
int loadID = mb.getObjectUUID();
|
int loadID = mb.getObjectUUID();
|
||||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
@@ -85,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -31,7 +32,6 @@ 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,59 +39,54 @@ 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 parentBuilding = (Building) target;
|
building = (Building)target;
|
||||||
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
NPC created;
|
||||||
NPC npc = NPC.createNPC(name, contractID,
|
Guild guild = null;
|
||||||
pc.getLoc(), null, zone, (short) level, null);
|
Vector3fImmutable loc;
|
||||||
|
if(building != null){
|
||||||
if (npc != null) {
|
guild = building.getGuild();
|
||||||
WorldGrid.addObject(npc, pc);
|
loc = building.loc;
|
||||||
ChatManager.chatSayInfo(pc,
|
} else{
|
||||||
"NPC with ID " + npc.getDBID() + " added");
|
loc = pc.loc;
|
||||||
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
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
|
||||||
|
public class AuditHeightMapCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public AuditHeightMapCmd() {
|
||||||
|
super("auditheightmap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
int count = Integer.parseInt(words[0]);
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
|
||||||
|
|
||||||
|
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
||||||
|
|
||||||
|
if (currentZone != null && currentZone.getHeightMap() != null) {
|
||||||
|
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long delta = end - start;
|
||||||
|
|
||||||
|
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /auditmobs [zone.UUID]'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Audits all the mobs in a zone.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import engine.InterestManagement.HeightMap;
|
|||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -21,58 +22,205 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public GetHeightCmd() {
|
public GetHeightCmd() {
|
||||||
super("getHeight");
|
super("getHeight");
|
||||||
|
this.addCmdString("height");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
Zone currentZone;
|
boolean end = true;
|
||||||
Zone parentZone;
|
|
||||||
Zone heightmapZone;
|
|
||||||
|
|
||||||
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
float height = HeightMap.getWorldHeight(pc);
|
||||||
heightmapZone = HeightMap.getNextZoneWithTerrain(currentZone);
|
|
||||||
parentZone = HeightMap.getNextZoneWithTerrain(currentZone.getParent());
|
|
||||||
|
|
||||||
float currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc());
|
this.throwbackInfo(pc, "Altitude : " + height);
|
||||||
float parentHeight = HeightMap.getWorldHeight(parentZone, playerCharacter.getLoc());
|
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), heightmapZone);
|
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
|
||||||
Vector2f gridSquare = heightmapZone.getHeightMap().getGridSquare(zoneLoc);
|
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.getName());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.getName());
|
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
|
||||||
this.throwbackInfo(playerCharacter, "Zone Height: " + heightmapZone.worldAltitude);
|
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
|
||||||
this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.getSeaLevel());
|
|
||||||
this.throwbackInfo(playerCharacter, "Grid : " + (int) gridSquare.x + "x" + (int) gridSquare.y);
|
|
||||||
this.throwbackInfo(playerCharacter, "*** 256: " + currentHeight);
|
|
||||||
this.throwbackInfo(playerCharacter, "***Adjusted Height: " + (currentHeight + playerCharacter.getCharacterHeight()));
|
|
||||||
|
|
||||||
HeightMap.SCALEVALUE = 1f / 255f;
|
if (end)
|
||||||
currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc());
|
return;
|
||||||
HeightMap.SCALEVALUE = 1f / 256f;
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
Vector2f gridOffset;
|
||||||
|
Vector2f parentGrid;
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
|
if (currentZone == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Zone parentZone = currentZone.getParent();
|
||||||
|
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
|
||||||
|
//find the next parents heightmap if the currentzone heightmap is null.
|
||||||
|
while (heightMap == null) {
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor()) {
|
||||||
|
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Using parent zone instead: ");
|
||||||
|
currentZone = currentZone.getParent();
|
||||||
|
heightMap = currentZone.getHeightMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
|
||||||
|
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
|
||||||
|
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
|
||||||
|
|
||||||
|
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
|
||||||
|
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
||||||
|
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
||||||
|
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
|
||||||
|
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
|
||||||
|
|
||||||
|
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
||||||
|
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
||||||
|
} else
|
||||||
|
parentGrid = new Vector2f(-1, -1);
|
||||||
|
|
||||||
|
gridSquare = heightMap.getGridSquare(zoneLoc);
|
||||||
|
gridOffset = HeightMap.getGridOffset(gridSquare);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
|
||||||
|
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
|
||||||
|
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
|
||||||
|
|
||||||
|
if (parentGrid.x != -1) {
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
|
||||||
|
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
|
||||||
|
}
|
||||||
|
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
if (parentZone != null) {
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = 100 / parentXRadius;
|
||||||
|
float bucketScaleZ = 200 / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float strMod = pc.statStrBase - 40;
|
||||||
|
|
||||||
|
strMod *= .00999999998f;
|
||||||
|
|
||||||
|
strMod += 1f;
|
||||||
|
|
||||||
|
float radius = 0;
|
||||||
|
switch (pc.getRaceID()) {
|
||||||
|
case 2017:
|
||||||
|
radius = 3.1415927f;
|
||||||
|
case 2000:
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
strMod *= 1.5707964f;
|
||||||
|
|
||||||
|
strMod += 3.1415927f;
|
||||||
|
|
||||||
|
strMod -= .5f;
|
||||||
|
|
||||||
|
|
||||||
|
realWorldAltitude += strMod;
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "***255 Adjusted: " + (currentHeight + playerCharacter.getCharacterHeight()));
|
|
||||||
this.throwbackInfo(playerCharacter, "Drowning Height: " + (heightmapZone.getSeaLevel() + playerCharacter.getCharacterHeight()));
|
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "------------");
|
|
||||||
this.throwbackInfo(playerCharacter, "Parent : " + parentZone.getName());
|
|
||||||
this.throwbackInfo(playerCharacter, "Height returned : " + parentHeight);
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x) + "][" + (gridSquare.y) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x + 1) + "][" + (gridSquare.y) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x) + "][" + (gridSquare.y + 1) + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "[" + (gridSquare.x + 1) + "][" + (gridSquare.y + 1) + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Queries heightmap engine";
|
return "Temporarily Changes SubRace";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /getheight";
|
return "' /subrace mobBaseID";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-32
@@ -9,59 +9,55 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.ItemContainerType;
|
||||||
|
import engine.Enum.ItemType;
|
||||||
|
import engine.Enum.OwnerType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Eighty
|
||||||
*/
|
*/
|
||||||
|
public class GimmeCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public class PrintEffectsCmd extends AbstractDevCmd {
|
public GimmeCmd() {
|
||||||
|
super("gimme");
|
||||||
public PrintEffectsCmd() {
|
|
||||||
super("printeffects");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
int amt = 0;
|
||||||
AbstractCharacter tar;
|
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
|
||||||
|
amt = 10000000 - currentGold;
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
||||||
tar = (AbstractCharacter) target;
|
throwbackError(pc, "Failed to add gold to inventory");
|
||||||
|
return;
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Effects For Character: " + tar.getName() + newline;
|
|
||||||
|
|
||||||
for(String effect : tar.effects.keySet()){
|
|
||||||
output += effect + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Returns the player's current stats";
|
return "Round up current gold in inventory to 10,000,000";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /printstats'";
|
return "'./gimme";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ./hotzone <- display the current hotzone & time remaining
|
|
||||||
* ./hotzone random <- change hotzone to random new zone
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class HotzoneCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public HotzoneCmd() {
|
|
||||||
super("hotzone");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder();
|
|
||||||
String outString;
|
|
||||||
|
|
||||||
for (String s : words) {
|
|
||||||
data.append(s);
|
|
||||||
data.append(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
String input = data.toString().trim();
|
|
||||||
|
|
||||||
if (input.length() == 0) {
|
|
||||||
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
|
||||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
|
||||||
throwbackInfo(playerCharacter, outString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("random")) {
|
|
||||||
ZoneManager.generateAndSetRandomHotzone();
|
|
||||||
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
|
||||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
|
||||||
throwbackInfo(playerCharacter, outString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("reset")) {
|
|
||||||
ZoneManager.resetHotZones();
|
|
||||||
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./hotzone [random]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,7 @@ import engine.gameManager.BuildingManager;
|
|||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
import engine.util.StringUtils;
|
import engine.util.StringUtils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -337,7 +338,8 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "Swimming : " + targetPC.isSwimming();
|
output += "Swimming : " + targetPC.isSwimming();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "isMoving : " + targetPC.isMoving();
|
output += "isMoving : " + targetPC.isMoving();
|
||||||
|
output += newline;
|
||||||
|
output += "Zerg Multiplier : " + targetPC.ZergMultiplier;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -440,9 +442,7 @@ 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;
|
||||||
@@ -531,6 +531,13 @@ 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);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,10 +42,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
|||||||
String trigger = args[0];
|
String trigger = args[0];
|
||||||
switch (trigger) {
|
switch (trigger) {
|
||||||
case "true":
|
case "true":
|
||||||
HourlyJobThread.mineWindowOpen(mine);
|
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
HourlyJobThread.mineWindowClose(mine);
|
HalfHourlyJobThread.mineWindowClose(mine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PrintRunesCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintRunesCmd() {
|
|
||||||
super("printrunes");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
AbstractCharacter tar;
|
|
||||||
|
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
|
||||||
tar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
|
|
||||||
|
|
||||||
for(CharacterRune rune : ((AbstractCharacter)target).runes){
|
|
||||||
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Returns the player's current stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /printstats'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
@@ -72,6 +73,10 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||||
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
|
out += "Move Speed: " + tar.getSpeed() + newline;
|
||||||
|
out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline;
|
||||||
|
out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline;
|
||||||
|
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
|
||||||
throwbackInfo(pc, out);
|
throwbackInfo(pc, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,19 +108,15 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
main = getWeaponBase(1, equip);
|
main = getWeaponBase(1, equip);
|
||||||
ItemBase off = null;
|
ItemBase off = null;
|
||||||
|
|
||||||
if(equip != null){
|
if (equip != null)
|
||||||
if(equip.get(2) != null && !equip.get(2).getItemBase().isShield()){
|
getWeaponBase(2, equip);
|
||||||
//off hand weapon
|
if (main == null && off == null) {
|
||||||
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
|
||||||
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
} else {
|
||||||
out += "Range: " + tar.rangeHandTwo + newline;
|
if (main != null)
|
||||||
out += "Attack Speed: " + tar.speedHandTwo + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
|
||||||
} else{
|
if (off != null)
|
||||||
out += "Attack Rating: " + tar.atrHandOne + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
|
||||||
out += "Damage: " + tar.minDamageHandOne + " - " + tar.maxDamageHandOne + newline;
|
|
||||||
out += "Range: " + tar.rangeHandOne + newline;
|
|
||||||
out += "Attack Speed: " + tar.speedHandOne + newline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
|
|
||||||
|
|||||||
@@ -59,25 +59,22 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(GameObjectType.NPC,
|
DbManager.removeFromCache(GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -154,11 +151,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -167,11 +163,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
@@ -25,17 +25,42 @@ public class RegionCmd extends AbstractDevCmd {
|
|||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
Regions region = ((AbstractCharacter)target).region;
|
|
||||||
if (region == null) {
|
if (pc.region == null) {
|
||||||
this.throwbackInfo(pc, "No Region Found.");
|
this.throwbackInfo(pc, "No Region Found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region != null) {
|
|
||||||
this.throwbackInfo(pc, "Region Info: " + ((AbstractCharacter) target).getName());
|
String newLine = System.getProperty("line.separator");
|
||||||
this.throwbackInfo(pc, "Region Name: " + region);
|
String result = "";
|
||||||
this.throwbackInfo(pc, "Region Height: " + region.lerpY((AbstractCharacter)target));
|
result += (pc.region.getClass().getSimpleName());
|
||||||
|
result += (" {");
|
||||||
|
result += (newLine);
|
||||||
|
Field[] fields = pc.region.getClass().getDeclaredFields();
|
||||||
|
|
||||||
|
//print field names paired with their values
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
result += (" ");
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (field.getName().contains("Furniture"))
|
||||||
|
continue;
|
||||||
|
result += (field.getName());
|
||||||
|
result += (": ");
|
||||||
|
//requires access to private field:
|
||||||
|
result += (field.get(pc.region).toString());
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
System.out.println(ex);
|
||||||
|
}
|
||||||
|
result.trim();
|
||||||
|
result += (newLine);
|
||||||
}
|
}
|
||||||
|
result += ("}");
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, result.toString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
import engine.Enum.BuildingGroup;
|
||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
@@ -137,16 +138,49 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//remove cached shrines.
|
//remove cached shrines.
|
||||||
if ((building.getBlueprintUUID() != 0)
|
if ((building.getBlueprintUUID() != 0)
|
||||||
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
||||||
Shrine.RemoveShrineFromCacheByBuilding(building);
|
Shrine.RemoveShrineFromCacheByBuilding(building);
|
||||||
|
|
||||||
// Remove hirelings for this building
|
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mobA = null;
|
||||||
|
|
||||||
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
|
if (ac.getObjectType() == GameObjectType.NPC)
|
||||||
BuildingManager.removeHireling(building, abstractCharacter);
|
npc = (NPC) ac;
|
||||||
|
else if (ac.getObjectType() == GameObjectType.Mob)
|
||||||
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
|
if (npc != null) {
|
||||||
|
for (Mob mob : npc.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);
|
||||||
@@ -175,13 +209,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.removeObject(mob, pc);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
|
|
||||||
public class SeaAuditCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public SeaAuditCmd() {
|
|
||||||
super("seaaudit");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.getAllZones())
|
|
||||||
if (zone.getSeaLevel() > zone.worldAltitude)
|
|
||||||
this.throwbackInfo(playerCharacter, zone.getObjectUUID() + zone.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Queries heightmap engine";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /getheight";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -46,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level < 1 || level > 75) {
|
if (level < 1 || level > 80) {
|
||||||
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-75";
|
return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// pum.setEffectID(token);
|
// pum.setEffectID(token);
|
||||||
// pum.setSourceType(pc.getObjectType().ordinal());
|
// pum.setSourceType(pc.getObjectType().ordinal());
|
||||||
// pum.setSourceID(pc.getObjectUUID());
|
// pum.setSourceID(pc.getObjectUUID());
|
||||||
// pum.setStartLocType(pc.getObjectType().ordinal());
|
// pum.setTargetType(pc.getObjectType().ordinal());
|
||||||
// pum.setTargetID(pc.getObjectUUID());
|
// pum.setTargetID(pc.getObjectUUID());
|
||||||
// pum.setNumTrains(40);
|
// pum.setNumTrains(40);
|
||||||
// pum.setDuration(-1);
|
// pum.setDuration(-1);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ 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");
|
||||||
}
|
}
|
||||||
@@ -25,7 +27,15 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
String output;
|
String output;
|
||||||
|
|
||||||
output = "Booty Simulation:" + newline;
|
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;
|
||||||
@@ -44,6 +54,7 @@ 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>();
|
||||||
@@ -51,14 +62,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
int failures = 0;
|
int failures = 0;
|
||||||
int goldAmount = 0;
|
int goldAmount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < simCount; ++i) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mob.loadInventory();
|
mob.loadInventory();
|
||||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
||||||
switch (lootItem.getItemBase().getType()) {
|
switch (lootItem.getItemBase().getType()) {
|
||||||
case CONTRACT: //CONTRACT
|
case CONTRACT: //CONTRACT
|
||||||
Contracts.add(lootItem);
|
if(lootItem.getName().contains("Captain"))
|
||||||
|
GuardContracts.add(lootItem);
|
||||||
|
else
|
||||||
|
Contracts.add(lootItem);
|
||||||
break;
|
break;
|
||||||
case OFFERING: //OFFERING
|
case OFFERING: //OFFERING
|
||||||
Offerings.add(lootItem);
|
Offerings.add(lootItem);
|
||||||
@@ -130,9 +144,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int baseBound = 100000;
|
||||||
|
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
|
||||||
|
int totalRange = baseBound + levelPenalty;
|
||||||
|
if(mob.level >= 50){
|
||||||
|
totalRange = baseBound;
|
||||||
|
}
|
||||||
|
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
|
||||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
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;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, serverZone, null, 0, "", 1);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "Sea Level = " + zone.getSeaLevel();
|
output += "Sea Level = " + zone.getSeaLevel();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "World Altitude = " + zone.worldAltitude;
|
output += "World Altitude = " + zone.getWorldAltitude();
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|
||||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
@@ -61,95 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + newline;
|
output += mob.getName() + newline;
|
||||||
output += mob.agentType.toString() + newline;
|
if (mob.BehaviourType != null) {
|
||||||
|
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
||||||
int contractID = 0;
|
if (mob.BehaviourType.BehaviourHelperType != null) {
|
||||||
|
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 += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
||||||
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
||||||
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
||||||
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
||||||
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
||||||
} else {
|
} else {
|
||||||
output += "BehaviourType: NULL" + newline;
|
output += "BehaviourType: NULL" + newline;
|
||||||
}
|
}
|
||||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + 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, Float> entry : mob.playerAgroMap.entrySet()) {
|
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
||||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + 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;
|
||||||
|
|
||||||
if (mob.guardedCity != null)
|
for (int token : mob.mobPowers.keySet())
|
||||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
output += token + 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package engine.gameManager;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.exception.MsgSendException;
|
||||||
|
import engine.math.Vector3f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.*;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
public class ArenaManager {
|
||||||
|
private static final List<Arena> activeArenas = new ArrayList<>();
|
||||||
|
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
|
||||||
|
public static Long pulseDelay = 180000L;
|
||||||
|
public static Long lastExecution = 0L;
|
||||||
|
|
||||||
|
public static void pulseArenas() {
|
||||||
|
if(lastExecution == 0L){
|
||||||
|
lastExecution = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(activeArenas.isEmpty() && playerQueue.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<Arena> iterator = activeArenas.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Arena arena = iterator.next();
|
||||||
|
if (arena.checkToComplete()) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lastExecution + pulseDelay > System.currentTimeMillis())
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastExecution = System.currentTimeMillis();
|
||||||
|
|
||||||
|
while (playerQueue.size() > 1) {
|
||||||
|
createArena();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void joinQueue(PlayerCharacter player) {
|
||||||
|
if (!playerQueue.contains(player)) {
|
||||||
|
playerQueue.add(player);
|
||||||
|
}
|
||||||
|
for(PlayerCharacter pc : playerQueue){
|
||||||
|
if(pc.equals(player))
|
||||||
|
continue;
|
||||||
|
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void leaveQueue(PlayerCharacter player) {
|
||||||
|
playerQueue.remove(player);
|
||||||
|
for(PlayerCharacter pc : playerQueue){
|
||||||
|
if(pc.equals(player))
|
||||||
|
continue;
|
||||||
|
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createArena() {
|
||||||
|
if (playerQueue.size() > 1) {
|
||||||
|
|
||||||
|
Collections.shuffle(playerQueue);
|
||||||
|
Arena newArena = new Arena();
|
||||||
|
|
||||||
|
//set starting time
|
||||||
|
newArena.startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
//decide an arena location
|
||||||
|
newArena.loc = selectRandomArenaLocation();
|
||||||
|
|
||||||
|
// Assign players to the arena
|
||||||
|
newArena.player1 = playerQueue.remove(0);
|
||||||
|
newArena.player2 = playerQueue.remove(0);
|
||||||
|
|
||||||
|
// Teleport players to the arena location
|
||||||
|
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||||
|
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||||
|
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||||
|
|
||||||
|
// Add the new arena to the active arenas list
|
||||||
|
activeArenas.add(newArena);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
|
||||||
|
if (winner != null && loser != null) {
|
||||||
|
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
|
||||||
|
arena.player1.getName(), arena.player2.getName(), winner.getName());
|
||||||
|
} else {
|
||||||
|
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
|
||||||
|
arena.player1.getName(), arena.player2.getName());
|
||||||
|
}
|
||||||
|
// Teleport players to the arena location
|
||||||
|
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||||
|
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||||
|
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
activeArenas.remove(arena);
|
||||||
|
|
||||||
|
if(winner != null){
|
||||||
|
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
|
||||||
|
//handle prize distribution
|
||||||
|
//ItemBase specialLoot = ItemBase.getItemBase(866);
|
||||||
|
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
|
||||||
|
//promoted.setNumOfItems(21235);
|
||||||
|
//promoted.setName("Special Banker(21235)");
|
||||||
|
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
|
||||||
|
//winner.getCharItemManager().addItemToInventory(promoted);
|
||||||
|
//winner.getCharItemManager().updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3fImmutable selectRandomArenaLocation() {
|
||||||
|
boolean locSet = false;
|
||||||
|
Vector3fImmutable loc = Vector3fImmutable.ZERO;
|
||||||
|
|
||||||
|
while (!locSet) {
|
||||||
|
try {
|
||||||
|
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
|
||||||
|
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
|
||||||
|
float y = 0; // Y coordinate is always 0
|
||||||
|
|
||||||
|
loc = new Vector3fImmutable(x, y, z * -1);
|
||||||
|
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
|
||||||
|
if(inRange.isEmpty() && !isUnderWater(loc))
|
||||||
|
locSet = true;
|
||||||
|
//}
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUnderWater(Vector3fImmutable loc) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(loc);
|
||||||
|
|
||||||
|
if (zone.getSeaLevel() != 0) {
|
||||||
|
|
||||||
|
float localAltitude = loc.y;
|
||||||
|
if (localAltitude < zone.getSeaLevel())
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (loc.y < 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -308,72 +308,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeHireling(Building building, AbstractCharacter hireling) {
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob guardCaptain = (Mob) hireling;
|
|
||||||
|
|
||||||
// Clear minions from database if a guard captain
|
|
||||||
|
|
||||||
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
|
||||||
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear minions from world
|
|
||||||
|
|
||||||
for (Integer minionUUID : hireling.minions) {
|
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
|
||||||
DbManager.removeFromCache(minionMob);
|
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
|
||||||
WorldGrid.unloadObject(minionMob);
|
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove hireling from building
|
|
||||||
|
|
||||||
building.getHirelings().remove(hireling);
|
|
||||||
|
|
||||||
// Remove from zone mob set
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob hirelingMob = (Mob) hireling;
|
|
||||||
|
|
||||||
if (hirelingMob.getParentZone() != null)
|
|
||||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
|
||||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
|
||||||
|
|
||||||
NPC hirelingNPC = (NPC) hireling;
|
|
||||||
|
|
||||||
if (hirelingNPC.getParentZone() != null)
|
|
||||||
if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC))
|
|
||||||
hirelingNPC.getParentZone().zoneNPCSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unload hireling from world
|
|
||||||
|
|
||||||
DbManager.removeFromCache(hireling);
|
|
||||||
WorldGrid.RemoveWorldObject(hireling);
|
|
||||||
WorldGrid.removeObject(hireling);
|
|
||||||
|
|
||||||
// Delete hireling from database
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob))
|
|
||||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
|
||||||
else
|
|
||||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void cleanupHirelings(Building building) {
|
public static void cleanupHirelings(Building building) {
|
||||||
|
|
||||||
// Early exit: Cannot have hirelings in a building
|
// Early exit: Cannot have hirelings in a building
|
||||||
@@ -386,18 +320,42 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (building.getRank() < 1) {
|
if (building.getRank() < 1) {
|
||||||
|
|
||||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
|
||||||
BuildingManager.removeHireling(building, slottedNPC);
|
|
||||||
|
|
||||||
|
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
((NPC) slottedNPC).remove();
|
||||||
|
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete hireling if building has deranked.
|
// Delete hireling if building has deranked.
|
||||||
|
|
||||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||||
|
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mob = null;
|
||||||
|
|
||||||
|
if (hireling.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
npc = (NPC) hireling;
|
||||||
|
else if (hireling.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
mob = (Mob) hireling;
|
||||||
|
|
||||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||||
BuildingManager.removeHireling(building, hireling);
|
|
||||||
|
if (npc != null) {
|
||||||
|
if (!npc.remove())
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
} else if (mob != null) {
|
||||||
|
if (!NPCManager.removeMobileFromBuilding(mob, building))
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,6 +438,18 @@ 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)
|
||||||
@@ -562,7 +532,30 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL)){
|
||||||
|
if(contract.getContractID() == 850) {
|
||||||
|
boolean hasRunemaster = false;
|
||||||
|
for (AbstractCharacter npc : building.getHirelings().keySet()) {
|
||||||
|
|
||||||
|
if (npc.getObjectType() != GameObjectType.NPC)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(npc.contractUUID == 850)
|
||||||
|
hasRunemaster = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasRunemaster)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int maxSlots = building.getBlueprint().getMaxSlots();
|
||||||
|
if(building.getBlueprint().getBuildingGroup() != null) {
|
||||||
|
maxSlots = building.getBlueprint().getSlotsForRank(building.getRank());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxSlots == building.getHirelings().size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
@@ -572,63 +565,41 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mobile;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contract.getContractID() == 910) {
|
if (contract.getContractID() == 910) {
|
||||||
|
|
||||||
//guard dog
|
//guard dog
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ public enum ChatManager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
else {
|
else {
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.util.HashSet;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static engine.math.FastMath.sqr;
|
||||||
|
|
||||||
public enum CombatManager {
|
public enum CombatManager {
|
||||||
|
|
||||||
COMBATMANAGER;
|
COMBATMANAGER;
|
||||||
@@ -39,6 +41,63 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Message sent by player to attack something.
|
* Message sent by player to attack something.
|
||||||
*/
|
*/
|
||||||
|
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
|
PlayerCharacter player;
|
||||||
|
int targetType;
|
||||||
|
AbstractWorldObject target;
|
||||||
|
|
||||||
|
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//source must match player this account belongs to
|
||||||
|
|
||||||
|
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
|
||||||
|
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetType = msg.getTargetType();
|
||||||
|
|
||||||
|
if (targetType == GameObjectType.PlayerCharacter.ordinal()) {
|
||||||
|
target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Building.ordinal()) {
|
||||||
|
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
target = Mob.getFromCache(msg.getTargetID());
|
||||||
|
} else {
|
||||||
|
player.setCombatTarget(null);
|
||||||
|
return; //not valid type to attack
|
||||||
|
}
|
||||||
|
|
||||||
|
// quit of the combat target is already the current combat target
|
||||||
|
// or there is no combat target
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//set sources target
|
||||||
|
|
||||||
|
player.setCombatTarget(target);
|
||||||
|
|
||||||
|
//put in combat if not already
|
||||||
|
|
||||||
|
if (!player.isCombat())
|
||||||
|
toggleCombat(true, origin);
|
||||||
|
|
||||||
|
//make character stand if sitting
|
||||||
|
|
||||||
|
if (player.isSit())
|
||||||
|
toggleSit(false, origin);
|
||||||
|
|
||||||
|
AttackTarget(player, target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
||||||
|
|
||||||
@@ -82,6 +141,11 @@ public enum CombatManager {
|
|||||||
if (off == null)
|
if (off == null)
|
||||||
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
|
||||||
|
|
||||||
|
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||||
|
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
@@ -459,7 +523,7 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Attempt to attack target
|
* Attempt to attack target
|
||||||
*/
|
*/
|
||||||
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
private static void attack(AbstractCharacter ac, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
||||||
|
|
||||||
float atr;
|
float atr;
|
||||||
int minDamage, maxDamage;
|
int minDamage, maxDamage;
|
||||||
@@ -467,20 +531,20 @@ public enum CombatManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (attacker == null)
|
if (ac == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mainHand) {
|
if (mainHand) {
|
||||||
atr = attacker.getAtrHandOne();
|
atr = ac.getAtrHandOne();
|
||||||
minDamage = attacker.getMinDamageHandOne();
|
minDamage = ac.getMinDamageHandOne();
|
||||||
maxDamage = attacker.getMaxDamageHandOne();
|
maxDamage = ac.getMaxDamageHandOne();
|
||||||
} else {
|
} else {
|
||||||
atr = attacker.getAtrHandTwo();
|
atr = ac.getAtrHandTwo();
|
||||||
minDamage = attacker.getMinDamageHandTwo();
|
minDamage = ac.getMinDamageHandTwo();
|
||||||
maxDamage = attacker.getMaxDamageHandTwo();
|
maxDamage = ac.getMaxDamageHandTwo();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tarIsRat = false;
|
boolean tarIsRat = false;
|
||||||
@@ -499,9 +563,9 @@ public enum CombatManager {
|
|||||||
//Dont think we need to do this anymore.
|
//Dont think we need to do this anymore.
|
||||||
|
|
||||||
if (tarIsRat)
|
if (tarIsRat)
|
||||||
if (attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
||||||
|
|
||||||
float percent = 1 + attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
float percent = 1 + ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
||||||
|
|
||||||
minDamage *= percent;
|
minDamage *= percent;
|
||||||
maxDamage *= percent;
|
maxDamage *= percent;
|
||||||
@@ -512,24 +576,24 @@ public enum CombatManager {
|
|||||||
//subtract stamina
|
//subtract stamina
|
||||||
|
|
||||||
if (wb == null)
|
if (wb == null)
|
||||||
attacker.modifyStamina(-0.5f, attacker, true);
|
ac.modifyStamina(-0.5f, ac, true);
|
||||||
else {
|
else {
|
||||||
float stam = wb.getWeight() / 3;
|
float stam = wb.getWeight() / 3;
|
||||||
stam = (stam < 1) ? 1 : stam;
|
stam = (stam < 1) ? 1 : stam;
|
||||||
attacker.modifyStamina(-(stam), attacker, true);
|
ac.modifyStamina(-(stam), ac, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker.cancelOnAttackSwing();
|
ac.cancelOnAttackSwing();
|
||||||
|
|
||||||
errorTrack = 2;
|
errorTrack = 2;
|
||||||
|
|
||||||
//set last time this player has attacked something.
|
//set last time this player has attacked something.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != attacker.getObjectUUID() && attacker.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != ac.getObjectUUID() && ac.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
attacker.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
} else
|
} else
|
||||||
attacker.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
||||||
|
|
||||||
errorTrack = 3;
|
errorTrack = 3;
|
||||||
|
|
||||||
@@ -540,46 +604,73 @@ public enum CombatManager {
|
|||||||
if (target.getObjectType().equals(GameObjectType.Building)) {
|
if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
defense = 0;
|
defense = 0;
|
||||||
|
|
||||||
|
Building building = (Building) target;
|
||||||
|
|
||||||
|
if (building.getParentZone() != null && building.getParentZone().isPlayerCity()) {
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")) {
|
||||||
|
|
||||||
|
building.getTimestamps().put("CallForHelp", System.currentTimeMillis() + 15000);
|
||||||
|
|
||||||
|
for (Mob mob : building.getParentZone().zoneMobSet) {
|
||||||
|
if (!mob.isPlayerGuard())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getCombatTarget() != null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getGuild() != null && building.getGuild() != null)
|
||||||
|
if (!Guild.sameGuild(mob.getGuild().getNation(), building.getGuild().getNation()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getLoc().distanceSquared2D(building.getLoc()) > sqr(300))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mob.setCombatTarget(ac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AbstractCharacter tar = (AbstractCharacter) target;
|
AbstractCharacter tar = (AbstractCharacter) target;
|
||||||
defense = tar.getDefenseRating();
|
defense = tar.getDefenseRating();
|
||||||
handleRetaliate(tar, attacker); //Handle target attacking back if in combat and has no other target
|
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 4;
|
errorTrack = 4;
|
||||||
|
|
||||||
//Get hit chance
|
//Get hit chance
|
||||||
|
|
||||||
int chance;
|
//int chance;
|
||||||
float dif = atr - defense;
|
float dif = atr - defense;
|
||||||
|
|
||||||
if (dif > 100)
|
//if (dif > 100)
|
||||||
chance = 94;
|
// chance = 94;
|
||||||
else if (dif < -100)
|
//else if (dif < -100)
|
||||||
chance = 4;
|
// chance = 4;
|
||||||
else
|
//else
|
||||||
chance = (int) ((0.45 * dif) + 49);
|
// chance = (int) ((0.45 * dif) + 49);
|
||||||
|
|
||||||
errorTrack = 5;
|
errorTrack = 5;
|
||||||
|
|
||||||
//calculate hit/miss
|
//calculate hit/miss
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
|
||||||
DeferredPowerJob dpj = null;
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
if (roll < chance) {
|
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
if (LandHit((int)atr,(int)defense)) {
|
||||||
|
|
||||||
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
|
|
||||||
boolean skipPassives = false;
|
boolean skipPassives = false;
|
||||||
PlayerBonuses bonuses = attacker.getBonuses();
|
PlayerBonuses bonuses = ac.getBonuses();
|
||||||
|
|
||||||
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
||||||
skipPassives = true;
|
skipPassives = true;
|
||||||
@@ -594,26 +685,26 @@ public enum CombatManager {
|
|||||||
// Apply Weapon power effect if any. don't try to apply twice if
|
// Apply Weapon power effect if any. don't try to apply twice if
|
||||||
// dual wielding. Perform after passive test for sync purposes.
|
// dual wielding. Perform after passive test for sync purposes.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
((PlayerCharacter) ac).setWeaponPower(dpj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to apply second backstab.
|
//check to apply second backstab.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
||||||
float attackRange = getWeaponRange(wb, bonuses);
|
float attackRange = getWeaponRange(wb, bonuses);
|
||||||
@@ -633,24 +724,24 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Handle Block passive
|
//Handle Block passive
|
||||||
|
|
||||||
if (testPassive(attacker, tarAc, "Block") && canTestBlock(attacker, target)) {
|
if (testPassive(ac, tarAc, "Block") && canTestBlock(ac, target)) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Parry passive
|
//Handle Parry passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (canTestParry(attacker, target) && testPassive(attacker, tarAc, "Parry")) {
|
if (canTestParry(ac, target) && testPassive(ac, tarAc, "Parry")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,12 +752,12 @@ public enum CombatManager {
|
|||||||
//Handle Dodge passive
|
//Handle Dodge passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (testPassive(attacker, tarAc, "Dodge")) {
|
if (testPassive(ac, tarAc, "Dodge")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,7 +773,7 @@ public enum CombatManager {
|
|||||||
//if target is player, set last attack timestamp
|
//if target is player, set last attack timestamp
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) target, attacker, false);
|
updateAttackTimers((PlayerCharacter) target, ac, false);
|
||||||
|
|
||||||
//Get damage Type
|
//Get damage Type
|
||||||
|
|
||||||
@@ -690,7 +781,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (wb != null)
|
if (wb != null)
|
||||||
damageType = wb.getDamageType();
|
damageType = wb.getDamageType();
|
||||||
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege())
|
else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege())
|
||||||
damageType = DamageType.Siege;
|
damageType = DamageType.Siege;
|
||||||
else
|
else
|
||||||
damageType = DamageType.Crush;
|
damageType = DamageType.Crush;
|
||||||
@@ -709,7 +800,7 @@ public enum CombatManager {
|
|||||||
//make sure target is not immune to damage type;
|
//make sure target is not immune to damage type;
|
||||||
|
|
||||||
if (resists != null && resists.immuneTo(damageType)) {
|
if (resists != null && resists.immuneTo(damageType)) {
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,9 +811,9 @@ public enum CombatManager {
|
|||||||
float damage;
|
float damage;
|
||||||
|
|
||||||
if (wb != null)
|
if (wb != null)
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
else
|
else
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
|
|
||||||
float d = 0f;
|
float d = 0f;
|
||||||
|
|
||||||
@@ -735,35 +826,40 @@ public enum CombatManager {
|
|||||||
if (tarAc.isSit())
|
if (tarAc.isSit())
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
|
||||||
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||||
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
|
}
|
||||||
|
|
||||||
if (tarAc.getHealth() > 0)
|
if (tarAc.getHealth() > 0)
|
||||||
d = tarAc.modifyHealth(-damage, attacker, false);
|
d = tarAc.modifyHealth(-damage, ac, false);
|
||||||
|
|
||||||
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getHealth() > 0)
|
if (target.getHealth() > 0)
|
||||||
d = ((Building) target).modifyHealth(-damage, attacker);
|
d = ((Building) target).modifyHealth(-damage, ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 13;
|
errorTrack = 13;
|
||||||
|
|
||||||
//Test to see if any damage needs done to weapon or armor
|
//Test to see if any damage needs done to weapon or armor
|
||||||
|
|
||||||
testItemDamage(attacker, target, weapon, wb);
|
testItemDamage(ac, target, weapon, wb);
|
||||||
|
|
||||||
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
||||||
|
|
||||||
if (tarAc != null && !tarAc.isAlive())
|
if (tarAc != null && !tarAc.isAlive())
|
||||||
removeAttackTimers(attacker);
|
removeAttackTimers(ac);
|
||||||
|
|
||||||
//test double death fix
|
//test double death fix
|
||||||
|
|
||||||
if (d != 0)
|
if (d != 0)
|
||||||
sendCombatMessage(attacker, target, damage, wb, dpj, mainHand); //send damage message
|
sendCombatMessage(ac, target, damage, wb, dpj, mainHand); //send damage message
|
||||||
|
|
||||||
errorTrack = 14;
|
errorTrack = 14;
|
||||||
|
|
||||||
@@ -790,7 +886,7 @@ public enum CombatManager {
|
|||||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
if (procChance < MBServerStatics.PROC_CHANCE)
|
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||||
((WeaponProcEffectModifier) aem).applyProc(attacker, target);
|
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -802,52 +898,52 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//handle damage shields
|
//handle damage shields
|
||||||
|
|
||||||
if (attacker.isAlive() && tarAc != null && tarAc.isAlive())
|
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||||
handleDamageShields(attacker, tarAc, damage);
|
handleDamageShields(ac, tarAc, damage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Apply Weapon power effect if any.
|
// Apply Weapon power effect if any.
|
||||||
// don't try to apply twice if dual wielding.
|
// don't try to apply twice if dual wielding.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PowersBase wp = dpj.getPower();
|
PowersBase wp = dpj.getPower();
|
||||||
|
|
||||||
if (wp.requiresHitRoll() == false) {
|
if (wp.requiresHitRoll() == false) {
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
} else
|
} else
|
||||||
((PlayerCharacter) attacker).setWeaponPower(null);
|
((PlayerCharacter) ac).setWeaponPower(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob)
|
if (target.getObjectType() == GameObjectType.Mob)
|
||||||
((Mob) target).handleDirectAggro(attacker);
|
((Mob) target).handleDirectAggro(ac);
|
||||||
|
|
||||||
errorTrack = 17;
|
errorTrack = 17;
|
||||||
|
|
||||||
//miss, Send miss message
|
//miss, Send miss message
|
||||||
|
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
|
|
||||||
//if attacker is player, set last attack timestamp
|
//if attacker is player, set last attack timestamp
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 18;
|
errorTrack = 18;
|
||||||
|
|
||||||
//cancel effects that break on attack or attackSwing
|
//cancel effects that break on attack or attackSwing
|
||||||
attacker.cancelOnAttack();
|
ac.cancelOnAttack();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(attacker.getName() + ' ' + errorTrack + ' ' + e);
|
Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,6 +1055,10 @@ public enum CombatManager {
|
|||||||
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
|
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
|
||||||
swingAnimation = 0;
|
swingAnimation = 0;
|
||||||
|
|
||||||
|
if(source != null && source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
|
damage *= ((PlayerCharacter)source).ZergMultiplier;
|
||||||
|
} // Health modifications are modified by the ZergMechanic
|
||||||
|
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
|
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
|
||||||
DispatchMessage.sendToAllInRange(target, cmm);
|
DispatchMessage.sendToAllInRange(target, cmm);
|
||||||
}
|
}
|
||||||
@@ -1125,7 +1225,7 @@ public enum CombatManager {
|
|||||||
toggleCombat(msg.getToggle(), origin);
|
toggleCombat(msg.getToggle(), origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
private static void toggleCombat(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
@@ -1149,7 +1249,10 @@ public enum CombatManager {
|
|||||||
if (pc == null)
|
if (pc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pc.setSit(toggle);
|
if(pc.isFlying())
|
||||||
|
pc.setSit(false);
|
||||||
|
else
|
||||||
|
pc.setSit(toggle);
|
||||||
|
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
rwss.setPlayer(pc);
|
rwss.setPlayer(pc);
|
||||||
@@ -1172,69 +1275,68 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Called when character takes damage.
|
//Called when character takes damage.
|
||||||
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) {
|
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
|
||||||
|
|
||||||
if (attacker == null || target == null)
|
if (ac == null || tarAc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (attacker.equals(target))
|
if (ac.equals(tarAc))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.isAlive() || !attacker.isAlive())
|
if (!tarAc.isAlive() || !ac.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean isCombat = target.isCombat();
|
boolean isCombat = tarAc.isCombat();
|
||||||
|
|
||||||
//If target in combat and has no target, then attack back
|
//If target in combat and has no target, then attack back
|
||||||
|
|
||||||
AbstractWorldObject awoCombTar = target.getCombatTarget();
|
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
|
||||||
|
|
||||||
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege()))
|
if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege()))
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
||||||
target.setCombatTarget(attacker);
|
tarAc.setCombatTarget(ac);
|
||||||
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
||||||
|
|
||||||
if (target.getTimers() != null)
|
if (tarAc.getTimers() != null)
|
||||||
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||||
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
Mob pet = ((PlayerCharacter) target).getPet();
|
Mob pet = ((PlayerCharacter) tarAc).getPet();
|
||||||
|
|
||||||
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||||
pet.setCombatTarget(attacker);
|
pet.setCombatTarget(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mob Retaliate.
|
//Handle Mob Retaliate.
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
|
||||||
Mob attackedMobile = (Mob) target;
|
Mob retaliater = (Mob) tarAc;
|
||||||
|
|
||||||
//handle minion informing his captain of an attack
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
|
||||||
|
|
||||||
if (attackedMobile.agentType.equals(AIAgentType.GUARDMINION) && attackedMobile.guardCaptain != null && attackedMobile.guardCaptain.isAlive()) {
|
|
||||||
|
|
||||||
if (attackedMobile.guardCaptain.combatTarget == null)
|
|
||||||
attackedMobile.guardCaptain.setCombatTarget(attacker);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mobile already has a target; don't switch.
|
|
||||||
|
|
||||||
if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attackedMobile.setCombatTarget(attacker);
|
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
||||||
|
return;
|
||||||
|
|
||||||
|
retaliater.setCombatTarget(ac);
|
||||||
|
if(retaliater.isPlayerGuard && (retaliater.BehaviourType.equals(MobBehaviourType.GuardMinion) || retaliater.BehaviourType.equals(MobBehaviourType.GuardCaptain))){
|
||||||
|
for(Mob guard : retaliater.guardedCity.getParent().zoneMobSet){
|
||||||
|
if(guard.isPlayerGuard && guard.combatTarget == null){
|
||||||
|
guard.setCombatTarget(ac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1351,4 +1453,17 @@ public enum CombatManager {
|
|||||||
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean LandHit(int C5, int D5){
|
||||||
|
|
||||||
|
float chance = (C5-((C5+D5)*.315f)) / ((D5-((C5+D5)*.315f)) + (C5-((C5+D5)*.315f)));
|
||||||
|
int convertedChance = Math.round(chance * 100);
|
||||||
|
//convertedChance = Math.max(5, Math.min(95, convertedChance));
|
||||||
|
|
||||||
|
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||||
|
|
||||||
|
if(roll < 5)//always 5% chance ot miss
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return roll <= convertedChance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ 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,
|
||||||
|
|
||||||
// Mobile AI modifiers
|
// Mobile AI modifiers
|
||||||
|
|||||||
@@ -46,11 +46,9 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintRunesCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
||||||
@@ -81,7 +79,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
|
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());
|
||||||
@@ -105,6 +102,7 @@ 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 EnchantCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
||||||
// Admin
|
// Admin
|
||||||
@@ -130,6 +128,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
||||||
DevCmdManager.registerDevCmd(new GotoObj());
|
DevCmdManager.registerDevCmd(new GotoObj());
|
||||||
DevCmdManager.registerDevCmd(new convertLoc());
|
DevCmdManager.registerDevCmd(new convertLoc());
|
||||||
|
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
|
||||||
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
||||||
@@ -144,7 +143,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||||
DevCmdManager.registerDevCmd(new SeaAuditCmd());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerDevCmd(AbstractDevCmd cmd) {
|
private static void registerDevCmd(AbstractDevCmd cmd) {
|
||||||
@@ -180,8 +179,23 @@ public enum DevCmdManager {
|
|||||||
|
|
||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//only admin level can run dev commands on production
|
||||||
|
boolean playerAllowed = false;
|
||||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
||||||
|
switch (adc.getMainCmdString()) {
|
||||||
|
case "printresists":
|
||||||
|
case "printstats":
|
||||||
|
case "printskills":
|
||||||
|
case "printpowers":
|
||||||
|
case "gimme":
|
||||||
|
case "goto":
|
||||||
|
case "teleportmode":
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import engine.objects.*;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +36,12 @@ public enum LootManager {
|
|||||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||||
|
|
||||||
|
public static final ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510));
|
||||||
|
public static final ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(27570,188900,188910,188920,188930,188940,188950,189500));
|
||||||
|
public static final ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(27550,27560,189100,189110,189120,189130,189140,189150));
|
||||||
|
public static final ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(27600,188700,188720,189550,189560));
|
||||||
|
public static final ArrayList<Integer> racial_guard_uuids = new ArrayList<>(Arrays.asList(841,951,952,1050,1052,1180,1182,1250,1252,1350,1352,1450,1452,1500,1502,1525,1527,1550,1552,1575,1577,1600,1602,1650,1652,1700,980100,980102));
|
||||||
|
|
||||||
// Drop Rates
|
// Drop Rates
|
||||||
|
|
||||||
public static float NORMAL_DROP_RATE;
|
public static float NORMAL_DROP_RATE;
|
||||||
@@ -68,40 +76,116 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateMobLoot(Mob mob) {
|
public static void GenerateMobLoot(Mob mob) {
|
||||||
|
|
||||||
|
//no loot for safezones
|
||||||
|
if(mob == null || mob.getSafeZone()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//determine if mob is in hotzone
|
//determine if mob is in hotzone
|
||||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
boolean inHotzone = false;
|
||||||
|
|
||||||
//iterate the booty sets
|
//iterate the booty sets
|
||||||
|
|
||||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
if(mob.mobBase == null || mob.getMobBaseID() == 253003){
|
||||||
|
int i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet))
|
||||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
||||||
|
|
||||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet)) {
|
||||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
||||||
|
}else if(mob.bootySet != 0 && ItemBase.getItemBase(mob.bootySet) != null){
|
||||||
|
MobLoot specialDrop = null;
|
||||||
|
specialDrop = new MobLoot(mob,ItemBase.getItemBase(mob.bootySet),true);
|
||||||
|
if(specialDrop != null) {
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
|
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||||
|
mob.setResists(new Resists("Dropper"));
|
||||||
|
if(!Mob.discDroppers.contains(mob))
|
||||||
|
Mob.AddDiscDropper(mob);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||||
for (Item it : mob.getInventory()) {
|
for (Item it : mob.getInventory()) {
|
||||||
|
|
||||||
ItemBase ib = it.getItemBase();
|
ItemBase ib = it.getItemBase();
|
||||||
if(ib == null)
|
if (ib == null)
|
||||||
break;
|
break;
|
||||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
chatMsg.setMessageType(10);
|
chatMsg.setMessageType(10);
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
||||||
|
|
||||||
boolean hotzoneWasRan = false;
|
boolean hotzoneWasRan = false;
|
||||||
float dropRate = 1.0f;
|
float dropRate;
|
||||||
|
|
||||||
|
if (!mob.getSafeZone()) {
|
||||||
|
int contractLow = 1, contractHigh = 400;
|
||||||
|
int runeLow = 401, runeHigh = 800;
|
||||||
|
int resourceLow = 801, resourceHigh = 900;
|
||||||
|
int glassLow = 901, glassHigh = 910;
|
||||||
|
int guardLow = 911, guardHigh = 920;
|
||||||
|
|
||||||
|
// Pre-compute adjusted high values
|
||||||
|
int contractAdjust = 0, runeAdjust = 0, resourceAdjust = 0, glassAdjust = 0, guardAdjust = 0;
|
||||||
|
if (mob.level < 50) {
|
||||||
|
int dif = 50 - mob.level;
|
||||||
|
contractAdjust = (int)(400 * (dif * 0.02f));
|
||||||
|
runeAdjust = (int)(400 * (dif * 0.02f));
|
||||||
|
resourceAdjust = (int)(100 * (dif * 0.02f));
|
||||||
|
glassAdjust = (int)(10 * (dif * 0.02f));
|
||||||
|
guardAdjust = (int)(10 * (dif * 0.02f));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a single random roll
|
||||||
|
int specialCaseRoll = ThreadLocalRandom.current().nextInt(1, 100001);
|
||||||
|
|
||||||
|
// Calculate adjusted high values once
|
||||||
|
int contractHighAdjusted = contractHigh - contractAdjust;
|
||||||
|
int runeHighAdjusted = runeHigh - runeAdjust;
|
||||||
|
int resourceHighAdjusted = resourceHigh - resourceAdjust;
|
||||||
|
int glassHighAdjusted = glassHigh - glassAdjust;
|
||||||
|
int guardHighAdjusted = guardHigh - guardAdjust;
|
||||||
|
|
||||||
|
// Check the roll range and handle accordingly
|
||||||
|
if (specialCaseRoll >= contractLow && specialCaseRoll <= contractHighAdjusted) {
|
||||||
|
SpecialCaseContractDrop(mob, entries);
|
||||||
|
} else if (specialCaseRoll >= runeLow && specialCaseRoll <= runeHighAdjusted) {
|
||||||
|
SpecialCaseRuneDrop(mob, entries);
|
||||||
|
} else if (specialCaseRoll >= resourceLow && specialCaseRoll <= resourceHighAdjusted) {
|
||||||
|
SpecialCaseResourceDrop(mob, entries);
|
||||||
|
} else if (specialCaseRoll >= glassLow && specialCaseRoll <= glassHighAdjusted) {
|
||||||
|
int glassID = rollRandomItem(126);
|
||||||
|
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||||
|
if (glassItem != null) {
|
||||||
|
MobLoot toAddGlass = new MobLoot(mob, glassItem, false);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAddGlass);
|
||||||
|
}
|
||||||
|
} else if (specialCaseRoll >= guardLow && specialCaseRoll <= guardHighAdjusted) {
|
||||||
|
int guardContractID = racial_guard_uuids.get(new java.util.Random().nextInt(racial_guard_uuids.size()));
|
||||||
|
ItemBase guardContract = ItemBase.getItemBase(guardContractID);
|
||||||
|
if (guardContract != null) {
|
||||||
|
MobLoot toAddContract = new MobLoot(mob, guardContract, false);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAddContract);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Iterate all entries in this bootySet and process accordingly
|
// Iterate all entries in this bootySet and process accordingly
|
||||||
|
|
||||||
for (BootySetEntry bse : entries) {
|
for (BootySetEntry bse : entries) {
|
||||||
switch (bse.bootyType) {
|
switch (bse.bootyType) {
|
||||||
case "GOLD":
|
case "GOLD":
|
||||||
@@ -109,8 +193,10 @@ public enum LootManager {
|
|||||||
break;
|
break;
|
||||||
case "LOOT":
|
case "LOOT":
|
||||||
|
|
||||||
if (mob.getSafeZone() == false)
|
if (mob.getSafeZone())
|
||||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
return; // no loot to drop in safezones
|
||||||
|
|
||||||
|
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||||
|
|
||||||
if (inHotzone == true)
|
if (inHotzone == true)
|
||||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||||
@@ -135,6 +221,109 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SpecialCaseContractDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||||
|
|
||||||
|
int lootTableID = 0;
|
||||||
|
for(BootySetEntry entry : entries){
|
||||||
|
if(entry.bootyType.equals("LOOT")){
|
||||||
|
lootTableID = entry.genTable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lootTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ContractTableID = 0;
|
||||||
|
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||||
|
try {
|
||||||
|
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.CONTRACT)) {
|
||||||
|
ContractTableID = entry.itemTableID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ContractTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ContractTableID));
|
||||||
|
if(ib != null){
|
||||||
|
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SpecialCaseRuneDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||||
|
int lootTableID = 0;
|
||||||
|
for(BootySetEntry entry : entries){
|
||||||
|
if(entry.bootyType.equals("LOOT")){
|
||||||
|
lootTableID = entry.genTable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lootTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int RuneTableID = 0;
|
||||||
|
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||||
|
try {
|
||||||
|
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RUNE)) {
|
||||||
|
RuneTableID = entry.itemTableID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(RuneTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemBase ib = ItemBase.getItemBase(rollRandomItem(RuneTableID));
|
||||||
|
if(ib != null){
|
||||||
|
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SpecialCaseResourceDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||||
|
int lootTableID = 0;
|
||||||
|
for(BootySetEntry entry : entries){
|
||||||
|
if(entry.bootyType.equals("LOOT")){
|
||||||
|
lootTableID = entry.genTable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lootTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ResourceTableID = 0;
|
||||||
|
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||||
|
try {
|
||||||
|
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RESOURCE)) {
|
||||||
|
ResourceTableID = entry.itemTableID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ResourceTableID == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ResourceTableID));
|
||||||
|
if(ib != null){
|
||||||
|
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
||||||
|
|
||||||
if (mob == null || _genTables.containsKey(genTableID) == false)
|
if (mob == null || _genTables.containsKey(genTableID) == false)
|
||||||
@@ -156,11 +345,10 @@ public enum LootManager {
|
|||||||
|
|
||||||
//gets the 1-320 roll for this mob
|
//gets the 1-320 roll for this mob
|
||||||
int itemTableRoll = 0;
|
int itemTableRoll = 0;
|
||||||
int objectType = mob.getObjectType().ordinal();
|
|
||||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
itemTableRoll = TableRoll(mob.level, inHotzone);
|
itemTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||||
if (tableRow == null)
|
if (tableRow == null)
|
||||||
@@ -172,13 +360,23 @@ public enum LootManager {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||||
|
if(ThreadLocalRandom.current().nextInt(1,101) < 91)
|
||||||
|
return null; // cut down world drops rates of resources by 90%
|
||||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||||
}
|
}
|
||||||
|
if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.RUNE)){
|
||||||
|
int randomRune = rollRandomItem(itemTableId);
|
||||||
|
if(randomRune != 0) {
|
||||||
|
itemUUID = randomRune;
|
||||||
|
}
|
||||||
|
} else if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.CONTRACT)){
|
||||||
|
int randomContract = rollRandomItem(itemTableId);
|
||||||
|
if(randomContract != 0) {
|
||||||
|
itemUUID = randomContract;
|
||||||
|
}
|
||||||
|
}
|
||||||
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||||
Enum.ItemType outType = outItem.getItemBase().getType();
|
|
||||||
|
|
||||||
|
|
||||||
if(selectedRow.pModTable != 0){
|
if(selectedRow.pModTable != 0){
|
||||||
try {
|
try {
|
||||||
@@ -196,6 +394,12 @@ public enum LootManager {
|
|||||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(outItem.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || outItem.getItemBase().getType().equals(Enum.ItemType.RUNE)){
|
||||||
|
if(ThreadLocalRandom.current().nextInt(1,101) < 66)
|
||||||
|
return null; // cut down world drops rates of resources by 65%
|
||||||
|
}
|
||||||
|
|
||||||
return outItem;
|
return outItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +420,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
prefixTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||||
|
|
||||||
@@ -248,7 +452,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
suffixTableRoll = TableRoll(mob.level);
|
||||||
}
|
}
|
||||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||||
|
|
||||||
@@ -263,23 +467,36 @@ public enum LootManager {
|
|||||||
return inItem;
|
return inItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
public static int TableRoll(int mobLevel) {
|
||||||
|
|
||||||
if (mobLevel > 65)
|
int rank = (int)(mobLevel * 0.1f);
|
||||||
mobLevel = 65;
|
int min = 50;
|
||||||
|
int max = 100;
|
||||||
int max = (int) (4.882 * mobLevel + 127.0);
|
switch(rank){
|
||||||
|
case 1:
|
||||||
if (max > 319)
|
min = 200;
|
||||||
max = 319;
|
max = 250;
|
||||||
|
break;
|
||||||
int min = (int) (4.469 * mobLevel - 3.469);
|
case 2:
|
||||||
|
min = 210;
|
||||||
if (min < 70)
|
max = 275;
|
||||||
min = 70;
|
break;
|
||||||
|
case 3:
|
||||||
if (inHotzone)
|
min = 220;
|
||||||
min += mobLevel;
|
max = 300;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
min = 230;
|
||||||
|
max = 320;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
min = 240;
|
||||||
|
max = 320;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
|
|
||||||
@@ -299,12 +516,7 @@ public enum LootManager {
|
|||||||
|
|
||||||
int high = bse.highGold;
|
int high = bse.highGold;
|
||||||
int low = bse.lowGold;
|
int low = bse.lowGold;
|
||||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
int gold = (int) (ThreadLocalRandom.current().nextInt(low, high + 1) * NORMAL_GOLD_RATE);
|
||||||
|
|
||||||
if (inHotzone == true)
|
|
||||||
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
|
||||||
else
|
|
||||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
|
||||||
|
|
||||||
if (gold > 0) {
|
if (gold > 0) {
|
||||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||||
@@ -315,47 +527,63 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||||
|
|
||||||
try {
|
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||||
|
if(toAdd != null){
|
||||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
ItemBase ib = toAdd.getItemBase();
|
||||||
|
switch(ib.getType()){
|
||||||
if (toAdd != null)
|
case CONTRACT:
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
case RUNE:
|
||||||
|
case RESOURCE:
|
||||||
} catch (Exception e) {
|
return;
|
||||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
}
|
||||||
int i = 0;
|
toAdd.setIsID(true);
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void GenerateEquipmentDrop(Mob mob) {
|
public static void GenerateEquipmentDrop(Mob mob) {
|
||||||
|
|
||||||
if(mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard))
|
if (mob == null || mob.getSafeZone())
|
||||||
return; // safehold guards don't drop their equipment
|
return; // no equipment to drop in safezones
|
||||||
|
|
||||||
|
if(mob.StrongholdGuardian || mob.StrongholdCommander || mob.StrongholdEpic)
|
||||||
|
return; // stronghold mobs don't drop equipment
|
||||||
|
|
||||||
//do equipment here
|
//do equipment here
|
||||||
int dropCount = 0;
|
if (mob.getEquip() != null) {
|
||||||
if (mob.getEquip() != null)
|
boolean isVorg = false;
|
||||||
for (MobEquipment me : mob.getEquip().values()) {
|
for (MobEquipment me : mob.getEquip().values()) {
|
||||||
|
|
||||||
if (me.getDropChance() == 0)
|
if (me.getDropChance() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
String name = me.getItemBase().getName().toLowerCase();
|
||||||
|
if (name.contains("vorgrim legionnaire's") || name.contains("vorgrim auxiliary's") ||name.contains("bellugh nuathal") || name.contains("crimson circle"))
|
||||||
|
isVorg = true;
|
||||||
|
|
||||||
|
if(isVorg && !mob.isDropper){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
float dropChance = me.getDropChance() * 100;
|
float dropChance = me.getDropChance() * 100;
|
||||||
|
ItemBase itemBase = me.getItemBase();
|
||||||
|
if(isVorg) {
|
||||||
|
mob.spawnTime = ThreadLocalRandom.current().nextInt(300, 2700);
|
||||||
|
dropChance = 10;
|
||||||
|
itemBase = getRandomVorg(itemBase);
|
||||||
|
}
|
||||||
if (equipmentRoll > dropChance)
|
if (equipmentRoll > dropChance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
MobLoot ml = new MobLoot(mob, itemBase, false);
|
||||||
|
|
||||||
if (ml != null && dropCount < 1) {
|
ml.setIsID(true);
|
||||||
ml.setIsID(true);
|
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
mob.getCharItemManager().addItemToInventory(ml);
|
||||||
mob.getCharItemManager().addItemToInventory(ml);
|
|
||||||
dropCount = 1;
|
|
||||||
//break; // Exit on first successful roll.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||||
@@ -369,8 +597,11 @@ public enum LootManager {
|
|||||||
|
|
||||||
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
||||||
|
|
||||||
if (lootItem != null)
|
if (lootItem != null) {
|
||||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||||
|
if(lootItem.getItemBase().isDiscRune() && !Mob.discDroppers.contains(mob))
|
||||||
|
Mob.AddDiscDropper(mob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||||
@@ -394,12 +625,12 @@ public enum LootManager {
|
|||||||
|
|
||||||
//check if player owns the gift he is trying to open
|
//check if player owns the gift he is trying to open
|
||||||
|
|
||||||
if (itemMan.doesCharOwnThisItem(gift.getObjectUUID()) == false)
|
if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//roll 1-100 for the gen table selection
|
//roll 1-100 for the gen table selection
|
||||||
|
|
||||||
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
int genRoll = ThreadLocalRandom.current().nextInt(94, 100) + 1;
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
||||||
|
|
||||||
if(selectedRow == null)
|
if(selectedRow == null)
|
||||||
@@ -415,45 +646,276 @@ public enum LootManager {
|
|||||||
|
|
||||||
//create the item from the table, quantity is always 1
|
//create the item from the table, quantity is always 1
|
||||||
|
|
||||||
MobLoot winnings = new MobLoot(playerCharacter, ItemBase.getItemBase(selectedItem.cacheID), 1, false);
|
ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID);
|
||||||
|
if(ib.getUUID() == Warehouse.coalIB.getUUID()){
|
||||||
|
//no more coal, give gold instead
|
||||||
|
if (itemMan.getGoldInventory().getNumOfItems() + 250000 > 10000000) {
|
||||||
|
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
itemMan.addGoldToInventory(250000,false);
|
||||||
|
itemMan.updateInventory();
|
||||||
|
}else {
|
||||||
|
MobLoot winnings = new MobLoot(playerCharacter, ib, 1, false);
|
||||||
|
|
||||||
if (winnings == null)
|
if (winnings == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//early exit if the inventory of the player will not old the item
|
//early exit if the inventory of the player will not hold the item
|
||||||
|
|
||||||
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
||||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//determine if the winning item needs a prefix
|
||||||
|
|
||||||
|
if (selectedRow.pModTable != 0) {
|
||||||
|
int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
||||||
|
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
||||||
|
if (prefix != null)
|
||||||
|
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//determine if the winning item needs a suffix
|
||||||
|
|
||||||
|
if (selectedRow.sModTable != 0) {
|
||||||
|
int suffixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
||||||
|
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
||||||
|
if (suffix != null)
|
||||||
|
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
||||||
|
}
|
||||||
|
winnings.setIsID(true);
|
||||||
|
|
||||||
|
//remove gift from inventory
|
||||||
|
|
||||||
|
itemMan.consume(gift);
|
||||||
|
|
||||||
|
//add winnings to player inventory
|
||||||
|
|
||||||
|
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
||||||
|
itemMan.addItemToInventory(playerWinnings);
|
||||||
|
itemMan.updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int rollRandomItem(int itemTable){
|
||||||
|
int returnedID = ItemTableEntry.getRandomItem(itemTable);
|
||||||
|
return returnedID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemBase getRandomVorg(ItemBase itemBase){
|
||||||
|
int roll = 0;
|
||||||
|
if(vorg_ha_uuids.contains(itemBase.getUUID())) {
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
|
switch (roll) {
|
||||||
|
case 1:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(0));
|
||||||
|
case 2:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(1));
|
||||||
|
case 3:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(2));
|
||||||
|
case 4:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(3));
|
||||||
|
case 5:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(4));
|
||||||
|
case 6:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(5));
|
||||||
|
case 7:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(6));
|
||||||
|
case 8:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(7));
|
||||||
|
default:
|
||||||
|
return ItemBase.getItemBase(vorg_ha_uuids.get(8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//determine if the winning item needs a prefix
|
if(vorg_ma_uuids.contains(itemBase.getUUID())) {
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
if(selectedRow.pModTable != 0){
|
switch (roll) {
|
||||||
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
case 1:
|
||||||
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
return ItemBase.getItemBase(vorg_ma_uuids.get(0));
|
||||||
if(prefix != null)
|
case 2:
|
||||||
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
return ItemBase.getItemBase(vorg_ma_uuids.get(1));
|
||||||
|
case 3:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(2));
|
||||||
|
case 4:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(3));
|
||||||
|
case 5:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(4));
|
||||||
|
case 6:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(5));
|
||||||
|
case 7:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(6));
|
||||||
|
default:
|
||||||
|
return ItemBase.getItemBase(vorg_ma_uuids.get(7));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//determine if the winning item needs a suffix
|
if(vorg_la_uuids.contains(itemBase.getUUID())) {
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
if(selectedRow.sModTable != 0){
|
switch (roll) {
|
||||||
int suffixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
case 1:
|
||||||
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
return ItemBase.getItemBase(vorg_la_uuids.get(0));
|
||||||
if (suffix != null)
|
case 2:
|
||||||
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
return ItemBase.getItemBase(vorg_la_uuids.get(1));
|
||||||
|
case 3:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(2));
|
||||||
|
case 4:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(3));
|
||||||
|
case 5:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(4));
|
||||||
|
case 6:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(5));
|
||||||
|
case 7:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(6));
|
||||||
|
default:
|
||||||
|
return ItemBase.getItemBase(vorg_la_uuids.get(7));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
winnings.setIsID(true);
|
|
||||||
|
|
||||||
//remove gift from inventory
|
if(vorg_cloth_uuids.contains(itemBase.getUUID())) {
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
|
switch (roll) {
|
||||||
|
case 1:
|
||||||
|
return ItemBase.getItemBase(vorg_cloth_uuids.get(0));
|
||||||
|
case 2:
|
||||||
|
return ItemBase.getItemBase(vorg_cloth_uuids.get(1));
|
||||||
|
case 3:
|
||||||
|
return ItemBase.getItemBase(vorg_cloth_uuids.get(2));
|
||||||
|
case 4:
|
||||||
|
return ItemBase.getItemBase(vorg_cloth_uuids.get(3));
|
||||||
|
default:
|
||||||
|
return ItemBase.getItemBase(vorg_cloth_uuids.get(4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
itemMan.consume(gift);
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//add winnings to player inventory
|
public static void DropPresent(Mob mob){
|
||||||
|
int random = 971049 + ThreadLocalRandom.current().nextInt(24);
|
||||||
|
if (random > 971071)
|
||||||
|
random = 971071;
|
||||||
|
|
||||||
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
ItemBase present = ItemBase.getItemBase(random);
|
||||||
itemMan.addItemToInventory(playerWinnings);
|
if (present != null) {
|
||||||
itemMan.updateInventory();
|
MobLoot toAdd = new MobLoot(mob, present, true);
|
||||||
|
|
||||||
|
if (toAdd != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GenerateStrongholdLoot(Mob mob, boolean commander, boolean epic) {
|
||||||
|
|
||||||
|
mob.getCharItemManager().clearInventory();
|
||||||
|
|
||||||
|
int multiplier = 1;
|
||||||
|
if (commander)
|
||||||
|
multiplier = 2;
|
||||||
|
if(epic)
|
||||||
|
multiplier = 10;
|
||||||
|
|
||||||
|
int high = 125000;
|
||||||
|
int low = 50000;
|
||||||
|
int gold = ThreadLocalRandom.current().nextInt(low, high + 1) * multiplier;
|
||||||
|
|
||||||
|
if (gold > 0) {
|
||||||
|
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||||
|
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//present drop chance for all
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 35)
|
||||||
|
DropPresent(mob);
|
||||||
|
|
||||||
|
//random contract drop chance for all
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 40) {
|
||||||
|
int contractTableID = 250;
|
||||||
|
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
||||||
|
if (contractTableID > 259)
|
||||||
|
contractTableID = 659;
|
||||||
|
|
||||||
|
int id = rollRandomItem(contractTableID);
|
||||||
|
ItemBase ib = ItemBase.getItemBase(id);
|
||||||
|
if (ib != null) {
|
||||||
|
MobLoot contract = new MobLoot(mob, ib, true);
|
||||||
|
|
||||||
|
if (contract != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(contract);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//special commander drop chances
|
||||||
|
if (commander)
|
||||||
|
GenerateCommanderLoot(mob,false);
|
||||||
|
|
||||||
|
//special epic drop chances
|
||||||
|
if (epic) {
|
||||||
|
GenerateCommanderLoot(mob, true);
|
||||||
|
GenerateCommanderLoot(mob,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GenerateCommanderLoot(Mob mob, boolean epic){
|
||||||
|
//present chance
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
||||||
|
DropPresent(mob);
|
||||||
|
|
||||||
|
//present chance
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
||||||
|
DropPresent(mob);
|
||||||
|
|
||||||
|
//chance for glass
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
|
int glassID = rollRandomItem(126);
|
||||||
|
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||||
|
if (glassItem != null) {
|
||||||
|
MobLoot toAdd2 = new MobLoot(mob, glassItem, true);
|
||||||
|
|
||||||
|
if (toAdd2 != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//chance for disc
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
|
int discID = rollRandomItem(3202);
|
||||||
|
ItemBase discItem = ItemBase.getItemBase(discID);
|
||||||
|
if (discItem != null) {
|
||||||
|
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
|
||||||
|
|
||||||
|
if (toAdd3 != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//chance for stat rune
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
|
int runeID = rollRandomItem(3201);
|
||||||
|
ItemBase runeItem = ItemBase.getItemBase(runeID);
|
||||||
|
if (runeItem != null) {
|
||||||
|
MobLoot toAdd4 = new MobLoot(mob, runeItem, true);
|
||||||
|
|
||||||
|
if (toAdd4 != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(epic){
|
||||||
|
int contractTableID = 250;
|
||||||
|
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
||||||
|
if (contractTableID > 259)
|
||||||
|
contractTableID = 659;
|
||||||
|
|
||||||
|
int id = rollRandomItem(contractTableID);
|
||||||
|
ItemBase ib = ItemBase.getItemBase(id);
|
||||||
|
if (ib != null) {
|
||||||
|
MobLoot contract = new MobLoot(mob, ib, true);
|
||||||
|
|
||||||
|
if (contract != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(contract);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
||||||
|
|
||||||
building.maintDateTime = maintDate;
|
building.maintDateTime = maintDate.withHour(1).withMinute(0).withSecond(0);
|
||||||
DbManager.BuildingQueries.updateMaintDate(building);
|
DbManager.BuildingQueries.updateMaintDate(building);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,19 +49,15 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
if (chargeUpkeep(building) == false)
|
if (chargeUpkeep(building) == false)
|
||||||
derankList.add(building);
|
derankList.add(building);
|
||||||
|
else
|
||||||
|
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||||
}
|
}
|
||||||
// Reset maintenance dates for these buildings
|
|
||||||
|
|
||||||
for (Building building : maintList) {
|
for (Building building : derankList) {
|
||||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
|
||||||
|
|
||||||
}
|
|
||||||
// Derak or destroy buildings that did not
|
|
||||||
// have funds available.
|
|
||||||
|
|
||||||
for (Building building : derankList)
|
|
||||||
building.destroyOrDerank(null);
|
building.destroyOrDerank(null);
|
||||||
|
if(building.getRank() > 0)
|
||||||
|
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
|
||||||
|
}
|
||||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +94,10 @@ public enum MaintenanceManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//only ToL pays maintenance
|
||||||
|
if(building.getBlueprint().getBuildingGroup() != null && !building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
|
||||||
|
continue;
|
||||||
|
|
||||||
// No maintenance on banestones omfg
|
// No maintenance on banestones omfg
|
||||||
|
|
||||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
||||||
@@ -122,9 +122,9 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
|
|
||||||
//no maintenance if day of week doesnt match
|
//no maintenance if day of week doesnt match
|
||||||
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
//if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
//}
|
||||||
// Add building to maintenance queue
|
// Add building to maintenance queue
|
||||||
|
|
||||||
maintList.add(building);
|
maintList.add(building);
|
||||||
@@ -186,49 +186,8 @@ public enum MaintenanceManager {
|
|||||||
// If this is an R8 tree, validate that we can
|
// If this is an R8 tree, validate that we can
|
||||||
// cover the resources required
|
// cover the resources required
|
||||||
|
|
||||||
if (building.getRank() == 8) {
|
|
||||||
|
|
||||||
hasResources = true;
|
|
||||||
|
|
||||||
if (warehouse == null)
|
|
||||||
hasResources = false;
|
|
||||||
else {
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
|
||||||
|
|
||||||
if (resourceValue < 5)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
|
||||||
|
|
||||||
if (resourceValue < 5)
|
|
||||||
hasResources = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Validation completed but has failed. We can derank
|
|
||||||
// the target building and early exit
|
|
||||||
|
|
||||||
if ((hasFunds == false) ||
|
|
||||||
((building.getRank() == 8) && !hasResources)) {
|
|
||||||
|
|
||||||
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
|
||||||
// and it's not an R8 deranking
|
|
||||||
|
|
||||||
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
|
||||||
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (hasFunds == false) {
|
||||||
return false; // Early exit for having failed to meet maintenance
|
return false; // Early exit for having failed to meet maintenance
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,58 +212,6 @@ public enum MaintenanceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Early exit as we're done if we're not an R8 tree
|
|
||||||
|
|
||||||
if (building.getRank() < 8)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Now for the resources if it's an R8 tree
|
|
||||||
|
|
||||||
// Withdraw Stone
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
|
||||||
} else {
|
|
||||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Withdraw Lumber
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
|
||||||
} else {
|
|
||||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Withdraw Galvor
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
|
||||||
} else {
|
|
||||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
|
||||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
|
||||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
|
||||||
} else {
|
|
||||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public enum MovementManager {
|
|||||||
|
|
||||||
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
if (((PlayerCharacter) toMove).isCasting())
|
if (((PlayerCharacter) toMove).isCasting())
|
||||||
((PlayerCharacter) toMove).update();
|
((PlayerCharacter) toMove).update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public enum MovementManager {
|
|||||||
if (!toMove.isMoving())
|
if (!toMove.isMoving())
|
||||||
toMove.resetLastSetLocUpdate();
|
toMove.resetLastSetLocUpdate();
|
||||||
else
|
else
|
||||||
toMove.update();
|
toMove.update(false);
|
||||||
|
|
||||||
// Update movement for the player
|
// Update movement for the player
|
||||||
|
|
||||||
@@ -116,8 +116,8 @@ public enum MovementManager {
|
|||||||
|
|
||||||
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
||||||
|
|
||||||
if (msg.getInBuildingUUID() > 0) {
|
if (msg.getTargetID() > 0) {
|
||||||
Building building = BuildingManager.getBuildingFromCache(msg.getInBuildingUUID());
|
Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
if (building != null) {
|
if (building != null) {
|
||||||
|
|
||||||
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
||||||
@@ -128,8 +128,8 @@ public enum MovementManager {
|
|||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
toMove.setInBuilding(msg.getInBuilding());
|
toMove.setInBuilding(msg.getInBuilding());
|
||||||
toMove.setInFloorID(msg.getInBuildingFloor());
|
toMove.setInFloorID(msg.getUnknown01());
|
||||||
toMove.setInBuildingID(msg.getInBuildingUUID());
|
toMove.setInBuildingID(msg.getTargetID());
|
||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
||||||
|
|
||||||
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
@@ -174,9 +174,9 @@ public enum MovementManager {
|
|||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
||||||
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
||||||
msg.setInBuilding(toMove.region.level);
|
msg.setInBuilding(toMove.region.level);
|
||||||
msg.setInBuildingFloor(toMove.region.room);
|
msg.setUnknown01(toMove.region.room);
|
||||||
msg.setStartLocType(GameObjectType.Building.ordinal());
|
msg.setTargetType(GameObjectType.Building.ordinal());
|
||||||
msg.setInBuildingUUID(regionBuilding.getObjectUUID());
|
msg.setTargetID(regionBuilding.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -185,8 +185,8 @@ public enum MovementManager {
|
|||||||
toMove.setInBuilding(-1);
|
toMove.setInBuilding(-1);
|
||||||
msg.setStartCoord(toMove.getLoc());
|
msg.setStartCoord(toMove.getLoc());
|
||||||
msg.setEndCoord(endLocation);
|
msg.setEndCoord(endLocation);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
||||||
@@ -233,7 +233,7 @@ public enum MovementManager {
|
|||||||
toMove.cancelOnMove();
|
toMove.cancelOnMove();
|
||||||
|
|
||||||
//cancel any attacks for manual move.
|
//cancel any attacks for manual move.
|
||||||
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getInitiatedFromAttack() == 0)
|
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
|
||||||
toMove.setCombatTarget(null);
|
toMove.setCombatTarget(null);
|
||||||
|
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ public enum MovementManager {
|
|||||||
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
||||||
|
|
||||||
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
||||||
ac.update();
|
ac.update(false);
|
||||||
ac.stopMovement(ac.getLoc());
|
ac.stopMovement(ac.getLoc());
|
||||||
if (ac.isAlive())
|
if (ac.isAlive())
|
||||||
MovementManager.sendRWSSMsg(ac);
|
MovementManager.sendRWSSMsg(ac);
|
||||||
@@ -408,7 +408,7 @@ public enum MovementManager {
|
|||||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
member.update();
|
member.update(false);
|
||||||
|
|
||||||
|
|
||||||
// All checks passed, let's move the player
|
// All checks passed, let's move the player
|
||||||
@@ -464,7 +464,7 @@ public enum MovementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc) {
|
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
|
||||||
|
|
||||||
|
|
||||||
if (targetLoc == null)
|
if (targetLoc == null)
|
||||||
@@ -473,6 +473,7 @@ public enum MovementManager {
|
|||||||
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
||||||
|
|
||||||
teleporter.stopMovement(targetLoc);
|
teleporter.stopMovement(targetLoc);
|
||||||
|
teleporter.setRegion(region);
|
||||||
|
|
||||||
//mobs ignore region sets for now.
|
//mobs ignore region sets for now.
|
||||||
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
|
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
|||||||
@@ -5,17 +5,13 @@ import engine.InterestManagement.WorldGrid;
|
|||||||
import engine.math.Quaternion;
|
import engine.math.Quaternion;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.PowersBase;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import javax.smartcardio.ATR;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -27,6 +23,92 @@ public enum NPCManager {
|
|||||||
NPC_MANAGER;
|
NPC_MANAGER;
|
||||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||||
|
|
||||||
|
public static void LoadAllRuneSets() {
|
||||||
|
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadAllBootySets() {
|
||||||
|
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyRuneSetEffects(Mob mob) {
|
||||||
|
|
||||||
|
// Early exit
|
||||||
|
|
||||||
|
if (mob.runeSet == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Apply all rune effects.
|
||||||
|
|
||||||
|
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
||||||
|
mob.isPlayerGuard = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only captains have contracts
|
||||||
|
|
||||||
|
if (mob.contract != null || mob.isPlayerGuard)
|
||||||
|
applyEffectsForRune(mob, 252621);
|
||||||
|
|
||||||
|
|
||||||
|
// Apply effects from RuneSet
|
||||||
|
|
||||||
|
if (mob.runeSet != 0)
|
||||||
|
for (int runeID : _runeSetMap.get(mob.runeSet))
|
||||||
|
applyEffectsForRune(mob, runeID);
|
||||||
|
|
||||||
|
// Not sure why but apply Warrior effects for some reason?
|
||||||
|
|
||||||
|
applyEffectsForRune(mob, 2518);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
|
||||||
|
|
||||||
|
EffectsBase effectsBase;
|
||||||
|
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
|
||||||
|
|
||||||
|
// Race runes are in the runeset but not in runebase for some reason
|
||||||
|
|
||||||
|
if (sourceRune == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
|
||||||
|
|
||||||
|
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||||
|
|
||||||
|
if (effectsBase == null) {
|
||||||
|
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to upgrade effects if needed.
|
||||||
|
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||||
|
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Current effect is a higher rank, dont apply.
|
||||||
|
if (eff.getTrains() > mbe.getRank())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//new effect is of a higher rank. remove old effect and apply new one.
|
||||||
|
eff.cancelJob();
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
||||||
|
|
||||||
necroPet.setCombatTarget(null);
|
necroPet.setCombatTarget(null);
|
||||||
@@ -45,12 +127,10 @@ public enum NPCManager {
|
|||||||
|
|
||||||
DbManager.removeFromCache(necroPet);
|
DbManager.removeFromCache(necroPet);
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = necroPet.getOwner();
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
|
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
necroPet.setOwner(null);
|
||||||
necroPet.guardCaptain = null;
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
if (updateOwner == false)
|
if (updateOwner == false)
|
||||||
@@ -122,6 +202,78 @@ public enum NPCManager {
|
|||||||
playerCharacter.necroPets.clear();
|
playerCharacter.necroPets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void removeSiegeMinions(Mob mobile) {
|
||||||
|
|
||||||
|
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
|
||||||
|
|
||||||
|
if (mobile.isMoving()) {
|
||||||
|
|
||||||
|
mobile.stopMovement(mobile.getLoc());
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
toRemove.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
WorldGrid.removeObject(toRemove);
|
||||||
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
|
if (petOwner != null) {
|
||||||
|
|
||||||
|
petOwner.setPet(null);
|
||||||
|
toRemove.setOwner(null);
|
||||||
|
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
|
||||||
|
|
||||||
|
// Remove npc from it's building
|
||||||
|
|
||||||
|
try {
|
||||||
|
mobile.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobile.parentZone != null)
|
||||||
|
mobile.parentZone.zoneMobSet.remove(mobile);
|
||||||
|
|
||||||
|
if (building != null) {
|
||||||
|
building.getHirelings().remove(mobile);
|
||||||
|
removeSiegeMinions(mobile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete npc from database
|
||||||
|
|
||||||
|
if (DbManager.MobQueries.DELETE_MOB(mobile) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Remove npc from the simulation
|
||||||
|
|
||||||
|
mobile.removeFromCache();
|
||||||
|
DbManager.removeFromCache(mobile);
|
||||||
|
WorldGrid.RemoveWorldObject(mobile);
|
||||||
|
WorldGrid.removeObject(mobile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadAllPirateNames() {
|
public static void loadAllPirateNames() {
|
||||||
|
|
||||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||||
@@ -188,19 +340,10 @@ public enum NPCManager {
|
|||||||
else
|
else
|
||||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||||
|
|
||||||
// Override slot for siege engines
|
//if (buildingSlot == -1)
|
||||||
|
//Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||||
|
|
||||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||||
Mob siegeMobile = (Mob) abstractCharacter;
|
|
||||||
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildingSlot == -1)
|
|
||||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
|
||||||
|
|
||||||
// Pets are regular mobiles not hirelings (Siege engines)
|
|
||||||
if (abstractCharacter.contract != null)
|
|
||||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
|
||||||
|
|
||||||
// Override bind and location for this npc derived
|
// Override bind and location for this npc derived
|
||||||
// from BuildingManager slot location data.
|
// from BuildingManager slot location data.
|
||||||
@@ -227,251 +370,4 @@ public enum NPCManager {
|
|||||||
|
|
||||||
return buildingSlot;
|
return buildingSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AssignPatrolPoints(Mob mob) {
|
|
||||||
mob.patrolPoints = new ArrayList<>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
float patrolRadius = mob.getSpawnRadius();
|
|
||||||
|
|
||||||
if (patrolRadius > 256)
|
|
||||||
patrolRadius = 256;
|
|
||||||
|
|
||||||
if (patrolRadius < 60)
|
|
||||||
patrolRadius = 60;
|
|
||||||
|
|
||||||
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
|
|
||||||
mob.patrolPoints.add(newPatrolPoint);
|
|
||||||
|
|
||||||
if (i == 1) {
|
|
||||||
mob.setLoc(newPatrolPoint);
|
|
||||||
mob.endLoc = newPatrolPoint;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyGuardStanceModifiers(Mob guard){
|
|
||||||
float damageModifier = 1;
|
|
||||||
float attackRatingModifier = 1;
|
|
||||||
float defenseModifier = 1;
|
|
||||||
float attackSpeedModifier = 1;
|
|
||||||
float powerDamageModifier = 1;
|
|
||||||
//handle stance modifiers for guard mob
|
|
||||||
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){
|
|
||||||
//apply rogue bonuses
|
|
||||||
attackRatingModifier += 0.5f;
|
|
||||||
defenseModifier += 0.5f;
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}else {
|
|
||||||
Integer contractID;
|
|
||||||
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
|
||||||
contractID = guard.guardCaptain.contract.getContractID();
|
|
||||||
} else{
|
|
||||||
contractID = guard.contract.getContractID();
|
|
||||||
}
|
|
||||||
if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()){
|
|
||||||
//apply mage offensive Stance
|
|
||||||
powerDamageModifier += 0.5f;
|
|
||||||
} else{
|
|
||||||
//apply fighter offensive stance
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
guard.minDamageHandOne *= damageModifier;
|
|
||||||
guard.minDamageHandTwo *= damageModifier;
|
|
||||||
guard.maxDamageHandOne *= damageModifier;
|
|
||||||
guard.maxDamageHandTwo *= damageModifier;
|
|
||||||
guard.atrHandOne *= attackRatingModifier;
|
|
||||||
guard.atrHandTwo *= attackRatingModifier;
|
|
||||||
guard.defenseRating *= defenseModifier;
|
|
||||||
guard.speedHandOne *= attackSpeedModifier;
|
|
||||||
guard.speedHandTwo *= attackSpeedModifier;
|
|
||||||
|
|
||||||
//TODO figure out how to apply +50% powerdamage to mage guards
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDamageAndSpeedForGuard(Mob guard){
|
|
||||||
|
|
||||||
float rankModifier = 1 + (guard.getRank() * 0.1f);
|
|
||||||
int primaryStat = 0;
|
|
||||||
if(guard.equip == null) {
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier);
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier);
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
}else{
|
|
||||||
if(guard.equip.containsKey(1)){
|
|
||||||
//has main hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(1).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = weapon.getSpeed();
|
|
||||||
guard.rangeHandOne = weapon.getRange();
|
|
||||||
} else if(guard.equip.containsKey(2) && !guard.equip.get(2).getItemBase().isShield()){
|
|
||||||
//has off hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(2).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandTwo = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandTwo = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandTwo = weapon.getSpeed();
|
|
||||||
guard.rangeHandTwo = weapon.getRange();
|
|
||||||
} else {
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
guard.rangeHandOne = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDefenseForGuard(Mob guard){
|
|
||||||
int dexterity = guard.getStatDexCurrent();
|
|
||||||
if(dexterity < 1)
|
|
||||||
dexterity = 1;
|
|
||||||
int baseDef = guard.mobBase.getDefenseRating();
|
|
||||||
int armorDefense = 0;
|
|
||||||
for(MobEquipment equipped : guard.equip.values())
|
|
||||||
if(equipped.getItemBase().isArmor() || equipped.getItemBase().isShield())
|
|
||||||
armorDefense += equipped.getItemBase().getDefense();
|
|
||||||
guard.defenseRating = dexterity + baseDef + armorDefense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setAttackRatingForGuard(Mob guard) {
|
|
||||||
int strength = guard.getStatStrCurrent();
|
|
||||||
int baseAtr = guard.mobBase.getAttackRating();
|
|
||||||
if (guard.equip.get(1) != null)
|
|
||||||
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(1).getItemBase().getPercentRequired() * 4) + (guard.equip.get(1).getItemBase().getPercentRequired() * 3));
|
|
||||||
else if (guard.equip.get(2) != null && !guard.equip.get(2).getItemBase().isShield())
|
|
||||||
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(2).getItemBase().getPercentRequired() * 4) + (guard.equip.get(2).getItemBase().getPercentRequired() * 3));
|
|
||||||
else
|
|
||||||
guard.atrHandOne = baseAtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMaxHealthForGuard(Mob guard){
|
|
||||||
//values derived fom reading memory address for health on client when selecting player guards
|
|
||||||
switch(guard.getRank()){
|
|
||||||
default:
|
|
||||||
guard.healthMax = 750; //rank 1
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
guard.healthMax = 2082;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
guard.healthMax = 2740;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
guard.healthMax = 3414;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
guard.healthMax = 4080;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
guard.healthMax = 4746;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
guard.healthMax = 5412;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseEffects(Mob mob) {
|
|
||||||
EffectsBase effectsBase;
|
|
||||||
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
|
|
||||||
|
|
||||||
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
|
||||||
|
|
||||||
if (effectsBase == null) {
|
|
||||||
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check to upgrade effects if needed.
|
|
||||||
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
|
|
||||||
|
|
||||||
if (eff == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Current effect is a higher rank, dont apply.
|
|
||||||
if (eff.getTrains() > mbe.getRank())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//new effect is of a higher rank. remove old effect and apply new one.
|
|
||||||
eff.cancelJob();
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyEquipmentResists(Mob mob){
|
|
||||||
if(mob.equip != null){
|
|
||||||
for(MobEquipment equipped : mob.equip.values()){
|
|
||||||
ItemBase itemBase = equipped.getItemBase();
|
|
||||||
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
|
||||||
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseSkill(Mob mob) {
|
|
||||||
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
|
|
||||||
if(baseSkill != null)
|
|
||||||
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRuneSkills(Mob mob, int runeID){
|
|
||||||
//load mob skill adjustments from mobbase rune
|
|
||||||
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
|
|
||||||
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
|
|
||||||
if(SkillsBase.getFromCache(entry.skill_type) == null)
|
|
||||||
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
|
|
||||||
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
|
|
||||||
if(skillBase == null)
|
|
||||||
continue;
|
|
||||||
if (entry.level <= mob.level)
|
|
||||||
if (mob.skills.containsKey(entry.name) == false)
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
|
|
||||||
else
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRunesForNPC(NPC npc){
|
|
||||||
npc.runes = new ArrayList<>();
|
|
||||||
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
|
|
||||||
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID());
|
|
||||||
npc.runes.add(shopkeeper);
|
|
||||||
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
|
|
||||||
for (int runeID : _runeSetMap.get(npc.runeSetID)) {
|
|
||||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
|
||||||
if(rb != null) {
|
|
||||||
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
|
|
||||||
npc.runes.add(toApply);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,13 @@ public enum PowersManager {
|
|||||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers;
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
|
|
||||||
private static JobScheduler js;
|
private static JobScheduler js;
|
||||||
|
|
||||||
|
private PowersManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void initPowersManager(boolean fullPowersLoad) {
|
public static void initPowersManager(boolean fullPowersLoad) {
|
||||||
|
|
||||||
if (fullPowersLoad)
|
if (fullPowersLoad)
|
||||||
@@ -100,16 +103,6 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<RunePowerEntry> getPowersForRune(int rune_id) {
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> powerEntries = PowersManager._allRunePowers.get(rune_id);
|
|
||||||
|
|
||||||
if (powerEntries == null)
|
|
||||||
powerEntries = new ArrayList<>();
|
|
||||||
|
|
||||||
return powerEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This pre-loads all powers and effects
|
// This pre-loads all powers and effects
|
||||||
public static void InitializePowers() {
|
public static void InitializePowers() {
|
||||||
|
|
||||||
@@ -170,6 +163,14 @@ public enum PowersManager {
|
|||||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||||
boolean sendCastToSelf) {
|
boolean sendCastToSelf) {
|
||||||
|
|
||||||
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
|
||||||
|
CombatManager.toggleSit(false,origin);
|
||||||
|
|
||||||
|
if(pc.isMoving())
|
||||||
|
pc.stopMovement(pc.getMovementLoc());
|
||||||
|
|
||||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||||
// Cast failed for some reason, reset timer
|
// Cast failed for some reason, reset timer
|
||||||
|
|
||||||
@@ -178,13 +179,10 @@ public enum PowersManager {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
// Send Fail to cast message
|
// Send Fail to cast message
|
||||||
PlayerCharacter pc = SessionManager
|
|
||||||
.getPlayerCharacter(origin);
|
|
||||||
|
|
||||||
if (pc != null) {
|
if (pc != null) {
|
||||||
sendPowerMsg(pc, 2, msg);
|
sendPowerMsg(pc, 2, msg);
|
||||||
if (pc.isCasting()) {
|
if (pc.isCasting()) {
|
||||||
pc.update();
|
pc.update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pc.setIsCasting(false);
|
pc.setIsCasting(false);
|
||||||
@@ -212,6 +210,41 @@ public enum PowersManager {
|
|||||||
|
|
||||||
boolean CSRCast = false;
|
boolean CSRCast = false;
|
||||||
|
|
||||||
|
if(msg.getPowerUsedID() == 430628895) {
|
||||||
|
|
||||||
|
boolean failed = false;// group teleport
|
||||||
|
City city = ZoneManager.getCityAtLocation(playerCharacter.loc);
|
||||||
|
if (city == null) {
|
||||||
|
failed = true;
|
||||||
|
}else{
|
||||||
|
Bane bane = city.getBane();
|
||||||
|
if (bane == null) {
|
||||||
|
failed = true;
|
||||||
|
}else{
|
||||||
|
if(!bane.getSiegePhase().equals(SiegePhase.WAR)){
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(failed){
|
||||||
|
//check to see if we are at an active mine
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(playerCharacter.loc);
|
||||||
|
if(zone != null){
|
||||||
|
Mine mine = null;
|
||||||
|
for(Building building : zone.zoneBuildingSet){
|
||||||
|
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)){
|
||||||
|
mine = Mine.getMineFromTower(building.getObjectUUID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mine != null){
|
||||||
|
failed = !mine.isActive;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(failed)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (MBServerStatics.POWERS_DEBUG) {
|
if (MBServerStatics.POWERS_DEBUG) {
|
||||||
ChatManager.chatSayInfo(
|
ChatManager.chatSayInfo(
|
||||||
@@ -248,6 +281,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// get power
|
// get power
|
||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
|
|
||||||
if (pb == null) {
|
if (pb == null) {
|
||||||
ChatManager.chatSayInfo(playerCharacter,
|
ChatManager.chatSayInfo(playerCharacter,
|
||||||
"This power is not implemented yet.");
|
"This power is not implemented yet.");
|
||||||
@@ -259,6 +293,35 @@ public enum PowersManager {
|
|||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check for movement buffs while flying
|
||||||
|
if(playerCharacter.isFlying()) {
|
||||||
|
switch(pb.token){
|
||||||
|
case 429005674:
|
||||||
|
case 429505739:
|
||||||
|
case 431054700:
|
||||||
|
case 428005600:
|
||||||
|
case 431610080:
|
||||||
|
case 427935608:
|
||||||
|
case 427857146:
|
||||||
|
case 427988218:
|
||||||
|
case 431854842:
|
||||||
|
case 421074170:
|
||||||
|
case 429611355:
|
||||||
|
case 428955899:
|
||||||
|
case 1794395699:
|
||||||
|
case 429428796:
|
||||||
|
case 1514898036:
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff");
|
||||||
|
//resync stamina
|
||||||
|
playerCharacter.setStamina(playerCharacter.getStamina(), playerCharacter);
|
||||||
|
|
||||||
|
// Update all surrounding clients.
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter);
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (playerCharacter.getLastPower() != null)
|
if (playerCharacter.getLastPower() != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -286,6 +349,12 @@ public enum PowersManager {
|
|||||||
msg.setNumTrains(trains);
|
msg.setNumTrains(trains);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(pb.token){
|
||||||
|
case 429420458: // BH eyes
|
||||||
|
msg.setNumTrains(msg.getNumTrains() * 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// can't go over total trains by player
|
// can't go over total trains by player
|
||||||
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
||||||
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
||||||
@@ -377,15 +446,20 @@ public enum PowersManager {
|
|||||||
float range = pb.getRange();
|
float range = pb.getRange();
|
||||||
// verify target is in range
|
// verify target is in range
|
||||||
|
|
||||||
|
if(pb.token != 429396028) {
|
||||||
|
|
||||||
|
if (verifyInvalidRange(playerCharacter, target, range))
|
||||||
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||||
|
// TODO send message that target is out of range
|
||||||
|
return true;
|
||||||
|
// verify target is valid type
|
||||||
|
if (!validateTarget(target, playerCharacter, pb))
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
pb.isSpell = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (verifyInvalidRange(playerCharacter, target, range))
|
|
||||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
|
||||||
// TODO send message that target is out of range
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// verify target is valid type
|
|
||||||
if (!validateTarget(target, playerCharacter, pb))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
@@ -494,7 +568,6 @@ public enum PowersManager {
|
|||||||
// Validity checks passed, move on to casting spell
|
// Validity checks passed, move on to casting spell
|
||||||
//get caster's live counter
|
//get caster's live counter
|
||||||
int casterLiveCounter = playerCharacter.getLiveCounter();
|
int casterLiveCounter = playerCharacter.getLiveCounter();
|
||||||
|
|
||||||
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
|
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
|
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
|
||||||
@@ -521,7 +594,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
||||||
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
|
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
|
||||||
playerCharacter.update();
|
playerCharacter.update(false);
|
||||||
playerCharacter.setSit(false);
|
playerCharacter.setSit(false);
|
||||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
@@ -529,7 +602,9 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update cast (use skill) fail condition
|
// update cast (use skill) fail condition
|
||||||
playerCharacter.cancelOnCast();
|
if(pb.token != 429396028) {
|
||||||
|
playerCharacter.cancelOnCast();
|
||||||
|
}
|
||||||
|
|
||||||
// update castSpell (use spell) fail condition if spell
|
// update castSpell (use spell) fail condition if spell
|
||||||
if (pb.isSpell())
|
if (pb.isSpell())
|
||||||
@@ -542,13 +617,12 @@ public enum PowersManager {
|
|||||||
|
|
||||||
|
|
||||||
if (time > 100) {
|
if (time > 100) {
|
||||||
playerCharacter.update();
|
playerCharacter.update(false);
|
||||||
playerCharacter.setIsCasting(true);
|
playerCharacter.setIsCasting(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
||||||
|
|
||||||
// run timer job to end cast
|
// run timer job to end cast
|
||||||
if (time < 1) // run immediately
|
if (time < 1) // run immediately
|
||||||
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
||||||
@@ -713,8 +787,19 @@ public enum PowersManager {
|
|||||||
if (playerCharacter == null || msg == null)
|
if (playerCharacter == null || msg == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//if((msg.getPowerUsedID() == 429495514 || msg.getPowerUsedID() == 429407306) && playerCharacter.getRace().getName().toLowerCase().contains("shade")){
|
||||||
|
// //use sneak instead of hide
|
||||||
|
// PowersBase pb = PowersManager.getPowerByToken(429397210);
|
||||||
|
// int offsetTrains = (40 - msg.getNumTrains()) ;
|
||||||
|
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
|
||||||
|
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,427857146,offsetTrains,false);
|
||||||
|
//}
|
||||||
|
if(msg.getPowerUsedID() == 429494441) {//wildkins chase
|
||||||
|
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
|
||||||
|
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
|
||||||
|
}
|
||||||
if (playerCharacter.isCasting()) {
|
if (playerCharacter.isCasting()) {
|
||||||
playerCharacter.update();
|
playerCharacter.update(false);
|
||||||
playerCharacter.updateStamRegen(-100);
|
playerCharacter.updateStamRegen(-100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,15 +901,16 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
float range = pb.getRange() + speedRange;
|
float range = pb.getRange() + speedRange;
|
||||||
|
|
||||||
|
if(pb.token != 429396028) {
|
||||||
|
|
||||||
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
||||||
|
|
||||||
sendPowerMsg(playerCharacter, 8, msg);
|
sendPowerMsg(playerCharacter, 8, msg);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||||
|
// TODO send message that target is out of range
|
||||||
}
|
}
|
||||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
|
||||||
// TODO send message that target is out of range
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,6 +932,8 @@ public enum PowersManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerCharacter.setHateValue(pb.getHateValue(trains));
|
||||||
|
|
||||||
//Send Cast Message.
|
//Send Cast Message.
|
||||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||||
// castMsg.setNumTrains(9999);
|
// castMsg.setNumTrains(9999);
|
||||||
@@ -896,6 +984,8 @@ public enum PowersManager {
|
|||||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||||
|
if (!pb.isHarmful())
|
||||||
|
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
@@ -1236,7 +1326,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
PlayerCharacter target = SessionManager
|
PlayerCharacter target = SessionManager
|
||||||
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||||
if (target == null || target.equals(pc) || target.isCombat()) {
|
if (target == null || target.equals(pc)) {
|
||||||
|
|
||||||
if (target == null) // Player not found. Send not found message
|
if (target == null) // Player not found. Send not found message
|
||||||
ChatManager.chatInfoError(pc,
|
ChatManager.chatInfoError(pc,
|
||||||
@@ -1340,6 +1430,16 @@ public enum PowersManager {
|
|||||||
else
|
else
|
||||||
duration = 45000; // Belgosh Summons, 45 seconds
|
duration = 45000; // Belgosh Summons, 45 seconds
|
||||||
|
|
||||||
|
boolean enemiesNear = false;
|
||||||
|
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)){
|
||||||
|
PlayerCharacter playerCharacter = (PlayerCharacter)awo;
|
||||||
|
if(!playerCharacter.guild.getNation().equals(pc.guild.getNation())){
|
||||||
|
enemiesNear = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(enemiesNear && !pc.isInSafeZone())
|
||||||
|
duration += 60000;
|
||||||
|
|
||||||
// Teleport to summoners location
|
// Teleport to summoners location
|
||||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||||
@@ -1465,8 +1565,17 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create list of characters
|
// create list of characters
|
||||||
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
HashSet<AbstractCharacter> trackChars;
|
||||||
allTargets, playerCharacter, maxTargets);
|
switch(msg.getPowerToken()){
|
||||||
|
case 431511776:
|
||||||
|
case 429578587:
|
||||||
|
case 429503360:
|
||||||
|
trackChars = getTrackList(playerCharacter);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||||
|
|
||||||
@@ -1479,6 +1588,30 @@ public enum PowersManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashSet<AbstractCharacter> getTrackList(PlayerCharacter tracker){
|
||||||
|
HashSet<AbstractCharacter> list = new HashSet<AbstractCharacter>();
|
||||||
|
HashSet<AbstractWorldObject> shortList = WorldGrid.getObjectsInRangePartial(tracker.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||||
|
HashSet<AbstractWorldObject> fullList = WorldGrid.getObjectsInRangePartial(tracker.loc,1408, MBServerStatics.MASK_PLAYER);
|
||||||
|
ArrayList<Guild> guildsPresent = new ArrayList<>();
|
||||||
|
for(AbstractWorldObject awo : shortList){
|
||||||
|
PlayerCharacter pc = (PlayerCharacter)awo;
|
||||||
|
if(!guildsPresent.contains(pc.guild.getNation())){
|
||||||
|
guildsPresent.add(pc.guild.getNation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(AbstractWorldObject awo : fullList){
|
||||||
|
if(awo.equals(tracker))
|
||||||
|
continue;
|
||||||
|
PlayerCharacter pc = (PlayerCharacter)awo;
|
||||||
|
if(!pc.isAlive())
|
||||||
|
continue;
|
||||||
|
if(guildsPresent.contains(pc.guild.getNation()))
|
||||||
|
list.add(pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
private static void sendRecyclePower(int token, ClientConnection origin) {
|
private static void sendRecyclePower(int token, ClientConnection origin) {
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||||
|
|
||||||
@@ -2192,7 +2325,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// set player is not casting for regens
|
// set player is not casting for regens
|
||||||
if (pc.isCasting()) {
|
if (pc.isCasting()) {
|
||||||
pc.update();
|
pc.update(false);
|
||||||
}
|
}
|
||||||
pc.setIsCasting(false);
|
pc.setIsCasting(false);
|
||||||
|
|
||||||
@@ -2244,28 +2377,26 @@ public enum PowersManager {
|
|||||||
defense = 0f;
|
defense = 0f;
|
||||||
// Get hit chance
|
// Get hit chance
|
||||||
|
|
||||||
if (pc.getDebug(16)) {
|
//if (pc.getDebug(16)) {
|
||||||
String smsg = "ATR: " + atr + ", Defense: " + defense;
|
// String smsg = "ATR: " + atr + ", Defense: " + defense;
|
||||||
ChatManager.chatSystemInfo(pc, smsg);
|
// ChatManager.chatSystemInfo(pc, smsg);
|
||||||
}
|
//}
|
||||||
|
|
||||||
int chance;
|
//int chance;
|
||||||
|
|
||||||
if (atr > defense || defense == 0)
|
//if (atr > defense || defense == 0)
|
||||||
chance = 94;
|
// chance = 94;
|
||||||
else {
|
//else {
|
||||||
float dif = atr / defense;
|
// float dif = atr / defense;
|
||||||
if (dif <= 0.8f)
|
// if (dif <= 0.8f)
|
||||||
chance = 4;
|
// chance = 4;
|
||||||
else
|
// else
|
||||||
chance = ((int) (450 * (dif - 0.8f)) + 4);
|
// chance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// calculate hit/miss
|
// calculate hit/miss
|
||||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
|
||||||
|
|
||||||
boolean disable = true;
|
if (CombatManager.LandHit((int)atr,(int)defense)) {
|
||||||
if (roll < chance) {
|
|
||||||
// Hit, check if dodge kicked in
|
// Hit, check if dodge kicked in
|
||||||
if (awo instanceof AbstractCharacter) {
|
if (awo instanceof AbstractCharacter) {
|
||||||
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
||||||
@@ -2565,7 +2696,9 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void cancelOnStun(AbstractCharacter ac) {
|
public static void cancelOnStun(AbstractCharacter ac) {
|
||||||
|
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
|
//PlayerCharacter.GroundPlayer((PlayerCharacter)ac);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PowersBase getLastPower(AbstractCharacter ac) {
|
private static PowersBase getLastPower(AbstractCharacter ac) {
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.*;
|
||||||
import engine.objects.City;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Runegate;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -33,7 +30,7 @@ public enum SimulationManager {
|
|||||||
SERVERHEARTBEAT;
|
SERVERHEARTBEAT;
|
||||||
|
|
||||||
private static final long CITY_PULSE = 2000;
|
private static final long CITY_PULSE = 2000;
|
||||||
private static final long RUNEGATE_PULSE = 3000;
|
private static final long RUNEGATE_PULSE = 1000;
|
||||||
private static final long UPDATE_PULSE = 1000;
|
private static final long UPDATE_PULSE = 1000;
|
||||||
private static final long FlIGHT_PULSE = 100;
|
private static final long FlIGHT_PULSE = 100;
|
||||||
public static Duration executionTime = Duration.ofNanos(1);
|
public static Duration executionTime = Duration.ofNanos(1);
|
||||||
@@ -116,9 +113,18 @@ public enum SimulationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ((_cityPulseTime != 0)
|
if ((_cityPulseTime != 0) && (System.currentTimeMillis() > _cityPulseTime)) {
|
||||||
&& (System.currentTimeMillis() > _cityPulseTime))
|
try {
|
||||||
pulseCities();
|
pulseCities();
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ArenaManager.pulseArenas();
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(
|
Logger.error(
|
||||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||||
@@ -154,7 +160,7 @@ public enum SimulationManager {
|
|||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
continue;
|
continue;
|
||||||
player.update();
|
player.update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updatePulseTime = System.currentTimeMillis() + 500;
|
_updatePulseTime = System.currentTimeMillis() + 500;
|
||||||
@@ -203,8 +209,12 @@ public enum SimulationManager {
|
|||||||
city = (City) cityObject;
|
city = (City) cityObject;
|
||||||
city.onEnter();
|
city.onEnter();
|
||||||
}
|
}
|
||||||
|
for(Mine mine : Mine.getMines()){
|
||||||
|
if(mine != null && mine.isActive)
|
||||||
|
mine.onEnter();
|
||||||
|
}
|
||||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -214,6 +224,10 @@ public enum SimulationManager {
|
|||||||
private void pulseRunegates() {
|
private void pulseRunegates() {
|
||||||
|
|
||||||
for (Runegate runegate : Runegate._runegates.values()) {
|
for (Runegate runegate : Runegate._runegates.values()) {
|
||||||
|
for(Portal portal : runegate._portals)
|
||||||
|
if(!portal.isActive())
|
||||||
|
portal.activate(false);
|
||||||
|
|
||||||
runegate.collidePortals();
|
runegate.collidePortals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,347 @@
|
|||||||
|
package engine.gameManager;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.math.Vector3f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.*;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
public class StrongholdManager {
|
||||||
|
|
||||||
|
public static void processStrongholds() {
|
||||||
|
ArrayList<Mine> mines = Mine.getMines();
|
||||||
|
|
||||||
|
|
||||||
|
//process strongholds selecting 3 randomly to become active
|
||||||
|
int count = 0;
|
||||||
|
while (count < 3) {
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(1, mines.size()) - 1;
|
||||||
|
Mine mine = mines.get(random);
|
||||||
|
if (mine != null) {
|
||||||
|
if (!mine.isActive && !mine.isStronghold) {
|
||||||
|
StartStronghold(mine);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StartStronghold(Mine mine){
|
||||||
|
|
||||||
|
//remove buildings
|
||||||
|
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||||
|
if(tower == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mine.isStronghold = true;
|
||||||
|
mine.strongholdMobs = new ArrayList<>();
|
||||||
|
mine.oldBuildings = new HashMap<>();
|
||||||
|
|
||||||
|
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||||
|
for(Building building : mineZone.zoneBuildingSet){
|
||||||
|
mine.oldBuildings.put(building.getObjectUUID(),building.meshUUID);
|
||||||
|
building.setMeshUUID(407650);
|
||||||
|
building.setMeshScale(new Vector3f(0,0,0));
|
||||||
|
InterestManager.setObjectDirty(building);
|
||||||
|
WorldGrid.updateObject(building);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update tower to become stronghold mesh
|
||||||
|
tower.setMeshUUID(getStrongholdMeshID(mine.getParentZone()));
|
||||||
|
tower.setMeshScale(new Vector3f(1,1,1));
|
||||||
|
InterestManager.setObjectDirty(tower);
|
||||||
|
WorldGrid.updateObject(tower);
|
||||||
|
|
||||||
|
//create elite mobs
|
||||||
|
for(int i = 0; i < mine.capSize * 2; i++){
|
||||||
|
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(tower.loc,30);
|
||||||
|
MobBase guardBase = MobBase.getMobBase(getStrongholdGuardianID(tower.meshUUID));
|
||||||
|
Mob guard = Mob.createStrongholdMob(guardBase.getLoadID(), loc, Guild.getErrantGuild(),true,mineZone,null,0, guardBase.getFirstName(),65);
|
||||||
|
if(guard != null){
|
||||||
|
guard.parentZone = mine.getParentZone();
|
||||||
|
guard.bindLoc = loc;
|
||||||
|
guard.setLoc(loc);
|
||||||
|
guard.StrongholdGuardian = true;
|
||||||
|
guard.equipmentSetID = getStrongholdMobEquipSetID(guard);
|
||||||
|
guard.runAfterLoad();
|
||||||
|
guard.setLevel((short)65);
|
||||||
|
guard.setResists(new Resists("Elite"));
|
||||||
|
guard.spawnTime = 1000000000;
|
||||||
|
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
|
mine.strongholdMobs.add(guard);
|
||||||
|
LootManager.GenerateStrongholdLoot(guard,false,false);
|
||||||
|
guard.healthMax = 12500;
|
||||||
|
guard.setHealth(guard.healthMax);
|
||||||
|
guard.maxDamageHandOne = 1550;
|
||||||
|
guard.minDamageHandOne = 750;
|
||||||
|
guard.atrHandOne = 1800;
|
||||||
|
guard.defenseRating = 2200;
|
||||||
|
guard.setFirstName("Elite Guardian");
|
||||||
|
InterestManager.setObjectDirty(guard);
|
||||||
|
WorldGrid.addObject(guard,loc.x,loc.z);
|
||||||
|
WorldGrid.updateObject(guard);
|
||||||
|
guard.stronghold = mine;
|
||||||
|
guard.mobPowers.clear();
|
||||||
|
guard.mobPowers.put(429399948,20); // find weakness
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//create stronghold commander
|
||||||
|
Vector3fImmutable loc = tower.loc;
|
||||||
|
MobBase commanderBase = MobBase.getMobBase(getStrongholdCommanderID(tower.meshUUID));
|
||||||
|
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc,Guild.getErrantGuild(),true,mineZone,null,0, commanderBase.getFirstName(),75);
|
||||||
|
if(commander != null){
|
||||||
|
commander.parentZone = mine.getParentZone();
|
||||||
|
commander.bindLoc = loc;
|
||||||
|
commander.setLoc(loc);
|
||||||
|
commander.StrongholdCommander = true;
|
||||||
|
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
||||||
|
commander.runAfterLoad();
|
||||||
|
commander.setLevel((short)75);
|
||||||
|
commander.setResists(new Resists("Elite"));
|
||||||
|
commander.spawnTime = 1000000000;
|
||||||
|
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
|
commander.mobPowers.clear();
|
||||||
|
commander.mobPowers.put(429032838, 40); // gravechill
|
||||||
|
commander.mobPowers.put(429757701,20); // magebolt
|
||||||
|
commander.mobPowers.put(429121388,20); // blight
|
||||||
|
commander.mobPowers.put(431566891,20); // lightning bolt
|
||||||
|
commander.mobPowers.put(428716075,20); // fire bolt
|
||||||
|
commander.mobPowers.put(429010987,20); // ice bolt
|
||||||
|
mine.strongholdMobs.add(commander);
|
||||||
|
LootManager.GenerateStrongholdLoot(commander,true, false);
|
||||||
|
commander.healthMax = 50000;
|
||||||
|
commander.setHealth(commander.healthMax);
|
||||||
|
commander.maxDamageHandOne = 3500;
|
||||||
|
commander.minDamageHandOne = 1500;
|
||||||
|
commander.atrHandOne = 3500;
|
||||||
|
commander.defenseRating = 3500;
|
||||||
|
commander.setFirstName("Guardian Commander");
|
||||||
|
InterestManager.setObjectDirty(commander);
|
||||||
|
WorldGrid.addObject(commander,loc.x,loc.z);
|
||||||
|
WorldGrid.updateObject(commander);
|
||||||
|
commander.stronghold = mine;
|
||||||
|
}
|
||||||
|
|
||||||
|
mine.isActive = true;
|
||||||
|
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
|
||||||
|
tower.getBounds().setRegions(tower);
|
||||||
|
InterestManager.setObjectDirty(tower);
|
||||||
|
WorldGrid.updateObject(tower);
|
||||||
|
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Begun!");
|
||||||
|
Logger.info(mine.getZoneName() + "'s Stronghold Has Begun!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EndStronghold(Mine mine){
|
||||||
|
|
||||||
|
//restore the buildings
|
||||||
|
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||||
|
if(tower == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mine.isStronghold = false;
|
||||||
|
|
||||||
|
//get rid of the mobs
|
||||||
|
for(Mob mob : mine.strongholdMobs) {
|
||||||
|
mob.despawn();
|
||||||
|
mob.removeFromCache();
|
||||||
|
DbManager.MobQueries.DELETE_MOB(mob);
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore the buildings
|
||||||
|
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||||
|
for(Building building : mineZone.zoneBuildingSet){
|
||||||
|
if(mine.oldBuildings.containsKey(building.getObjectUUID())) {
|
||||||
|
building.setMeshUUID(mine.oldBuildings.get(building.getObjectUUID()));
|
||||||
|
building.setMeshScale(new Vector3f(1, 1, 1));
|
||||||
|
InterestManager.setObjectDirty(building);
|
||||||
|
WorldGrid.updateObject(building);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update tower to become Mine Tower again
|
||||||
|
tower.setMeshUUID(1500100);
|
||||||
|
|
||||||
|
mine.isActive = false;
|
||||||
|
tower.setProtectionState(Enum.ProtectionState.NPC);
|
||||||
|
tower.getBounds().setRegions(tower);
|
||||||
|
InterestManager.setObjectDirty(tower);
|
||||||
|
WorldGrid.updateObject(tower);
|
||||||
|
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
||||||
|
Logger.info(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdMeshID(Zone parent){
|
||||||
|
while(!parent.isMacroZone()){
|
||||||
|
parent = parent.getParent();
|
||||||
|
if(parent.getName().equalsIgnoreCase("seafloor")){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch(parent.getObjectUUID()){
|
||||||
|
case 197:
|
||||||
|
case 234:
|
||||||
|
case 178:
|
||||||
|
case 122:
|
||||||
|
return 814000; //Frost Giant Hall (ICE)
|
||||||
|
case 968:
|
||||||
|
case 951:
|
||||||
|
case 313:
|
||||||
|
case 331:
|
||||||
|
return 5001500; // Lich Queens Keep (UNDEAD)
|
||||||
|
case 785:
|
||||||
|
case 761:
|
||||||
|
case 717:
|
||||||
|
case 737:
|
||||||
|
return 1306600; // Temple of the Dragon (DESERT)
|
||||||
|
case 353:
|
||||||
|
case 371:
|
||||||
|
case 388:
|
||||||
|
case 532:
|
||||||
|
return 564600; // Undead Lord's Keep (SWAMP)
|
||||||
|
case 550:
|
||||||
|
case 508:
|
||||||
|
case 475:
|
||||||
|
case 418:
|
||||||
|
return 1326600; // elven hall
|
||||||
|
case 437:
|
||||||
|
case 491:
|
||||||
|
case 590:
|
||||||
|
case 569:
|
||||||
|
return 602400;
|
||||||
|
case 824:
|
||||||
|
case 842:
|
||||||
|
case 632:
|
||||||
|
return 1600000; // chaos temple
|
||||||
|
}
|
||||||
|
return 456100; // small stockade
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdGuardianID(int ID){
|
||||||
|
switch(ID){
|
||||||
|
case 814000:
|
||||||
|
return 253004; // Mountain Giant Raider Axe
|
||||||
|
case 5001500:
|
||||||
|
return 253008; // Vampire Spear Warrior
|
||||||
|
case 1306600:
|
||||||
|
return 253007; // Desert Orc Warrior
|
||||||
|
case 564600:
|
||||||
|
return 253010; // Kolthoss Warrior
|
||||||
|
case 1326600:
|
||||||
|
return 253005; //elven warrior
|
||||||
|
case 602400:
|
||||||
|
return 253009; // templar missionary
|
||||||
|
case 1600000:
|
||||||
|
return 253006; // scourger
|
||||||
|
}
|
||||||
|
return 13434; // human sword and board warrior
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdEpicID(int ID){
|
||||||
|
switch(ID){
|
||||||
|
case 814000:
|
||||||
|
return 253023; // Mountain Giant Raider Axe
|
||||||
|
case 5001500:
|
||||||
|
return 253022; // Vampire Spear Warrior
|
||||||
|
case 1306600:
|
||||||
|
return 253021; // Desert Orc Warrior
|
||||||
|
case 564600:
|
||||||
|
return 253018; // Kolthoss Warrior
|
||||||
|
case 1326600:
|
||||||
|
return 253019; //elven warrior
|
||||||
|
case 602400:
|
||||||
|
return 253024; // templar missionary
|
||||||
|
case 1600000:
|
||||||
|
return 253020; // scourger
|
||||||
|
}
|
||||||
|
return 13434; // human sword and board warrior
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdCommanderID(int ID){
|
||||||
|
switch(ID){
|
||||||
|
case 814000:
|
||||||
|
return 253017;
|
||||||
|
case 5001500:
|
||||||
|
return 253012;
|
||||||
|
case 1306600:
|
||||||
|
return 253016; // Desert Orc Xbow
|
||||||
|
case 564600:
|
||||||
|
return 253011; // xbow kolthoss
|
||||||
|
case 1326600:
|
||||||
|
return 253013; //elven bow warrior
|
||||||
|
case 602400:
|
||||||
|
return 253015; // dune giant with xbow
|
||||||
|
case 1600000:
|
||||||
|
return 253014; // barbator
|
||||||
|
}
|
||||||
|
return 13433;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdMobEquipSetID(Mob mob) {
|
||||||
|
if(mob.StrongholdGuardian){
|
||||||
|
return 6327;
|
||||||
|
}else{
|
||||||
|
return 10790;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CheckToEndStronghold(Mine mine) {
|
||||||
|
|
||||||
|
boolean stillAlive = false;
|
||||||
|
for (Mob mob : mine.strongholdMobs)
|
||||||
|
if (mob.isAlive())
|
||||||
|
stillAlive = true;
|
||||||
|
|
||||||
|
if (!stillAlive) {
|
||||||
|
// Epic encounter
|
||||||
|
|
||||||
|
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||||
|
if (tower == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||||
|
|
||||||
|
Vector3fImmutable loc = tower.loc;
|
||||||
|
MobBase commanderBase = MobBase.getMobBase(getStrongholdEpicID(tower.meshUUID));
|
||||||
|
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc, Guild.getErrantGuild(), true, mineZone, null, 0, commanderBase.getFirstName(), 75);
|
||||||
|
if (commander != null) {
|
||||||
|
commander.parentZone = mine.getParentZone();
|
||||||
|
commander.bindLoc = loc;
|
||||||
|
commander.setLoc(loc);
|
||||||
|
commander.StrongholdEpic = true;
|
||||||
|
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
||||||
|
commander.runAfterLoad();
|
||||||
|
commander.setLevel((short) 85);
|
||||||
|
commander.setResists(new Resists("Elite"));
|
||||||
|
commander.spawnTime = 1000000000;
|
||||||
|
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
|
commander.mobPowers.clear();
|
||||||
|
commander.mobPowers.put(429032838, 40); // gravechill
|
||||||
|
commander.mobPowers.put(429757701,40); // magebolt
|
||||||
|
commander.mobPowers.put(429121388,40); // blight
|
||||||
|
commander.mobPowers.put(431566891,40); // lightning bolt
|
||||||
|
commander.mobPowers.put(428716075,40); // fire bolt
|
||||||
|
commander.mobPowers.put(429010987,40); // ice bolt
|
||||||
|
mine.strongholdMobs.add(commander);
|
||||||
|
LootManager.GenerateStrongholdLoot(commander, true, true);
|
||||||
|
commander.healthMax = 250000;
|
||||||
|
commander.setHealth(commander.healthMax);
|
||||||
|
commander.maxDamageHandOne = 5000;
|
||||||
|
commander.minDamageHandOne = 2500;
|
||||||
|
commander.atrHandOne = 5000;
|
||||||
|
commander.defenseRating = 3500;
|
||||||
|
commander.setFirstName("Defender of " + mine.getParentZone().getParent().getName());
|
||||||
|
InterestManager.setObjectDirty(commander);
|
||||||
|
WorldGrid.addObject(commander,loc.x,loc.z);
|
||||||
|
WorldGrid.updateObject(commander);
|
||||||
|
commander.stronghold = mine;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package engine.gameManager;
|
||||||
|
import engine.objects.Guild;
|
||||||
|
public class ZergManager {
|
||||||
|
|
||||||
|
public static float getCurrentMultiplier(int count, int maxCount){
|
||||||
|
switch(maxCount) {
|
||||||
|
case 3: return getMultiplier3Man(count);
|
||||||
|
case 5: return getMultiplier5Man(count);
|
||||||
|
case 10: return getMultiplier10Man(count);
|
||||||
|
case 20: return getMultiplier20Man(count);
|
||||||
|
case 30: return getMultiplier30Man(count);
|
||||||
|
case 40: return getMultiplier40Man(count);
|
||||||
|
default: return 1.0f; //unlimited
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static float getMultiplier3Man(int count) {
|
||||||
|
if(count < 4)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 6)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch(count){
|
||||||
|
case 4: return 0.63f;
|
||||||
|
case 5: return 0.40f;
|
||||||
|
case 6: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static float getMultiplier5Man(int count) {
|
||||||
|
if(count < 6)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 10)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch(count){
|
||||||
|
case 6: return 0.75f;
|
||||||
|
case 7: return 0.57f;
|
||||||
|
case 8: return 0.44f;
|
||||||
|
case 9: return 0.33f;
|
||||||
|
case 10: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static float getMultiplier10Man(int count) {
|
||||||
|
if(count < 11)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 20)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch(count){
|
||||||
|
case 11: return 0.86f;
|
||||||
|
case 12: return 0.75f;
|
||||||
|
case 13: return 0.65f;
|
||||||
|
case 14: return 0.57f;
|
||||||
|
case 15: return 0.50f;
|
||||||
|
case 16: return 0.44f;
|
||||||
|
case 17: return 0.38f;
|
||||||
|
case 18: return 0.33f;
|
||||||
|
case 19: return 0.29f;
|
||||||
|
case 20: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static float getMultiplier20Man(int count) {
|
||||||
|
if(count < 21)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 40)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch (count)
|
||||||
|
{
|
||||||
|
case 21: return 0.93f;
|
||||||
|
case 22: return 0.86f;
|
||||||
|
case 23: return 0.80f;
|
||||||
|
case 24: return 0.75f;
|
||||||
|
case 25: return 0.70f;
|
||||||
|
case 26: return 0.65f;
|
||||||
|
case 27: return 0.61f;
|
||||||
|
case 28: return 0.57f;
|
||||||
|
case 29: return 0.53f;
|
||||||
|
case 30: return 0.50f;
|
||||||
|
case 31: return 0.47f;
|
||||||
|
case 32: return 0.44f;
|
||||||
|
case 33: return 0.41f;
|
||||||
|
case 34: return 0.38f;
|
||||||
|
case 35: return 0.36f;
|
||||||
|
case 36: return 0.33f;
|
||||||
|
case 37: return 0.31f;
|
||||||
|
case 38: return 0.29f;
|
||||||
|
case 39: return 0.27f;
|
||||||
|
case 40: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static float getMultiplier30Man(int count) {
|
||||||
|
if(count < 31)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 60)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch (count)
|
||||||
|
{
|
||||||
|
case 31: return 0.95f;
|
||||||
|
case 32: return 0.91f;
|
||||||
|
case 33: return 0.86f;
|
||||||
|
case 34: return 0.82f;
|
||||||
|
case 35: return 0.79f;
|
||||||
|
case 36: return 0.75f;
|
||||||
|
case 37: return 0.72f;
|
||||||
|
case 38: return 0.68f;
|
||||||
|
case 39: return 0.65f;
|
||||||
|
case 40: return 0.63f;
|
||||||
|
case 41: return 0.60f;
|
||||||
|
case 42: return 0.57f;
|
||||||
|
case 43: return 0.55f;
|
||||||
|
case 44: return 0.52f;
|
||||||
|
case 45: return 0.50f;
|
||||||
|
case 46: return 0.48f;
|
||||||
|
case 47: return 0.46f;
|
||||||
|
case 48: return 0.44f;
|
||||||
|
case 49: return 0.42f;
|
||||||
|
case 50: return 0.40f;
|
||||||
|
case 51: return 0.38f;
|
||||||
|
case 52: return 0.37f;
|
||||||
|
case 53: return 0.35f;
|
||||||
|
case 54: return 0.33f;
|
||||||
|
case 55: return 0.32f;
|
||||||
|
case 56: return 0.30f;
|
||||||
|
case 57: return 0.29f;
|
||||||
|
case 58: return 0.28f;
|
||||||
|
case 59: return 0.26f;
|
||||||
|
case 60: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static float getMultiplier40Man(int count) {
|
||||||
|
if(count < 41)
|
||||||
|
return 1.0f;
|
||||||
|
|
||||||
|
if(count > 80)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
switch (count)
|
||||||
|
{
|
||||||
|
case 41: return 0.96f;
|
||||||
|
case 42: return 0.93f;
|
||||||
|
case 43: return 0.90f;
|
||||||
|
case 44: return 0.86f;
|
||||||
|
case 45: return 0.83f;
|
||||||
|
case 46: return 0.80f;
|
||||||
|
case 47: return 0.78f;
|
||||||
|
case 48: return 0.75f;
|
||||||
|
case 49: return 0.72f;
|
||||||
|
case 50: return 0.70f;
|
||||||
|
case 51: return 0.68f;
|
||||||
|
case 52: return 0.65f;
|
||||||
|
case 53: return 0.63f;
|
||||||
|
case 54: return 0.61f;
|
||||||
|
case 55: return 0.59f;
|
||||||
|
case 56: return 0.57f;
|
||||||
|
case 57: return 0.55f;
|
||||||
|
case 58: return 0.53f;
|
||||||
|
case 59: return 0.52f;
|
||||||
|
case 60: return 0.50f;
|
||||||
|
case 61: return 0.48f;
|
||||||
|
case 62: return 0.47f;
|
||||||
|
case 63: return 0.45f;
|
||||||
|
case 64: return 0.44f;
|
||||||
|
case 65: return 0.42f;
|
||||||
|
case 66: return 0.41f;
|
||||||
|
case 67: return 0.40f;
|
||||||
|
case 68: return 0.38f;
|
||||||
|
case 69: return 0.37f;
|
||||||
|
case 70: return 0.36f;
|
||||||
|
case 71: return 0.35f;
|
||||||
|
case 72: return 0.33f;
|
||||||
|
case 73: return 0.32f;
|
||||||
|
case 74: return 0.31f;
|
||||||
|
case 75: return 0.30f;
|
||||||
|
case 76: return 0.29f;
|
||||||
|
case 77: return 0.28f;
|
||||||
|
case 78: return 0.27f;
|
||||||
|
case 79: return 0.26f;
|
||||||
|
case 80: return 0.25f;
|
||||||
|
default: return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.HeightMap;
|
|
||||||
import engine.db.archive.CityRecord;
|
import engine.db.archive.CityRecord;
|
||||||
import engine.db.archive.DataWarehouse;
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
@@ -20,14 +19,12 @@ import engine.objects.Building;
|
|||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class contains methods and structures which
|
* Class contains methods and structures which
|
||||||
@@ -110,20 +107,6 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of available hotZones
|
|
||||||
// remaining in this cycle (1am)
|
|
||||||
|
|
||||||
public static int availableHotZones() {
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.macroZones)
|
|
||||||
if (ZoneManager.validHotZone(zone))
|
|
||||||
count = count + 1;
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resets the availability of hotZones
|
// Resets the availability of hotZones
|
||||||
// for this cycle
|
// for this cycle
|
||||||
|
|
||||||
@@ -218,63 +201,6 @@ public enum ZoneManager {
|
|||||||
ZoneManager.playerCityZones.add(zone);
|
ZoneManager.playerCityZones.add(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void generateAndSetRandomHotzone() {
|
|
||||||
|
|
||||||
Zone hotZone;
|
|
||||||
ArrayList<Integer> zoneArray = new ArrayList<>();
|
|
||||||
|
|
||||||
if (ZoneManager.macroZones.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Reset hotZone availability if none are left.
|
|
||||||
|
|
||||||
if (ZoneManager.availableHotZones() == 0)
|
|
||||||
ZoneManager.resetHotZones();
|
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.macroZones)
|
|
||||||
if (validHotZone(zone))
|
|
||||||
zoneArray.add(zone.getObjectUUID());
|
|
||||||
|
|
||||||
int entryIndex = ThreadLocalRandom.current().nextInt(zoneArray.size());
|
|
||||||
|
|
||||||
hotZone = ZoneManager.getZoneByUUID(zoneArray.get(entryIndex));
|
|
||||||
|
|
||||||
if (hotZone == null) {
|
|
||||||
Logger.error("Hotzone is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneManager.setHotZone(hotZone);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean validHotZone(Zone zone) {
|
|
||||||
|
|
||||||
if (zone.getSafeZone() == (byte) 1)
|
|
||||||
return false; // no safe zone hotzones// if (this.hotzone == null)
|
|
||||||
|
|
||||||
if (zone.getNodes().isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (zone.equals(ZoneManager.seaFloor))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//no duplicate hotZones
|
|
||||||
|
|
||||||
if (zone.hasBeenHotzone == true)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Enforce min level
|
|
||||||
|
|
||||||
if (zone.minLvl < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (ZoneManager.hotZone != null)
|
|
||||||
return ZoneManager.hotZone.getObjectUUID() != zone.getObjectUUID();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converts world coordinates to coordinates local to a given zone.
|
// Converts world coordinates to coordinates local to a given zone.
|
||||||
|
|
||||||
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
||||||
@@ -454,31 +380,4 @@ public enum ZoneManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float caclulateWorldAltitude(Zone zone) {
|
|
||||||
|
|
||||||
float worldAlttitude = MBServerStatics.SEA_FLOOR_ALTITUDE;
|
|
||||||
|
|
||||||
// Seafloor
|
|
||||||
|
|
||||||
if (zone.getParent() == null)
|
|
||||||
return worldAlttitude;
|
|
||||||
|
|
||||||
Zone parentZone = zone.getParent();
|
|
||||||
|
|
||||||
// Children of seafloor
|
|
||||||
|
|
||||||
if (parentZone.getParent() == null)
|
|
||||||
return worldAlttitude + zone.getYCoord();
|
|
||||||
|
|
||||||
// return height from heightmap engine at zone location
|
|
||||||
|
|
||||||
worldAlttitude = HeightMap.getWorldHeight(parentZone, zone.getLoc());
|
|
||||||
|
|
||||||
// Add zone offset to value
|
|
||||||
|
|
||||||
worldAlttitude += zone.getYCoord();
|
|
||||||
|
|
||||||
return worldAlttitude;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void endEffect() {
|
public void endEffect() {
|
||||||
if (this.eb == null)
|
if (this.eb == null || this.power == null)
|
||||||
return;
|
return;
|
||||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).fearedObject = null;
|
((Mob) this.target).setFearedObject(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).fearedObject = null;
|
((Mob) this.target).setFearedObject(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,13 +47,13 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// cannot summon a player in combat
|
// cannot summon a player in combat
|
||||||
if (this.target.isCombat()) {
|
//if (this.target.isCombat()) {
|
||||||
|
|
||||||
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
// ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||||
|
|
||||||
PowersManager.finishRecycleTime(428523680, this.source, false);
|
// PowersManager.finishRecycleTime(428523680, this.source, false);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
|
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
|
||||||
@@ -61,6 +61,8 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.source.region != null)
|
||||||
|
this.target.setRegion(this.source.region);
|
||||||
//teleport target to source
|
//teleport target to source
|
||||||
target.teleport(source.getLoc());
|
target.teleport(source.getLoc());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
import engine.gameManager.LootManager;
|
import engine.gameManager.LootManager;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class ItemTableEntry {
|
public class ItemTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -35,11 +37,23 @@ public class ItemTableEntry {
|
|||||||
List<ItemTableEntry> itemTableEntryList;
|
List<ItemTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||||
|
if(itemTableEntryList != null) {
|
||||||
for (ItemTableEntry iteration : itemTableEntryList)
|
for (ItemTableEntry iteration : itemTableEntryList)
|
||||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
itemTableEntry = iteration;
|
itemTableEntry = iteration;
|
||||||
|
}
|
||||||
return itemTableEntry;
|
return itemTableEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Integer getRandomItem(int itemTable) {
|
||||||
|
int id = 0;
|
||||||
|
List<ItemTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
|
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||||
|
|
||||||
|
if(itemTableEntryList != null && itemTableEntryList.size() > 1){
|
||||||
|
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0, itemTableEntryList.size())).cacheID;
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class ModTableEntry {
|
|||||||
List<ModTableEntry> itemTableEntryList;
|
List<ModTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||||
|
if(itemTableEntryList != null) {
|
||||||
for (ModTableEntry iteration : itemTableEntryList)
|
for (ModTableEntry iteration : itemTableEntryList)
|
||||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
modTableEntry = iteration;
|
modTableEntry = iteration;
|
||||||
|
}
|
||||||
return modTableEntry;
|
return modTableEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class Bounds {
|
|||||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
if (building.getBounds().colliders == null)
|
if (building.getBounds() == null || building.getBounds().colliders == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Colliders collider : building.getBounds().colliders) {
|
for (Colliders collider : building.getBounds().colliders) {
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package engine.mobileAI.BehaviourFiles;
|
||||||
|
|
||||||
|
import engine.objects.Mob;
|
||||||
|
|
||||||
|
public class PlayerGuard {
|
||||||
|
|
||||||
|
public static void process(Mob guard){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package engine.mobileAI.BehaviourFiles;
|
||||||
|
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mobileAI.enumMobState;
|
||||||
|
import engine.mobileAI.utilities.CombatUtilities;
|
||||||
|
import engine.mobileAI.utilities.MovementUtilities;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.ItemBase;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.powers.PowersBase;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class PlayerPet {
|
||||||
|
|
||||||
|
public static void process(Mob pet){
|
||||||
|
if(pet.getOwner() == null && !pet.isNecroPet()){
|
||||||
|
pet.killCharacter("no owner");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!WorldGrid.getObjectsInRangePartial(pet.loc, MBServerStatics.CHARACTER_LOAD_RANGE,1).contains(pet.getOwner())){
|
||||||
|
pet.teleport(pet.getOwner().loc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(enumMobState.getState(pet)){
|
||||||
|
case dead:
|
||||||
|
pet.despawn();
|
||||||
|
return;
|
||||||
|
case patrolling:
|
||||||
|
if(pet.loc.distanceSquared(pet.getOwner().loc) > 90 && !pet.isMoving()){
|
||||||
|
MovementUtilities.aiMove(pet,pet.getOwner().loc,false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case attacking:
|
||||||
|
attack(pet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void attack(Mob mob){
|
||||||
|
|
||||||
|
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||||
|
mob.setCombatTarget(null);
|
||||||
|
aggro(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||||
|
if (!MovementUtilities.canMove(mob))
|
||||||
|
return;
|
||||||
|
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mob.updateLocation();
|
||||||
|
|
||||||
|
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||||
|
boolean mainHand = true;
|
||||||
|
if(weapon == null) {
|
||||||
|
weapon = mob.getWeaponItemBase(false);
|
||||||
|
mainHand = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||||
|
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||||
|
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void aggro(Mob mob){
|
||||||
|
|
||||||
|
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,30, MBServerStatics.MASK_MOB)) {
|
||||||
|
Mob potentialTarget = (Mob) awo;
|
||||||
|
if (!potentialTarget.isAlive())
|
||||||
|
continue;
|
||||||
|
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
|
mob.setCombatTarget(potentialTarget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package engine.mobileAI.BehaviourFiles;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.mobileAI.utilities.CombatUtilities;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
|
||||||
|
public class SiegeMob {
|
||||||
|
public static void process(Mob treb){
|
||||||
|
if(!treb.isAlive()){
|
||||||
|
if(!treb.despawned){
|
||||||
|
treb.despawn();
|
||||||
|
treb.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(treb.deathTime == 0) {
|
||||||
|
treb.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(treb.deathTime + 900000L > System.currentTimeMillis()) {
|
||||||
|
treb.respawn();
|
||||||
|
treb.setCombatTarget(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(treb.combatTarget == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!treb.combatTarget.getObjectType().equals(Enum.GameObjectType.Building)) {
|
||||||
|
treb.setCombatTarget(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!treb.combatTarget.isAlive()) {
|
||||||
|
treb.setCombatTarget(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!CombatUtilities.inRangeToAttack(treb,treb.combatTarget))
|
||||||
|
treb.setCombatTarget(null);
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > treb.getNextAttackTime()) {
|
||||||
|
CombatUtilities.combatCycle(treb, treb.combatTarget, true, null);
|
||||||
|
treb.setNextAttackTime(System.currentTimeMillis() + 11000L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package engine.mobileAI.BehaviourFiles;
|
||||||
|
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mobileAI.enumMobState;
|
||||||
|
import engine.mobileAI.utilities.CombatUtilities;
|
||||||
|
import engine.mobileAI.utilities.MovementUtilities;
|
||||||
|
import engine.objects.*;
|
||||||
|
import engine.powers.PowersBase;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class StandardMob {
|
||||||
|
public static void process(Mob mob){
|
||||||
|
switch(enumMobState.getState(mob)){
|
||||||
|
case idle:
|
||||||
|
return;
|
||||||
|
case dead:
|
||||||
|
respawn(mob);
|
||||||
|
return;
|
||||||
|
case patrolling:
|
||||||
|
if(mob.combatTarget == null)
|
||||||
|
aggro(mob);
|
||||||
|
if(mob.combatTarget == null)
|
||||||
|
patrol(mob);
|
||||||
|
return;
|
||||||
|
case attacking:
|
||||||
|
attack(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void respawn(Mob mob){
|
||||||
|
if (mob.deathTime == 0) {
|
||||||
|
mob.setDeathTime(System.currentTimeMillis());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mob.despawned) {
|
||||||
|
|
||||||
|
if (mob.getCharItemManager() != null && mob.getCharItemManager().getInventoryCount() > 0) {
|
||||||
|
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||||
|
mob.despawn();
|
||||||
|
mob.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//No items in inventory.
|
||||||
|
} else if (mob.isHasLoot()) {
|
||||||
|
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||||
|
mob.despawn();
|
||||||
|
mob.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Mob never had Loot.
|
||||||
|
} else {
|
||||||
|
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||||
|
mob.despawn();
|
||||||
|
mob.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Mob.discDroppers.contains(mob))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > (mob.deathTime + (mob.spawnTime * 1000L))) {
|
||||||
|
if (!Zone.respawnQue.contains(mob)) {
|
||||||
|
Zone.respawnQue.add(mob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void aggro(Mob mob){
|
||||||
|
if(enumMobState.Agressive(mob)){
|
||||||
|
for(int id : mob.playerAgroMap.keySet()){
|
||||||
|
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache(id);
|
||||||
|
if(!potentialTarget.isAlive() || !mob.canSee(potentialTarget))
|
||||||
|
continue;
|
||||||
|
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
|
mob.setCombatTarget(potentialTarget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,60, MBServerStatics.MASK_PET)){
|
||||||
|
Mob potentialTarget = (Mob)awo;
|
||||||
|
if(!potentialTarget.isAlive())
|
||||||
|
continue;
|
||||||
|
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
|
mob.setCombatTarget(potentialTarget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void patrol(Mob mob){
|
||||||
|
if (!MovementUtilities.canMove(mob))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mob.stopPatrolTime + 5000L > System.currentTimeMillis())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mob.isMoving())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||||
|
mob.lastPatrolPointIndex = 0;
|
||||||
|
|
||||||
|
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||||
|
mob.lastPatrolPointIndex += 1;
|
||||||
|
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void attack(Mob mob){
|
||||||
|
if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||||
|
|
||||||
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
|
for (Map.Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||||
|
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||||
|
mob.setCombatTarget(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||||
|
mob.setCombatTarget(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mob.isMoving() && !CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||||
|
if (!MovementUtilities.canMove(mob))
|
||||||
|
return;
|
||||||
|
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mob.updateLocation();
|
||||||
|
|
||||||
|
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||||
|
boolean mainHand = true;
|
||||||
|
if(weapon == null) {
|
||||||
|
weapon = mob.getWeaponItemBase(false);
|
||||||
|
mainHand = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||||
|
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||||
|
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package engine.mobileAI;
|
||||||
|
|
||||||
|
import engine.mobileAI.BehaviourFiles.PlayerGuard;
|
||||||
|
import engine.mobileAI.BehaviourFiles.PlayerPet;
|
||||||
|
import engine.mobileAI.BehaviourFiles.SiegeMob;
|
||||||
|
import engine.mobileAI.BehaviourFiles.StandardMob;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
|
||||||
|
public class EasyAI {
|
||||||
|
|
||||||
|
public static void aiRun(Mob mob) {
|
||||||
|
if (mob == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mob.isPlayerGuard) {
|
||||||
|
PlayerGuard.process(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mob.isSiege()){
|
||||||
|
SiegeMob.process(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mob.isPet()) {
|
||||||
|
PlayerPet.process(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StandardMob.process(mob);
|
||||||
|
}
|
||||||
|
}
|
||||||
+430
-306
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
package engine.mobileAI.Threads;
|
package engine.mobileAI.Threads;
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.mobileAI.EasyAI;
|
||||||
import engine.mobileAI.MobAI;
|
import engine.mobileAI.MobAI;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
@@ -33,7 +34,7 @@ public class MobAIThread implements Runnable{
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (mob != null)
|
if (mob != null)
|
||||||
MobAI.DetermineAction(mob);
|
EasyAI.aiRun(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package engine.mobileAI;
|
||||||
|
|
||||||
|
import engine.objects.Mob;
|
||||||
|
|
||||||
|
public enum enumMobState {
|
||||||
|
idle,
|
||||||
|
attacking,
|
||||||
|
patrolling,
|
||||||
|
dead;
|
||||||
|
|
||||||
|
public static enumMobState getState(Mob mob){
|
||||||
|
if(mob.playerAgroMap.isEmpty())
|
||||||
|
return enumMobState.idle;
|
||||||
|
|
||||||
|
if(!mob.isAlive())
|
||||||
|
return enumMobState.dead;
|
||||||
|
|
||||||
|
if(mob.combatTarget != null)
|
||||||
|
return enumMobState.attacking;
|
||||||
|
|
||||||
|
return enumMobState.patrolling;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean Agressive(Mob mob){
|
||||||
|
return mob.BehaviourType.name().contains("Aggro");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
||||||
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
|
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
||||||
@@ -139,37 +139,22 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
|
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
|
||||||
int defenseScore = 0;
|
int defense = 0;
|
||||||
int attackScore = agent.getAtrHandOne();
|
int atr = agent.getAtrHandOne();
|
||||||
switch (target.getObjectType()) {
|
switch (target.getObjectType()) {
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
defenseScore = ((AbstractCharacter) target).getDefenseRating();
|
defense = ((AbstractCharacter) target).getDefenseRating();
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
|
|
||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
defenseScore = attackScore;
|
defense = atr;
|
||||||
break;
|
break;
|
||||||
case Building:
|
case Building:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return !CombatManager.LandHit(atr,defense);
|
||||||
int hitChance;
|
|
||||||
if (attackScore > defenseScore || defenseScore == 0)
|
|
||||||
hitChance = 94;
|
|
||||||
else if (attackScore == defenseScore && target.getObjectType() == GameObjectType.Mob)
|
|
||||||
hitChance = 10;
|
|
||||||
else {
|
|
||||||
float dif = attackScore / defenseScore;
|
|
||||||
if (dif <= 0.8f)
|
|
||||||
hitChance = 4;
|
|
||||||
else
|
|
||||||
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
|
|
||||||
if (target.getObjectType() == GameObjectType.Building)
|
|
||||||
hitChance = 100;
|
|
||||||
}
|
|
||||||
return ThreadLocalRandom.current().nextInt(100) > hitChance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
||||||
@@ -264,9 +249,19 @@ public class CombatUtilities {
|
|||||||
swingIsBlock(agent, target, passiveAnim);
|
swingIsBlock(agent, target, passiveAnim);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (agent.getEquip().get(1) != null && agent.getEquip().get(2) != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
swingIsDamage(agent, target, determineDamage(agent), anim);
|
//mob is duel wielding and should conduct an attack for each hand
|
||||||
|
ItemBase weapon1 = agent.getEquip().get(1).getItemBase();
|
||||||
|
double range1 = getMaxDmg(weapon1.getMinDamage(), agent, weapon1) - getMinDmg(weapon1.getMinDamage(), agent, weapon1);
|
||||||
|
double damage1 = getMinDmg(weapon1.getMinDamage(), agent, weapon1) + ((ThreadLocalRandom.current().nextFloat() * range1) + (ThreadLocalRandom.current().nextFloat() * range1)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage1, CombatManager.getSwingAnimation(weapon1, null, true));
|
||||||
|
ItemBase weapon2 = agent.getEquip().get(2).getItemBase();
|
||||||
|
double range2 = getMaxDmg(weapon2.getMinDamage(), agent, weapon2) - getMinDmg(weapon2.getMinDamage(), agent, weapon2);
|
||||||
|
double damage2 = getMinDmg(weapon2.getMinDamage(), agent, weapon2) + ((ThreadLocalRandom.current().nextFloat() * range2) + (ThreadLocalRandom.current().nextFloat() * range2)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage2, CombatManager.getSwingAnimation(weapon1, null, false));
|
||||||
|
} else {
|
||||||
|
swingIsDamage(agent, target, determineDamage(agent), anim);
|
||||||
|
}
|
||||||
|
|
||||||
if (agent.getWeaponPower() != null)
|
if (agent.getWeaponPower() != null)
|
||||||
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
||||||
@@ -309,10 +304,19 @@ public class CombatUtilities {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int damage = 0;
|
float damage = 0;
|
||||||
|
|
||||||
DamageType dt = getDamageType(agent);
|
DamageType dt = getDamageType(agent);
|
||||||
damage = ThreadLocalRandom.current().nextInt((int)getMinDmg(agent), (int)getMaxDmg(agent) + 1);
|
if ((agent.agentType.equals(AIAgentType.PET)) == true || agent.isPet() == true || agent.isNecroPet() == true) {
|
||||||
|
damage = calculatePetDamage(agent);
|
||||||
|
} else if (agent.isPlayerGuard() == true) {
|
||||||
|
//damage = calculateGuardDamage(agent);
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
} else if (agent.getLevel() > 80) {
|
||||||
|
damage = calculateEpicDamage(agent);
|
||||||
|
} else {
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
}
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||||
if (((AbstractCharacter) target).isSit()) {
|
if (((AbstractCharacter) target).isSit()) {
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
@@ -338,16 +342,158 @@ public class CombatUtilities {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMinDmg(Mob agent) {
|
public static int calculatePetDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for pet
|
||||||
return agent.minDamageHandTwo;
|
float range;
|
||||||
else return agent.minDamageHandOne;
|
float damage;
|
||||||
|
float min = 40;
|
||||||
|
float max = 60;
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double minDmg = getMinDmg(min, agent, null);
|
||||||
|
double maxDmg = getMaxDmg(max, agent, null);
|
||||||
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
|
range = (float) (maxDmg - minDmg);
|
||||||
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (damage * dmgMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMaxDmg(Mob agent) {
|
public static int calculateGuardDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for guard
|
||||||
return agent.maxDamageHandTwo;
|
ItemBase weapon = agent.getEquip().get(1).getItemBase();
|
||||||
else return agent.maxDamageHandOne;
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
|
||||||
|
double minDmg = weapon.getMinDamage();
|
||||||
|
double maxDmg = weapon.getMaxDamage();
|
||||||
|
double min = getMinDmg(minDmg, agent, weapon);
|
||||||
|
double max = getMaxDmg(maxDmg, agent, weapon);
|
||||||
|
|
||||||
|
DamageType dt = weapon.getDamageType();
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateEpicDamage(Mob agent) {
|
||||||
|
//handle r8 mob damage
|
||||||
|
DamageType dt = DamageType.Crush;
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double min = agent.getMinDamageHandOne();
|
||||||
|
double max = agent.getMaxDamageHandOne();
|
||||||
|
if (agent.getEquip().get(1) != null) {
|
||||||
|
if (agent.getEquip().get(1).getItemBase() != null) {
|
||||||
|
dt = agent.getEquip().get(1).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandOne();
|
||||||
|
max = agent.getMaxDamageHandOne();
|
||||||
|
} else if (agent.getEquip().get(2).getItemBase() != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
|
dt = agent.getEquip().get(2).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandTwo();
|
||||||
|
max = agent.getMaxDamageHandTwo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateMobDamage(Mob agent) {
|
||||||
|
ItemBase weapon = null;
|
||||||
|
double minDmg;
|
||||||
|
double maxDmg;
|
||||||
|
DamageType dt;
|
||||||
|
|
||||||
|
//main hand or offhand damage
|
||||||
|
|
||||||
|
if (agent.getEquip().get(1) != null)
|
||||||
|
weapon = agent.getEquip().get(1).getItemBase();
|
||||||
|
else if (agent.getEquip().get(2) != null)
|
||||||
|
weapon = agent.getEquip().get(2).getItemBase();
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
minDmg = getMinDmg(weapon.getMinDamage(), agent, weapon);
|
||||||
|
maxDmg = getMaxDmg(weapon.getMaxDamage(), agent, weapon);
|
||||||
|
dt = weapon.getDamageType();
|
||||||
|
} else {
|
||||||
|
minDmg = agent.getMobBase().getDamageMin();
|
||||||
|
maxDmg = agent.getMobBase().getDamageMax();
|
||||||
|
dt = DamageType.Crush;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double range = maxDmg - minDmg;
|
||||||
|
double damage = minDmg + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMinDmg(double min, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired())) {
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
if (agent.getSkills().containsKey(weapon.getMastery())) {
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
|
||||||
|
}
|
||||||
|
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
import engine.Enum.SourceType;
|
import engine.Enum.SourceType;
|
||||||
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.Threads.MobAIThread;
|
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -38,7 +38,7 @@ public class MovementUtilities {
|
|||||||
if (agent.getContract() != null)
|
if (agent.getContract() != null)
|
||||||
guardCaptain = agent;
|
guardCaptain = agent;
|
||||||
else
|
else
|
||||||
guardCaptain = (Mob) agent.guardCaptain;
|
guardCaptain = (Mob) agent.npcOwner;
|
||||||
|
|
||||||
if (guardCaptain != null) {
|
if (guardCaptain != null) {
|
||||||
Building barracks = guardCaptain.building;
|
Building barracks = guardCaptain.building;
|
||||||
@@ -83,7 +83,7 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inRangeToAggro(Mob agent, PlayerCharacter target) {
|
public static boolean inRangeToAggro(Mob agent, AbstractCharacter target) {
|
||||||
|
|
||||||
Vector3fImmutable sl = agent.getLoc();
|
Vector3fImmutable sl = agent.getLoc();
|
||||||
Vector3fImmutable tl = target.getLoc();
|
Vector3fImmutable tl = target.getLoc();
|
||||||
@@ -147,7 +147,7 @@ public class MovementUtilities {
|
|||||||
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset, boolean isWalking) {
|
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//don't move farther than 30 units from player.
|
//don't move farther than 30 units from player.
|
||||||
@@ -158,7 +158,7 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
||||||
|
|
||||||
aiMove(agent, newLoc, isWalking);
|
aiMove(agent, newLoc, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.toString());
|
Logger.error(e.toString());
|
||||||
}
|
}
|
||||||
@@ -169,6 +169,9 @@ public class MovementUtilities {
|
|||||||
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(!agent.BehaviourType.canRoam)
|
||||||
|
return false;
|
||||||
|
|
||||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,10 +247,10 @@ public class MovementUtilities {
|
|||||||
msg.setSourceID(agent.getObjectUUID());
|
msg.setSourceID(agent.getObjectUUID());
|
||||||
msg.setStartCoord(startLoc);
|
msg.setStartCoord(startLoc);
|
||||||
msg.setEndCoord(endLoc);
|
msg.setEndCoord(endLoc);
|
||||||
msg.setInBuildingFloor(-1);
|
msg.setUnknown01(-1);
|
||||||
msg.setInBuilding(-1);
|
msg.setInBuilding(-1);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import static engine.net.MessageDispatcher.maxRecipients;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch Message is the main interface to Magicbane's threaded
|
* Dispatch Message is the main interface to Magicbane's threaded
|
||||||
* async message delivery system.
|
* asynch message delivery system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DispatchMessage {
|
public class DispatchMessage {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import engine.exception.FactoryBuildException;
|
|||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
@@ -94,11 +96,9 @@ public class NetMsgFactory {
|
|||||||
if (origin instanceof ClientConnection) {
|
if (origin instanceof ClientConnection) {
|
||||||
PlayerCharacter player = ((ClientConnection) origin).getPlayerCharacter();
|
PlayerCharacter player = ((ClientConnection) origin).getPlayerCharacter();
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// if (MBServerStatics.worldServerName.equals("Grief"))
|
|
||||||
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||||
} else
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Please Report What You Just Did. Ref Code: " + opcode);
|
||||||
Logger.error("Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (pc == null)
|
if (pc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pc.update();
|
pc.update(false);
|
||||||
if (msg.getSpeed() == 2)
|
if (msg.getSpeed() == 2)
|
||||||
pc.setWalkMode(false);
|
pc.setWalkMode(false);
|
||||||
else
|
else
|
||||||
@@ -114,7 +114,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (pc == null)
|
if (pc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pc.update();
|
pc.update(false);
|
||||||
|
|
||||||
pc.setSit(msg.toggleSitStand());
|
pc.setSit(msg.toggleSitStand());
|
||||||
|
|
||||||
@@ -560,12 +560,30 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (!itemManager.inventoryContains(i))
|
if (!itemManager.inventoryContains(i))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i.isCanDestroy())
|
//cannot delete gold
|
||||||
if (itemManager.delete(i) == true) {
|
if(i.getItemBaseID() == 7)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (i.isCanDestroy()) {
|
||||||
|
int goldValue = i.getBaseValue();
|
||||||
|
if (i.getItemBase().isRune())
|
||||||
|
goldValue = 500000;
|
||||||
|
|
||||||
|
if (i.getItemBaseID() == 980066)
|
||||||
|
goldValue = 0;
|
||||||
|
|
||||||
|
if(itemManager.getGoldInventory().getNumOfItems() + goldValue > 10000000)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemManager.delete(i)) {
|
||||||
|
if (goldValue > 0)
|
||||||
|
itemManager.addGoldToInventory(goldValue, false);
|
||||||
|
|
||||||
|
itemManager.updateInventory();
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
||||||
@@ -643,7 +661,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setInBuilding(-1);
|
moveMsg.setInBuilding(-1);
|
||||||
moveMsg.setInBuildingFloor(-1);
|
moveMsg.setUnknown01(-1);
|
||||||
|
|
||||||
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
@@ -654,6 +672,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
|
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void lootWindowRequest(LootWindowRequestMsg msg, ClientConnection origin) throws MsgSendException {
|
private static void lootWindowRequest(LootWindowRequestMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
@@ -1243,6 +1263,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
|
|
||||||
cost = sell.getBaseValue();
|
cost = sell.getBaseValue();
|
||||||
|
if(sell.getItemBaseID() == 980066)
|
||||||
|
cost = 0;
|
||||||
|
|
||||||
//apply damaged value reduction
|
//apply damaged value reduction
|
||||||
float durabilityCurrent = sell.getDurabilityCurrent();
|
float durabilityCurrent = sell.getDurabilityCurrent();
|
||||||
@@ -1347,6 +1369,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// test within talking range
|
// test within talking range
|
||||||
|
if(npc.isInSafeZone())
|
||||||
|
npc.sellPercent = 0;
|
||||||
|
|
||||||
if (sourcePlayer.getLoc().distanceSquared2D(npc.getLoc()) > MBServerStatics.NPC_TALK_RANGE * MBServerStatics.NPC_TALK_RANGE) {
|
if (sourcePlayer.getLoc().distanceSquared2D(npc.getLoc()) > MBServerStatics.NPC_TALK_RANGE * MBServerStatics.NPC_TALK_RANGE) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 14);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 14);
|
||||||
@@ -1358,219 +1382,192 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (sourcePlayer == null)
|
if (sourcePlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (origin.buyLock.tryLock()) {
|
if (origin.buyLock.tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
||||||
|
if (itemMan == null) {
|
||||||
if (itemMan == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||||
|
if (npc == null) {
|
||||||
if (npc == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Item gold = itemMan.getGoldInventory();
|
Item gold = itemMan.getGoldInventory();
|
||||||
|
if (gold == null) {
|
||||||
if (gold == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Item buy = null;
|
Item buy = null;
|
||||||
|
|
||||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||||
if (sellInventory == null)
|
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||||
|
// sellInventory = npc.getSellInventorySteward();
|
||||||
|
//}
|
||||||
|
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||||
|
// sellInventory = npc.getSellInventoryBuilder();
|
||||||
|
//}
|
||||||
|
if (sellInventory == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
for (MobEquipment me : sellInventory) {
|
for (MobEquipment me : sellInventory) {
|
||||||
if (me.getObjectUUID() == msg.getItemID()) {
|
if (me.getObjectUUID() == msg.getItemID()) {
|
||||||
ItemBase ib = me.getItemBase();
|
ItemBase ib = me.getItemBase();
|
||||||
if (ib == null)
|
if (ib == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight())) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int cost = me.getMagicValue();
|
int cost = me.getMagicValue();
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
switch(npc.getContractID()){
|
||||||
|
case 1201:
|
||||||
|
cost = ItemBase.getDiscPrice(ib.getUUID());
|
||||||
|
bargain = 0;
|
||||||
|
break;
|
||||||
|
case 1202:
|
||||||
|
cost = ItemBase.getStatPrice(ib.getUUID());
|
||||||
|
bargain = 0;
|
||||||
|
break;
|
||||||
|
case 900:
|
||||||
|
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
|
||||||
|
bargain = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float profit;
|
||||||
|
|
||||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
if(npc.isInSafeZone())
|
||||||
|
profit = 0;
|
||||||
if (profit < 1)
|
else
|
||||||
profit = 1;
|
profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||||
|
|
||||||
|
|
||||||
cost *= profit;
|
if(profit > 0)
|
||||||
|
cost *= profit;
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
//dont' have enough goldItem exit!
|
//dont' have enough goldItem exit!
|
||||||
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
int buildingDeposit = cost - me.getMagicValue();
|
int buildingDeposit = cost - me.getMagicValue();
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}if(npc.getContractID() == 1502041){
|
||||||
|
me.fromNoob = true;
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
} else if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||||
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
||||||
|
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
|
||||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
handleResourcePurchase(me,itemMan,sourcePlayer,ib);
|
||||||
|
}else {
|
||||||
if (buy != null) {
|
buy = Item.createItemForPlayer(sourcePlayer, ib, me.fromNoob);
|
||||||
me.transferEnchants(buy);
|
if (buy != null) {
|
||||||
itemMan.addItemToInventory(buy);
|
me.transferEnchants(buy);
|
||||||
//itemMan.updateInventory();
|
itemMan.addItemToInventory(buy);
|
||||||
|
if(npc.contractUUID == 900 && buy.getItemBaseID() == 1705032){
|
||||||
|
buy.setNumOfItems(10);
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||||
|
}
|
||||||
|
//itemMan.updateInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
||||||
|
|
||||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||||
|
|
||||||
if (npcCim == null)
|
if (npcCim == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buy = Item.getFromCache(msg.getItemID());
|
buy = Item.getFromCache(msg.getItemID());
|
||||||
|
|
||||||
if (buy == null)
|
if (buy == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemBase ib = buy.getItemBase();
|
ItemBase ib = buy.getItemBase();
|
||||||
|
|
||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!npcCim.inventoryContains(buy))
|
if (!npcCim.inventoryContains(buy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO test cost and subtract goldItem
|
//TODO test cost and subtract goldItem
|
||||||
|
|
||||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||||
int cost = buy.getBaseValue();
|
int cost = buy.getBaseValue();
|
||||||
|
|
||||||
if (buy.isID() || buy.isCustomValue())
|
if (buy.isID() || buy.isCustomValue())
|
||||||
cost = buy.getMagicValue();
|
cost = buy.getMagicValue();
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||||
|
|
||||||
if (profit < 1)
|
if (profit < 1)
|
||||||
profit = 1;
|
profit = 1;
|
||||||
|
|
||||||
if (!buy.isCustomValue())
|
if (!buy.isCustomValue())
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
else
|
else
|
||||||
cost = buy.getValue();
|
cost = buy.getValue();
|
||||||
|
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null)
|
if (b != null)
|
||||||
if (b.getProtectionState().equals(ProtectionState.NPC))
|
if (b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
|
|
||||||
int buildingDeposit = cost;
|
int buildingDeposit = cost;
|
||||||
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buy != null)
|
if (buy != null)
|
||||||
itemMan.buyFromNPC(buy, npc);
|
itemMan.buyFromNPC(buy, npc);
|
||||||
|
|
||||||
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
||||||
|
|
||||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||||
|
|
||||||
if (npcCim == null)
|
if (npcCim == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buy = MobLoot.getFromCache(msg.getItemID());
|
buy = MobLoot.getFromCache(msg.getItemID());
|
||||||
|
|
||||||
if (buy == null)
|
if (buy == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemBase ib = buy.getItemBase();
|
ItemBase ib = buy.getItemBase();
|
||||||
|
|
||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!npcCim.inventoryContains(buy))
|
if (!npcCim.inventoryContains(buy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//test room available for item
|
//test room available for item
|
||||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO test cost and subtract goldItem
|
//TODO test cost and subtract goldItem
|
||||||
|
|
||||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||||
|
|
||||||
int cost = buy.getMagicValue();
|
int cost = buy.getMagicValue();
|
||||||
cost *= npc.getSellPercent(sourcePlayer);
|
cost *= npc.getSellPercent(sourcePlayer);
|
||||||
|
|
||||||
|
|
||||||
if (gold.getNumOfItems() - cost < 0) {
|
if (gold.getNumOfItems() - cost < 0) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||||
b = null;
|
b = null;
|
||||||
int buildingDeposit = cost;
|
int buildingDeposit = cost;
|
||||||
|
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buy != null)
|
if (buy != null)
|
||||||
itemMan.buyFromNPC(buy, npc);
|
itemMan.buyFromNPC(buy, npc);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buy != null) {
|
if (buy != null) {
|
||||||
|
|
||||||
msg.setItem(buy);
|
msg.setItem(buy);
|
||||||
//send the buy message back to update player
|
//send the buy message back to update player
|
||||||
// msg.setItemType(buy.getObjectType().ordinal());
|
// msg.setItemType(buy.getObjectType().ordinal());
|
||||||
@@ -1579,14 +1576,43 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
itemMan.updateInventory();
|
itemMan.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
origin.buyLock.unlock();
|
origin.buyLock.unlock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, PlayerCharacter sourcePlayer, ItemBase ib){
|
||||||
|
boolean stacked = false;
|
||||||
|
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||||
|
for(Item item : itemMan.getInventory()){
|
||||||
|
int itemID = item.getItemBaseID();
|
||||||
|
int meID = me.getItemBase().getUUID();
|
||||||
|
if(itemID == meID){
|
||||||
|
if(Warehouse.maxResources.isEmpty())
|
||||||
|
Warehouse.getMaxResources();
|
||||||
|
int maxStack = Warehouse.maxResources.get(itemID);
|
||||||
|
if(maxStack > item.getNumOfItems() + buystack){
|
||||||
|
item.setNumOfItems(item.getNumOfItems() + buystack);
|
||||||
|
stacked = true;
|
||||||
|
itemMan.updateInventory();
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!stacked){
|
||||||
|
Item buy = Item.createItemForPlayer(sourcePlayer, ib, false);
|
||||||
|
if (buy != null) {
|
||||||
|
me.transferEnchants(buy);
|
||||||
|
itemMan.addItemToInventory(buy);
|
||||||
|
buy.setNumOfItems(buystack);
|
||||||
|
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemMan.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
||||||
@@ -1646,14 +1672,21 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
max *= (1 + (durMod * 0.01f));
|
max *= (1 + (durMod * 0.01f));
|
||||||
if (dur >= max || dur < 1) {
|
if (dur >= max || dur < 1) {
|
||||||
//redundancy message to clear item from window in client
|
//redundancy message to clear item from window in client
|
||||||
|
if (!DbManager.ItemQueries.SET_DURABILITY(toRepair, dur))
|
||||||
|
return;
|
||||||
toRepair.setDurabilityCurrent(max);
|
toRepair.setDurabilityCurrent(max);
|
||||||
msg.setupRepairAck(max - dur);
|
msg.setupRepairAck(max - dur);
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO get cost to repair
|
|
||||||
int cost = (int) ((max - dur) * 80.1);
|
int pointsToRepair = max - dur;
|
||||||
|
double damageRatio = (double)1.0d - (toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax();
|
||||||
|
int modifiedValue = (int)(damageRatio * toRepair.getMagicValue());
|
||||||
|
int costPerPoint = modifiedValue / toRepair.getDurabilityMax();
|
||||||
|
int modifiedRepairCost = (int)(pointsToRepair * costPerPoint)+ npc.getSpecialPrice();
|
||||||
|
int cost = (int)(modifiedRepairCost * 1 + npc.buyPercent) + npc.getSpecialPrice();
|
||||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null)
|
if (b != null)
|
||||||
@@ -1892,6 +1925,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
case POWER:
|
case POWER:
|
||||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||||
break;
|
break;
|
||||||
|
case REQUESTMELEEATTACK:
|
||||||
|
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
||||||
|
break;
|
||||||
case READYTOENTER:
|
case READYTOENTER:
|
||||||
break;
|
break;
|
||||||
case OPENVAULT:
|
case OPENVAULT:
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public enum Protocol {
|
|||||||
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
||||||
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
||||||
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
||||||
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, AttackCmdMsgHandler.class), // Attack
|
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, null), // Attack
|
||||||
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
||||||
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
||||||
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import engine.objects.GuildStatusController;
|
|||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Resource;
|
import engine.objects.Resource;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
@@ -35,26 +36,28 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
|||||||
|
|
||||||
//TODO verify this against the warehouse?
|
//TODO verify this against the warehouse?
|
||||||
|
|
||||||
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus()) == false) // is this only GL?
|
if (!GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus())) // is this only GL?
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Mine mine = Mine.getMine(changeProductionMsg.getMineID());
|
Mine mine = Mine.getMine(changeProductionMsg.getMineID());
|
||||||
|
|
||||||
if (mine == null)
|
if (mine == null) {
|
||||||
|
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Mine was Null");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
//make sure mine belongs to guild
|
//make sure mine belongs to guild
|
||||||
|
|
||||||
if (mine.getOwningGuild().isEmptyGuild() ||
|
if (mine.getOwningGuild().isEmptyGuild() || mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
|
||||||
mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//make sure valid resource
|
//make sure valid resource
|
||||||
|
|
||||||
Resource resource = Resource.resourceByHash.get(changeProductionMsg.getResourceHash());
|
Resource resource = Resource.resourceByHash.get(changeProductionMsg.getResourceHash());
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null) {
|
||||||
|
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Resource was Null");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//update resource
|
//update resource
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
package engine.net.client.handlers;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.CombatManager;
|
|
||||||
import engine.net.client.ClientConnection;
|
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @Author:
|
|
||||||
* @Summary: Processes application protocol message which keeps
|
|
||||||
* client's tcp connection open.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|
||||||
|
|
||||||
public AttackCmdMsgHandler() {
|
|
||||||
super(AttackCmdMsg.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
|
||||||
|
|
||||||
// Member variable declaration
|
|
||||||
|
|
||||||
AttackCmdMsg msg;
|
|
||||||
|
|
||||||
// Member variable assignment
|
|
||||||
|
|
||||||
msg = (AttackCmdMsg) baseMsg;
|
|
||||||
|
|
||||||
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (playerCharacter == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
AbstractWorldObject target = null;
|
|
||||||
Enum.GameObjectType targetType;
|
|
||||||
|
|
||||||
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
|
|
||||||
|
|
||||||
switch(targetType){
|
|
||||||
case Mob:
|
|
||||||
target = Mob.getMob(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case PlayerCharacter:
|
|
||||||
target = PlayerCharacter.getPlayerCharacter(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case Building:
|
|
||||||
target = BuildingManager.getBuilding(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case NPC:
|
|
||||||
target = NPC.getNPC(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(target == null) {
|
|
||||||
playerCharacter.setCombatTarget(null);
|
|
||||||
return true; // cannot attack a null target
|
|
||||||
}
|
|
||||||
//set sources target
|
|
||||||
|
|
||||||
playerCharacter.setCombatTarget(target);
|
|
||||||
|
|
||||||
//put in combat if not already
|
|
||||||
|
|
||||||
if (!playerCharacter.isCombat())
|
|
||||||
CombatManager.toggleCombat(true, origin);
|
|
||||||
|
|
||||||
//make character stand if sitting
|
|
||||||
|
|
||||||
if (playerCharacter.isSit())
|
|
||||||
CombatManager.toggleSit(false, origin);
|
|
||||||
|
|
||||||
CombatManager.AttackTarget(playerCharacter, target);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -47,13 +47,16 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
|||||||
if (pc.region != null && !pc.region.isOutside())
|
if (pc.region != null && !pc.region.isOutside())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// Find out if we already have an altitude timer running and if so
|
// Find out if we already have an altitude timer running and if so
|
||||||
// do not process more alt change requests
|
// do not process more alt change requests
|
||||||
|
|
||||||
|
pc.updateFlight();
|
||||||
|
|
||||||
if (pc.getTakeOffTime() != 0)
|
if (pc.getTakeOffTime() != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
pc.setTakeOffTime(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
||||||
// remove all movement timers and jobs
|
// remove all movement timers and jobs
|
||||||
//TODO: test if they can fly
|
//TODO: test if they can fly
|
||||||
@@ -67,7 +70,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
|||||||
if (pc.getAltitude() == 0 && !msg.up())
|
if (pc.getAltitude() == 0 && !msg.up())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
pc.update();
|
pc.update(false);
|
||||||
pc.stopMovement(pc.getLoc());
|
pc.stopMovement(pc.getLoc());
|
||||||
msg.setStartAlt(pc.getAltitude());
|
msg.setStartAlt(pc.getAltitude());
|
||||||
if (msg.up()) {
|
if (msg.up()) {
|
||||||
@@ -132,7 +135,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg.up()) {
|
if (msg.up()) {
|
||||||
pc.update();
|
pc.update(false);
|
||||||
pc.setDesiredAltitude(targetAlt);
|
pc.setDesiredAltitude(targetAlt);
|
||||||
pc.setTakeOffTime(System.currentTimeMillis());
|
pc.setTakeOffTime(System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
@@ -158,7 +161,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
|||||||
} else
|
} else
|
||||||
pc.setDesiredAltitude(targetAlt);
|
pc.setDesiredAltitude(targetAlt);
|
||||||
|
|
||||||
pc.update();
|
pc.update(false);
|
||||||
|
|
||||||
|
|
||||||
pc.setTakeOffTime(System.currentTimeMillis());
|
pc.setTakeOffTime(System.currentTimeMillis());
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// If the hotZone has changed then update the client's map accordingly.
|
// If the hotZone has changed then update the client's map accordingly.
|
||||||
|
|
||||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
if (playerCharacter.getTimestamps().containsKey("hotzoneupdate") && playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
|||||||
if (city != null)
|
if (city != null)
|
||||||
bane = city.getBane();
|
bane = city.getBane();
|
||||||
|
|
||||||
if (bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
if (bane != null){// && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class GroupInviteResponseHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Run Keyclone Audit
|
// Run Keyclone Audit
|
||||||
|
|
||||||
KEYCLONEAUDIT.audit(player, group);
|
//KEYCLONEAUDIT.audit(player, group);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class HirelingServiceMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
npc.setRepairCost(msg.repairCost);
|
npc.setSpecialPrice(msg.repairCost);
|
||||||
ManageNPCMsg outMsg = new ManageNPCMsg(npc);
|
ManageNPCMsg outMsg = new ManageNPCMsg(npc);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
targetItem.recycle(vendor);
|
targetItem.recycle(vendor);
|
||||||
vendor.removeItemFromForge(targetItem);
|
vendor.removeItemFromForge(targetItem);
|
||||||
|
|
||||||
|
//refund the gold for cancelled item
|
||||||
|
if(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue() < 15000000){
|
||||||
|
vendor.building.setStrongboxValue(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue());
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh vendor's inventory to client
|
// Refresh vendor's inventory to client
|
||||||
|
|
||||||
outMsg = new ManageNPCMsg(vendor);
|
outMsg = new ManageNPCMsg(vendor);
|
||||||
|
|||||||
@@ -62,16 +62,23 @@ public class MOTDEditHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 1) // Guild MOTD
|
if (type == 1) { // Guild MOTD
|
||||||
msg.setMessage(guild.getMOTD());
|
msg.setMessage(guild.getMOTD());
|
||||||
else if (type == 3) // IC MOTD
|
guild.updateDatabase();
|
||||||
|
}else if (type == 3) { // IC MOTD
|
||||||
msg.setMessage(guild.getICMOTD());
|
msg.setMessage(guild.getICMOTD());
|
||||||
else if (type == 0) { // Nation MOTD
|
guild.updateDatabase();
|
||||||
|
}else if (type == 0) { // Nation MOTD
|
||||||
Guild nation = guild.getNation();
|
Guild nation = guild.getNation();
|
||||||
if (nation == null || !nation.isNation()) {
|
if (nation == null || !nation.isNation()) {
|
||||||
ErrorPopupMsg.sendErrorMsg(playerCharacter, "You do not have such authority!");
|
ErrorPopupMsg.sendErrorMsg(playerCharacter, "You do not have such authority!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
nation.setNMOTD(msg.getMessage());
|
||||||
|
nation.updateDatabase();
|
||||||
|
for(Guild sub : nation.getSubGuildList()){
|
||||||
|
sub.setNMOTD(nation.getNMOTD());
|
||||||
|
}
|
||||||
msg.setMessage(nation.getMOTD());
|
msg.setMessage(nation.getMOTD());
|
||||||
}
|
}
|
||||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import engine.powers.PowersBase;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
@@ -105,7 +106,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Validate player can obtain blessing
|
// Validate player can obtain blessing
|
||||||
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
|
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -126,12 +127,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
realm = RealmMap.getRealmForCity(city);
|
realm = RealmMap.getRealmForCity(city);
|
||||||
|
|
||||||
if (realm.getCanBeClaimed() == false) {
|
if (!realm.getCanBeClaimed()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
|
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realm.isRuled() == true) {
|
if (realm.isRuled()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
|
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -142,12 +143,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void requestBoon(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
private static void requestBoon(PlayerCharacter player, NPC npc) {
|
||||||
|
|
||||||
Building shrineBuilding;
|
Building shrineBuilding;
|
||||||
Shrine shrine;
|
Shrine shrine;
|
||||||
|
|
||||||
if (npc.getGuild() != player.getGuild())
|
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
shrineBuilding = npc.getBuilding();
|
shrineBuilding = npc.getBuilding();
|
||||||
@@ -155,7 +156,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (shrineBuilding == null)
|
if (shrineBuilding == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE)
|
if (shrineBuilding.getBlueprint() != null && !shrineBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.SHRINE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (shrineBuilding.getRank() == -1)
|
if (shrineBuilding.getRank() == -1)
|
||||||
@@ -171,11 +172,9 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//already haz boon.
|
|
||||||
|
|
||||||
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 199);
|
//remove old boon to apply new one, allows boon refreshing
|
||||||
return;
|
player.effects.remove(PowersManager.getPowerByToken(shrine.getShrineType().getPowerToken()).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Shrine.canTakeFavor(player, shrine))
|
if (!Shrine.canTakeFavor(player, shrine))
|
||||||
@@ -191,16 +190,31 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rank = shrine.getRank();
|
int trains = 0;
|
||||||
//R8 trees always get atleast rank 2 boons. rank uses index, where 0 is first place, 1 is second, etc...
|
switch(npc.getRank()){
|
||||||
if (shrineBuilding.getCity() != null && shrineBuilding.getCity().getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
case 1:
|
||||||
if (rank != 0)
|
trains = 10;
|
||||||
rank = 1;
|
break;
|
||||||
int trains = 40 - (rank * 10);
|
case 2:
|
||||||
if (trains < 0)
|
trains = 15;
|
||||||
trains = 0;
|
break;
|
||||||
|
case 3:
|
||||||
|
trains = 20;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
trains = 25;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
trains = 30;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
trains = 35;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
trains = 40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//System.out.println(trains);
|
|
||||||
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false);
|
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false);
|
||||||
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor.");
|
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor.");
|
||||||
shrineBuilding.addEffectBit(1000000 << 2);
|
shrineBuilding.addEffectBit(1000000 << 2);
|
||||||
@@ -260,60 +274,85 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetCity == null)
|
if (targetCity == null){
|
||||||
return;
|
Mine mineTele = null;
|
||||||
|
for(Mine mine : Mine.getMinesToTeleportTo(player)){
|
||||||
//verify level required to teleport or repledge
|
if(mine.getObjectUUID() == msg.getCityID()){
|
||||||
|
mineTele = mine;
|
||||||
Guild toGuild = targetCity.getGuild();
|
}
|
||||||
|
}
|
||||||
if (toGuild != null)
|
if(mineTele == null){
|
||||||
if (isTeleport) {
|
|
||||||
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
|
||||||
return;
|
|
||||||
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
|
||||||
return;
|
return;
|
||||||
|
}else {
|
||||||
|
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||||
|
msg.setTeleportTime(time);
|
||||||
|
Building tower = Mine.getTower(mineTele);
|
||||||
|
if (tower == null)
|
||||||
|
return;
|
||||||
|
Vector3fImmutable teleportLoc = Vector3fImmutable.getRandomPointOnCircle(tower.getLoc(), 10);
|
||||||
|
ChatManager.chatSystemInfo(player, "You Will Teleport To " + mineTele.getParentZone().getParent().getName() + "'s Mine In " + time + " Seconds.");
|
||||||
|
if (time > 0) {
|
||||||
|
//TODO add timer to teleport
|
||||||
|
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||||
|
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//finish porting to a city
|
||||||
|
//verify level required to teleport or repledge
|
||||||
|
|
||||||
boolean joinedGuild = false;
|
Guild toGuild = targetCity.getGuild();
|
||||||
|
|
||||||
//if repledge, reguild the player
|
if (toGuild != null)
|
||||||
|
if (isTeleport) {
|
||||||
|
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
||||||
|
return;
|
||||||
|
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!isTeleport)
|
boolean joinedGuild = false;
|
||||||
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
|
||||||
|
|
||||||
int time;
|
//if repledge, reguild the player
|
||||||
|
|
||||||
if (!isTeleport) //repledge
|
if (!isTeleport)
|
||||||
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
||||||
else
|
|
||||||
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
|
||||||
|
|
||||||
//resend message
|
int time;
|
||||||
msg.setTeleportTime(time);
|
|
||||||
|
|
||||||
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
if (!isTeleport) //repledge
|
||||||
|
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
||||||
|
else
|
||||||
|
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||||
|
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
//resend message
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
msg.setTeleportTime(time);
|
||||||
|
|
||||||
|
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
||||||
|
|
||||||
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
//teleport player to city
|
||||||
|
|
||||||
|
Vector3fImmutable teleportLoc;
|
||||||
|
|
||||||
|
if (targetCity.getTOL().getRank() == 8)
|
||||||
|
teleportLoc = targetCity.getTOL().getStuckLocation();
|
||||||
|
else
|
||||||
|
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||||
|
|
||||||
|
if (time > 0) {
|
||||||
|
//TODO add timer to teleport
|
||||||
|
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||||
|
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||||
|
} else if (joinedGuild) {
|
||||||
|
player.teleport(teleportLoc);
|
||||||
|
player.setSafeMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//teleport player to city
|
|
||||||
|
|
||||||
Vector3fImmutable teleportLoc;
|
|
||||||
|
|
||||||
if (targetCity.getTOL().getRank() == 8)
|
|
||||||
teleportLoc = targetCity.getTOL().getStuckLocation();
|
|
||||||
else
|
|
||||||
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
|
||||||
|
|
||||||
if (time > 0) {
|
|
||||||
//TODO add timer to teleport
|
|
||||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
|
||||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
|
||||||
} else if (joinedGuild) {
|
|
||||||
player.teleport(teleportLoc);
|
|
||||||
player.setSafeMode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PowersBase getPowerforHermit(NPC npc) {
|
private static PowersBase getPowerforHermit(NPC npc) {
|
||||||
@@ -420,7 +459,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (isHermit(npc))
|
if (isHermit(npc))
|
||||||
requestHermitBlessing(msg, origin, player, npc);
|
requestHermitBlessing(msg, origin, player, npc);
|
||||||
else
|
else
|
||||||
requestBoon(msg, origin, player, npc);
|
requestBoon(player, npc);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
LeaderboardMessage lbm = new LeaderboardMessage();
|
LeaderboardMessage lbm = new LeaderboardMessage();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.NPCManager;
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
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;
|
||||||
@@ -15,6 +16,9 @@ import engine.net.client.msg.*;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
* @Summary: Processes application protocol message which
|
* @Summary: Processes application protocol message which
|
||||||
@@ -23,6 +27,8 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
|
||||||
|
|
||||||
public MinionTrainingMsgHandler() {
|
public MinionTrainingMsgHandler() {
|
||||||
super(MinionTrainingMessage.class);
|
super(MinionTrainingMessage.class);
|
||||||
}
|
}
|
||||||
@@ -32,9 +38,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (playerCharacter == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||||
@@ -44,24 +50,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc == null)
|
if (npc == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||||
|
|
||||||
if (building == null)
|
if (b == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//clear minion
|
//clear minion
|
||||||
|
|
||||||
if (npc.minionLock.writeLock().tryLock()) {
|
if (npc.minionLock.writeLock().tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (minionMsg.getType() == 2) {
|
if (minionMsg.getType() == 2) {
|
||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -69,35 +74,33 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (petOwner != null) {
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
petOwner.setPet(null);
|
||||||
|
toRemove.setOwner(null);
|
||||||
if (petOwner != null) {
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
petOwner.setPet(null);
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||||
|
|
||||||
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(b.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(b.getObjectUUID());
|
||||||
|
|
||||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||||
mca1.setTargetID3(npc.getObjectUUID());
|
mca1.setTargetID3(npc.getObjectUUID());
|
||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(b.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -112,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -143,15 +146,47 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (mobBase == 0)
|
if (mobBase == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
||||||
|
|
||||||
if (siegeMob == null)
|
if (siegeMob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (siegeMob != null) {
|
||||||
|
|
||||||
|
siegeMob.setSpawnTime(60 * 15);
|
||||||
|
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
|
||||||
|
|
||||||
|
siegeMob.building = building;
|
||||||
|
siegeMob.parentZone = zone;
|
||||||
|
|
||||||
|
// Slot siege minion
|
||||||
|
// Can be either corner tower or bulwark.
|
||||||
|
|
||||||
|
int slot;
|
||||||
|
|
||||||
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
|
||||||
|
slot = 2;
|
||||||
|
else
|
||||||
|
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
|
||||||
|
|
||||||
|
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
||||||
|
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
|
||||||
|
|
||||||
|
// Rotate slot position by the building rotation
|
||||||
|
|
||||||
|
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
|
||||||
|
|
||||||
|
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||||
|
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||||
|
|
||||||
|
zone.zoneMobSet.add(siegeMob);
|
||||||
|
siegeMob.setLoc(siegeMob.bindLoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -179,13 +214,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.REMOVE_GUARD_MINION(npc.getObjectUUID(), toRemove.firstName))
|
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -193,22 +228,17 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
if (petOwner != null) {
|
||||||
|
petOwner.setPet(null);
|
||||||
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
toRemove.setOwner(null);
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
if (trebOwner != null) {
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
trebOwner.setPet(null);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(building.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(building.getObjectUUID());
|
||||||
@@ -218,11 +248,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -258,7 +288,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase = npc.getMobBaseID();
|
int mobBase = npc.getMobBaseID();
|
||||||
@@ -268,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(mobBase);
|
String pirateName = NPCManager.getPirateName(mobBase);
|
||||||
|
|
||||||
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||||
|
|
||||||
if (toCreate == null)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.ADD_GUARD_MINION(npc.getObjectUUID(), pirateName))
|
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
||||||
|
|
||||||
|
if (toCreate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
@@ -284,7 +314,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
|
|
||||||
package engine.net.client.handlers;
|
package engine.net.client.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -28,11 +26,13 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
|
|||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
||||||
ClientConnection origin) throws MsgSendException {
|
ClientConnection origin) throws MsgSendException {
|
||||||
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
||||||
PlayerCharacter pc = origin.getPlayerCharacter();
|
|
||||||
if(pc == null)
|
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null;
|
||||||
return true;
|
if (pc == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
MovementManager.movement(msg, pc);
|
MovementManager.movement(msg, pc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -421,31 +421,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//ANNIVERSERY GIFT
|
|
||||||
case 31:
|
case 31:
|
||||||
// *** Disabled for now: Needs bootyset created
|
|
||||||
|
|
||||||
//if (ib.getUUID() == 971012) {
|
|
||||||
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
|
|
||||||
// int annyID = ItemBase.AnniverseryGifts.get(random);
|
|
||||||
|
|
||||||
// ItemBase annyIB = ItemBase.getItemBase(annyID);
|
|
||||||
// if (annyIB != null) {
|
|
||||||
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
|
|
||||||
// if (gift != null) {
|
|
||||||
// itemMan.addItemToInventory(gift);
|
|
||||||
// itemMan.consume(item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
|
|
||||||
LootManager.peddleFate(player,item);
|
LootManager.peddleFate(player,item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30: //water bucket
|
case 30: //water bucket
|
||||||
case 8: //potions, tears of saedron
|
case 8: //potions, tears of saedron
|
||||||
|
|
||||||
case 5: //runes, petition, warrant, scrolls
|
case 5: //runes, petition, warrant, scrolls
|
||||||
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
|
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
|
||||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||||
@@ -462,7 +443,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (uuid > 252122 && uuid < 252128) { //mastery runes
|
} else if (uuid > 252122 && uuid < 252137) { //blood runes
|
||||||
|
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||||
|
itemMan.consume(item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else if (uuid > 252128 && uuid < 252128) { //mastery runes
|
||||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
}
|
}
|
||||||
@@ -528,7 +514,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send piss bucket animation
|
// Send piss bucket animation
|
||||||
|
|
||||||
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
|
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
|
||||||
vum.configure();
|
vum.configure();
|
||||||
DispatchMessage.sendToAllInRange(player, vum);
|
DispatchMessage.sendToAllInRange(player, vum);
|
||||||
@@ -543,7 +528,9 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
player.cancelOnSpell();
|
if(!item.getItemBase().getType().equals(ItemType.POTION)) {
|
||||||
|
player.cancelOnSpell();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default: //shouldn't be here, consume item
|
default: //shouldn't be here, consume item
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import engine.Enum.ProfitType;
|
|||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.FastMath;
|
import engine.math.FastMath;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -36,7 +37,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
super(OrderNPCMsg.class);
|
super(OrderNPCMsg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processRedeedHireling(AbstractCharacter hireling, Building building, ClientConnection origin) {
|
public static void processRedeedMob(Mob mob, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
Contract contract;
|
Contract contract;
|
||||||
@@ -47,28 +48,33 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
itemMan = player.getCharItemManager();
|
itemMan = player.getCharItemManager();
|
||||||
|
|
||||||
contract = hireling.contract;
|
contract = mob.getContract();
|
||||||
|
|
||||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!building.getHirelings().containsKey(hireling))
|
if (!building.getHirelings().containsKey(mob))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, hireling);
|
if (!NPCManager.removeMobileFromBuilding(mob, building)) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
building.getHirelings().remove(mob);
|
||||||
|
|
||||||
itemBase = ItemBase.getItemBase(contract.getContractID());
|
itemBase = ItemBase.getItemBase(contract.getContractID());
|
||||||
|
|
||||||
if (itemBase == null) {
|
if (itemBase == null) {
|
||||||
Logger.error("Could not find Contract for npc: " + hireling.getObjectUUID());
|
Logger.error("Could not find Contract for npc: " + mob.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean itemWorked = false;
|
boolean itemWorked = false;
|
||||||
|
|
||||||
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) hireling.getRank() - 1), (byte) ((byte) hireling.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) mob.getRank() - 1), (byte) ((byte) mob.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
||||||
item.setNumOfItems(1);
|
item.setNumOfItems(1);
|
||||||
item.containerType = Enum.ItemContainerType.INVENTORY;
|
item.containerType = Enum.ItemContainerType.INVENTORY;
|
||||||
|
|
||||||
@@ -206,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
||||||
|
if (guard.getObjectType() == GameObjectType.Mob)
|
||||||
|
((Mob) guard).setPatrolPointIndex(0);
|
||||||
|
}
|
||||||
} else if (building.getPatrolPoints() != null)
|
} else if (building.getPatrolPoints() != null)
|
||||||
ClearPatrolPoints(building.getObjectUUID());
|
ClearPatrolPoints(building.getObjectUUID());
|
||||||
|
|
||||||
@@ -213,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||||
} else if (building.getSentryPoints() != null)
|
} else if (building.getSentryPoints() != null)
|
||||||
ClearSentryPoints(building.getObjectUUID());
|
ClearSentryPoints(building.getObjectUUID());
|
||||||
|
|
||||||
|
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
||||||
|
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||||
@@ -276,6 +290,28 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static synchronized void processRedeedNPC(AbstractCharacter abstractCharacter, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
|
// Member variable declaration
|
||||||
|
|
||||||
|
switch (abstractCharacter.getObjectType()) {
|
||||||
|
case NPC:
|
||||||
|
NPC npc = (NPC) abstractCharacter;
|
||||||
|
|
||||||
|
Building cityBuilding = npc.getBuilding();
|
||||||
|
|
||||||
|
if (cityBuilding == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BuildingManager.processRedeedNPC(npc, npc.building, origin);
|
||||||
|
break;
|
||||||
|
case Mob:
|
||||||
|
Mob mob = (Mob) abstractCharacter;
|
||||||
|
processRedeedMob(mob, mob.building, origin);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
||||||
@@ -466,7 +502,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(npc, building, origin);
|
processRedeedNPC(npc, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
@@ -505,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return true;
|
return true;
|
||||||
@@ -534,7 +570,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building.getHirelings().containsKey(mob) == false)
|
if (building.getHirelings().containsKey(mob) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, mob);
|
if (NPCManager.removeMobileFromBuilding(mob, building) == false) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
||||||
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
||||||
@@ -569,7 +608,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(mob, building, origin);
|
processRedeedNPC(mob, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
||||||
0,
|
HeightMap.getWorldHeight(treeInfo.getLoc()),
|
||||||
treeInfo.getLoc().z);
|
treeInfo.getLoc().z);
|
||||||
|
|
||||||
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
||||||
@@ -754,7 +754,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
plantLoc.z - serverZone.getAbsZ(), treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
plantLoc.z - serverZone.getAbsZ(), treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
||||||
|
|
||||||
// Uh oh!
|
// Uh oh!
|
||||||
|
|
||||||
if (cityObjects == null || cityObjects.isEmpty()) {
|
if (cityObjects == null || cityObjects.isEmpty()) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return false;
|
return false;
|
||||||
@@ -768,7 +767,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
||||||
treeObject.runAfterLoad();
|
treeObject.runAfterLoad();
|
||||||
|
;
|
||||||
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
||||||
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
||||||
|
|
||||||
@@ -793,11 +792,10 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
ZoneManager.addPlayerCityZone(zoneObject);
|
ZoneManager.addPlayerCityZone(zoneObject);
|
||||||
serverZone.addNode(zoneObject);
|
serverZone.addNode(zoneObject);
|
||||||
|
|
||||||
zoneObject.worldAltitude = ZoneManager.caclulateWorldAltitude(zoneObject);
|
zoneObject.generateWorldAltitude();
|
||||||
|
|
||||||
cityObject.setParent(zoneObject);
|
cityObject.setParent(zoneObject);
|
||||||
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already
|
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already
|
||||||
|
|
||||||
//Link the tree of life with the new zone
|
//Link the tree of life with the new zone
|
||||||
|
|
||||||
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
@@ -819,6 +817,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
treeObject.setLoc(treeObject.getLoc());
|
treeObject.setLoc(treeObject.getLoc());
|
||||||
InterestManager.setObjectDirty(treeObject);
|
InterestManager.setObjectDirty(treeObject);
|
||||||
|
// WorldGrid.addObject(treeObject, playerCharacter);
|
||||||
|
|
||||||
serverRealm.addCity(cityObject.getObjectUUID());
|
serverRealm.addCity(cityObject.getObjectUUID());
|
||||||
playerNation.setCityUUID(cityObject.getObjectUUID());
|
playerNation.setCityUUID(cityObject.getObjectUUID());
|
||||||
@@ -916,7 +915,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Early exit if something went horribly wrong
|
// Early exit if something went horribly wrong
|
||||||
// with locating the current realm and/or zone
|
// with locating the current realm and/or zone
|
||||||
|
|
||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -979,8 +977,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City cityObject;
|
City cityObject;
|
||||||
PlacementInfo buildingList;
|
PlacementInfo buildingList;
|
||||||
|
|
||||||
// Setup working variables
|
// Setup working variables we'll need
|
||||||
|
|
||||||
buildingList = msg.getFirstPlacementInfo();
|
buildingList = msg.getFirstPlacementInfo();
|
||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
||||||
@@ -1093,6 +1090,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
||||||
|
|
||||||
|
|
||||||
// Overlap check and wall deed verifications
|
// Overlap check and wall deed verifications
|
||||||
for (PlacementInfo wall : walls) {
|
for (PlacementInfo wall : walls) {
|
||||||
|
|
||||||
@@ -1111,6 +1109,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
for (Building building : serverZone.zoneBuildingSet) {
|
for (Building building : serverZone.zoneBuildingSet) {
|
||||||
|
|
||||||
|
|
||||||
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
||||||
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
||||||
|
|
||||||
@@ -1130,14 +1129,12 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
||||||
|
|
||||||
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
||||||
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to place wall piece
|
// Attempt to place wall piece
|
||||||
|
|
||||||
wallPiece = createStructure(player, wall, serverZone);
|
wallPiece = createStructure(player, wall, serverZone);
|
||||||
@@ -1148,12 +1145,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// walls are auto protected
|
// walls are auto protected
|
||||||
|
|
||||||
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
||||||
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deduct gold from character's inventory
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1173,7 +1172,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All siege buildings build in 15 minutes
|
// All siege buildings build in 15 minutes
|
||||||
|
|
||||||
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
||||||
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
||||||
completionDate = DateTime.now().plusMinutes(15);
|
completionDate = DateTime.now().plusMinutes(15);
|
||||||
@@ -1193,7 +1191,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
||||||
|
|
||||||
// Make sure we have a valid mesh
|
// Make sure we have a valid mesh
|
||||||
|
|
||||||
if (newMesh == null) {
|
if (newMesh == null) {
|
||||||
Logger.error("CreateStructure: DB returned null object.");
|
Logger.error("CreateStructure: DB returned null object.");
|
||||||
return null;
|
return null;
|
||||||
@@ -1365,16 +1362,15 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
newMesh = (Building) ago;
|
newMesh = (Building) ago;
|
||||||
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
||||||
|
// WorldGrid.addObject(newMesh, player);
|
||||||
newMesh.setLoc(newMesh.getLoc());
|
newMesh.setLoc(newMesh.getLoc());
|
||||||
InterestManager.setObjectDirty(newMesh);
|
InterestManager.setObjectDirty(newMesh);
|
||||||
newMesh.runAfterLoad();
|
newMesh.runAfterLoad();
|
||||||
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
||||||
Warehouse warehouse = (Warehouse) ago;
|
Warehouse warehouse = (Warehouse) ago;
|
||||||
City city = City.getCity(currentZone.getPlayerCityUUID());
|
City city = City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
||||||
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
|
|||||||
player.stopMovement(player.getBindLoc());
|
player.stopMovement(player.getBindLoc());
|
||||||
player.setSafeMode();
|
player.setSafeMode();
|
||||||
player.updateLocation();
|
player.updateLocation();
|
||||||
|
player.setRegion(AbstractWorldObject.GetRegionByWorldObject(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setTimeStamp("logout", 0);
|
player.setTimeStamp("logout", 0);
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
msg = (TaxCityMsg) baseMsg;
|
msg = (TaxCityMsg) baseMsg;
|
||||||
|
|
||||||
ViewTaxes(msg, player);
|
//realm taxing disabled
|
||||||
|
//ViewTaxes(msg, player);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.net.*;
|
import engine.net.*;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -70,62 +71,120 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean applyRune(int runeID, ClientConnection origin, PlayerCharacter playerCharacter) {
|
public static boolean applyRune(int runeID, ClientConnection origin, PlayerCharacter playerCharacter) {
|
||||||
|
|
||||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
RuneBase rb = RuneBase.getRuneBase(runeID);
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
if (playerCharacter == null || origin == null || rb == null) {
|
if (playerCharacter == null || origin == null || rb == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
int raceID = playerCharacter.getRaceID();
|
||||||
//Check race is met
|
//Check race is met
|
||||||
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
||||||
if (races.size() > 0) {
|
if(runeID != 3007 && runeID != 3014) {//bounty hunter and huntsman
|
||||||
int raceID = playerCharacter.getRaceID();
|
if (races.size() > 0) {
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
for (int validID : races.keySet()) {
|
for (int validID : races.keySet()) {
|
||||||
if (validID == raceID) {
|
if (validID == raceID) {
|
||||||
|
valid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(runeID == 3040)
|
||||||
valid = true;
|
valid = true;
|
||||||
break;
|
|
||||||
|
if(runeID == 3049)
|
||||||
|
valid = true;
|
||||||
|
|
||||||
|
if(raceID == 1999){
|
||||||
|
switch(runeID){
|
||||||
|
case 2514:
|
||||||
|
case 3036:
|
||||||
|
case 3033:
|
||||||
|
case 3001:
|
||||||
|
case 3002:
|
||||||
|
case 3003:
|
||||||
|
case 3004:
|
||||||
|
case 3008:
|
||||||
|
case 3009:
|
||||||
|
case 3013:
|
||||||
|
case 3016:
|
||||||
|
case 3017:
|
||||||
|
case 3018:
|
||||||
|
case 3020:
|
||||||
|
case 3021:
|
||||||
|
case 3030:
|
||||||
|
case 3031:
|
||||||
|
case 3037:
|
||||||
|
case 3045:
|
||||||
|
case 3046:
|
||||||
|
case 3047:
|
||||||
|
case 3048:
|
||||||
|
case 3049:
|
||||||
|
valid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!valid) {
|
//Check base class is met
|
||||||
|
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||||
|
if (baseClasses.size() > 0) {
|
||||||
|
int baseClassID = playerCharacter.getBaseClassID();
|
||||||
|
boolean valid = false;
|
||||||
|
for (int validID : baseClasses.keySet()) {
|
||||||
|
if (validID == baseClassID) {
|
||||||
|
valid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(runeID == 3040)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3036 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3033 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3035 && baseClassID == 2501)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3028 && baseClassID == 2501 && playerCharacter.getRace().getName().contains("Irekei"))
|
||||||
|
valid = true;
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Check promotion class is met
|
||||||
|
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||||
|
if (promotionClasses.size() > 0) {
|
||||||
|
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||||
|
int baseClassID = playerCharacter.getBaseClassID();
|
||||||
|
boolean valid = false;
|
||||||
|
for (int validID : promotionClasses.keySet()) {
|
||||||
|
if (validID == promotionClassID) {
|
||||||
|
valid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(runeID == 3040)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3004 && (playerCharacter.getPromotionClassID() == 2505 || playerCharacter.getPromotionClassID() == 2510))
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3036 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3033 && raceID == 1999)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3028 && (raceID == 2013 || raceID == 2014) && playerCharacter.getBaseClassID() == 2501)
|
||||||
|
valid = true;
|
||||||
|
if(runeID == 3035 && baseClassID == 2501)
|
||||||
|
valid = true;
|
||||||
|
if (!valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
if(playerCharacter.getPromotionClassID() == 2519){//priest
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check base class is met
|
|
||||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
|
||||||
if (baseClasses.size() > 0) {
|
|
||||||
int baseClassID = playerCharacter.getBaseClassID();
|
|
||||||
boolean valid = false;
|
|
||||||
for (int validID : baseClasses.keySet()) {
|
|
||||||
if (validID == baseClassID) {
|
|
||||||
valid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!valid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check promotion class is met
|
|
||||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
|
||||||
if (promotionClasses.size() > 0) {
|
|
||||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
|
||||||
boolean valid = false;
|
|
||||||
for (int validID : promotionClasses.keySet()) {
|
|
||||||
if (validID == promotionClassID) {
|
|
||||||
valid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!valid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check disciplines are met
|
//Check disciplines are met
|
||||||
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
||||||
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
||||||
@@ -139,7 +198,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int discCount = 0;
|
int discCount = 0;
|
||||||
for (CharacterRune cr : runes) {
|
for (CharacterRune cr : runes) {
|
||||||
int runeBaseID = cr.getRuneBaseID();
|
int runeBaseID = cr.getRuneBaseID();
|
||||||
@@ -152,28 +210,35 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check level is met
|
//Check level is met
|
||||||
if (playerCharacter.getLevel() < rb.getLevelRequired()) {
|
if (playerCharacter.getLevel() < rb.getLevelRequired()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int strTotal = 0;
|
int strTotal = 0;
|
||||||
int dexTotal = 0;
|
int dexTotal = 0;
|
||||||
int conTotal = 0;
|
int conTotal = 0;
|
||||||
int intTotal = 0;
|
int intTotal = 0;
|
||||||
int spiTotal = 0;
|
int spiTotal = 0;
|
||||||
int cost = 0;
|
int cost = 0;
|
||||||
|
|
||||||
//Check any attributes are met
|
//Check any attributes are met
|
||||||
ArrayList<RuneBaseAttribute> attrs = rb.getAttrs();
|
ArrayList<RuneBaseAttribute> attrs = rb.getAttrs();
|
||||||
|
|
||||||
if (rb.getAttrs() != null)
|
if (rb.getAttrs() != null)
|
||||||
for (RuneBaseAttribute rba : attrs) {
|
for (RuneBaseAttribute rba : attrs) {
|
||||||
int attrID = rba.getAttributeID();
|
int attrID = rba.getAttributeID();
|
||||||
int mod = rba.getModValue();
|
int mod = rba.getModValue();
|
||||||
switch (attrID) {
|
switch (attrID) {
|
||||||
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
case "Scion of the Dar Khelegeur":
|
||||||
|
case "Scion of the Gwaridorn":
|
||||||
|
case "Scion of the Twathedilion":
|
||||||
|
mod = 0;
|
||||||
|
}
|
||||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -226,25 +291,64 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if max number runes already reached
|
//Check if max number runes already reached
|
||||||
if (runes.size() > 12) {
|
if (runes.size() > 12) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter,"You Have Too Many Runes Applied");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||||
|
RuneBase rb2 = charRune.getRuneBase();
|
||||||
|
switch (rb2.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Scion of the Dar Khelegeur":
|
||||||
|
case "Scion of the Gwaridorn":
|
||||||
|
case "Scion of the Twathedilion":
|
||||||
|
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||||
|
RuneBase rb2 = charRune.getRuneBase();
|
||||||
|
switch (rb2.getName()) {
|
||||||
|
case "Scion of the Dar Khelegeur":
|
||||||
|
case "Scion of the Gwaridorn":
|
||||||
|
case "Scion of the Twathedilion":
|
||||||
|
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
//if discipline, check number applied
|
//if discipline, check number applied
|
||||||
if (isDiscipline(runeID)) {
|
if (isDiscipline(runeID)) {
|
||||||
if (playerCharacter.getLevel() < 70) {
|
switch(playerCharacter.getRank()){
|
||||||
if (discCount > 2) {
|
case 1:
|
||||||
return false;
|
case 2:
|
||||||
}
|
case 3:
|
||||||
} else {
|
case 4:
|
||||||
if (discCount > 3) {
|
case 5:
|
||||||
return false;
|
case 6:
|
||||||
}
|
if(discCount > 3)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
if(discCount > 5)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Everything succeeded. Let's apply the rune
|
//Everything succeeded. Let's apply the rune
|
||||||
//Attempt add rune to database
|
//Attempt add rune to database
|
||||||
CharacterRune runeWithoutID = new CharacterRune(rb, playerCharacter.getObjectUUID());
|
CharacterRune runeWithoutID = new CharacterRune(rb, playerCharacter.getObjectUUID());
|
||||||
@@ -258,7 +362,6 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
if (cr == null) {
|
if (cr == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove any overridden runes from player
|
//remove any overridden runes from player
|
||||||
ArrayList<Integer> overwrite = rb.getOverwrite();
|
ArrayList<Integer> overwrite = rb.getOverwrite();
|
||||||
CharacterRune toRemove = null;
|
CharacterRune toRemove = null;
|
||||||
@@ -267,13 +370,10 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
toRemove = playerCharacter.removeRune(overwriteID);
|
toRemove = playerCharacter.removeRune(overwriteID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//add rune to player
|
//add rune to player
|
||||||
playerCharacter.addRune(cr);
|
playerCharacter.addRune(cr);
|
||||||
|
|
||||||
// recalculate all bonuses/formulas/skills/powers
|
// recalculate all bonuses/formulas/skills/powers
|
||||||
playerCharacter.recalculate();
|
playerCharacter.recalculate();
|
||||||
|
|
||||||
//if overwriting a stat rune, add any amount granted from previous rune.
|
//if overwriting a stat rune, add any amount granted from previous rune.
|
||||||
if (toRemove != null) {
|
if (toRemove != null) {
|
||||||
RuneBase rbs = toRemove.getRuneBase();
|
RuneBase rbs = toRemove.getRuneBase();
|
||||||
@@ -299,30 +399,35 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
|||||||
if (dif > 0 && spiTotal < (int) playerCharacter.statSpiMax) {
|
if (dif > 0 && spiTotal < (int) playerCharacter.statSpiMax) {
|
||||||
playerCharacter.addSpi(dif);
|
playerCharacter.addSpi(dif);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recalculate all bonuses/formulas/skills/powers
|
// recalculate all bonuses/formulas/skills/powers
|
||||||
playerCharacter.recalculate();
|
playerCharacter.recalculate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch (rb.getName()) {
|
||||||
|
case "Born of the Ethyri":
|
||||||
|
case "Born of the Taripontor":
|
||||||
|
case "Born of the Gwendannen":
|
||||||
|
case "Born of the Invorri":
|
||||||
|
case "Born of the Irydnu":
|
||||||
|
case "Scion of the Dar Khelegeur":
|
||||||
|
case "Scion of the Gwaridorn":
|
||||||
|
case "Scion of the Twathedilion":
|
||||||
|
cost = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, msm);
|
dispatch = Dispatch.borrow(playerCharacter, msm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
//send apply rune message to client
|
//send apply rune message to client
|
||||||
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID, cr.getObjectType().ordinal(), cr.getObjectUUID(), false);
|
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID, cr.getObjectType().ordinal(), cr.getObjectUUID(), false);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, arm);
|
dispatch = Dispatch.borrow(playerCharacter, arm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
|
|
||||||
//alert them of success
|
//alert them of success
|
||||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 160);
|
ErrorPopupMsg.sendErrorPopup(playerCharacter, 160);
|
||||||
|
|
||||||
//reapply bonuses
|
//reapply bonuses
|
||||||
playerCharacter.applyBonuses();
|
playerCharacter.applyBonuses();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
if (contract != null)
|
if (contract != null)
|
||||||
sellInventory = contract.getSellInventory();
|
sellInventory = contract.getSellInventory();
|
||||||
|
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||||
|
// sellInventory = npc.getSellInventorySteward();
|
||||||
|
// }
|
||||||
|
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||||
|
// sellInventory = npc.getSellInventoryBuilder();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (man != null)
|
if (man != null)
|
||||||
|
|||||||
@@ -104,8 +104,10 @@ public class CityDataMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
temp.putInt(mineList.size());
|
temp.putInt(mineList.size());
|
||||||
for (Mine mine : mineList)
|
for (Mine mine : mineList) {
|
||||||
Mine.serializeForClientMsg(mine, temp);
|
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
|
||||||
|
Mine.serializeForClientMsg(mine, temp);
|
||||||
|
}
|
||||||
temp.put((byte) 0); // PAD
|
temp.put((byte) 0); // PAD
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,8 +180,10 @@ public class CityDataMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer.putInt(mineList.size());
|
writer.putInt(mineList.size());
|
||||||
for (Mine mine : mineList)
|
for (Mine mine : mineList) {
|
||||||
Mine.serializeForClientMsg(mine, writer);
|
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
|
||||||
|
Mine.serializeForClientMsg(mine, writer);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
writer.putString(npcHire.getName());
|
writer.putString(npcHire.getName());
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
writer.putInt(Blueprint.getNpcMaintCost(npcHire.getRank()));
|
writer.putInt(0);
|
||||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||||
writer.putInt(((NPC) npcHire).getContract().getIconID()); // Was 60
|
writer.putInt(((NPC) npcHire).getContract().getIconID()); // Was 60
|
||||||
else if (npcHire.getObjectType() == GameObjectType.Mob) {
|
else if (npcHire.getObjectType() == GameObjectType.Mob) {
|
||||||
@@ -392,9 +392,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
writer.putInt(bane.getSiegePhase().ordinal()); //1 challenge //2 standoff //3 war
|
writer.putInt(bane.getSiegePhase().ordinal()); //1 challenge //2 standoff //3 war
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
if (!bane.isAccepted() && this.assetManager.getGuild() == banedCity.getGuild() && GuildStatusController.isInnerCouncil(this.assetManager.getGuildStatus()))
|
//if (!bane.isAccepted() && this.assetManager.getGuild() == banedCity.getGuild() && GuildStatusController.isInnerCouncil(this.assetManager.getGuildStatus()))
|
||||||
writer.put((byte) 1); //canSetTime
|
// writer.put((byte) 1); //canSetTime
|
||||||
else
|
//else
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
DateTime placedOn = bane.getLiveDate();
|
DateTime placedOn = bane.getLiveDate();
|
||||||
@@ -485,36 +485,19 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
writer.putInt(building.getRank());
|
writer.putInt(building.getRank());
|
||||||
|
|
||||||
// Maintenance costs include resource if
|
writer.putInt(1); // Gold only
|
||||||
// this structure is an R8 tree
|
|
||||||
|
|
||||||
if (building.getRank() == 8)
|
|
||||||
writer.putInt(5); // Resources included
|
|
||||||
else
|
|
||||||
writer.putInt(1); // Gold only
|
|
||||||
|
|
||||||
writer.putInt(2308551); //Gold
|
writer.putInt(2308551); //Gold
|
||||||
if (building.getBlueprint() == null)
|
if (building.getBlueprint() == null)
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
else
|
else
|
||||||
writer.putInt(building.getBlueprint().getMaintCost(building.getRank())); // maint cost
|
writer.putInt(building.getBlueprint().getMaintCost()); // maint cost
|
||||||
|
|
||||||
if (building.getRank() == 8) {
|
|
||||||
writer.putInt(74856115); // Stone
|
|
||||||
writer.putInt(1500); // maint cost
|
|
||||||
writer.putInt(-1603256692); // Lumber
|
|
||||||
writer.putInt(1500); // maint cost
|
|
||||||
writer.putInt(-1596311545); // Galvor
|
|
||||||
writer.putInt(5); // maint cost
|
|
||||||
writer.putInt(1532478436); // Wormwood
|
|
||||||
writer.putInt(5); // maint cost
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalDateTime maintDate = building.maintDateTime;
|
LocalDateTime maintDate = building.maintDateTime;
|
||||||
|
|
||||||
if (maintDate == null)
|
if (maintDate == null)
|
||||||
maintDate = LocalDateTime.now();
|
maintDate = LocalDateTime.now();
|
||||||
writer.putLocalDateTime(LocalDateTime.now()); // current time
|
writer.putLocalDateTime(maintDate); // current time
|
||||||
|
|
||||||
// utc offset?
|
// utc offset?
|
||||||
writer.putInt((int) java.time.Duration.between(LocalDateTime.now(), maintDate).getSeconds()); // Seconds to maint date
|
writer.putInt((int) java.time.Duration.between(LocalDateTime.now(), maintDate).getSeconds()); // Seconds to maint date
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +96,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putString("A weapon suited to laying siege");
|
writer.putString("A weapon suited to laying siege");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void serializeGuardList(ByteBufferWriter writer, int minion, Mob captain) {
|
private static void serializeGuardList(ByteBufferWriter writer, int minion) {
|
||||||
|
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(captain.getRank());//minion rank
|
writer.putInt(1);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
writer.putInt(600); //roll time
|
writer.putInt(600); //roll time
|
||||||
@@ -342,17 +343,14 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain list
|
//artillery captain list
|
||||||
|
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
|
||||||
writer.putInt(1 + npc.minions.size());
|
writer.putInt(1 + siegeMinions.size());
|
||||||
serializeBulwarkList(writer, 1); //Trebuchet
|
serializeBulwarkList(writer, 1); //Trebuchet
|
||||||
//serializeBulwarkList(writer, 2); //Ballista
|
//serializeBulwarkList(writer, 2); //Ballista
|
||||||
|
|
||||||
if (npc.minions != null && npc.minions.size() > 0)
|
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
|
||||||
|
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
|
|
||||||
|
for (Mob mob : siegeMinions.keySet()) {
|
||||||
this.unknown83 = mob.getObjectUUID();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
@@ -368,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
long timeLife = upgradeTime - curTime;
|
long timeLife = upgradeTime - curTime;
|
||||||
|
|
||||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||||
if (mob.guardCaptain.isAlive()) {
|
if (mob.npcOwner.isAlive()) {
|
||||||
writer.put((byte) 0);//shows respawning timer
|
writer.put((byte) 0);//shows respawning timer
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
@@ -505,7 +503,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putString("Repair items");
|
writer.putString("Repair items");
|
||||||
writer.putString("percent");
|
writer.putString("percent");
|
||||||
writer.putInt(npc.getRepairCost()); //cost for repair
|
writer.putInt(npc.getSpecialPrice()); //cost for repair
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
|
|
||||||
ArrayList<Integer> modPrefixList = npc.getModTypeTable();
|
ArrayList<Integer> modPrefixList = npc.getModTypeTable();
|
||||||
@@ -559,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mobA = Mob.getMob(this.targetID);
|
mobA = Mob.getFromCacheDBID(this.targetID);
|
||||||
|
|
||||||
if (mobA == null) {
|
if (mobA == null) {
|
||||||
Logger.error("Missing Mob of ID " + this.targetID);
|
Logger.error("Missing Mob of ID " + this.targetID);
|
||||||
@@ -668,15 +666,14 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain list
|
//artillery captain list
|
||||||
|
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
|
||||||
|
|
||||||
writer.putInt(mobA.minions.size() + 1);
|
writer.putInt(siegeMinions.size() + 1);
|
||||||
|
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
||||||
|
|
||||||
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
|
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||||
|
|
||||||
if (mobA.minions != null && mobA.minions.size() > 0)
|
for (Mob mob : siegeMinions.keySet()) {
|
||||||
|
|
||||||
for (Integer minionUUID : mobA.minions) {
|
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
this.unknown83 = mob.getObjectUUID();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
@@ -692,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
long timeLife = upgradeTime - curTime;
|
long timeLife = upgradeTime - curTime;
|
||||||
|
|
||||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||||
if (mob.guardCaptain.isAlive()) {
|
if (mob.npcOwner.isAlive()) {
|
||||||
writer.put((byte) 0);//shows respawning timer
|
writer.put((byte) 0);//shows respawning timer
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package engine.net.client.msg;
|
package engine.net.client.msg;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
@@ -22,19 +21,19 @@ import engine.objects.Building;
|
|||||||
|
|
||||||
public class MoveToPointMsg extends ClientNetMsg {
|
public class MoveToPointMsg extends ClientNetMsg {
|
||||||
|
|
||||||
private int sourceType; //ordinal of the character type that sent this message 54=PlayerCharacter
|
private int sourceType;
|
||||||
private int sourceID; // uuid of the source character of this message
|
private int sourceID;
|
||||||
private float startLat; //start loc of move message (offset if inside a building not world loc)
|
private float startLat;
|
||||||
private float startLon; //start loc of move message (offset if inside a building not world loc)
|
private float startLon;
|
||||||
private float startAlt; //start loc of move message (offset if inside a building not world loc)
|
private float startAlt;
|
||||||
private float endLat; //end loc of move message (offset if inside a building not world loc)
|
private float endLat;
|
||||||
private float endLon; //end loc of move message (offset if inside a building not world loc)
|
private float endLon;
|
||||||
private float endAlt; //end loc of move message (offset if inside a building not world loc)
|
private float endAlt;
|
||||||
private int startLocType; // enum ordinal of the object player is inside 0=nothing 8=building
|
private int targetType;
|
||||||
private int inBuildingUUID; // uuid of the building character is currently inside
|
private int targetID;
|
||||||
private int inBuilding; // is inside a building 0=true -1=false
|
private int inBuilding; // 0=true, -1=false 0/1/2 = floor you are on
|
||||||
private int inBuildingFloor; // floor of building character is currently in -1=not inside building 0/1/2/3 = floor number
|
private int unknown01;
|
||||||
private byte initiatedByAttack; // move message sent as a result of move to target to attack 0=false 1=true
|
private byte unknown02;
|
||||||
private byte unknown03;
|
private byte unknown03;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,11 +54,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endLat = msg.endLat;
|
this.endLat = msg.endLat;
|
||||||
this.endLon = msg.endLon;
|
this.endLon = msg.endLon;
|
||||||
this.endAlt = msg.endAlt;
|
this.endAlt = msg.endAlt;
|
||||||
this.startLocType = msg.startLocType;
|
this.targetType = msg.targetType;
|
||||||
this.inBuildingUUID = msg.inBuildingUUID;
|
this.targetID = msg.targetID;
|
||||||
this.inBuilding = msg.inBuilding;
|
this.inBuilding = msg.inBuilding;
|
||||||
this.inBuildingFloor = msg.inBuildingFloor;
|
this.unknown01 = msg.unknown01;
|
||||||
this.initiatedByAttack = msg.initiatedByAttack;
|
this.unknown02 = msg.unknown02;
|
||||||
this.unknown03 = msg.unknown03;
|
this.unknown03 = msg.unknown03;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,11 +73,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endLat = building.getLoc().x;
|
this.endLat = building.getLoc().x;
|
||||||
this.endLon = building.getLoc().z;
|
this.endLon = building.getLoc().z;
|
||||||
this.endAlt = building.getLoc().y;
|
this.endAlt = building.getLoc().y;
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = -1;
|
this.inBuilding = -1;
|
||||||
this.inBuildingFloor = -1;
|
this.unknown01 = -1;
|
||||||
this.initiatedByAttack = 0;
|
this.unknown02 = 0;
|
||||||
this.unknown03 = 0;
|
this.unknown03 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +108,11 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
writer.putFloat(this.endAlt);
|
writer.putFloat(this.endAlt);
|
||||||
writer.putFloat(this.endLon);
|
writer.putFloat(this.endLon);
|
||||||
|
|
||||||
writer.putInt(this.startLocType);
|
writer.putInt(this.targetType);
|
||||||
writer.putInt(this.inBuildingUUID);
|
writer.putInt(this.targetID);
|
||||||
|
|
||||||
writer.putInt(this.inBuilding);
|
writer.putInt(this.inBuilding);
|
||||||
writer.putInt(this.inBuildingFloor);
|
writer.putInt(this.unknown01);
|
||||||
|
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
@@ -136,13 +135,13 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endAlt = reader.getFloat();
|
this.endAlt = reader.getFloat();
|
||||||
this.endLon = reader.getFloat();
|
this.endLon = reader.getFloat();
|
||||||
|
|
||||||
this.startLocType = reader.getInt();
|
this.targetType = reader.getInt();
|
||||||
this.inBuildingUUID = reader.getInt();
|
this.targetID = reader.getInt();
|
||||||
|
|
||||||
this.inBuilding = reader.getInt();
|
this.inBuilding = reader.getInt();
|
||||||
this.inBuildingFloor = reader.getInt();
|
this.unknown01 = reader.getInt();
|
||||||
|
|
||||||
this.initiatedByAttack = reader.get();
|
this.unknown02 = reader.get();
|
||||||
this.unknown03 = reader.get();
|
this.unknown03 = reader.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,20 +209,20 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.endAlt = value;
|
this.endAlt = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStartLocType() {
|
public int getTargetType() {
|
||||||
return this.startLocType;
|
return this.targetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartLocType(int value) {
|
public void setTargetType(int value) {
|
||||||
this.startLocType = value;
|
this.targetType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInBuildingUUID() {
|
public int getTargetID() {
|
||||||
return this.inBuildingUUID;
|
return this.targetID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInBuildingUUID(int value) {
|
public void setTargetID(int value) {
|
||||||
this.inBuildingUUID = value;
|
this.targetID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInBuilding() {
|
public int getInBuilding() {
|
||||||
@@ -234,8 +233,12 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.inBuilding = value;
|
this.inBuilding = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInBuildingFloor(int value) {
|
public int getUnknown01() {
|
||||||
this.inBuildingFloor = value;
|
return this.unknown01;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnknown01(int value) {
|
||||||
|
this.unknown01 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartCoord(Vector3fImmutable value) {
|
public void setStartCoord(Vector3fImmutable value) {
|
||||||
@@ -251,8 +254,8 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearTarget() {
|
public void clearTarget() {
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayer(AbstractCharacter ac) {
|
public void setPlayer(AbstractCharacter ac) {
|
||||||
@@ -260,10 +263,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
this.sourceID = ac.getObjectUUID();
|
this.sourceID = ac.getObjectUUID();
|
||||||
this.setStartCoord(ac.getLoc());
|
this.setStartCoord(ac.getLoc());
|
||||||
this.setEndCoord(ac.getEndLoc());
|
this.setEndCoord(ac.getEndLoc());
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = ac.getInBuilding();
|
this.inBuilding = ac.getInBuilding();
|
||||||
this.inBuildingFloor = ac.getInFloorID();
|
this.unknown01 = ac.getInFloorID();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,10 +274,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
if (target == null) {
|
if (target == null) {
|
||||||
this.setStartCoord(ac.getLoc());
|
this.setStartCoord(ac.getLoc());
|
||||||
this.setEndCoord(ac.getEndLoc());
|
this.setEndCoord(ac.getEndLoc());
|
||||||
this.startLocType = 0;
|
this.targetType = 0;
|
||||||
this.inBuildingUUID = 0;
|
this.targetID = 0;
|
||||||
this.inBuilding = -1;
|
this.inBuilding = -1;
|
||||||
this.inBuildingFloor = -1;
|
this.unknown01 = -1;
|
||||||
} else {
|
} else {
|
||||||
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
|
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
|
||||||
Vector3fImmutable convertLocEnd = convertLocStart;
|
Vector3fImmutable convertLocEnd = convertLocStart;
|
||||||
@@ -283,10 +286,10 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
this.setStartCoord(convertLocStart);
|
this.setStartCoord(convertLocStart);
|
||||||
this.setEndCoord(convertLocEnd);
|
this.setEndCoord(convertLocEnd);
|
||||||
this.startLocType = GameObjectType.Building.ordinal();
|
this.targetType = GameObjectType.Building.ordinal();
|
||||||
this.inBuildingUUID = target.getObjectUUID();
|
this.targetID = target.getObjectUUID();
|
||||||
this.inBuilding = ac.getInBuilding();
|
this.inBuilding = ac.getInBuilding();
|
||||||
this.inBuildingFloor = ac.getInFloorID();
|
this.unknown01 = ac.getInFloorID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -295,11 +298,7 @@ public class MoveToPointMsg extends ClientNetMsg {
|
|||||||
return unknown03;
|
return unknown03;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInitiatedFromAttack() {
|
public int getUnknown02() {
|
||||||
return initiatedByAttack;
|
return unknown02;
|
||||||
}
|
|
||||||
|
|
||||||
public int getInBuildingFloor() {
|
|
||||||
return this.inBuildingFloor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
|||||||
|
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
import engine.net.AbstractConnection;
|
import engine.net.AbstractConnection;
|
||||||
import engine.net.ByteBufferReader;
|
import engine.net.ByteBufferReader;
|
||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
@@ -53,18 +54,45 @@ public class ServerInfoMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
writer.putInt(WorldServer.worldMapID);
|
writer.putInt(WorldServer.worldMapID);
|
||||||
writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
|
writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
|
||||||
if (LoginServer.population < MBServerStatics.LOW_POPULATION)
|
int TotalTrees = 21;
|
||||||
writer.putInt(0); //Land Rush
|
int currentR8Trees = DbManager.CityQueries.GET_CAPITAL_CITY_COUNT();
|
||||||
else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION)
|
|
||||||
writer.putInt(1); //Low pop
|
switch(currentR8Trees){
|
||||||
else if (LoginServer.population < MBServerStatics.HIGH_POPULATION)
|
case 0:
|
||||||
writer.putInt(2); //Normal pop
|
case 1:
|
||||||
else if (LoginServer.population < MBServerStatics.VERY_OVERPOPULATED_POPULATION)
|
case 2:
|
||||||
writer.putInt(3); //High Pop
|
case 3:
|
||||||
else if (LoginServer.population < MBServerStatics.FULL_POPULATION)
|
case 4:
|
||||||
writer.putInt(4); //Very overpopulated pop
|
writer.putInt(0); //Land Rush
|
||||||
else
|
break;
|
||||||
writer.putInt(5); //Full pop
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
writer.putInt(1); //Low pop
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
writer.putInt(2); //Normal pop
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
case 15:
|
||||||
|
case 16:
|
||||||
|
writer.putInt(3); //High Pop
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
case 18:
|
||||||
|
case 19:
|
||||||
|
case 20:
|
||||||
|
writer.putInt(4); //Very overpopulated pop
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
writer.putInt(5); //Full pop
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import engine.net.ByteBufferReader;
|
|||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
public class TeleportRepledgeListMsg extends ClientNetMsg {
|
public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||||
|
|
||||||
ArrayList<City> cities;
|
ArrayList<City> cities;
|
||||||
|
ArrayList<Mine> mines;
|
||||||
private PlayerCharacter player;
|
private PlayerCharacter player;
|
||||||
private boolean isTeleport;
|
private boolean isTeleport;
|
||||||
|
|
||||||
@@ -77,10 +80,19 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
if (isTeleport)
|
if (isTeleport) {
|
||||||
cities = City.getCitiesToTeleportTo(player);
|
cities = City.getCitiesToTeleportTo(player);
|
||||||
else
|
try {
|
||||||
|
mines = Mine.getMinesToTeleportTo(player);
|
||||||
|
if(mines == null)
|
||||||
|
mines = new ArrayList<>();
|
||||||
|
}catch(Exception e){
|
||||||
|
Logger.error("Unable To Load Mines For Teleport: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
cities = City.getCitiesToRepledgeTo(player);
|
||||||
|
mines = new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,10 +108,14 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
|
|
||||||
writer.putInt(cities.size());
|
writer.putInt(cities.size() + mines.size());
|
||||||
|
|
||||||
for (City city : cities)
|
for (City city : cities)
|
||||||
City.serializeForClientMsg(city, writer);
|
City.serializeForClientMsg(city, writer);
|
||||||
|
|
||||||
|
for(Mine mine : mines)
|
||||||
|
Mine.serializeForClientMsgTeleport(mine, writer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCharacter getPlayer() {
|
public PlayerCharacter getPlayer() {
|
||||||
|
|||||||
@@ -114,26 +114,36 @@ public class VendorDialogMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
VendorDialog vd = null;
|
VendorDialog vd = null;
|
||||||
Contract contract = npc.getContract();
|
Contract contract = npc.getContract();
|
||||||
|
if(npc.contractUUID == 1502043){
|
||||||
|
vd = Contract.HandleArenaMaster(msg.unknown03,npc,playerCharacter);
|
||||||
|
msg.updateMessage(3, vd);
|
||||||
|
}else if(npc.contractUUID == 1502040){ //enrollment officer
|
||||||
|
//PlayerCharacter.unboxPlayer(playerCharacter);
|
||||||
|
vd = Contract.HandleEnrollmentOfficer(msg.unknown03,npc,playerCharacter);
|
||||||
|
msg.updateMessage(3, vd);
|
||||||
|
}else if(contract.getContractID() == 1502042){
|
||||||
|
vd = Contract.HandleBaneCommanderOptions(msg.unknown03, npc, playerCharacter);
|
||||||
|
msg.updateMessage(3, vd);
|
||||||
|
}else {
|
||||||
|
|
||||||
if (contract == null)
|
if (contract == null)
|
||||||
vd = VendorDialog.getHostileVendorDialog();
|
|
||||||
else if (npc.getBuilding() != null) {
|
|
||||||
if (BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
|
||||||
vd = VendorDialog.getHostileVendorDialog();
|
vd = VendorDialog.getHostileVendorDialog();
|
||||||
else
|
else if (npc.getBuilding() != null) {
|
||||||
|
if (npc.getBuilding() != null && BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
||||||
|
vd = VendorDialog.getHostileVendorDialog();
|
||||||
|
else
|
||||||
|
vd = contract.getVendorDialog();
|
||||||
|
} else
|
||||||
vd = contract.getVendorDialog();
|
vd = contract.getVendorDialog();
|
||||||
} else
|
if (vd == null)
|
||||||
vd = contract.getVendorDialog();
|
vd = VendorDialog.getHostileVendorDialog();
|
||||||
if (vd == null)
|
|
||||||
vd = VendorDialog.getHostileVendorDialog();
|
|
||||||
|
|
||||||
if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) {
|
if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) {
|
||||||
msg.updateMessage(3, vd);
|
msg.updateMessage(3, vd);
|
||||||
} else {
|
} else {
|
||||||
if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin))
|
if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin))
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
vd = VendorDialog.getVendorDialog(msg.unknown03);
|
//vd = VendorDialog.getVendorDialog(msg.unknown03);
|
||||||
msg.updateMessage(3, vd);
|
msg.updateMessage(3, vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,26 +558,59 @@ public class VendorDialogMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
// verify race valid for profession
|
// verify race valid for profession
|
||||||
Race race = pc.getRace();
|
Race race = pc.getRace();
|
||||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
if(race.getRaceRuneID() == 1999) {
|
||||||
// TODO send client promotion error
|
boolean valid = false;
|
||||||
return;
|
switch(promoID){
|
||||||
|
case 2504:
|
||||||
|
case 2505:
|
||||||
|
case 2506:
|
||||||
|
case 2507:
|
||||||
|
case 2510:
|
||||||
|
case 2511:
|
||||||
|
case 2512:
|
||||||
|
case 2514:
|
||||||
|
case 2515:
|
||||||
|
case 2517:
|
||||||
|
case 2518:
|
||||||
|
case 2519:
|
||||||
|
case 2520:
|
||||||
|
case 2521:
|
||||||
|
case 2523:
|
||||||
|
valid = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||||
|
// TODO send client promotion error
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// verify baseclass valid for profession
|
// verify baseclass valid for profession
|
||||||
BaseClass bc = pc.getBaseClass();
|
BaseClass bc = pc.getBaseClass();
|
||||||
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
if (bc == null) {
|
||||||
// TODO send client promotion error
|
// TODO send client promotion error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!promo.isAllowedRune(bc.getToken())){
|
||||||
|
if(!bc.getName().equals("Rogue") && !promo.getName().equals("Druid"))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// verify gender
|
if(race.getRaceRuneID() != 1999) {
|
||||||
if (promoID == 2511 && pc.isMale()) // Fury
|
// verify gender
|
||||||
return;
|
if (promoID == 2511 && pc.isMale()) // Fury
|
||||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
return;
|
||||||
return;
|
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||||
if (promoID == 2517 && !pc.isMale()) // Warlock
|
return;
|
||||||
return;
|
if (promoID == 2517 && !pc.isMale()) // Warlock
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Everything valid. Let's promote
|
// Everything valid. Let's promote
|
||||||
pc.setPromotionClass(promo.getObjectUUID());
|
pc.setPromotionClass(promo.getObjectUUID());
|
||||||
|
|
||||||
@@ -588,6 +631,11 @@ public class VendorDialogMsg extends ClientNetMsg {
|
|||||||
.getObjectUUID(), true);
|
.getObjectUUID(), true);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
|
if(pc.getCharItemManager() != null && pc.getCharItemManager().getGoldInventory() != null && pc.getCharItemManager().getGoldInventory().getNumOfItems() < 1000) {
|
||||||
|
pc.getCharItemManager().addGoldToInventory(1000, false);
|
||||||
|
pc.getCharItemManager().addItemToInventory(new MobLoot(pc, ItemBase.getItemBase(980066), 1, false).promoteToItem(pc));
|
||||||
|
pc.getCharItemManager().updateInventory();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package engine.objects;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.InterestManagement.HeightMap;
|
|
||||||
import engine.InterestManagement.InterestManager;
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.exception.SerializationException;
|
import engine.exception.SerializationException;
|
||||||
@@ -37,7 +36,6 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
@@ -51,8 +49,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public int contractUUID;
|
public int contractUUID;
|
||||||
public Contract contract;
|
public Contract contract;
|
||||||
|
|
||||||
public String firstName;
|
protected String firstName;
|
||||||
public String lastName;
|
protected String lastName;
|
||||||
protected short statStrCurrent;
|
protected short statStrCurrent;
|
||||||
protected short statDexCurrent;
|
protected short statDexCurrent;
|
||||||
protected short statConCurrent;
|
protected short statConCurrent;
|
||||||
@@ -70,7 +68,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public Guild guild;
|
public Guild guild;
|
||||||
protected byte runningTrains;
|
protected byte runningTrains;
|
||||||
protected ConcurrentHashMap<Integer, CharacterPower> powers;
|
protected ConcurrentHashMap<Integer, CharacterPower> powers;
|
||||||
public ConcurrentHashMap<String, CharacterSkill> skills;
|
protected ConcurrentHashMap<String, CharacterSkill> skills;
|
||||||
// Variables NOT to be stored in db
|
// Variables NOT to be stored in db
|
||||||
protected boolean sit = false;
|
protected boolean sit = false;
|
||||||
protected boolean walkMode;
|
protected boolean walkMode;
|
||||||
@@ -87,19 +85,19 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
protected AtomicFloat mana = new AtomicFloat();
|
protected AtomicFloat mana = new AtomicFloat();
|
||||||
protected float manaMax; // Health/Mana/Stamina
|
protected float manaMax; // Health/Mana/Stamina
|
||||||
protected AtomicBoolean isAlive = new AtomicBoolean(true);
|
protected AtomicBoolean isAlive = new AtomicBoolean(true);
|
||||||
public Resists resists = new Resists("Genric");
|
protected Resists resists = new Resists("Genric");
|
||||||
protected ConcurrentHashMap<String, JobContainer> timers;
|
protected ConcurrentHashMap<String, JobContainer> timers;
|
||||||
protected ConcurrentHashMap<String, Long> timestamps;
|
protected ConcurrentHashMap<String, Long> timestamps;
|
||||||
public int atrHandOne;
|
public int atrHandOne;
|
||||||
public int atrHandTwo;
|
protected int atrHandTwo;
|
||||||
public int minDamageHandOne;
|
public int minDamageHandOne;
|
||||||
public int maxDamageHandOne;
|
public int maxDamageHandOne;
|
||||||
public int minDamageHandTwo;
|
protected int minDamageHandTwo;
|
||||||
public int maxDamageHandTwo;
|
protected int maxDamageHandTwo;
|
||||||
public float rangeHandOne;
|
protected float rangeHandOne;
|
||||||
public float rangeHandTwo;
|
protected float rangeHandTwo;
|
||||||
public float speedHandOne;
|
protected float speedHandOne;
|
||||||
public float speedHandTwo;
|
protected float speedHandTwo;
|
||||||
public int defenseRating;
|
public int defenseRating;
|
||||||
protected boolean isActive; // <-Do not use this for deleting character!
|
protected boolean isActive; // <-Do not use this for deleting character!
|
||||||
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
|
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
|
||||||
@@ -116,37 +114,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
protected boolean movingUp = false;
|
protected boolean movingUp = false;
|
||||||
private float desiredAltitude = 0;
|
private float desiredAltitude = 0;
|
||||||
private long takeOffTime = 0;
|
private long takeOffTime = 0;
|
||||||
|
private float hateValue = 0;
|
||||||
private long lastHateUpdate = 0;
|
private long lastHateUpdate = 0;
|
||||||
|
private boolean collided = false;
|
||||||
private byte aoecntr = 0;
|
private byte aoecntr = 0;
|
||||||
|
|
||||||
public int hidden = 0; // current rank of hide/sneak/invis
|
|
||||||
public CopyOnWriteArrayList<Integer> minions = new CopyOnWriteArrayList();
|
|
||||||
|
|
||||||
public ArrayList<CharacterRune> runes;
|
|
||||||
|
|
||||||
public AbstractCharacter() {
|
public AbstractCharacter() {
|
||||||
super();
|
super();
|
||||||
this.firstName = "";
|
|
||||||
this.lastName = "";
|
|
||||||
|
|
||||||
this.statStrCurrent = (short) 0;
|
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
this.statDexCurrent = (short) 0;
|
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
this.statConCurrent = (short) 0;
|
|
||||||
this.statIntCurrent = (short) 0;
|
|
||||||
this.statSpiCurrent = (short) 0;
|
|
||||||
|
|
||||||
this.unusedStatPoints = (short) 0;
|
|
||||||
|
|
||||||
this.level = (short) 0; // TODO get this from MobsBase later
|
|
||||||
this.exp = 1;
|
|
||||||
this.walkMode = true;
|
|
||||||
this.bindLoc = Vector3fImmutable.ZERO;
|
|
||||||
this.faceDir = Vector3fImmutable.ZERO;
|
|
||||||
|
|
||||||
this.runningTrains = (byte) 0;
|
|
||||||
|
|
||||||
this.skills = new ConcurrentHashMap<>();
|
|
||||||
this.powers = new ConcurrentHashMap<>();
|
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,6 +211,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
|
// Dangerous to use THIS in a constructor!!!
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -276,6 +255,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
|
// Dangerous to use THIS in a constructor!!!
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,6 +288,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
initializeCharacter();
|
initializeCharacter();
|
||||||
|
|
||||||
|
// Dangerous to use THIS in a constructor!!!
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -356,6 +339,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
|
// Dangerous to use THIS in a constructor!!!
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBankCapacity() {
|
public static int getBankCapacity() {
|
||||||
@@ -507,17 +493,23 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
boolean canFly = false;
|
boolean canFly = false;
|
||||||
PlayerBonuses bonus = flyer.getBonuses();
|
PlayerBonuses bonus = flyer.getBonuses();
|
||||||
|
|
||||||
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive())
|
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive()) {
|
||||||
canFly = true;
|
canFly = true;
|
||||||
|
}
|
||||||
|
if(flyer.effects.containsKey("MoveBuff")){
|
||||||
|
canFly = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return canFly;
|
return canFly;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void teleport(AbstractCharacter worldObject, final Vector3fImmutable targetLoc) {
|
public static void teleport(AbstractCharacter worldObject, final Vector3fImmutable targetLoc) {
|
||||||
|
Regions targetRegion = Regions.GetRegionForTeleport(targetLoc);
|
||||||
worldObject.locationLock.writeLock().lock();
|
worldObject.locationLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
MovementManager.translocate(worldObject, targetLoc);
|
MovementManager.translocate(worldObject, targetLoc, targetRegion);
|
||||||
if (worldObject.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (worldObject.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) worldObject);
|
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) worldObject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -769,7 +761,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public abstract Vector3fImmutable getBindLoc();
|
public abstract Vector3fImmutable getBindLoc();
|
||||||
|
|
||||||
public final void setBindLoc(final Vector3fImmutable value) {
|
public final void setBindLoc(final Vector3fImmutable value) {
|
||||||
this.bindLoc = value;
|
if(this.getObjectType().equals(GameObjectType.PlayerCharacter) && this.guild.getNation().equals(Guild.getErrantGuild())){
|
||||||
|
this.bindLoc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,20f);
|
||||||
|
}else {
|
||||||
|
this.bindLoc = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Vector3fImmutable getFaceDir() {
|
public final Vector3fImmutable getFaceDir() {
|
||||||
@@ -985,14 +981,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setLoc(final Vector3fImmutable value) {
|
public final void setLoc(final Vector3fImmutable value) {
|
||||||
Regions region = Regions.GetRegionForTeleport(value);
|
|
||||||
if(region != null){
|
|
||||||
this.region = region;
|
|
||||||
}
|
|
||||||
|
|
||||||
super.setLoc(value); // set the location in the world
|
super.setLoc(value); // set the location in the world
|
||||||
this.resetLastSetLocUpdate();
|
this.resetLastSetLocUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3fImmutable getMovementLoc() {
|
public Vector3fImmutable getMovementLoc() {
|
||||||
@@ -1112,7 +1102,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setCombatTarget(final AbstractWorldObject value) {
|
public final void setCombatTarget(final AbstractWorldObject value) {
|
||||||
|
|
||||||
if(this.getObjectTypeMask() == 2050) {//MOB?
|
if(this.getObjectTypeMask() == 2050) {//MOB?
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (this.isCombat()) {
|
if (this.isCombat()) {
|
||||||
@@ -1130,9 +1119,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.combatTarget = value;
|
this.combatTarget = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
||||||
@@ -1206,10 +1193,15 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final float modifyHealth(
|
public final float modifyHealth(float value, final AbstractCharacter attacker, final boolean fromCost) {
|
||||||
final float value,
|
|
||||||
final AbstractCharacter attacker,
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
final boolean fromCost) {
|
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||||
|
} // Health modifications are modified by the ZergMechanic
|
||||||
|
|
||||||
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||||
|
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||||
|
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -1249,29 +1241,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
CombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.getObjectType().equals(GameObjectType.Mob)){
|
|
||||||
//handle hate value addition
|
|
||||||
Mob target = (Mob)this;
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
||||||
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
|
|
||||||
if (target.isPlayerGuard()){
|
|
||||||
if(target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
|
|
||||||
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(this.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
City playerCity = ZoneManager.getCityAtLocation(this.loc);
|
|
||||||
if(playerCity != null){
|
|
||||||
if(!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
|
|
||||||
if(!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
|
|
||||||
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
|
|
||||||
playerCity.cityOutlaws.add(attacker.getObjectUUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newHealth - oldHealth;
|
return newHealth - oldHealth;
|
||||||
} finally {
|
} finally {
|
||||||
this.healthLock.writeLock().unlock();
|
this.healthLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -1291,11 +1265,19 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float modifyMana(
|
public final float modifyMana(
|
||||||
final float value,
|
float value,
|
||||||
final AbstractCharacter attacker,
|
final AbstractCharacter attacker,
|
||||||
final boolean fromCost
|
final boolean fromCost
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
|
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||||
|
} // Health modifications are modified by the ZergMechanic
|
||||||
|
|
||||||
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||||
|
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||||
|
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||||
|
|
||||||
if (!this.isAlive()) {
|
if (!this.isAlive()) {
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
@@ -1330,11 +1312,19 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float modifyStamina(
|
public final float modifyStamina(
|
||||||
final float value,
|
float value,
|
||||||
final AbstractCharacter attacker,
|
final AbstractCharacter attacker,
|
||||||
final boolean fromCost
|
final boolean fromCost
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||||
|
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||||
|
} // Health modifications are modified by the ZergMechanic
|
||||||
|
|
||||||
|
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||||
|
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||||
|
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||||
|
|
||||||
if (!this.isAlive()) {
|
if (!this.isAlive()) {
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
@@ -1457,9 +1447,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void teleport(final Vector3fImmutable targetLoc) {
|
public void teleport(final Vector3fImmutable targetLoc) {
|
||||||
|
Regions targetRegion = Regions.GetRegionForTeleport(targetLoc);
|
||||||
locationLock.writeLock().lock();
|
locationLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
MovementManager.translocate(this, targetLoc);
|
MovementManager.translocate(this, targetLoc, targetRegion);
|
||||||
MovementManager.sendRWSSMsg(this);
|
MovementManager.sendRWSSMsg(this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -1568,7 +1559,15 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
Effect eff = this.effects.get(s);
|
Effect eff = this.effects.get(s);
|
||||||
if (eff == null)
|
if (eff == null)
|
||||||
continue;
|
continue;
|
||||||
if (eff.cancelOnMove() && eff.cancel()) {
|
|
||||||
|
Boolean override = false;
|
||||||
|
if(this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
PlayerCharacter pc = (PlayerCharacter) this;
|
||||||
|
if (eff.getEffectsBase().getIDString().equals("INVIS-B") && s.equals("Invisible") && pc.getRace().getName().contains("Shade"))
|
||||||
|
override = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!override && eff.cancelOnMove() && eff.cancel()) {
|
||||||
//System.out.println("canceling on Move");
|
//System.out.println("canceling on Move");
|
||||||
eff.cancelJob();
|
eff.cancelJob();
|
||||||
this.effects.remove(s);
|
this.effects.remove(s);
|
||||||
@@ -1794,6 +1793,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.inBuildingID = inBuildingID;
|
this.inBuildingID = inBuildingID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getHateValue() {
|
||||||
|
if (this.hateValue <= 0) {
|
||||||
|
this.hateValue = 0;
|
||||||
|
return hateValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.lastHateUpdate == 0) {
|
||||||
|
this.lastHateUpdate = System.currentTimeMillis();
|
||||||
|
return this.hateValue;
|
||||||
|
}
|
||||||
|
long duration = System.currentTimeMillis() - this.lastHateUpdate;
|
||||||
|
//convert duration to seconds and multiply Hate Delimiter.
|
||||||
|
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
|
||||||
|
this.hateValue -= modAmount;
|
||||||
|
this.lastHateUpdate = System.currentTimeMillis();
|
||||||
|
return this.hateValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHateValue(float hateValue) {
|
||||||
|
this.lastHateUpdate = System.currentTimeMillis();
|
||||||
|
this.hateValue = hateValue;
|
||||||
|
}
|
||||||
|
|
||||||
public int getInFloorID() {
|
public int getInFloorID() {
|
||||||
return inFloorID;
|
return inFloorID;
|
||||||
}
|
}
|
||||||
@@ -1827,7 +1849,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//updates
|
//updates
|
||||||
public void update() {
|
public void update(Boolean newSystem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRegen() {
|
public void updateRegen() {
|
||||||
@@ -1847,16 +1869,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
try {
|
try {
|
||||||
switch (updateType) {
|
switch (updateType) {
|
||||||
case ALL:
|
case ALL:
|
||||||
update();
|
update(false);
|
||||||
break;
|
break;
|
||||||
case REGEN:
|
case REGEN:
|
||||||
updateRegen();
|
updateRegen();
|
||||||
break;
|
break;
|
||||||
case LOCATION:
|
case LOCATION:
|
||||||
update();
|
update(false);
|
||||||
break;
|
break;
|
||||||
case MOVEMENTSTATE:
|
case MOVEMENTSTATE:
|
||||||
update();
|
update(false);
|
||||||
break;
|
break;
|
||||||
case FLIGHT:
|
case FLIGHT:
|
||||||
updateFlight();
|
updateFlight();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package engine.objects;
|
package engine.objects;
|
||||||
|
|
||||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
@@ -33,19 +32,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
public boolean assist = false;
|
public boolean assist = false;
|
||||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||||
|
|
||||||
public AbstractCharacter guardCaptain;
|
|
||||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
|
||||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
|
||||||
;
|
|
||||||
public Enum.MobBehaviourType behaviourType;
|
|
||||||
public ArrayList<Vector3fImmutable> patrolPoints;
|
|
||||||
public int lastPatrolPointIndex = 0;
|
|
||||||
public long stopPatrolTime = 0;
|
|
||||||
public City guardedCity;
|
|
||||||
|
|
||||||
public AbstractIntelligenceAgent() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
||||||
super(rs);
|
super(rs);
|
||||||
@@ -101,8 +87,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.agentType = Enum.AIAgentType.CHARMED;
|
this.agentType = Enum.AIAgentType.CHARMED;
|
||||||
|
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
((Mob) this).setOwner(owner);
|
||||||
((Mob) this).guardCaptain = owner;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +110,14 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerCharacter getOwner() {
|
||||||
|
|
||||||
|
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||||
|
return this.getOwner();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getSafeZone() {
|
public boolean getSafeZone() {
|
||||||
|
|
||||||
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
||||||
@@ -163,11 +156,9 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.setCombatTarget(null);
|
this.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear owner and set not alive
|
//clear owner
|
||||||
|
|
||||||
this.isAlive.set(false);
|
PlayerCharacter owner = this.getOwner();
|
||||||
|
|
||||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
|
||||||
|
|
||||||
//close pet window
|
//close pet window
|
||||||
|
|
||||||
@@ -183,7 +174,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
owner.setPet(null);
|
owner.setPet(null);
|
||||||
|
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||||
this.guardCaptain = null;
|
((Mob) this).setOwner(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
this.effects.remove(name);
|
this.effects.remove(name);
|
||||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (this.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
if (name.equals("Flight")) {
|
if (name.equals("Flight")) {
|
||||||
((PlayerCharacter) this).update();
|
((PlayerCharacter) this).update(false);
|
||||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,9 +357,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
Mob mob = (Mob) this;
|
Mob mob = (Mob) this;
|
||||||
if (mob.isSiege()) {
|
if (mob.isSiege()) {
|
||||||
if (mob.isPet()) {
|
if (mob.isPet()) {
|
||||||
|
PlayerCharacter petOwner = mob.getOwner();
|
||||||
|
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
|
|
||||||
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
||||||
petOwner.dismissPet();
|
petOwner.dismissPet();
|
||||||
return;
|
return;
|
||||||
@@ -387,7 +385,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
if (source.equals("Flight")) {
|
if (source.equals("Flight")) {
|
||||||
//ground player
|
//ground player
|
||||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
((PlayerCharacter) this).update();
|
((PlayerCharacter) this).update(false);
|
||||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,7 +414,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
if (source.equals("Flight")) {
|
if (source.equals("Flight")) {
|
||||||
//ground player
|
//ground player
|
||||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
((PlayerCharacter) this).update();
|
((PlayerCharacter) this).update(false);
|
||||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -502,13 +500,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
return;
|
return;
|
||||||
this.lastLoc = new Vector3fImmutable(this.loc);
|
this.lastLoc = new Vector3fImmutable(this.loc);
|
||||||
this.loc = loc;
|
this.loc = loc;
|
||||||
|
this.loc = this.loc.setY(HeightMap.getWorldHeight(this) + this.getAltitude());
|
||||||
if(this instanceof AbstractCharacter && this.region != null){
|
|
||||||
this.loc = this.loc.setY(this.region.lerpY(this) + this.getAltitude());
|
|
||||||
} else{
|
|
||||||
this.loc = this.loc.setY(HeightMap.getWorldHeight(this.getLoc()) + this.getAltitude());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//lets not add mob to world grid if he is currently despawned.
|
//lets not add mob to world grid if he is currently despawned.
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob) && ((Mob) this).despawned)
|
if (this.getObjectType().equals(GameObjectType.Mob) && ((Mob) this).despawned)
|
||||||
@@ -616,6 +608,9 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
this.movingUp = movingUp;
|
this.movingUp = movingUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRegion(Regions region) {
|
||||||
|
this.region = region;
|
||||||
|
}
|
||||||
|
|
||||||
//used for interestmanager loading and unloading objects to client.
|
//used for interestmanager loading and unloading objects to client.
|
||||||
// if not in grid, unload from player.
|
// if not in grid, unload from player.
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package engine.objects;
|
||||||
|
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.gameManager.ArenaManager;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.MovementManager;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class Arena {
|
||||||
|
public PlayerCharacter player1;
|
||||||
|
public PlayerCharacter player2;
|
||||||
|
public Long startTime;
|
||||||
|
public Vector3fImmutable loc;
|
||||||
|
|
||||||
|
public Arena(){
|
||||||
|
|
||||||
|
}
|
||||||
|
public Boolean disqualify() {
|
||||||
|
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(this.loc, 250f, MBServerStatics.MASK_PLAYER);
|
||||||
|
HashSet<AbstractWorldObject> warningRange = WorldGrid.getObjectsInRangePartial(this.loc, 500f, MBServerStatics.MASK_PLAYER);
|
||||||
|
for(AbstractWorldObject obj : warningRange){
|
||||||
|
PlayerCharacter pc = (PlayerCharacter)obj;
|
||||||
|
if(pc.equals(this.player1) || pc.equals(this.player2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ChatManager.chatSystemInfo(pc, "WARNING!! You are entering an arena zone!");
|
||||||
|
}
|
||||||
|
//boot out all non competitors
|
||||||
|
for(AbstractWorldObject obj : inRange){
|
||||||
|
if(obj.equals(this.player1))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(obj.equals(this.player2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PlayerCharacter intruder = (PlayerCharacter)obj;
|
||||||
|
MovementManager.translocate(intruder,new Vector3fImmutable(88853,32,45079),Regions.GetRegionForTeleport(new Vector3fImmutable(88853,32,45079)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inRange.contains(this.player1) && inRange.contains(this.player2)) {
|
||||||
|
ArenaManager.endArena(this,this.player2,this.player1,"Player Has Left Arena");
|
||||||
|
return true;
|
||||||
|
} else if (!inRange.contains(this.player2) && inRange.contains(this.player1)) {
|
||||||
|
ArenaManager.endArena(this,this.player1,this.player2,"Player Has Left Arena");
|
||||||
|
return true;
|
||||||
|
}else if (!inRange.contains(this.player2) && !inRange.contains(this.player1)) {
|
||||||
|
ArenaManager.endArena(this,null,null,"Both Parties Have Left The Arena");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean checkToComplete(){
|
||||||
|
|
||||||
|
if(this.startTime == null)
|
||||||
|
this.startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - this.startTime < 10000L)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(this.disqualify())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!this.player1.isAlive() && this.player2.isAlive()){
|
||||||
|
ArenaManager.endArena(this,this.player2,this.player1,"Player Has Died");
|
||||||
|
return true;
|
||||||
|
} else if(this.player1.isAlive() && !this.player2.isAlive()){
|
||||||
|
ArenaManager.endArena(this,this.player1,this.player2,"Player Has Died");
|
||||||
|
return true;
|
||||||
|
} else if(!this.player1.isAlive() && !this.player2.isAlive()){
|
||||||
|
ArenaManager.endArena(this,null,null,"Both Players Have Died");
|
||||||
|
return true;
|
||||||
|
} else if(this.startTime + 300000L < System.currentTimeMillis()){
|
||||||
|
ArenaManager.endArena(this,null,null,"Time Has Elapsed");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,19 +14,19 @@ import engine.Enum.ProtectionState;
|
|||||||
import engine.Enum.SiegePhase;
|
import engine.Enum.SiegePhase;
|
||||||
import engine.Enum.SiegeResult;
|
import engine.Enum.SiegeResult;
|
||||||
import engine.InterestManagement.HeightMap;
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.archive.BaneRecord;
|
import engine.db.archive.BaneRecord;
|
||||||
import engine.db.archive.DataWarehouse;
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.*;
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.ActivateBaneJob;
|
import engine.jobs.ActivateBaneJob;
|
||||||
import engine.jobs.BaneDefaultTimeJob;
|
import engine.jobs.BaneDefaultTimeJob;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
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.CityDataMsg;
|
||||||
import engine.net.client.msg.PlaceAssetMsg;
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
@@ -37,6 +37,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public final class Bane {
|
public final class Bane {
|
||||||
@@ -48,6 +49,10 @@ public final class Bane {
|
|||||||
private DateTime placementDate = null;
|
private DateTime placementDate = null;
|
||||||
private DateTime liveDate = null;
|
private DateTime liveDate = null;
|
||||||
private BaneDefaultTimeJob defaultTimeJob;
|
private BaneDefaultTimeJob defaultTimeJob;
|
||||||
|
public boolean timeSet = false;
|
||||||
|
public boolean daySet = false;
|
||||||
|
public boolean capSet = false;
|
||||||
|
public int capSize = 10;
|
||||||
|
|
||||||
// Internal cache for banes
|
// Internal cache for banes
|
||||||
private ActivateBaneJob activateBaneJob;
|
private ActivateBaneJob activateBaneJob;
|
||||||
@@ -64,6 +69,12 @@ public final class Bane {
|
|||||||
this.ownerUUID = rs.getInt("ownerUUID");
|
this.ownerUUID = rs.getInt("ownerUUID");
|
||||||
this.stoneUUID = rs.getInt("stoneUUID");
|
this.stoneUUID = rs.getInt("stoneUUID");
|
||||||
|
|
||||||
|
this.timeSet = rs.getInt("time_set") == 1;
|
||||||
|
this.daySet = rs.getInt("day_set") == 1;
|
||||||
|
this.capSet = rs.getInt("cap_set") == 1;
|
||||||
|
this.capSize = rs.getInt("cap_size");
|
||||||
|
|
||||||
|
|
||||||
sqlDateTime = rs.getTimestamp("placementDate");
|
sqlDateTime = rs.getTimestamp("placementDate");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
@@ -100,12 +111,11 @@ public final class Bane {
|
|||||||
abtj = new ActivateBaneJob(cityUUID);
|
abtj = new ActivateBaneJob(cityUUID);
|
||||||
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
||||||
this.activateBaneJob = abtj;
|
this.activateBaneJob = abtj;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.liveDate == null)
|
//add bane commander NPC
|
||||||
setDefaultTime();
|
//summonBaneCommander(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) {
|
public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) {
|
||||||
@@ -266,9 +276,58 @@ public final class Bane {
|
|||||||
BaneRecord baneRecord = BaneRecord.borrow(bane, Enum.RecordEventType.PENDING);
|
BaneRecord baneRecord = BaneRecord.borrow(bane, Enum.RecordEventType.PENDING);
|
||||||
DataWarehouse.pushToWarehouse(baneRecord);
|
DataWarehouse.pushToWarehouse(baneRecord);
|
||||||
|
|
||||||
|
//add bane commander NPC
|
||||||
|
summonBaneCommander(bane);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//update map for all players online
|
||||||
|
for (PlayerCharacter playerCharacter : SessionManager.getAllActivePlayerCharacters()) {
|
||||||
|
CityDataMsg cityDataMsg = new CityDataMsg(SessionManager.getSession(playerCharacter), false);
|
||||||
|
cityDataMsg.updateMines(true);
|
||||||
|
cityDataMsg.updateCities(true);
|
||||||
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void summonBaneCommander(Bane bane){
|
||||||
|
Vector3fImmutable spawnLoc = Vector3fImmutable.getRandomPointOnCircle(bane.getStone().loc,6);
|
||||||
|
NPC baneCommander;
|
||||||
|
int commanderuuid = DbManager.NPCQueries.BANE_COMMANDER_EXISTS(bane.getStone().getObjectUUID());
|
||||||
|
|
||||||
|
if(commanderuuid == 0) {
|
||||||
|
//add bane commander NPC
|
||||||
|
int contractID = 1502042;
|
||||||
|
baneCommander = NPC.createNPC("Bane Commander", contractID, spawnLoc, bane.getCity().getGuild(), ZoneManager.findSmallestZone(bane.getStone().loc), (short) 70, bane.getStone());
|
||||||
|
try {
|
||||||
|
NPCManager.slotCharacterInBuilding(baneCommander);
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
WorldGrid.addObject(baneCommander,spawnLoc.x,spawnLoc.z);
|
||||||
|
WorldGrid.updateObject(baneCommander);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
baneCommander = NPC.getNPC(commanderuuid);
|
||||||
|
}
|
||||||
|
//try {
|
||||||
|
// NPCManager.slotCharacterInBuilding(baneCommander);
|
||||||
|
//}catch (Exception e){
|
||||||
|
//swallow it
|
||||||
|
//}
|
||||||
|
baneCommander.runAfterLoad();
|
||||||
|
//baneCommander.setLoc(spawnLoc);
|
||||||
|
InterestManager.setObjectDirty(baneCommander);
|
||||||
|
|
||||||
|
baneCommander.updateLocation();
|
||||||
|
}
|
||||||
|
|
||||||
public static Bane getBane(int cityUUID) {
|
public static Bane getBane(int cityUUID) {
|
||||||
|
|
||||||
Bane outBane;
|
Bane outBane;
|
||||||
@@ -381,8 +440,12 @@ public final class Bane {
|
|||||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
||||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
||||||
|
|
||||||
if (currentTime.isAfter(timeToSetDefault))
|
if (currentTime.isAfter(timeToSetDefault)){
|
||||||
this.setLiveDate(defaultTime);
|
DbManager.BaneQueries.SET_BANE_CAP_NEW(20,this.getCityUUID());
|
||||||
|
DbManager.BaneQueries.SET_BANE_TIME_NEW(9,this.getCityUUID());
|
||||||
|
DbManager.BaneQueries.SET_BANE_DAY_NEW(3,this.getCityUUID());
|
||||||
|
}
|
||||||
|
//this.setLiveDate(defaultTime);
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (this.defaultTimeJob != null)
|
if (this.defaultTimeJob != null)
|
||||||
@@ -448,6 +511,16 @@ public final class Bane {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Remove bane commander NPC
|
||||||
|
if(!baneStone.getHirelings().isEmpty()) {
|
||||||
|
NPC npc = (NPC)baneStone.getHirelings().keySet().stream().findFirst().orElse(null);
|
||||||
|
if(npc != null) {
|
||||||
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
DbManager.removeFromCache(npc);
|
||||||
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
|
WorldGrid.removeObject(npc);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Remove object from simulation
|
// Remove object from simulation
|
||||||
|
|
||||||
baneStone.removeFromCache();
|
baneStone.removeFromCache();
|
||||||
@@ -469,6 +542,9 @@ public final class Bane {
|
|||||||
return liveDate;
|
return liveDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLiveDate_NEW(DateTime baneTime) {
|
||||||
|
|
||||||
|
}
|
||||||
public void setLiveDate(DateTime baneTime) {
|
public void setLiveDate(DateTime baneTime) {
|
||||||
|
|
||||||
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
|
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
|
||||||
@@ -644,4 +720,63 @@ public final class Bane {
|
|||||||
return cityUUID;
|
return cityUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void applyZergBuffs(){
|
||||||
|
City city = this.getCity();
|
||||||
|
if(city == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
city.onEnter();
|
||||||
|
|
||||||
|
ArrayList<Integer> attackers = new ArrayList<>();
|
||||||
|
ArrayList<Integer> defenders = new ArrayList<>();
|
||||||
|
Guild attackNation = this.getOwner().getGuild().getNation();
|
||||||
|
Guild defendNation = this.getCity().getGuild().getNation();
|
||||||
|
HashSet<AbstractWorldObject> inSiegeRange = WorldGrid.getObjectsInRangePartial(city.getTOL().loc,1750f,1);
|
||||||
|
for(AbstractWorldObject obj : inSiegeRange){
|
||||||
|
int uuid = obj.getObjectUUID();
|
||||||
|
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||||
|
if(player == null)
|
||||||
|
continue;
|
||||||
|
Guild playerNation = player.guild.getNation();
|
||||||
|
//separate the players into categories
|
||||||
|
if(playerNation.equals(defendNation))
|
||||||
|
defenders.add(uuid);
|
||||||
|
else if(playerNation.equals(attackNation))
|
||||||
|
attackers.add(uuid);
|
||||||
|
else
|
||||||
|
MovementManager.translocate(player,Vector3fImmutable.getRandomPointOnCircle(ZoneManager.getZoneByUUID(656).getLoc(),30f),Regions.GetRegionForTeleport(ZoneManager.getZoneByUUID(656).getLoc()));
|
||||||
|
}
|
||||||
|
int attackerSize = 0;
|
||||||
|
int defenderSize = 0;
|
||||||
|
for(int uuid : city.baneAttendees.keySet()){
|
||||||
|
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||||
|
if(player == null)
|
||||||
|
continue;
|
||||||
|
if(player.guild.getNation().equals(defendNation))
|
||||||
|
defenderSize += 1;
|
||||||
|
else if(player.guild.getNation().equals(attackNation))
|
||||||
|
attackerSize += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//apply zerg mechanic for attackers
|
||||||
|
float attackerMultiplier = ZergManager.getCurrentMultiplier(attackerSize,this.capSize);
|
||||||
|
float defenderMultiplier = ZergManager.getCurrentMultiplier(defenderSize,this.capSize);
|
||||||
|
for(int uuid : attackers){
|
||||||
|
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||||
|
if(inSiegeRange.contains(player)) //player is still physically here, needs updated multiplier
|
||||||
|
player.ZergMultiplier = attackerMultiplier;
|
||||||
|
else
|
||||||
|
player.ZergMultiplier = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int uuid : defenders){
|
||||||
|
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||||
|
if(inSiegeRange.contains(player)) //player is still physically here, needs updated multiplier
|
||||||
|
player.ZergMultiplier = defenderMultiplier;
|
||||||
|
else
|
||||||
|
player.ZergMultiplier = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/* @Summary - Blueprint class is used for determining
|
/* @Summary - Blueprint class is used for determining
|
||||||
characteristics of instanced player owned
|
characteristics of instanced player owned
|
||||||
@@ -60,13 +61,12 @@ public class Blueprint {
|
|||||||
this.name = rs.getString("MeshName");
|
this.name = rs.getString("MeshName");
|
||||||
this.icon = rs.getInt("Icon");
|
this.icon = rs.getInt("Icon");
|
||||||
this.buildingGroup = BuildingGroup.valueOf(rs.getString("BuildingGroup"));
|
this.buildingGroup = BuildingGroup.valueOf(rs.getString("BuildingGroup"));
|
||||||
this.maxRank = rs.getInt("MaxRank");
|
|
||||||
this.maxSlots = rs.getInt("MaxSlots");
|
this.maxSlots = rs.getInt("MaxSlots");
|
||||||
this.rank1UUID = rs.getInt("Rank1UUID");
|
this.rank1UUID = rs.getInt("Rank1UUID");
|
||||||
this.rank3UUID = rs.getInt("Rank3UUID");
|
this.rank3UUID = rs.getInt("Rank3UUID");
|
||||||
this.rank7UUID = rs.getInt("Rank7UUID");
|
this.rank7UUID = rs.getInt("Rank7UUID");
|
||||||
this.destroyedUUID = rs.getInt("DestroyedUUID");
|
this.destroyedUUID = rs.getInt("DestroyedUUID");
|
||||||
|
this.maxRank = rs.getInt("MaxRank");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
@@ -108,9 +108,11 @@ public class Blueprint {
|
|||||||
maxShrines = 2;
|
maxShrines = 2;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
case 8:
|
|
||||||
maxShrines = 3;
|
maxShrines = 3;
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
maxShrines = 4;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
maxShrines = 0;
|
maxShrines = 0;
|
||||||
|
|
||||||
@@ -167,20 +169,48 @@ public class Blueprint {
|
|||||||
// based upon the building's current rank
|
// based upon the building's current rank
|
||||||
|
|
||||||
public static int getNpcMaintCost(int rank) {
|
public static int getNpcMaintCost(int rank) {
|
||||||
int maintCost = Integer.MAX_VALUE;
|
return 0;
|
||||||
|
|
||||||
maintCost = (9730 * rank) + 1890;
|
|
||||||
|
|
||||||
return maintCost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxRank() {
|
public int getMaxRank() {
|
||||||
|
BuildingGroup bg = this.buildingGroup;
|
||||||
|
switch(bg){
|
||||||
|
case AMAZONHALL:
|
||||||
|
case CATHEDRAL:
|
||||||
|
case GREATHALL:
|
||||||
|
case KEEP:
|
||||||
|
case THIEFHALL:
|
||||||
|
case TEMPLEHALL:
|
||||||
|
case WIZARDHALL:
|
||||||
|
case ELVENHALL:
|
||||||
|
case ELVENSANCTUM:
|
||||||
|
case IREKEIHALL:
|
||||||
|
case FORESTHALL:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return maxRank;
|
return maxRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSlots() {
|
public int getMaxSlots() {
|
||||||
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.BARRACK))
|
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.BARRACK))
|
||||||
return 1;
|
return 1;
|
||||||
|
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.TOL))
|
||||||
|
return 4;
|
||||||
|
BuildingGroup bg = this.buildingGroup;
|
||||||
|
switch(bg){
|
||||||
|
case AMAZONHALL:
|
||||||
|
case CATHEDRAL:
|
||||||
|
case GREATHALL:
|
||||||
|
case KEEP:
|
||||||
|
case THIEFHALL:
|
||||||
|
case TEMPLEHALL:
|
||||||
|
case WIZARDHALL:
|
||||||
|
case ELVENHALL:
|
||||||
|
case ELVENSANCTUM:
|
||||||
|
case IREKEIHALL:
|
||||||
|
case FORESTHALL:
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
return maxSlots;
|
return maxSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,10 +342,24 @@ public class Blueprint {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Early exit for buildings with single or no slots
|
// Early exit for buildings with single or no slots
|
||||||
|
if (this.maxSlots <= 1 && !this.buildingGroup.equals(BuildingGroup.TOL))
|
||||||
if (this.maxSlots <= 1)
|
|
||||||
return maxSlots;
|
return maxSlots;
|
||||||
|
|
||||||
|
BuildingGroup bg = this.buildingGroup;
|
||||||
|
switch(bg.name()) {
|
||||||
|
case "AMAZONHALL":
|
||||||
|
case "CATHEDRAL":
|
||||||
|
case "GREATHALL":
|
||||||
|
case "THIEFHALL":
|
||||||
|
case "TEMPLEHALL":
|
||||||
|
case "WIZARDHALL":
|
||||||
|
case "ELVENHALL":
|
||||||
|
case "ELVENSANCTUM":
|
||||||
|
case "IREKEIHALL":
|
||||||
|
case "FORESTHALL":
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.maxRank == 1 && currentRank == 1)
|
if (this.maxRank == 1 && currentRank == 1)
|
||||||
return getMaxSlots();
|
return getMaxSlots();
|
||||||
|
|
||||||
@@ -327,20 +371,22 @@ public class Blueprint {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
availableSlots = 2;
|
availableSlots = 2;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
availableSlots = 3;
|
availableSlots = 3;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
availableSlots = 1;
|
availableSlots = 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
availableSlots = 0;
|
availableSlots = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.TOL))
|
||||||
|
availableSlots += 1;
|
||||||
|
|
||||||
return availableSlots;
|
return availableSlots;
|
||||||
}
|
}
|
||||||
@@ -603,26 +649,14 @@ public class Blueprint {
|
|||||||
return this.blueprintUUID;
|
return this.blueprintUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaintCost(int rank) {
|
public int getMaintCost() {
|
||||||
|
|
||||||
int maintCost = Integer.MAX_VALUE;
|
int maintCost = Integer.MAX_VALUE;
|
||||||
|
|
||||||
switch (this.buildingGroup) {
|
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||||
case TOL:
|
return 3000000;
|
||||||
case BARRACK:
|
}else{
|
||||||
maintCost = (61500 * rank) + 19500;
|
return 0;
|
||||||
break;
|
|
||||||
case SPIRE:
|
|
||||||
maintCost = (4800 * rank) + 1200;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (maxRank == 1)
|
|
||||||
maintCost = 22500;
|
|
||||||
else
|
|
||||||
maintCost = (15900 * rank) + 3300;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return maintCost;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,22 @@ public class Building extends AbstractWorldObject {
|
|||||||
this.setHealth(healthMax);
|
this.setHealth(healthMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.ownerIsNPC){
|
||||||
|
//add extra HP for city walls of R8 trees
|
||||||
|
City city = ZoneManager.getCityAtLocation(this.loc);
|
||||||
|
if(city != null){
|
||||||
|
Building ToL = city.getTOL();
|
||||||
|
if(ToL != null){
|
||||||
|
if(ToL.rank == 8){
|
||||||
|
float currentHealth = this.health.get();
|
||||||
|
float newHealth = (currentHealth/this.healthMax) * (this.healthMax * 1.1f);
|
||||||
|
this.healthMax *= 1.1f;
|
||||||
|
this.setHealth(newHealth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Null out blueprint if not needed (npc building)
|
// Null out blueprint if not needed (npc building)
|
||||||
|
|
||||||
if (blueprintUUID == 0)
|
if (blueprintUUID == 0)
|
||||||
@@ -537,18 +553,6 @@ public class Building extends AbstractWorldObject {
|
|||||||
if (value < 0)
|
if (value < 0)
|
||||||
Mine.SendMineAttackMessage(this);
|
Mine.SendMineAttackMessage(this);
|
||||||
|
|
||||||
City playerCity = ZoneManager.getCityAtLocation(this.loc);
|
|
||||||
if(playerCity != null){
|
|
||||||
if(this.getGuild().getNation().equals(playerCity.getTOL().getGuild().getNation())){
|
|
||||||
//friendly building has been attacked, add attacker to city outlaw list
|
|
||||||
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()) && attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
|
||||||
playerCity.cityOutlaws.add(attacker.getObjectUUID());
|
|
||||||
for(Mob guard : playerCity.getParent().zoneMobSet)
|
|
||||||
if(guard.combatTarget == null)
|
|
||||||
guard.setCombatTarget(attacker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newHealth - oldHealth;
|
return newHealth - oldHealth;
|
||||||
|
|
||||||
|
|
||||||
@@ -792,24 +796,9 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
public int getMaintCost() {
|
public int getMaintCost() {
|
||||||
|
|
||||||
int maintCost = 0;
|
if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
|
||||||
|
return 3000000;
|
||||||
// Add cost for building structure
|
else return 0;
|
||||||
|
|
||||||
maintCost += this.getBlueprint().getMaintCost(rank);
|
|
||||||
|
|
||||||
// Add costs associated with hirelings
|
|
||||||
|
|
||||||
for (AbstractCharacter npc : this.hirelings.keySet()) {
|
|
||||||
|
|
||||||
if (npc.getObjectType() != GameObjectType.NPC)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
|
||||||
maintCost += Blueprint.getNpcMaintCost(npc.getRank());
|
|
||||||
}
|
|
||||||
|
|
||||||
return maintCost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void submitOpenDoorJob(int doorID) {
|
public final void submitOpenDoorJob(int doorID) {
|
||||||
@@ -848,6 +837,10 @@ public class Building extends AbstractWorldObject {
|
|||||||
return this.meshScale;
|
return this.meshScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMeshScale(Vector3f scale) {
|
||||||
|
this.meshScale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
public final int getMeshUUID() {
|
public final int getMeshUUID() {
|
||||||
return this.meshUUID;
|
return this.meshUUID;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user