Compare commits
627 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 24215e21c9 | |||
| 3accd779b9 | |||
| 1d673ca2e5 | |||
| c935ea1986 | |||
| 678ccafd3c | |||
| 31292785a5 | |||
| cdc4717033 | |||
| 35c8ac0289 | |||
| f5cc4a3290 | |||
| 74bd7ddb8b | |||
| 4feb95131c | |||
| d22ba7b89d | |||
| 722fd14be5 | |||
| 12e73d59c7 | |||
| 5c70f15064 | |||
| 8ca641f353 | |||
| 0f9500a0d7 | |||
| 0d51afb737 | |||
| 60e331de1a | |||
| 4a554b0d61 | |||
| 3f3d85fb36 | |||
| d2d655a839 | |||
| 0096b8051c | |||
| 86102c8933 | |||
| f06e2c2e5c | |||
| 74b425e567 | |||
| 22c8cdcf65 | |||
| 7ed026f088 | |||
| 232c381e96 | |||
| 69ea460d5e | |||
| cbe9a30590 | |||
| 1bbbc396bd | |||
| 8601f9fcd5 | |||
| 7f029fd0e2 | |||
| cc7188b404 | |||
| aa0621bb02 | |||
| b4ff1a3f7f | |||
| 9d6b1dcf60 | |||
| 6e123ecb86 | |||
| 2b8b9464af | |||
| cd8099b42f | |||
| 2cdcba47a5 | |||
| b7b4623c75 | |||
| 2d958b929d | |||
| e8f0e9f5de | |||
| 03f0f3fcf0 | |||
| 65db64d3df | |||
| 5a25958aa5 | |||
| 1f8c5495ab | |||
| a54aa03ade | |||
| e82445fcd2 | |||
| 9e9716fc88 | |||
| 4f01da368c | |||
| 93c4103f61 | |||
| f8180a7000 | |||
| 634f1478ce | |||
| 7335946c10 | |||
| fb4eea67ed | |||
| 96ba17f67a | |||
| ff17cacda7 | |||
| 4d6ce2b155 | |||
| b2c9331899 | |||
| 1cb01b1cce | |||
| e79fd0c3b4 | |||
| 6dd1d97be5 | |||
| 805034e30b | |||
| 9646964698 | |||
| 9ffaf96017 | |||
| ce98f80b85 | |||
| f683201086 | |||
| 4796f7042d | |||
| 94ff3cf222 | |||
| 174be35cac | |||
| ba266e506a | |||
| 4123157b92 | |||
| 7bb9aeacf7 | |||
| 1eda55a3f1 | |||
| f670e3143c | |||
| d55b57f7d0 | |||
| ea2f6f4593 | |||
| b592f050c2 | |||
| 25f522c539 | |||
| e89404abda | |||
| ad2cde9d85 | |||
| ba94fabfb8 | |||
| f7ab38e9a8 | |||
| 0d97fa614b | |||
| 6878916874 | |||
| c545468f26 | |||
| 7993fb22d2 | |||
| 19bdb89c0f | |||
| 6b0b0cc357 | |||
| bc1ae9a2c9 | |||
| 408e3a45ca | |||
| 52e0b5be4d | |||
| 161335da26 | |||
| 7f1bc2a4b7 | |||
| e37a4fab38 | |||
| 2760a45d2f | |||
| 77673fde5f | |||
| 5fd4e5a088 | |||
| b01b62ac3d | |||
| 7193ff7698 | |||
| dd72e20ff9 | |||
| f465ea4045 | |||
| 973dfc94f7 | |||
| a5255bcf11 | |||
| ec35228de9 | |||
| 47a93f6545 | |||
| 0cff40070b | |||
| 3f3fb53675 | |||
| b198dbcc09 | |||
| 60b8843563 | |||
| eff8be91d6 | |||
| 55e2d3fb5e | |||
| a6f417d9cc | |||
| 7b1b09dc40 | |||
| 5724608005 | |||
| f5d410f868 | |||
| a5c1422534 | |||
| 6df0e5625c | |||
| 5de932b095 | |||
| db7d606b36 | |||
| 30d302c43e | |||
| 95cfc43956 | |||
| 7c8d78581e | |||
| 6f4a9f7d1a | |||
| 7a5569ab89 | |||
| 042f7c675f | |||
| 3c4d8239db | |||
| 4f20cc9aba | |||
| 34812694b7 | |||
| 0bbbcbaa81 | |||
| 72172b9f05 | |||
| 1876e09b48 | |||
| 31c83f2bb5 | |||
| 065aa34652 | |||
| 8bbaae418d | |||
| 10db850de4 | |||
| 753c3686ea | |||
| f4bd928796 | |||
| 916a12a434 | |||
| 3a8521683b | |||
| df4d5a654f | |||
| 7fb5d7d23d | |||
| a7c9a15405 | |||
| b3b115e9ba | |||
| 1b5a64d8fc | |||
| 01f0e25e08 | |||
| 0782814c8e | |||
| 111ba02289 | |||
| f09a7d4d12 | |||
| e1e72b71bd | |||
| 4dce2e2aa2 | |||
| 743c897254 | |||
| f134f71695 | |||
| 91016dd53c | |||
| 39d04188b4 | |||
| c99433c9bd | |||
| 6cc94e076d | |||
| f294e48140 | |||
| c25f325f87 | |||
| ac0c11cb46 | |||
| 79e86e0a6f | |||
| 46f35f0b10 | |||
| 1b20201f8d | |||
| 0d744d900c | |||
| 9a8e0bd5c9 | |||
| 6b6be80fa8 | |||
| c2152432ce | |||
| 9348852e2c | |||
| 4b67f97ded | |||
| 2a9463be4e | |||
| 67bc13dcde | |||
| 7d6407fbf5 | |||
| 7b6f5f752b | |||
| ef43211103 | |||
| b312904548 | |||
| 3b1db51a5e | |||
| 17011de201 | |||
| f03edf5c5d | |||
| 320f06e1db | |||
| 78480ca3dd | |||
| 2e5f8701df | |||
| 3a514dc771 | |||
| c0b93ff809 | |||
| 31037c9324 | |||
| 2464deb3f3 | |||
| dbf42bfbef | |||
| e80cdc192d | |||
| 9850b54981 | |||
| a3a30f3f8a | |||
| 4d0018b176 | |||
| a9dcac0ad7 | |||
| adaa521bf5 | |||
| 0fe04041f6 | |||
| 9dd2e1d5e5 | |||
| 81d6054982 | |||
| ff2e381999 | |||
| e1d43ce0d0 | |||
| a906e30931 | |||
| 6a17f93e41 | |||
| 1edd4d681b | |||
| 911698a7e3 | |||
| 4fa646ce94 | |||
| bcb40fecbb | |||
| 147b9a42c4 | |||
| 81f86ceca9 | |||
| e2dbc19adc | |||
| d590511035 | |||
| f48b9f10e1 | |||
| 2607962038 | |||
| 4e05c2ab74 | |||
| 6cbcef00aa | |||
| a76fd9f319 | |||
| 8d7d3227cb | |||
| 9102fe1f6c | |||
| d999d00755 | |||
| a7e953ac20 | |||
| 46b4c110e5 | |||
| 30787f7ae2 | |||
| 9de1afa0fd | |||
| 9efba13b03 | |||
| d7ac838b6d | |||
| 50a169149f | |||
| de65f6bcef | |||
| 2adaff8f66 | |||
| e8032f65d1 | |||
| e710cf0930 | |||
| 286a76b1de | |||
| 73e30062ea | |||
| 7300af9073 | |||
| 2a2b61bc0f | |||
| 89c3eb4d47 | |||
| c03f464043 | |||
| 7b7492b5cc | |||
| 684a5459b3 | |||
| bb5904552a | |||
| fb9d65b54d | |||
| a53848334f | |||
| 19c6cd76a9 | |||
| d92b1c7473 | |||
| 07a5de2c57 | |||
| d0a837783e | |||
| 576f4af433 | |||
| 8ce81b144a | |||
| fcbb9b0cf1 | |||
| 4f115291eb | |||
| 79079e200a | |||
| dbab8f66da | |||
| 1d847d781b | |||
| 7604b7b07f | |||
| 8818282341 | |||
| 475ccaff0c | |||
| ba47b30673 | |||
| d557e30716 | |||
| 6499a16cc2 | |||
| a851d9a6ec | |||
| c09ae5d32f | |||
| 27d140f703 | |||
| 41aefa4a48 | |||
| 4723eb4bf2 | |||
| 28c6953c3d | |||
| 746a95e7d5 | |||
| 0e7336b8c6 | |||
| 11013bcd07 | |||
| 63c7fb08e0 | |||
| 6f39767fb4 | |||
| 2de1f78f22 | |||
| 98b73d978a | |||
| 5a62361edd | |||
| 127f80054f | |||
| 41b1718df1 | |||
| d3b1cf9928 | |||
| 7f8c297ae2 | |||
| 979cd70d65 | |||
| 35945f7542 | |||
| 84233ecdd6 | |||
| 4d601f13a0 | |||
| 1911de0757 | |||
| e00871324e | |||
| 0286b63a8e | |||
| a84c712110 | |||
| 8e93e82526 | |||
| 67bf8c2b11 | |||
| b8dbcb62db | |||
| bb5d257ae8 | |||
| 2391bd6606 | |||
| dc83bee227 | |||
| 3ff7414fb4 | |||
| 1e5790e6b9 | |||
| 364fb40e0b | |||
| 6a72a83076 | |||
| a83008ea4f | |||
| 89f672e0b0 | |||
| cc324777d1 | |||
| 692e7ec416 | |||
| 6cba850af5 | |||
| f3e266cf46 | |||
| ac347db0c8 | |||
| 70e6756651 | |||
| a46205b67b | |||
| 80aa413ea8 | |||
| 98d03620bc | |||
| cca4521c93 | |||
| a859150a20 | |||
| d64bd193d8 | |||
| d0df406236 | |||
| 92c8430031 | |||
| 99671697ba | |||
| 171c79dcf6 | |||
| 726d471e95 | |||
| c0ed59f14f | |||
| c19c516669 | |||
| 589ea1bce8 | |||
| c133b2da5c | |||
| 24a05543c8 | |||
| 90271890d7 | |||
| 225dc2af18 | |||
| 501c68b1e3 | |||
| 13a75fcd5d | |||
| 1bc3609cbe | |||
| 2c87e48178 | |||
| ac10b78d68 | |||
| 4549688ad7 | |||
| 0a6e40eb74 | |||
| b1b635380a | |||
| 7309fdc62f | |||
| 412ef0f642 | |||
| 3071cb5847 | |||
| 1a7f63ce05 | |||
| c03c1f4057 | |||
| 264094924b | |||
| 0ec2b436de | |||
| f36239a67e | |||
| b673ca9636 | |||
| cba7ee4066 | |||
| 0f2b46b898 | |||
| d76b670b75 | |||
| ca71079106 | |||
| adf686974d | |||
| 6ecaa4dc0c | |||
| c1939075cd | |||
| 18587e281f | |||
| dbd4c5d246 | |||
| 919b29c38f | |||
| 01113fc3a6 | |||
| b9627e1643 | |||
| e6d83ca36c | |||
| a522eeb823 | |||
| 8d1561cd29 | |||
| d7ba42f4da | |||
| 689fc142d0 | |||
| 8df0c838cc | |||
| f9825900cc | |||
| 1a27a54926 | |||
| 1e003c28ab | |||
| 8cada05424 | |||
| dda98318eb | |||
| 6e95ae5245 | |||
| a4a9a26ac4 | |||
| 93aec63f78 | |||
| 9804a0fc89 | |||
| 3484802a24 | |||
| 946a150db1 | |||
| 197df90a21 | |||
| a944f7342a | |||
| 7c855afbe7 | |||
| d42bc3520d | |||
| a86d90ef41 | |||
| c5dfb3ad81 | |||
| e879c588dc | |||
| 862e75cd4c | |||
| d47643e730 | |||
| 0727361933 | |||
| c1b0bcedf4 | |||
| 315c2abfb9 | |||
| b0c0c507e5 | |||
| 12b6e41432 | |||
| a2484f94eb | |||
| b4824c69b8 | |||
| 03fb180f02 | |||
| 250afe3bba | |||
| b80b3a81b5 | |||
| cd8b910262 | |||
| d007850afe | |||
| 7f3873b63f | |||
| 963df074a4 | |||
| 5505d7bc61 | |||
| 0c9ec31fa3 | |||
| d71c65702d | |||
| a4af39cab7 | |||
| 9ba697c310 | |||
| 2b670ea53a | |||
| 5ade37f7a4 | |||
| 1be657d3ef | |||
| 9dbefcd830 | |||
| e1a9ddae89 | |||
| 2690c3212b | |||
| aac7e46ae8 | |||
| a16bef418b | |||
| 8b4b3b971a | |||
| 692ee51608 | |||
| d5bd500f39 | |||
| e195d86fb6 | |||
| 114aeb9f64 | |||
| d95bc5c261 | |||
| 73fa5b5c7e | |||
| 85e5e2a7e3 | |||
| 48f88ec819 | |||
| 139998eaa1 | |||
| 673f606de8 | |||
| 9464500e95 | |||
| 5e5b9884ef | |||
| 94ab64d629 | |||
| 2c89509fa2 | |||
| fae81a0263 | |||
| a8d5521dd8 | |||
| ea555be08e | |||
| 74e97fb435 | |||
| eed25d8c16 | |||
| bc195c27db | |||
| 0653828fe3 | |||
| 2feba8ac50 | |||
| 5e7515a9ad | |||
| 2aaca661e2 | |||
| 3f27bae099 | |||
| 79f4a33b6e | |||
| ec47e24549 | |||
| 8fe7a6e896 | |||
| f068e6891e | |||
| cabbf8bf44 | |||
| 9c146fff4d | |||
| 333fcc9d14 | |||
| 4aca075da6 | |||
| a5bcdff216 | |||
| 3c704d6b85 | |||
| d26214d032 | |||
| 09c96c772e | |||
| f6e1c78b0b | |||
| ec80146117 | |||
| 980dee2e14 | |||
| 832b994757 | |||
| a18785fb3d | |||
| f076b38044 | |||
| 68f2af5306 | |||
| 052867893c | |||
| 13ba31285e | |||
| 61a418fd8e | |||
| 3fa4185b7f | |||
| 5cb08c1dc0 | |||
| fc3a0eaf0c | |||
| 2e83b8c693 | |||
| 44eafc3345 | |||
| 29ce3537f7 | |||
| 058887ff4d | |||
| dc18e71ee4 | |||
| 479e38e3f6 | |||
| dd764281e8 | |||
| f7959a51bd | |||
| 97e0ada1a9 | |||
| cc3d5fe076 | |||
| 2200cb9bef | |||
| a16cda8a4a | |||
| af53859ba9 | |||
| a7a1230f1b | |||
| df037a51f0 | |||
| 4d18e71aa1 | |||
| 7f579e5268 | |||
| f6c53e51ed | |||
| 1429a3a4d5 | |||
| dc81ddaba7 | |||
| 4a001179b5 | |||
| 1bff06cde0 | |||
| ba4648f812 | |||
| 1d0ab95b88 | |||
| 275644ec83 | |||
| 69416528b3 | |||
| d3e0146d86 | |||
| 35fab88949 | |||
| 27a37eba79 | |||
| deb5b36309 | |||
| b84de95865 | |||
| 5650c0f05a | |||
| afa1b8478a | |||
| cafe0a0fe1 | |||
| bfa43823f6 | |||
| 533ed87321 | |||
| 129bd4aaa6 | |||
| eb93481fda | |||
| a160fe1b00 | |||
| c2f70c0f26 | |||
| 98c0712dea | |||
| 7c4f7f391b | |||
| e01dc9b09c | |||
| 178bb3718a | |||
| f088d2aa72 | |||
| 0645a93b9c | |||
| 8b38f1a695 | |||
| 652476fde8 | |||
| 74a7a255be | |||
| abd112035a | |||
| f5f92a1d88 | |||
| 75d520831f | |||
| 92402097d4 | |||
| 5e92bab977 | |||
| a5df674fbe | |||
| 4462f74f8c | |||
| 781053ab22 | |||
| 053c105c26 | |||
| 46bf67672a | |||
| d539e419fe | |||
| ec5a8f5281 | |||
| 97558b51c8 | |||
| 4a3a8d4b65 | |||
| 85a66339e2 | |||
| b785d35231 | |||
| 21b1dba84d | |||
| fc71b8cb61 | |||
| 31129493e5 | |||
| 8b4eafebf3 | |||
| cf38362d84 | |||
| 30800478f2 | |||
| 9bbe9b399e | |||
| 16d17798be | |||
| 679c7afe0e | |||
| f10141eddb | |||
| 10805a7d37 | |||
| b979fbb1bc | |||
| b86ca33087 | |||
| 993abfbf6f | |||
| ffd41101c3 | |||
| 39e06994d9 | |||
| ec405226c5 | |||
| 627a35e364 | |||
| 6254472bb8 | |||
| 0bbedd5983 | |||
| 58fb2a9b90 | |||
| f7c76937fb | |||
| 52865d7cfd | |||
| 8424aa557f | |||
| 0ab7bafe5e | |||
| 43b212ed42 | |||
| 0b4873a522 | |||
| d3d1227d6c | |||
| 181e7661c1 | |||
| c1ee6f5b52 | |||
| dd84615ca1 | |||
| aad0418260 | |||
| 46f3850e93 | |||
| ab34931c3d | |||
| 52116063e5 | |||
| 04243cc21e | |||
| 1ab041ce0f | |||
| 1dac740fca | |||
| 1e3e173dfe | |||
| 27971c5fb3 | |||
| 52fab5d92b | |||
| 5054006ffc | |||
| f4e24e032b | |||
| 2248361503 | |||
| 5c20fca28a | |||
| 9bbb949868 | |||
| 3e6bfacd86 | |||
| 1043c84b9d | |||
| febada8d63 | |||
| 8b6fef4cbc | |||
| 1ce9029edf | |||
| 587ac802de | |||
| 58455843f9 | |||
| a09ac1f2a2 | |||
| 8c454c5d7c | |||
| 83dd47d22a | |||
| c2910bb87c | |||
| 7e6c051a02 | |||
| 35b368d7fe | |||
| d39790ab4c | |||
| 09d28b964a | |||
| 139490e943 | |||
| 8830388728 | |||
| 68b9f9e887 | |||
| 5ef45a2212 | |||
| 772e7f7f29 | |||
| 8afa00f885 | |||
| fcf76011f4 | |||
| 3e2f420c30 | |||
| 26fd6f8de2 | |||
| 0966b82d5f | |||
| d526d69bca | |||
| 242984ffaf | |||
| 4746a8c9cf | |||
| 1603c8d8e9 | |||
| ddba4f290d | |||
| d621877e8c | |||
| 713a52f705 | |||
| c68d5e0730 | |||
| 49c62fae60 | |||
| 3bd4e75422 | |||
| 791e5cb9b8 | |||
| 2fb8f53751 | |||
| dc366068a9 | |||
| 3ec76ab816 | |||
| d8750f5e2c | |||
| f272be8b4d | |||
| f8f86d8e46 | |||
| ee030a690a | |||
| 3df1da364c | |||
| 389373be30 | |||
| cc02be95f3 | |||
| 5a1027c611 | |||
| 64e780744d | |||
| 0abffeeb7f | |||
| 75f11deee1 | |||
| db91b606f6 | |||
| 82373f8cc8 | |||
| 946714d3ae | |||
| 8414b0f4cf | |||
| faa262db99 | |||
| 6955f69156 | |||
| 2ae39d2a29 | |||
| 8e44adf16e | |||
| fd73dbc349 | |||
| f58aa61859 | |||
| ae7fecbf6d | |||
| 5ed497dd69 | |||
| 14ee83e147 | |||
| a29269e335 |
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -70,7 +70,7 @@ public class Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateAccountStatus(String discordAccountID, Enum.AccountStatus accountStatus) {
|
public boolean updateAccountStatus(String discordAccountID, mbEnums.AccountStatus accountStatus) {
|
||||||
|
|
||||||
try (Connection connection = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
try (Connection connection = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
||||||
ConfigManager.MB_DATABASE_PASS.getValue());
|
ConfigManager.MB_DATABASE_PASS.getValue());
|
||||||
@@ -131,7 +131,7 @@ public class Database {
|
|||||||
discordAccount = new DiscordAccount();
|
discordAccount = new DiscordAccount();
|
||||||
discordAccount.discordAccount = rs.getString("discordAccount");
|
discordAccount.discordAccount = rs.getString("discordAccount");
|
||||||
discordAccount.gameAccountName = rs.getString("acct_uname");
|
discordAccount.gameAccountName = rs.getString("acct_uname");
|
||||||
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
|
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
|
||||||
discordAccount.isDiscordAdmin = rs.getByte("discordAdmin"); // Registration date cannot be null
|
discordAccount.isDiscordAdmin = rs.getByte("discordAdmin"); // Registration date cannot be null
|
||||||
|
|
||||||
Timestamp registrationDate = rs.getTimestamp("registrationDate");
|
Timestamp registrationDate = rs.getTimestamp("registrationDate");
|
||||||
@@ -328,7 +328,7 @@ public class Database {
|
|||||||
discordAccount = new DiscordAccount();
|
discordAccount = new DiscordAccount();
|
||||||
discordAccount.discordAccount = rs.getString("discordAccount");
|
discordAccount.discordAccount = rs.getString("discordAccount");
|
||||||
discordAccount.gameAccountName = rs.getString("acct_uname");
|
discordAccount.gameAccountName = rs.getString("acct_uname");
|
||||||
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
|
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
|
||||||
|
|
||||||
// Registration date cannot be null
|
// Registration date cannot be null
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.mbEnums;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class DiscordAccount {
|
public class DiscordAccount {
|
||||||
public String discordAccount;
|
public String discordAccount;
|
||||||
public String gameAccountName;
|
public String gameAccountName;
|
||||||
public Enum.AccountStatus status;
|
public mbEnums.AccountStatus status;
|
||||||
public LocalDateTime registrationDate;
|
public LocalDateTime registrationDate;
|
||||||
public LocalDateTime lastUpdateRequest;
|
public LocalDateTime lastUpdateRequest;
|
||||||
public byte isDiscordAdmin;
|
public byte isDiscordAdmin;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package discord.handlers;
|
|||||||
import discord.Database;
|
import discord.Database;
|
||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import engine.Enum;
|
import engine.mbEnums;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,7 +21,7 @@ public class AccountInfoRequest {
|
|||||||
public static void handleRequest(MessageReceivedEvent event) {
|
public static void handleRequest(MessageReceivedEvent event) {
|
||||||
|
|
||||||
String discordAccountID = event.getAuthor().getId();
|
String discordAccountID = event.getAuthor().getId();
|
||||||
Enum.AccountStatus accountStatus;
|
mbEnums.AccountStatus accountStatus;
|
||||||
|
|
||||||
if (Database.online == false) {
|
if (Database.online == false) {
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package discord.handlers;
|
|||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import discord.RobotSpeak;
|
import discord.RobotSpeak;
|
||||||
import engine.Enum;
|
import engine.mbEnums;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -23,7 +23,7 @@ public class BanToggleHandler {
|
|||||||
public static void handleRequest(MessageReceivedEvent event, String[] args) {
|
public static void handleRequest(MessageReceivedEvent event, String[] args) {
|
||||||
|
|
||||||
String discordAccountID;
|
String discordAccountID;
|
||||||
Enum.AccountStatus accountStatus;
|
mbEnums.AccountStatus accountStatus;
|
||||||
|
|
||||||
// Early exit if database unavailable or is not an admin
|
// Early exit if database unavailable or is not an admin
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ public class BanToggleHandler {
|
|||||||
|
|
||||||
// toggle ban status
|
// toggle ban status
|
||||||
|
|
||||||
if (discordAccounts.get(0).status.equals(Enum.AccountStatus.BANNED))
|
if (discordAccounts.get(0).status.equals(mbEnums.AccountStatus.BANNED))
|
||||||
accountStatus = Enum.AccountStatus.ACTIVE;
|
accountStatus = mbEnums.AccountStatus.ACTIVE;
|
||||||
else
|
else
|
||||||
accountStatus = Enum.AccountStatus.BANNED;
|
accountStatus = mbEnums.AccountStatus.BANNED;
|
||||||
|
|
||||||
// We have a valid discord ID at this point. Banstick?
|
// We have a valid discord ID at this point. Banstick?
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public class BanToggleHandler {
|
|||||||
|
|
||||||
// If we're toggling status to active we're done here.
|
// If we're toggling status to active we're done here.
|
||||||
|
|
||||||
if (accountStatus.equals(Enum.AccountStatus.ACTIVE))
|
if (accountStatus.equals(mbEnums.AccountStatus.ACTIVE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set users role to noob
|
// Set users role to noob
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package discord.handlers;
|
|||||||
import discord.Database;
|
import discord.Database;
|
||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import engine.Enum;
|
import engine.mbEnums;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class PasswordChangeHandler {
|
|||||||
|
|
||||||
// Banned or suspended user's get no love.
|
// Banned or suspended user's get no love.
|
||||||
|
|
||||||
if (discordAccount.status.equals(Enum.AccountStatus.BANNED)) {
|
if (discordAccount.status.equals(mbEnums.AccountStatus.BANNED)) {
|
||||||
MagicBot.sendResponse(event,
|
MagicBot.sendResponse(event,
|
||||||
"Sorry but that is too much work. \n" +
|
"Sorry but that is too much work. \n" +
|
||||||
"Your account detailings cannot for to log into game!");
|
"Your account detailings cannot for to log into game!");
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.gameManager.DispatchManager;
|
||||||
import engine.Enum.DispatchChannel;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.GroupManager;
|
import engine.gameManager.GroupManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.RefreshGroupJob;
|
import engine.jobs.RefreshGroupJob;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.DispatchChannel;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.net.AbstractNetMsg;
|
import engine.net.AbstractNetMsg;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
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.LoadCharacterMsg;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
@@ -88,7 +88,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (send) {
|
if (send) {
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ public enum InterestManager implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedStaticObjects.removeAll(toRemove);
|
loadedStaticObjects.removeAll(toRemove);
|
||||||
@@ -292,7 +292,7 @@ public enum InterestManager implements Runnable {
|
|||||||
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
||||||
NPC npc = (NPC) awo;
|
NPC npc = (NPC) awo;
|
||||||
@@ -304,13 +304,13 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (lsm.getStructureList().size() > 0) {
|
if (lsm.getStructureList().size() > 0) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LoadCharacterMsg lc : lcmList) {
|
for (LoadCharacterMsg lc : lcmList) {
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lc);
|
Dispatch dispatch = Dispatch.borrow(player, lc);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedStaticObjects.addAll(toLoad);
|
loadedStaticObjects.addAll(toLoad);
|
||||||
@@ -414,7 +414,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (!uom.getObjectList().isEmpty()) {
|
if (!uom.getObjectList().isEmpty()) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +482,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(mbEnums.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -492,7 +492,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (lcm != null) {
|
if (lcm != null) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
/* This class is the main interface for Magicbane's
|
import engine.gameManager.DispatchManager;
|
||||||
* Interest management facilities.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
|
||||||
import engine.net.client.msg.TerritoryChangeMessage;
|
import engine.net.client.msg.TerritoryChangeMessage;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -31,10 +27,17 @@ import static engine.objects.Realm.getRealm;
|
|||||||
|
|
||||||
public enum RealmMap {
|
public enum RealmMap {
|
||||||
|
|
||||||
REALM_MAP;
|
// MB Dev Notes:
|
||||||
|
// This class loads and caches realm maps used by each
|
||||||
|
// map set for its realm overlay. The RealmMap loaded is
|
||||||
|
// controlled by config entry MB_WORLD_REALMMAP
|
||||||
|
//
|
||||||
|
// Unlike a Heightmap this is a just color lookup; identical to
|
||||||
|
// the old image maps used in 90s web technology.
|
||||||
|
//
|
||||||
|
// Realm Map images are stored on disk in /mb.data/realmmaps/
|
||||||
|
|
||||||
// Spatial hashmap. Used for determining which Realm
|
REALM_MAP;
|
||||||
// a player is currently located within.
|
|
||||||
|
|
||||||
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
||||||
public static int[][] _realmImageMap;
|
public static int[][] _realmImageMap;
|
||||||
@@ -65,7 +68,7 @@ public enum RealmMap {
|
|||||||
|
|
||||||
public static Realm getRealmForCity(City city) {
|
public static Realm getRealmForCity(City city) {
|
||||||
Realm outRealm = null;
|
Realm outRealm = null;
|
||||||
outRealm = city.getRealm();
|
outRealm = city.realm;
|
||||||
return outRealm;
|
return outRealm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,17 +91,17 @@ public enum RealmMap {
|
|||||||
if (city != null) {
|
if (city != null) {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||||
} else {
|
} else {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import static java.lang.Math.PI;
|
import static java.lang.Math.PI;
|
||||||
|
|
||||||
|
|
||||||
|
// MB Dev Notes:
|
||||||
|
// The Terrain class handles lookups into the Heightmap data.
|
||||||
|
// It supports all current maps along with the differences in
|
||||||
|
// their parenting configuration.
|
||||||
|
//
|
||||||
|
// Heightmap images are stored on disk in /mb.data/heightmaps/
|
||||||
|
|
||||||
public class Terrain {
|
public class Terrain {
|
||||||
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
||||||
public short[][] terrain_pixel_data;
|
public short[][] terrain_pixel_data;
|
||||||
@@ -112,7 +120,7 @@ public class Terrain {
|
|||||||
|
|
||||||
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
||||||
|
|
||||||
// Retrieve the next zone with a terrain defined.
|
// Retrieve the next zone up in the tree with a terrain defined.
|
||||||
|
|
||||||
Zone terrainZone = getNextZoneWithTerrain(zone);
|
Zone terrainZone = getNextZoneWithTerrain(zone);
|
||||||
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
import engine.Enum.GridObjectType;
|
import engine.gameManager.DispatchManager;
|
||||||
import engine.math.FastMath;
|
import engine.math.FastMath;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.DispatchMessage;
|
import engine.mbEnums.GridObjectType;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.LoadCharacterMsg;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
@@ -201,7 +201,7 @@ public class WorldGrid {
|
|||||||
|
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
uom.addObject(awo);
|
uom.addObject(awo);
|
||||||
DispatchMessage.sendToAllInRange(awo, uom);
|
DispatchManager.sendToAllInRange(awo, uom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadObject(AbstractWorldObject awo) {
|
public static void loadObject(AbstractWorldObject awo) {
|
||||||
@@ -213,15 +213,15 @@ public class WorldGrid {
|
|||||||
case Building:
|
case Building:
|
||||||
lsm = new LoadStructureMsg();
|
lsm = new LoadStructureMsg();
|
||||||
lsm.addObject((Building) awo);
|
lsm.addObject((Building) awo);
|
||||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
DispatchManager.sendToAllInRange(awo, lsm);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
DispatchManager.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
DispatchManager.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// *** Refactor: Log error?
|
// *** Refactor: Log error?
|
||||||
@@ -239,19 +239,19 @@ public class WorldGrid {
|
|||||||
case Building:
|
case Building:
|
||||||
lsm = new LoadStructureMsg();
|
lsm = new LoadStructureMsg();
|
||||||
lsm.addObject((Building) awo);
|
lsm.addObject((Building) awo);
|
||||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
DispatchManager.sendToAllInRange(awo, lsm);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
DispatchManager.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
DispatchManager.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
DispatchManager.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// *** Refactor: Log error?
|
// *** Refactor: Log error?
|
||||||
@@ -263,7 +263,7 @@ public class WorldGrid {
|
|||||||
ClientConnection origin) {
|
ClientConnection origin) {
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
uom.addObject(awo);
|
uom.addObject(awo);
|
||||||
DispatchMessage.sendToAllInRange(awo, uom);
|
DispatchManager.sendToAllInRange(awo, uom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Bane;
|
import engine.objects.Bane;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
@@ -21,7 +21,7 @@ import java.sql.*;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.Enum.RecordEventType;
|
import static engine.mbEnums.RecordEventType;
|
||||||
|
|
||||||
public class BaneRecord extends DataRecord {
|
public class BaneRecord extends DataRecord {
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
private DateTime baneDropTime;
|
private DateTime baneDropTime;
|
||||||
|
|
||||||
private BaneRecord(Bane bane) {
|
private BaneRecord(Bane bane) {
|
||||||
this.recordType = Enum.DataRecordType.BANE;
|
this.recordType = mbEnums.DataRecordType.BANE;
|
||||||
this.eventType = RecordEventType.PENDING;
|
this.eventType = RecordEventType.PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
baneRecord = new BaneRecord(bane);
|
baneRecord = new BaneRecord(bane);
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
baneRecord.recordType = Enum.DataRecordType.BANE;
|
baneRecord.recordType = mbEnums.DataRecordType.BANE;
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
@@ -33,7 +33,7 @@ public class CharacterRecord extends DataRecord {
|
|||||||
private PlayerCharacter player;
|
private PlayerCharacter player;
|
||||||
|
|
||||||
private CharacterRecord(PlayerCharacter player) {
|
private CharacterRecord(PlayerCharacter player) {
|
||||||
this.recordType = Enum.DataRecordType.CHARACTER;
|
this.recordType = mbEnums.DataRecordType.CHARACTER;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class CharacterRecord extends DataRecord {
|
|||||||
if (characterRecord == null) {
|
if (characterRecord == null) {
|
||||||
characterRecord = new CharacterRecord(player);
|
characterRecord = new CharacterRecord(player);
|
||||||
} else {
|
} else {
|
||||||
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
|
characterRecord.recordType = mbEnums.DataRecordType.CHARACTER;
|
||||||
characterRecord.player = player;
|
characterRecord.player = player;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
public class CityRecord extends DataRecord {
|
public class CityRecord extends DataRecord {
|
||||||
|
|
||||||
private static final LinkedBlockingQueue<CityRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<CityRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
private Enum.RecordEventType eventType;
|
private mbEnums.RecordEventType eventType;
|
||||||
private City city;
|
private City city;
|
||||||
private String cityHash;
|
private String cityHash;
|
||||||
private String cityGuildHash;
|
private String cityGuildHash;
|
||||||
@@ -32,13 +32,13 @@ public class CityRecord extends DataRecord {
|
|||||||
private java.time.LocalDateTime establishedDatetime;
|
private java.time.LocalDateTime establishedDatetime;
|
||||||
|
|
||||||
private CityRecord(City city) {
|
private CityRecord(City city) {
|
||||||
this.recordType = Enum.DataRecordType.CITY;
|
this.recordType = mbEnums.DataRecordType.CITY;
|
||||||
this.city = city;
|
this.city = city;
|
||||||
this.eventType = Enum.RecordEventType.CREATE;
|
this.eventType = mbEnums.RecordEventType.CREATE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CityRecord borrow(City city, Enum.RecordEventType eventType) {
|
public static CityRecord borrow(City city, mbEnums.RecordEventType eventType) {
|
||||||
CityRecord cityRecord;
|
CityRecord cityRecord;
|
||||||
|
|
||||||
cityRecord = recordPool.poll();
|
cityRecord = recordPool.poll();
|
||||||
@@ -47,7 +47,7 @@ public class CityRecord extends DataRecord {
|
|||||||
cityRecord = new CityRecord(city);
|
cityRecord = new CityRecord(city);
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
cityRecord.recordType = Enum.DataRecordType.CITY;
|
cityRecord.recordType = mbEnums.DataRecordType.CITY;
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
cityRecord.city = city;
|
cityRecord.city = city;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class CityRecord extends DataRecord {
|
|||||||
|
|
||||||
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
||||||
|
|
||||||
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
if (cityRecord.eventType.equals(mbEnums.RecordEventType.CREATE))
|
||||||
cityRecord.establishedDatetime = cityRecord.city.established;
|
cityRecord.establishedDatetime = cityRecord.city.established;
|
||||||
else
|
else
|
||||||
cityRecord.establishedDatetime = java.time.LocalDateTime.now();
|
cityRecord.establishedDatetime = java.time.LocalDateTime.now();
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.mbEnums;
|
||||||
|
|
||||||
class DataRecord {
|
class DataRecord {
|
||||||
|
|
||||||
public Enum.DataRecordType recordType;
|
public mbEnums.DataRecordType recordType;
|
||||||
|
|
||||||
DataRecord() {
|
DataRecord() {
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.Enum.DataRecordType;
|
import static engine.mbEnums.DataRecordType;
|
||||||
|
|
||||||
public class DataWarehouse implements Runnable {
|
public class DataWarehouse implements Runnable {
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.RecordEventType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.RecordEventType;
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
||||||
public String guildHash;
|
public String guildHash;
|
||||||
public int guildID;
|
public int guildID;
|
||||||
private Enum.RecordEventType eventType;
|
private mbEnums.RecordEventType eventType;
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
private String guildName;
|
private String guildName;
|
||||||
private String charterName;
|
private String charterName;
|
||||||
@@ -44,9 +44,9 @@ public class GuildRecord extends DataRecord {
|
|||||||
private java.time.LocalDateTime eventDatetime;
|
private java.time.LocalDateTime eventDatetime;
|
||||||
|
|
||||||
private GuildRecord(Guild guild) {
|
private GuildRecord(Guild guild) {
|
||||||
this.recordType = Enum.DataRecordType.GUILD;
|
this.recordType = mbEnums.DataRecordType.GUILD;
|
||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
this.eventType = Enum.RecordEventType.CREATE;
|
this.eventType = mbEnums.RecordEventType.CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
|
public static GuildRecord borrow(Guild guild, mbEnums.RecordEventType eventType) {
|
||||||
GuildRecord guildRecord;
|
GuildRecord guildRecord;
|
||||||
//add
|
//add
|
||||||
guildRecord = recordPool.poll();
|
guildRecord = recordPool.poll();
|
||||||
@@ -81,7 +81,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
guildRecord.guild = guild;
|
guildRecord.guild = guild;
|
||||||
guildRecord.recordType = Enum.DataRecordType.GUILD;
|
guildRecord.recordType = mbEnums.DataRecordType.GUILD;
|
||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,8 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||||
guildRecord.guildName = guildRecord.guild.getName();
|
guildRecord.guildName = guildRecord.guild.getName();
|
||||||
guildRecord.charterName = Enum.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
mbEnums.GuildCharterType guildCharterType = guild.charter;
|
||||||
|
guildRecord.charterName = guildCharterType.name;
|
||||||
|
|
||||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -23,7 +23,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
public class MineRecord extends DataRecord {
|
public class MineRecord extends DataRecord {
|
||||||
|
|
||||||
private static final LinkedBlockingQueue<MineRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<MineRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
private Enum.RecordEventType eventType;
|
private mbEnums.RecordEventType eventType;
|
||||||
private String zoneHash;
|
private String zoneHash;
|
||||||
private String charHash;
|
private String charHash;
|
||||||
private String mineGuildHash;
|
private String mineGuildHash;
|
||||||
@@ -33,12 +33,12 @@ public class MineRecord extends DataRecord {
|
|||||||
private float locY;
|
private float locY;
|
||||||
|
|
||||||
private MineRecord() {
|
private MineRecord() {
|
||||||
this.recordType = Enum.DataRecordType.MINE;
|
this.recordType = mbEnums.DataRecordType.MINE;
|
||||||
this.eventType = Enum.RecordEventType.CAPTURE;
|
this.eventType = mbEnums.RecordEventType.CAPTURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MineRecord borrow(Mine mine, AbstractCharacter character, Enum.RecordEventType eventType) {
|
public static MineRecord borrow(Mine mine, AbstractCharacter character, mbEnums.RecordEventType eventType) {
|
||||||
|
|
||||||
MineRecord mineRecord;
|
MineRecord mineRecord;
|
||||||
mineRecord = recordPool.poll();
|
mineRecord = recordPool.poll();
|
||||||
@@ -48,13 +48,13 @@ public class MineRecord extends DataRecord {
|
|||||||
mineRecord = new MineRecord();
|
mineRecord = new MineRecord();
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
mineRecord.recordType = Enum.DataRecordType.MINE;
|
mineRecord.recordType = mbEnums.DataRecordType.MINE;
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
mineRecord.zoneHash = mine.getParentZone().hash;
|
mineRecord.zoneHash = mine.getParentZone().hash;
|
||||||
|
|
||||||
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (character.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
player = (PlayerCharacter) character;
|
player = (PlayerCharacter) character;
|
||||||
mineRecord.charHash = player.getHash();
|
mineRecord.charHash = player.getHash();
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.Enum.DataRecordType;
|
import static engine.mbEnums.DataRecordType;
|
||||||
import static engine.Enum.PvpHistoryType;
|
import static engine.mbEnums.PvpHistoryType;
|
||||||
|
|
||||||
public class PvpRecord extends DataRecord {
|
public class PvpRecord extends DataRecord {
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Realm;
|
import engine.objects.Realm;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -23,20 +23,20 @@ public class RealmRecord extends DataRecord {
|
|||||||
private static final LinkedBlockingQueue<RealmRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<RealmRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
private Realm realm;
|
private Realm realm;
|
||||||
private Enum.RecordEventType eventType;
|
private mbEnums.RecordEventType eventType;
|
||||||
private String cityHash;
|
private String cityHash;
|
||||||
private String guildHash;
|
private String guildHash;
|
||||||
private String charterType;
|
private String charterType;
|
||||||
private LocalDateTime eventDateTime;
|
private LocalDateTime eventDateTime;
|
||||||
|
|
||||||
private RealmRecord(Realm realm) {
|
private RealmRecord(Realm realm) {
|
||||||
this.recordType = Enum.DataRecordType.REALM;
|
this.recordType = mbEnums.DataRecordType.REALM;
|
||||||
this.realm = realm;
|
this.realm = realm;
|
||||||
this.eventType = Enum.RecordEventType.CAPTURE;
|
this.eventType = mbEnums.RecordEventType.CAPTURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RealmRecord borrow(Realm realm, Enum.RecordEventType eventType) {
|
public static RealmRecord borrow(Realm realm, mbEnums.RecordEventType eventType) {
|
||||||
RealmRecord realmRecord;
|
RealmRecord realmRecord;
|
||||||
|
|
||||||
realmRecord = recordPool.poll();
|
realmRecord = recordPool.poll();
|
||||||
@@ -45,7 +45,7 @@ public class RealmRecord extends DataRecord {
|
|||||||
realmRecord = new RealmRecord(realm);
|
realmRecord = new RealmRecord(realm);
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
realmRecord.recordType = Enum.DataRecordType.REALM;
|
realmRecord.recordType = mbEnums.DataRecordType.REALM;
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
realmRecord.realm = realm;
|
realmRecord.realm = realm;
|
||||||
|
|
||||||
@@ -53,9 +53,9 @@ public class RealmRecord extends DataRecord {
|
|||||||
|
|
||||||
realmRecord.cityHash = realm.getRulingCity().getHash();
|
realmRecord.cityHash = realm.getRulingCity().getHash();
|
||||||
realmRecord.guildHash = realm.getRulingCity().getGuild().getHash();
|
realmRecord.guildHash = realm.getRulingCity().getGuild().getHash();
|
||||||
realmRecord.charterType = Enum.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
|
realmRecord.charterType = mbEnums.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
|
||||||
|
|
||||||
if (realmRecord.eventType.equals(Enum.RecordEventType.CAPTURE))
|
if (realmRecord.eventType.equals(mbEnums.RecordEventType.CAPTURE))
|
||||||
realmRecord.eventDateTime = realm.ruledSince;
|
realmRecord.eventDateTime = realm.ruledSince;
|
||||||
else
|
else
|
||||||
realmRecord.eventDateTime = LocalDateTime.now();
|
realmRecord.eventDateTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,7 +27,7 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbAccountHandler() {
|
public dbAccountHandler() {
|
||||||
this.localClass = Account.class;
|
this.localClass = Account.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account GET_ACCOUNT(int accountID) {
|
public Account GET_ACCOUNT(int accountID) {
|
||||||
@@ -204,7 +204,7 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
if (account != null) {
|
if (account != null) {
|
||||||
account.runAfterLoad();
|
account.runAfterLoad();
|
||||||
|
|
||||||
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER))
|
if (ConfigManager.serverType.equals(mbEnums.ServerType.LOGINSERVER))
|
||||||
Account.AccountsMap.put(uname, account.getObjectUUID());
|
Account.AccountsMap.put(uname, account.getObjectUUID());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.BaseClass;
|
import engine.objects.BaseClass;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public class dbBaseClassHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBaseClassHandler() {
|
public dbBaseClassHandler() {
|
||||||
this.localClass = BaseClass.class;
|
this.localClass = BaseClass.class;
|
||||||
this.localObjectType = Enum.GameObjectType.BaseClass;
|
this.localObjectType = mbEnums.GameObjectType.BaseClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseClass GET_BASE_CLASS(final int id) {
|
public BaseClass GET_BASE_CLASS(final int id) {
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.DbObjectType;
|
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.Enum.TaxType;
|
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.DbObjectType;
|
||||||
|
import engine.mbEnums.ProtectionState;
|
||||||
|
import engine.mbEnums.TaxType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -34,7 +34,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBuildingHandler() {
|
public dbBuildingHandler() {
|
||||||
this.localClass = Building.class;
|
this.localClass = Building.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
@@ -112,7 +112,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
if (uuid == 0)
|
if (uuid == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
|
Building building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, uuid);
|
||||||
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
return building;
|
return building;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.BuildingLocation;
|
import engine.objects.BuildingLocation;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class dbBuildingLocationHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBuildingLocationHandler() {
|
public dbBuildingLocationHandler() {
|
||||||
this.localClass = BuildingLocation.class;
|
this.localClass = BuildingLocation.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<BuildingLocation> LOAD_BUILDING_LOCATIONS() {
|
public ArrayList<BuildingLocation> LOAD_BUILDING_LOCATIONS() {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.session.CSSession;
|
import engine.session.CSSession;
|
||||||
@@ -26,7 +27,7 @@ public class dbCSSessionHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCSSessionHandler() {
|
public dbCSSessionHandler() {
|
||||||
this.localClass = CSSession.class;
|
this.localClass = CSSession.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
|
public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.CharacterPower;
|
import engine.objects.CharacterPower;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
@@ -23,7 +23,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterPowerHandler() {
|
public dbCharacterPowerHandler() {
|
||||||
this.localClass = CharacterPower.class;
|
this.localClass = CharacterPower.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterPower ADD_CHARACTER_POWER(CharacterPower toAdd) {
|
public CharacterPower ADD_CHARACTER_POWER(CharacterPower toAdd) {
|
||||||
@@ -74,7 +74,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterPower GET_CHARACTER_POWER(int objectUUID) {
|
public CharacterPower GET_CHARACTER_POWER(int objectUUID) {
|
||||||
|
|
||||||
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(Enum.GameObjectType.CharacterPower, objectUUID);
|
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(mbEnums.GameObjectType.CharacterPower, objectUUID);
|
||||||
|
|
||||||
if (characterPower != null)
|
if (characterPower != null)
|
||||||
return characterPower;
|
return characterPower;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.CharacterRune;
|
import engine.objects.CharacterRune;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterRuneHandler() {
|
public dbCharacterRuneHandler() {
|
||||||
this.localClass = CharacterRune.class;
|
this.localClass = CharacterRune.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterRune ADD_CHARACTER_RUNE(final CharacterRune toAdd) {
|
public CharacterRune ADD_CHARACTER_RUNE(final CharacterRune toAdd) {
|
||||||
@@ -49,7 +49,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterRune GET_CHARACTER_RUNE(int runeID) {
|
public CharacterRune GET_CHARACTER_RUNE(int runeID) {
|
||||||
|
|
||||||
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(Enum.GameObjectType.CharacterRune, runeID);
|
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(mbEnums.GameObjectType.CharacterRune, runeID);
|
||||||
|
|
||||||
if (characterRune != null)
|
if (characterRune != null)
|
||||||
return characterRune;
|
return characterRune;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterSkill;
|
import engine.objects.CharacterSkill;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -24,7 +24,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterSkillHandler() {
|
public dbCharacterSkillHandler() {
|
||||||
this.localClass = CharacterSkill.class;
|
this.localClass = CharacterSkill.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
|
public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
|
||||||
@@ -72,7 +72,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterSkill GET_SKILL(final int objectUUID) {
|
public CharacterSkill GET_SKILL(final int objectUUID) {
|
||||||
|
|
||||||
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(Enum.GameObjectType.CharacterSkill, objectUUID);
|
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(mbEnums.GameObjectType.CharacterSkill, objectUUID);
|
||||||
|
|
||||||
if (characterSkill != null)
|
if (characterSkill != null)
|
||||||
return characterSkill;
|
return characterSkill;
|
||||||
@@ -95,7 +95,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ConcurrentHashMap<String, CharacterSkill> characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
ConcurrentHashMap<String, CharacterSkill> characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
|
|
||||||
if (ac == null || (!(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
|
if (ac == null || (!(ac.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))))
|
||||||
return characterSkills;
|
return characterSkills;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) ac;
|
PlayerCharacter playerCharacter = (PlayerCharacter) ac;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
@@ -25,7 +25,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCityHandler() {
|
public dbCityHandler() {
|
||||||
this.localClass = City.class;
|
this.localClass = City.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
||||||
@@ -52,25 +52,24 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, int realmID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||||
|
|
||||||
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
||||||
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
||||||
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
||||||
preparedStatement.setLong(3, realmID); //objectUUID of realm city belongs in
|
preparedStatement.setFloat(3, xCoord); //xOffset from parentZone center
|
||||||
preparedStatement.setFloat(4, xCoord); //xOffset from parentZone center
|
preparedStatement.setFloat(4, yCoord); //yOffset from parentZone center
|
||||||
preparedStatement.setFloat(5, yCoord); //yOffset from parentZone center
|
preparedStatement.setFloat(5, zCoord); //zOffset from parentZone center
|
||||||
preparedStatement.setFloat(6, zCoord); //zOffset from parentZone center
|
preparedStatement.setString(6, name); //city name
|
||||||
preparedStatement.setString(7, name); //city name
|
preparedStatement.setTimestamp(7, Timestamp.valueOf(established));
|
||||||
preparedStatement.setTimestamp(8, Timestamp.valueOf(established));
|
preparedStatement.setFloat(8, rotation);
|
||||||
preparedStatement.setFloat(9, rotation);
|
preparedStatement.setFloat(9, W);
|
||||||
preparedStatement.setFloat(10, W);
|
preparedStatement.setTimestamp(10, Timestamp.valueOf(upgradeTime));
|
||||||
preparedStatement.setTimestamp(11, Timestamp.valueOf(upgradeTime));
|
|
||||||
|
|
||||||
boolean work = preparedStatement.execute();
|
boolean work = preparedStatement.execute();
|
||||||
|
|
||||||
@@ -118,7 +117,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public City GET_CITY(final int cityId) {
|
public City GET_CITY(final int cityId) {
|
||||||
|
|
||||||
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, cityId);
|
City city = (City) DbManager.getFromCache(mbEnums.GameObjectType.City, cityId);
|
||||||
|
|
||||||
if (city != null)
|
if (city != null)
|
||||||
return city;
|
return city;
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.ItemManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Contract;
|
import engine.objects.Contract;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
import engine.objects.MobLoot;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -25,12 +25,12 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbContractHandler() {
|
public dbContractHandler() {
|
||||||
this.localClass = Contract.class;
|
this.localClass = Contract.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Contract GET_CONTRACT(final int objectUUID) {
|
public Contract GET_CONTRACT(final int objectUUID) {
|
||||||
|
|
||||||
Contract contract = (Contract) DbManager.getFromCache(Enum.GameObjectType.Contract, objectUUID);
|
Contract contract = (Contract) DbManager.getFromCache(mbEnums.GameObjectType.Contract, objectUUID);
|
||||||
|
|
||||||
if (contract != null)
|
if (contract != null)
|
||||||
return contract;
|
return contract;
|
||||||
@@ -66,7 +66,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
int templateID = rs.getInt("templateID");
|
int templateID = rs.getInt("templateID");
|
||||||
|
|
||||||
Item item = new Item(templateID);
|
Item item = new Item(templateID);
|
||||||
item.objectUUID = MobLoot.lastNegativeID.decrementAndGet();
|
item.objectUUID = ItemManager.lastNegativeID.decrementAndGet();
|
||||||
contract.getSellInventory().add(item);
|
contract.getSellInventory().add(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,12 +106,12 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateAllowedBuildings(final Contract con, final long slotbitvalue) {
|
public boolean updateAllowedBuildings(final Contract con) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `slotInBuildings`=? WHERE `contractID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, slotbitvalue);
|
preparedStatement.setString(1, mbEnums.asString(con.allowedBuildings));
|
||||||
preparedStatement.setInt(2, con.getContractID());
|
preparedStatement.setInt(2, con.getContractID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -126,7 +126,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
|
||||||
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?")) {
|
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, slotInBuildings=? WHERE `ID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, con.getContractID());
|
preparedStatement.setInt(1, con.getContractID());
|
||||||
preparedStatement.setString(2, con.getName());
|
preparedStatement.setString(2, con.getName());
|
||||||
@@ -135,7 +135,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
|
preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
|
||||||
preparedStatement.setInt(6, con.getIconID());
|
preparedStatement.setInt(6, con.getIconID());
|
||||||
preparedStatement.setInt(8, con.getObjectUUID());
|
preparedStatement.setInt(8, con.getObjectUUID());
|
||||||
preparedStatement.setLong(7, con.getAllowedBuildings().toLong());
|
preparedStatement.setString(7, mbEnums.asString(con.allowedBuildings));
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.effectmodifiers.*;
|
import engine.powers.effectmodifiers.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -63,7 +63,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
IDString = rs.getString("IDString");
|
IDString = rs.getString("IDString");
|
||||||
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
|
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
|
||||||
Enum.ModType modifier = Enum.ModType.GetModType(rs.getString("modType"));
|
mbEnums.ModType modifier = mbEnums.ModType.GetModType(rs.getString("modType"));
|
||||||
|
|
||||||
//combine item prefix and suffix effect modifiers
|
//combine item prefix and suffix effect modifiers
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, Enum.ModType modifier) throws SQLException {
|
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, mbEnums.ModType modifier) throws SQLException {
|
||||||
switch (modifier) {
|
switch (modifier) {
|
||||||
case AdjustAboveDmgCap:
|
case AdjustAboveDmgCap:
|
||||||
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
|
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
|
||||||
|
|||||||
@@ -10,38 +10,49 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.EffectsResourceCosts;
|
import engine.objects.EffectsResourceCosts;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||||
|
|
||||||
public dbEffectsResourceCostHandler() {
|
public dbEffectsResourceCostHandler() {
|
||||||
this.localClass = EffectsResourceCosts.class;
|
this.localClass = EffectsResourceCosts.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
|
public void LOAD_ALL_COSTMAPS() {
|
||||||
|
|
||||||
ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_effect_costmaps`")) {
|
||||||
|
|
||||||
preparedStatement.setString(1, idString);
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
effectsResourceCosts = getObjectsFromRs(rs, 1000);
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String effectID = rs.getString("effectID");
|
||||||
|
String costString = rs.getString("costmap");
|
||||||
|
JSONObject costJSON = new JSONObject(costString);
|
||||||
|
HashMap<mbEnums.ResourceType, Integer> costmap = new HashMap<>();
|
||||||
|
|
||||||
|
for (String key : costJSON.keySet()) {
|
||||||
|
int value = costJSON.getInt(key);
|
||||||
|
costmap.put(mbEnums.ResourceType.valueOf(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
PowersManager._effect_costMaps.put(effectID, costmap);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return effectsResourceCosts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GuildHistoryType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GuildHistoryType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
@@ -24,7 +24,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbGuildHandler() {
|
public dbGuildHandler() {
|
||||||
this.localClass = Guild.class;
|
this.localClass = Guild.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<PlayerCharacter> GET_GUILD_BANISHED(final int id) {
|
public static ArrayList<PlayerCharacter> GET_GUILD_BANISHED(final int id) {
|
||||||
@@ -276,7 +276,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public Guild GET_GUILD(int id) {
|
public Guild GET_GUILD(int id) {
|
||||||
|
|
||||||
Guild guild = (Guild) DbManager.getFromCache(Enum.GameObjectType.Guild, id);
|
Guild guild = (Guild) DbManager.getFromCache(mbEnums.GameObjectType.Guild, id);
|
||||||
|
|
||||||
if (guild != null)
|
if (guild != null)
|
||||||
return guild;
|
return guild;
|
||||||
@@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(6, guildTag.symbolColor);
|
preparedStatement.setInt(6, guildTag.symbolColor);
|
||||||
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
||||||
preparedStatement.setInt(8, guildTag.symbol);
|
preparedStatement.setInt(8, guildTag.symbol);
|
||||||
preparedStatement.setInt(9, g.getCharter());
|
preparedStatement.setInt(9, g.charter.templateID);
|
||||||
preparedStatement.setString(10, g.getLeadershipType());
|
preparedStatement.setString(10, g.getLeadershipType());
|
||||||
preparedStatement.setString(11, g.getMotto());
|
preparedStatement.setString(11, g.getMotto());
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
||||||
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
||||||
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
||||||
preparedStatement.setInt(7, g.getCharter());
|
preparedStatement.setInt(7, g.charter.templateID);
|
||||||
preparedStatement.setString(8, g.getMOTD());
|
preparedStatement.setString(8, g.getMOTD());
|
||||||
preparedStatement.setString(9, g.getICMOTD());
|
preparedStatement.setString(9, g.getICMOTD());
|
||||||
preparedStatement.setString(10, "");
|
preparedStatement.setString(10, "");
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.AbstractWorldObject;
|
import engine.objects.AbstractWorldObject;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -42,7 +42,7 @@ public abstract class dbHandlerBase {
|
|||||||
// Only call runAfterLoad() for objects instanced on the world server
|
// Only call runAfterLoad() for objects instanced on the world server
|
||||||
|
|
||||||
if ((abstractGameObject != null && abstractGameObject instanceof AbstractWorldObject) &&
|
if ((abstractGameObject != null && abstractGameObject instanceof AbstractWorldObject) &&
|
||||||
(ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER) ||
|
(ConfigManager.serverType.equals(mbEnums.ServerType.WORLDSERVER) ||
|
||||||
(abstractGameObject.getObjectType() == GameObjectType.Guild)))
|
(abstractGameObject.getObjectType() == GameObjectType.Guild)))
|
||||||
((AbstractWorldObject) abstractGameObject).runAfterLoad();
|
((AbstractWorldObject) abstractGameObject).runAfterLoad();
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,15 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.ItemContainerType;
|
|
||||||
import engine.Enum.ItemType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.ItemContainerType;
|
||||||
|
import engine.mbEnums.ItemType;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterItemManager;
|
import engine.objects.CharacterItemManager;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
import engine.objects.ItemTemplate;
|
import engine.objects.ItemTemplate;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -26,6 +25,7 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbItemHandler() {
|
public dbItemHandler() {
|
||||||
this.localClass = Item.class;
|
this.localClass = Item.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatTradeString(HashSet<Integer> list) {
|
private static String formatTradeString(HashSet<Integer> list) {
|
||||||
@@ -92,14 +92,14 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toAdd.equipSlot.equals(Enum.EquipSlotType.NONE))
|
if (toAdd.equipSlot.equals(mbEnums.EquipSlotType.NONE))
|
||||||
preparedStatement.setString(7, "");
|
preparedStatement.setString(7, "");
|
||||||
else
|
else
|
||||||
preparedStatement.setString(7, toAdd.equipSlot.name());
|
preparedStatement.setString(7, toAdd.equipSlot.name());
|
||||||
|
|
||||||
String flagString = "";
|
String flagString = "";
|
||||||
|
|
||||||
for (Enum.ItemFlags itemflag : toAdd.flags)
|
for (mbEnums.ItemFlags itemflag : toAdd.flags)
|
||||||
flagString += itemflag.toString() + ";";
|
flagString += itemflag.toString() + ";";
|
||||||
|
|
||||||
flagString = flagString.replaceAll(";$", "");
|
flagString = flagString.replaceAll(";$", "");
|
||||||
@@ -179,7 +179,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_ITEM_TEMPLATES() {
|
public void LOAD_ITEM_TEMPLATES() {
|
||||||
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
HashMap<ItemType, Integer> templateTCountMap = new HashMap<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;");
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;");
|
||||||
@@ -187,12 +187,15 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int templateID = rs.getInt("id");
|
int templateID = rs.getInt("id");
|
||||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template"));
|
JSONObject jsonObject = new JSONObject(rs.getString("template"));
|
||||||
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
|
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
|
||||||
itemTemplate.template_id = templateID;
|
itemTemplate.template_id = templateID;
|
||||||
ItemTemplate.templates.put(templateID, itemTemplate);
|
ItemTemplate.templates.put(templateID, itemTemplate);
|
||||||
|
|
||||||
|
templateTCountMap.merge(itemTemplate.item_type, 1, Integer::sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.info(templateTCountMap.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
@@ -216,6 +219,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item GET_ITEM(final int itemUUID) {
|
public Item GET_ITEM(final int itemUUID) {
|
||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
@@ -365,7 +369,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
||||||
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
|
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
|
||||||
ItemContainerType containerType, Enum.EquipSlotType slot) {
|
ItemContainerType containerType, mbEnums.EquipSlotType slot) {
|
||||||
|
|
||||||
boolean worked = false;
|
boolean worked = false;
|
||||||
|
|
||||||
@@ -400,7 +404,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot.equals(Enum.EquipSlotType.NONE))
|
if (slot.equals(mbEnums.EquipSlotType.NONE))
|
||||||
preparedStatement.setString(4, "");
|
preparedStatement.setString(4, "");
|
||||||
else
|
else
|
||||||
preparedStatement.setString(4, slot.name());
|
preparedStatement.setString(4, slot.name());
|
||||||
@@ -530,7 +534,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
String flagString = "";
|
String flagString = "";
|
||||||
|
|
||||||
for (Enum.ItemFlags itemflag : item.flags)
|
for (mbEnums.ItemFlags itemflag : item.flags)
|
||||||
flagString += itemflag.toString() + ";";
|
flagString += itemflag.toString() + ";";
|
||||||
|
|
||||||
flagString = flagString.replaceAll(";$", "");
|
flagString = flagString.replaceAll(";$", "");
|
||||||
@@ -550,7 +554,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
// Write 0 if we will not modify the value from template
|
// Write 0 if we will not modify the value from template
|
||||||
|
|
||||||
if (item.value == item.template.item_value)
|
if (value == item.template.item_value)
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
@@ -572,7 +576,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `equipSlot`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `equipSlot`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
if (item.equipSlot.equals(Enum.EquipSlotType.NONE))
|
if (item.equipSlot.equals(mbEnums.EquipSlotType.NONE))
|
||||||
preparedStatement.setString(1, "");
|
preparedStatement.setString(1, "");
|
||||||
else
|
else
|
||||||
preparedStatement.setString(1, item.equipSlot.name());
|
preparedStatement.setString(1, item.equipSlot.name());
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Kit;
|
import engine.objects.Kit;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class dbKitHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbKitHandler() {
|
public dbKitHandler() {
|
||||||
this.localClass = Kit.class;
|
this.localClass = Kit.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Kit> GET_ALL_KITS() {
|
public ArrayList<Kit> GET_ALL_KITS() {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.MenuOption;
|
import engine.objects.MenuOption;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class dbMenuHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMenuHandler() {
|
public dbMenuHandler() {
|
||||||
this.localClass = MenuOption.class;
|
this.localClass = MenuOption.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
|
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.MineProduction;
|
import engine.objects.MineProduction;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -24,7 +24,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMineHandler() {
|
public dbMineHandler() {
|
||||||
this.localClass = Mine.class;
|
this.localClass = Mine.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mine GET_MINE(int id) {
|
public Mine GET_MINE(int id) {
|
||||||
@@ -32,7 +32,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
if (id == 0)
|
if (id == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
|
Mine mine = (Mine) DbManager.getFromCache(mbEnums.GameObjectType.Mine, id);
|
||||||
|
|
||||||
if (mine != null)
|
if (mine != null)
|
||||||
return mine;
|
return mine;
|
||||||
@@ -83,7 +83,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CHANGE_RESOURCE(Mine mine, Enum.ResourceType resource) {
|
public boolean CHANGE_RESOURCE(Mine mine, mbEnums.ResourceType resource) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.MobBase;
|
import engine.objects.MobBase;
|
||||||
import engine.objects.MobBaseEffects;
|
import engine.objects.MobBaseEffects;
|
||||||
import engine.objects.MobBaseStats;
|
import engine.objects.MobBaseStats;
|
||||||
@@ -26,7 +27,7 @@ public class dbMobBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMobBaseHandler() {
|
public dbMobBaseHandler() {
|
||||||
this.localClass = MobBase.class;
|
this.localClass = MobBase.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MobBase GET_MOBBASE(int id) {
|
public MobBase GET_MOBBASE(int id) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -24,7 +25,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMobHandler() {
|
public dbMobHandler() {
|
||||||
this.localClass = Mob.class;
|
this.localClass = Mob.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob PERSIST(Mob toAdd) {
|
public Mob PERSIST(Mob toAdd) {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum.ProfitType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.ProfitType;
|
||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
import engine.objects.NPCProfits;
|
import engine.objects.NPCProfits;
|
||||||
import engine.objects.ProducedItem;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbNPCHandler() {
|
public dbNPCHandler() {
|
||||||
this.localClass = NPC.class;
|
this.localClass = NPC.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
@@ -310,6 +310,22 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_RACE(NPC npc, int value) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `npc_raceID`=? WHERE `UID`=?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, value);
|
||||||
|
preparedStatement.setLong(2, npc.getObjectUUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LOAD_PIRATE_NAMES() {
|
public void LOAD_PIRATE_NAMES() {
|
||||||
|
|
||||||
String pirateName;
|
String pirateName;
|
||||||
@@ -345,117 +361,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
+ NPC._pirateNames.size() + " mobBases");
|
+ NPC._pirateNames.size() + " mobBases");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long templateID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `templateID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, ID);
|
|
||||||
preparedStatement.setLong(2, npcUID);
|
|
||||||
preparedStatement.setLong(3, templateID);
|
|
||||||
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
|
||||||
preparedStatement.setBoolean(5, isRandom);
|
|
||||||
preparedStatement.setString(6, prefix);
|
|
||||||
preparedStatement.setString(7, suffix);
|
|
||||||
preparedStatement.setString(8, name);
|
|
||||||
preparedStatement.setInt(9, playerID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean REMOVE_FROM_PRODUCTION_LIST(final long ID, final long npcUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_npc_production` WHERE `ID`=? AND `npcUID`=?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, ID);
|
|
||||||
preparedStatement.setLong(2, npcUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean UPDATE_ITEM_TO_INVENTORY(final long ID, final long npcUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `inForge`=? WHERE `ID`=? AND `npcUID`=?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setByte(1, (byte) 0);
|
|
||||||
preparedStatement.setLong(2, ID);
|
|
||||||
preparedStatement.setLong(3, npcUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean UPDATE_ITEM_PRICE(final long ID, final long npcUID, int value) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `value`=? WHERE `ID`=? AND `npcUID`=?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
|
||||||
preparedStatement.setLong(2, ID);
|
|
||||||
preparedStatement.setLong(3, npcUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean UPDATE_ITEM_ID(final long ID, final long npcUID, final long value) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `ID`=? WHERE `ID`=? AND `npcUID`=? LIMIT 1;")) {
|
|
||||||
|
|
||||||
preparedStatement.setLong(1, value);
|
|
||||||
preparedStatement.setLong(2, ID);
|
|
||||||
preparedStatement.setLong(3, npcUID);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ALL_ITEMS_TO_PRODUCE(NPC npc) {
|
|
||||||
|
|
||||||
if (npc == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_npc_production` WHERE `npcUID` = ?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, npc.getObjectUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
ProducedItem producedItem = new ProducedItem(rs);
|
|
||||||
npc.forgedItems.add(producedItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean UPDATE_PROFITS(NPC npc, ProfitType profitType, float value) {
|
public boolean UPDATE_PROFITS(NPC npc, ProfitType profitType, float value) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Petition;
|
import engine.objects.Petition;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ public class dbPetitionHandler extends dbHandlerBase {
|
|||||||
" VALUES (?,?,?,?,?,?,?,?,?);")) {
|
" VALUES (?,?,?,?,?,?,?,?,?);")) {
|
||||||
|
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis()));
|
preparedStatement.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis()));
|
||||||
preparedStatement.setString(2, Enum.PetitionType.values()[petition.primaryType].name());
|
preparedStatement.setString(2, mbEnums.PetitionType.values()[petition.primaryType].name());
|
||||||
preparedStatement.setString(3, Enum.PetitionSubType.values()[petition.subType].name());
|
preparedStatement.setString(3, mbEnums.PetitionSubType.values()[petition.subType].name());
|
||||||
preparedStatement.setInt(4, petition.reportAccount.getObjectUUID());
|
preparedStatement.setInt(4, petition.reportAccount.getObjectUUID());
|
||||||
preparedStatement.setString(5, petition.reportAccount.getUname());
|
preparedStatement.setString(5, petition.reportAccount.getUname());
|
||||||
preparedStatement.setInt(6, petition.reportPlayer.getObjectUUID());
|
preparedStatement.setInt(6, petition.reportPlayer.getObjectUUID());
|
||||||
|
|||||||
@@ -9,9 +9,12 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.*;
|
import engine.mbEnums;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.Heraldry;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.PlayerFriends;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -26,7 +29,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPlayerCharacterHandler() {
|
public dbPlayerCharacterHandler() {
|
||||||
this.localClass = PlayerCharacter.class;
|
this.localClass = PlayerCharacter.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCharacter ADD_PLAYER_CHARACTER(final PlayerCharacter toAdd) {
|
public PlayerCharacter ADD_PLAYER_CHARACTER(final PlayerCharacter toAdd) {
|
||||||
@@ -173,7 +176,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
if (objectUUID == 0)
|
if (objectUUID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, objectUUID);
|
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(mbEnums.GameObjectType.PlayerCharacter, objectUUID);
|
||||||
|
|
||||||
if (playerCharacter != null)
|
if (playerCharacter != null)
|
||||||
return playerCharacter;
|
return playerCharacter;
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -25,7 +25,7 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPowerHandler() {
|
public dbPowerHandler() {
|
||||||
this.localClass = Mob.class;
|
this.localClass = Mob.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addAllSourceTypes() {
|
public static void addAllSourceTypes() {
|
||||||
@@ -41,7 +41,7 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
int token = DbManager.hasher.SBStringHash(IDString);
|
int token = DbManager.hasher.SBStringHash(IDString);
|
||||||
|
|
||||||
source = rs.getString("source").replace("-", "").trim();
|
source = rs.getString("source").replace("-", "").trim();
|
||||||
Enum.EffectSourceType effectSourceType = Enum.EffectSourceType.GetEffectSourceType(source);
|
mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source);
|
||||||
|
|
||||||
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
||||||
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.PromotionClass;
|
import engine.objects.PromotionClass;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class dbPromotionClassHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPromotionClassHandler() {
|
public dbPromotionClassHandler() {
|
||||||
this.localClass = PromotionClass.class;
|
this.localClass = PromotionClass.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> GET_ALLOWED_RUNES(final PromotionClass pc) {
|
public ArrayList<Integer> GET_ALLOWED_RUNES(final PromotionClass pc) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.RuneBaseAttribute;
|
import engine.objects.RuneBaseAttribute;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class dbRuneBaseAttributeHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseAttributeHandler() {
|
public dbRuneBaseAttributeHandler() {
|
||||||
this.localClass = RuneBaseAttribute.class;
|
this.localClass = RuneBaseAttribute.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.RuneBaseEffect;
|
import engine.objects.RuneBaseEffect;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -26,7 +27,7 @@ public class dbRuneBaseEffectHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseEffectHandler() {
|
public dbRuneBaseEffectHandler() {
|
||||||
this.localClass = RuneBaseEffect.class;
|
this.localClass = RuneBaseEffect.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) {
|
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
import engine.powers.RunePowerEntry;
|
import engine.powers.RunePowerEntry;
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
import engine.powers.RuneSkillAdjustEntry;
|
||||||
@@ -26,7 +27,7 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseHandler() {
|
public dbRuneBaseHandler() {
|
||||||
this.localClass = RuneBase.class;
|
this.localClass = RuneBase.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Portal;
|
import engine.objects.Portal;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -49,7 +49,7 @@ public class dbRunegateHandler extends dbHandlerBase {
|
|||||||
public ArrayList<Portal> GET_PORTAL_LIST(int gateUID) {
|
public ArrayList<Portal> GET_PORTAL_LIST(int gateUID) {
|
||||||
|
|
||||||
ArrayList<Portal> portalList = new ArrayList<>();
|
ArrayList<Portal> portalList = new ArrayList<>();
|
||||||
Building sourceBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, gateUID);
|
Building sourceBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, gateUID);
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_runegate_portals` WHERE `sourceBuilding` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_runegate_portals` WHERE `sourceBuilding` = ?;")) {
|
||||||
@@ -60,8 +60,8 @@ public class dbRunegateHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int targetBuildingID = rs.getInt("targetBuilding");
|
int targetBuildingID = rs.getInt("targetBuilding");
|
||||||
Building targetBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, targetBuildingID);
|
Building targetBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, targetBuildingID);
|
||||||
Enum.PortalType portalType = Enum.PortalType.valueOf(rs.getString("portalType"));
|
mbEnums.PortalType portalType = mbEnums.PortalType.valueOf(rs.getString("portalType"));
|
||||||
Portal portal = new Portal(sourceBuilding, portalType, targetBuilding);
|
Portal portal = new Portal(sourceBuilding, portalType, targetBuilding);
|
||||||
portalList.add(portal);
|
portalList.add(portal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.ProtectionState;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Shrine;
|
import engine.objects.Shrine;
|
||||||
@@ -28,7 +29,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbShrineHandler() {
|
public dbShrineHandler() {
|
||||||
this.localClass = Shrine.class;
|
this.localClass = Shrine.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.MaxSkills;
|
import engine.objects.MaxSkills;
|
||||||
import engine.objects.SkillsBase;
|
import engine.objects.SkillsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,7 +27,7 @@ public class dbSkillBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbSkillBaseHandler() {
|
public dbSkillBaseHandler() {
|
||||||
this.localClass = SkillsBase.class;
|
this.localClass = SkillsBase.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkillsBase GET_BASE(final int objectUUID) {
|
public SkillsBase GET_BASE(final int objectUUID) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.SkillReq;
|
import engine.objects.SkillReq;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -25,7 +26,7 @@ public class dbSkillReqHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbSkillReqHandler() {
|
public dbSkillReqHandler() {
|
||||||
this.localClass = SkillReq.class;
|
this.localClass = SkillReq.class;
|
||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<PowersBase> getAllPowersBase() {
|
public static ArrayList<PowersBase> getAllPowersBase() {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.VendorDialog;
|
import engine.objects.VendorDialog;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ public class dbVendorDialogHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbVendorDialogHandler() {
|
public dbVendorDialogHandler() {
|
||||||
this.localClass = VendorDialog.class;
|
this.localClass = VendorDialog.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
||||||
|
|
||||||
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(Enum.GameObjectType.VendorDialog, objectUUID);
|
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(mbEnums.GameObjectType.VendorDialog, objectUUID);
|
||||||
|
|
||||||
if (vendorDialog != null)
|
if (vendorDialog != null)
|
||||||
return vendorDialog;
|
return vendorDialog;
|
||||||
|
|||||||
@@ -9,19 +9,20 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.Enum.TransactionType;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.ForgeManager;
|
||||||
|
import engine.loot.WorkOrder;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
|
import engine.mbEnums.TransactionType;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.Transaction;
|
import engine.objects.Transaction;
|
||||||
import engine.objects.Warehouse;
|
import engine.objects.Warehouse;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -39,7 +40,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Enum.ResourceType resource, int amount, DateTime date) {
|
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, mbEnums.ResourceType resource, int amount, DateTime date) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||||
@@ -105,8 +106,8 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
JSONArray locks = new JSONArray();
|
JSONArray locks = new JSONArray();
|
||||||
|
|
||||||
for (Enum.ResourceType resource : warehouse.locked)
|
for (mbEnums.ResourceType resource : warehouse.locked)
|
||||||
locks.add(resource.name());
|
locks.put(resource.name());
|
||||||
|
|
||||||
warehouseJSON.put("locked", locks);
|
warehouseJSON.put("locked", locks);
|
||||||
|
|
||||||
@@ -127,22 +128,20 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_WAREHOUSES() {
|
public void LOAD_WAREHOUSES() {
|
||||||
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_warehouse`;");
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_warehouse`;");
|
||||||
ResultSet rs = preparedStatement.executeQuery()) {
|
ResultSet rs = preparedStatement.executeQuery()) {
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int cityUID = rs.getInt("cityUUID");
|
int cityUID = rs.getInt("cityUUID");
|
||||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("warehouse"));
|
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
||||||
City city = City.getCity(cityUID);
|
City city = City.getCity(cityUID);
|
||||||
city.warehouse = new Warehouse(jsonObject);
|
city.warehouse = new Warehouse(jsonObject);
|
||||||
city.warehouse.city = city;
|
city.warehouse.city = city;
|
||||||
|
|
||||||
// Locate warehouse building
|
// Locate warehouse building
|
||||||
for (Building building : city.parentZone.zoneBuildingSet) {
|
for (Building building : city.parentZone.zoneBuildingSet) {
|
||||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE)) {
|
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.WAREHOUSE)) {
|
||||||
city.warehouse.building = building;
|
city.warehouse.building = building;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -154,4 +153,76 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean WRITE_WORKORDER(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
JSONObject warehouseJSON = WorkOrder.toJson(workOrder);
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_workorders` (`workorderID`, `workorder`) VALUES (?, ?) " +
|
||||||
|
"ON DUPLICATE KEY UPDATE `workorder` = VALUES(`workorder`)")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, workOrder.workOrderID);
|
||||||
|
preparedStatement.setString(2, warehouseJSON.toString());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DELETE_WORKORDER(WorkOrder workOrder) {
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_workorders` WHERE `workorderID` = ?;")) {
|
||||||
|
preparedStatement.setInt(1, workOrder.workOrderID);
|
||||||
|
preparedStatement.executeUpdate();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_WORKORDERS() {
|
||||||
|
|
||||||
|
// Method loads NPC workOrders from disk at bootstrap.
|
||||||
|
// A workOrder will persist until completed or junked
|
||||||
|
// via the client interface.
|
||||||
|
|
||||||
|
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
||||||
|
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
||||||
|
ResultSet rs = preparedStatement.executeQuery()) {
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
JSONObject jsonObject = new JSONObject(rs.getString("workorder"));
|
||||||
|
WorkOrder workOrder = new WorkOrder(jsonObject);
|
||||||
|
submitList.add(workOrder);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit new workOrders to the ForgeManager
|
||||||
|
|
||||||
|
for (WorkOrder workOrder : submitList) {
|
||||||
|
|
||||||
|
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||||
|
|
||||||
|
// Delete but do not reconstitute orphan workOrders
|
||||||
|
|
||||||
|
if (workOrder.vendor == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
||||||
|
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||||
|
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||||
|
ForgeManager.forge.add(workOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.objects.ZoneTemplate;
|
import engine.objects.ZoneTemplate;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -26,7 +26,7 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbZoneHandler() {
|
public dbZoneHandler() {
|
||||||
this.localClass = Zone.class;
|
this.localClass = Zone.class;
|
||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Zone> GET_ALL_ZONES() {
|
public ArrayList<Zone> GET_ALL_ZONES() {
|
||||||
@@ -48,7 +48,7 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public Zone GET_BY_UID(long ID) {
|
public Zone GET_BY_UID(long ID) {
|
||||||
|
|
||||||
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, (int) ID);
|
Zone zone = (Zone) DbManager.getFromCache(mbEnums.GameObjectType.Zone, (int) ID);
|
||||||
|
|
||||||
if (zone != null)
|
if (zone != null)
|
||||||
return zone;
|
return zone;
|
||||||
@@ -90,8 +90,8 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
zoneTemplate.max_blend = 128;
|
zoneTemplate.max_blend = 128;
|
||||||
zoneTemplate.min_blend = 128;
|
zoneTemplate.min_blend = 128;
|
||||||
zoneTemplate.terrain_max_y = 5;
|
zoneTemplate.terrain_max_y = 5;
|
||||||
zoneTemplate.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
zoneTemplate.major_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
|
||||||
zoneTemplate.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
zoneTemplate.minor_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
|
||||||
zoneTemplate.terrain_type = "PLANAR";
|
zoneTemplate.terrain_type = "PLANAR";
|
||||||
|
|
||||||
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd;
|
package engine.devcmd;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
@@ -17,6 +16,7 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.ProtectionState;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -61,7 +61,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, zone, null, null, "", 1, mbEnums.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
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.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.PowerActionType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums.PowerActionType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|||||||
@@ -10,9 +10,14 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.ItemFactory;
|
import engine.objects.Item;
|
||||||
|
import engine.objects.ItemTemplate;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
@@ -24,22 +29,46 @@ public class CreateItemCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
if (words.length < 2) {
|
if (words.length < 2) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(playerCharacter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int templateID = Integer.parseInt(words[0]);
|
int templateID = Integer.parseInt(words[0]);
|
||||||
|
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||||
|
|
||||||
|
if (template == null) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "No such template found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int size = 1;
|
int size = 1;
|
||||||
|
|
||||||
if (words.length == 2)
|
if (words.length == 2)
|
||||||
size = Integer.parseInt(words[1]);
|
size = Integer.parseInt(words[1]);
|
||||||
|
|
||||||
ItemFactory.fillInventory(pc, templateID, size);
|
for (int i = 0; i < size; i++) {
|
||||||
|
|
||||||
|
if (!playerCharacter.charItemManager.hasRoomInventory(template.item_wt)) {
|
||||||
|
ChatManager.chatSystemInfo(playerCharacter, "You are encumbered!.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item item = new Item(templateID);
|
||||||
|
item.ownerID = playerCharacter.getObjectUUID();
|
||||||
|
item.ownerType = mbEnums.OwnerType.PlayerCharacter;
|
||||||
|
item.containerType = mbEnums.ItemContainerType.INVENTORY;
|
||||||
|
|
||||||
|
try {
|
||||||
|
item = DbManager.ItemQueries.PERSIST(item);
|
||||||
|
playerCharacter.charItemManager.addItemToInventory(item);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
playerCharacter.charItemManager.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
public class GotoObj extends AbstractDevCmd {
|
public class GotoObj extends AbstractDevCmd {
|
||||||
@@ -27,7 +27,7 @@ public class GotoObj extends AbstractDevCmd {
|
|||||||
|
|
||||||
int uuid;
|
int uuid;
|
||||||
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
|
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
|
||||||
Enum.DbObjectType objectType;
|
mbEnums.DbObjectType objectType;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uuid = Integer.parseInt(words[0]);
|
uuid = Integer.parseInt(words[0]);
|
||||||
@@ -41,37 +41,37 @@ public class GotoObj extends AbstractDevCmd {
|
|||||||
switch (objectType) {
|
switch (objectType) {
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
|
NPC npc = (NPC) DbManager.getFromCache(mbEnums.GameObjectType.NPC, uuid);
|
||||||
|
|
||||||
if (npc != null)
|
if (npc != null)
|
||||||
targetLoc = npc.getLoc();
|
targetLoc = npc.getLoc();
|
||||||
break;
|
break;
|
||||||
case MOB:
|
case MOB:
|
||||||
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
|
Mob mob = (Mob) DbManager.getFromCache(mbEnums.GameObjectType.Mob, uuid);
|
||||||
|
|
||||||
if (mob != null)
|
if (mob != null)
|
||||||
targetLoc = mob.getLoc();
|
targetLoc = mob.getLoc();
|
||||||
break;
|
break;
|
||||||
case CHARACTER:
|
case CHARACTER:
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
|
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(mbEnums.GameObjectType.PlayerCharacter, uuid);
|
||||||
|
|
||||||
if (playerCharacter != null)
|
if (playerCharacter != null)
|
||||||
targetLoc = playerCharacter.getLoc();
|
targetLoc = playerCharacter.getLoc();
|
||||||
break;
|
break;
|
||||||
case BUILDING:
|
case BUILDING:
|
||||||
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
|
Building building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, uuid);
|
||||||
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
targetLoc = building.getLoc();
|
targetLoc = building.getLoc();
|
||||||
break;
|
break;
|
||||||
case ZONE:
|
case ZONE:
|
||||||
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
|
Zone zone = (Zone) DbManager.getFromCache(mbEnums.GameObjectType.Zone, uuid);
|
||||||
|
|
||||||
if (zone != null)
|
if (zone != null)
|
||||||
targetLoc = zone.getLoc();
|
targetLoc = zone.getLoc();
|
||||||
break;
|
break;
|
||||||
case CITY:
|
case CITY:
|
||||||
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
|
City city = (City) DbManager.getFromCache(mbEnums.GameObjectType.City, uuid);
|
||||||
|
|
||||||
if (city != null)
|
if (city != null)
|
||||||
targetLoc = city.getLoc();
|
targetLoc = city.getLoc();
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.Enum.TargetColor;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.BuildingGroup;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
|
import engine.mbEnums.TargetColor;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.util.StringUtils;
|
import engine.util.StringUtils;
|
||||||
|
|
||||||
@@ -369,7 +369,8 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "InventorySet: " + targetNPC.getContract().inventorySet;
|
output += "InventorySet: " + targetNPC.getContract().inventorySet;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += targetNPC.getContract().getAllowedBuildings().toString();
|
Contract contract1 = targetNPC.getContract();
|
||||||
|
output += contract1.allowedBuildings.toString();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
|
output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
|
||||||
|
|
||||||
@@ -383,7 +384,8 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
if (mobBase != null) {
|
if (mobBase != null) {
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
|
Contract contract = targetNPC.getContract();
|
||||||
|
output += "Slottable: " + contract.allowedBuildings.toString();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -436,7 +438,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
if (targetMob.isPet()) {
|
if (targetMob.isPet()) {
|
||||||
output += "isPet: true";
|
output += "isPet: true";
|
||||||
output += newline;
|
output += newline;
|
||||||
if ((targetMob.agentType.equals(Enum.AIAgentType.PET)))
|
if ((targetMob.agentType.equals(mbEnums.AIAgentType.PET)))
|
||||||
output += "isSummonedPet: true";
|
output += "isSummonedPet: true";
|
||||||
else
|
else
|
||||||
output += "isSummonedPet: false";
|
output += "isSummonedPet: false";
|
||||||
@@ -456,7 +458,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((targetMob.agentType.equals(Enum.AIAgentType.MOBILE))) {
|
if ((targetMob.agentType.equals(mbEnums.AIAgentType.MOBILE))) {
|
||||||
output += "SpawnRadius: " + targetMob.getSpawnRadius();
|
output += "SpawnRadius: " + targetMob.getSpawnRadius();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
|
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
|
||||||
@@ -473,7 +475,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "EquipSet: " + targetMob.equipmentSetID;
|
output += "EquipSet: " + targetMob.equipmentSetID;
|
||||||
output += newline;
|
output += newline;
|
||||||
try {
|
try {
|
||||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
|
output += "Parent Zone LoadNum : " + targetMob.parentZone.templateID;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//who cares
|
//who cares
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,212 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector3f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class MakeBaneCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public MakeBaneCmd() {
|
|
||||||
super("makebane");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
if (words.length < 1 || words.length > 2) {
|
|
||||||
this.sendUsage(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int attackerID = 0;
|
|
||||||
int rank = 8;
|
|
||||||
|
|
||||||
if (words.length == 2) {
|
|
||||||
try {
|
|
||||||
attackerID = Integer.parseInt(words[0]);
|
|
||||||
rank = Integer.parseInt(words[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (words.length == 1) {
|
|
||||||
if (target == null) {
|
|
||||||
throwbackError(pc, "No target specified");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(target instanceof PlayerCharacter)) {
|
|
||||||
throwbackError(pc, "Target is not a player");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
attackerID = target.getObjectUUID();
|
|
||||||
|
|
||||||
try {
|
|
||||||
rank = Integer.parseInt(words[0]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throwbackError(pc, "Rank must be specified, 1 through 8");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rank < 1 || rank > 8) {
|
|
||||||
throwbackError(pc, "Rank must be 1 through 8");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
|
||||||
|
|
||||||
|
|
||||||
if (player.getGuild().isEmptyGuild()) {
|
|
||||||
throwbackError(pc, "Errant's can not place banes");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
|
|
||||||
|
|
||||||
if (attackerAGL == null) {
|
|
||||||
throwbackError(pc, "No guild leader found for attacking guild.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(attackerAGL instanceof PlayerCharacter)) {
|
|
||||||
throwbackError(pc, "Attacking guild leader is an NPC.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getGuild().isNPCGuild()) {
|
|
||||||
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (player.getGuild().getOwnedCity() != null) {
|
|
||||||
// throwbackError(pc, "The attacking guild already has a city.");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
|
||||||
|
|
||||||
if (zone == null) {
|
|
||||||
throwbackError(pc, "Unable to find the zone you're in.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!zone.guild_zone) {
|
|
||||||
throwbackError(pc, "This is not a player city.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityUUID);
|
|
||||||
if (city == null) {
|
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (city.getTOL() == null) {
|
|
||||||
throwbackError(pc, "Unable to find the tree of life for this city.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (city.getBane() != null) {
|
|
||||||
throwbackError(pc, "This city is already baned.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
|
|
||||||
throwbackError(pc, "This guild is already baning someone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Blueprint blueprint = Blueprint.getBlueprint(24300);
|
|
||||||
|
|
||||||
if (blueprint == null) {
|
|
||||||
throwbackError(pc, "Unable to find building set for banestone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3f rot = new Vector3f(0, 0, 0);
|
|
||||||
|
|
||||||
// *** Refactor : Overlap test goes here
|
|
||||||
|
|
||||||
//Let's drop a banestone!
|
|
||||||
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
|
|
||||||
|
|
||||||
if (localLocation == null) {
|
|
||||||
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
|
|
||||||
Logger.info("Failed to Convert World coordinates to local zone coordinates");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
|
|
||||||
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
|
|
||||||
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
|
|
||||||
null, blueprint.getBlueprintUUID(), 1, 0.0f);
|
|
||||||
|
|
||||||
if (stone == null) {
|
|
||||||
ChatManager.chatSystemError(pc, "Failed to create banestone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stone.addEffectBit((1 << 19));
|
|
||||||
BuildingManager.setRank(stone, (byte) rank);
|
|
||||||
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
|
||||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
|
||||||
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
|
||||||
|
|
||||||
//Make the bane
|
|
||||||
|
|
||||||
Bane bane = Bane.makeBane(player, city, stone);
|
|
||||||
|
|
||||||
if (bane == null) {
|
|
||||||
|
|
||||||
//delete bane stone, failed to make bane object
|
|
||||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
|
|
||||||
|
|
||||||
throwbackError(pc, "Failed to create bane.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldGrid.addObject(stone, pc);
|
|
||||||
|
|
||||||
//Add baned effect to TOL
|
|
||||||
city.getTOL().addEffectBit((1 << 16));
|
|
||||||
city.getTOL().updateEffects();
|
|
||||||
|
|
||||||
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
|
|
||||||
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
|
|
||||||
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
|
|
||||||
player.teleport(movePlayerOutsideStone);
|
|
||||||
|
|
||||||
throwbackInfo(pc, "The city has been succesfully baned.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Creates an bane.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./makebane playerUUID baneRank'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.ItemType;
|
|
||||||
import engine.Enum.OwnerType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums.ItemType;
|
||||||
|
import engine.mbEnums.OwnerType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -64,7 +64,7 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.Mob) {
|
if (tar.getObjectType() == GameObjectType.Mob) {
|
||||||
Mob tarMob = (Mob) tar;
|
Mob tarMob = (Mob) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
for (mbEnums.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||||
Item equip = tarMob.charItemManager.equipped.get(slot);
|
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||||
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
if (tar.getObjectType() == GameObjectType.NPC) {
|
if (tar.getObjectType() == GameObjectType.NPC) {
|
||||||
NPC tarMob = (NPC) tar;
|
NPC tarMob = (NPC) tar;
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
for (Enum.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
for (mbEnums.EquipSlotType slot : tarMob.charItemManager.equipped.keySet()) {
|
||||||
Item equip = tarMob.charItemManager.equipped.get(slot);
|
Item equip = tarMob.charItemManager.equipped.get(slot);
|
||||||
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
throwbackInfo(pc, equip.templateID + " : " + equip.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
@@ -82,10 +82,10 @@ public class PrintEquipCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
CharacterItemManager cim = ((AbstractCharacter) tar).charItemManager;
|
||||||
ConcurrentHashMap<Enum.EquipSlotType, Item> list = cim.getEquipped();
|
ConcurrentHashMap<mbEnums.EquipSlotType, Item> list = cim.getEquipped();
|
||||||
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
|
||||||
|
|
||||||
for (Enum.EquipSlotType slot : list.keySet()) {
|
for (mbEnums.EquipSlotType slot : list.keySet()) {
|
||||||
Item item = list.get(slot);
|
Item item = list.get(slot);
|
||||||
throwbackInfo(pc, " " + item.template.item_base_name + ", slot: " + slot);
|
throwbackInfo(pc, " " + item.template.item_base_name + ", slot: " + slot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.ItemType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums.ItemType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ItemManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +88,7 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
//get weapons
|
//get weapons
|
||||||
|
|
||||||
if (tar.charItemManager.equipped.isEmpty() == false)
|
if (tar.charItemManager.equipped.isEmpty() == false)
|
||||||
if (tar.charItemManager.equipped.get(Enum.EquipSlotType.LHELD) != null && !ItemTemplate.isShield(tar.charItemManager.equipped.get(Enum.EquipSlotType.LHELD))) {
|
if (tar.charItemManager.equipped.get(mbEnums.EquipSlotType.LHELD) != null && !ItemManager.isShield(tar.charItemManager.equipped.get(mbEnums.EquipSlotType.LHELD))) {
|
||||||
//off hand weapon
|
//off hand weapon
|
||||||
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
||||||
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
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;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.BuildingGroup;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -64,8 +64,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
|
||||||
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);
|
||||||
@@ -78,8 +79,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null) {
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||||
DbManager.removeFromCache(GameObjectType.Mob,
|
DbManager.removeFromCache(GameObjectType.Mob,
|
||||||
@@ -159,11 +161,12 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
|
||||||
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(Enum.GameObjectType.NPC,
|
DbManager.removeFromCache(mbEnums.GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
@@ -172,11 +175,12 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null) {
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||||
DbManager.removeFromCache(Enum.GameObjectType.Mob,
|
DbManager.removeFromCache(mbEnums.GameObjectType.Mob,
|
||||||
mobA.getObjectUUID());
|
mobA.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(mobA);
|
WorldGrid.RemoveWorldObject(mobA);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.SiegeResult;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.mbEnums.SiegeResult;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.DbObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
@@ -18,6 +16,8 @@ import engine.gameManager.ChatManager;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.BuildingGroup;
|
||||||
|
import engine.mbEnums.DbObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,8 +180,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
WorldGrid.removeObject(minionMob, pc);
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
if (minionMob.getParentZone() != null) {
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
@@ -202,9 +203,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
if (mob.getParentZone() != null) {
|
||||||
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
if (mob.parentZone != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
||||||
return;
|
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove npc from hirelings list.
|
// Remove npc from hirelings list.
|
||||||
@@ -222,8 +225,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.parentZone != null) {
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.parentZone.zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
|
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
"Mob with ID " + mob.getDBID() + " removed");
|
"Mob with ID " + mob.getDBID() + " removed");
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
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;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.net.DispatchMessage;
|
import engine.gameManager.DispatchManager;
|
||||||
|
import engine.mbEnums.DispatchChannel;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -41,7 +41,7 @@ public class SetHealthCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// Update all surrounding clients.
|
// Update all surrounding clients.
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.ProtectionState;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.ProtectionState;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
@@ -59,7 +59,7 @@ public class SetInvulCmd extends AbstractDevCmd {
|
|||||||
// status of the entire city
|
// status of the entire city
|
||||||
|
|
||||||
if ((b.getBlueprint() != null) &&
|
if ((b.getBlueprint() != null) &&
|
||||||
(b.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))) {
|
(b.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.TOL))) {
|
||||||
|
|
||||||
City city;
|
City city;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.net.DispatchMessage;
|
import engine.gameManager.DispatchManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -31,7 +32,7 @@ public class SetManaCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
//Update all surrounding clients. - NOT for Mana?
|
//Update all surrounding clients. - NOT for Mana?
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(pc, cmm, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DbObjectType;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.DbObjectType;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public class SetOwnerCmd extends AbstractDevCmd {
|
|||||||
// if it's a tol change ownership of the city
|
// if it's a tol change ownership of the city
|
||||||
|
|
||||||
if (_targetBuilding.getBlueprint() != null &&
|
if (_targetBuilding.getBlueprint() != null &&
|
||||||
_targetBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.TOL)) {
|
_targetBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.TOL)) {
|
||||||
|
|
||||||
City city = _targetBuilding.getCity();
|
City city = _targetBuilding.getCity();
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
|
||||||
import engine.InterestManagement.InterestManager;
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.net.DispatchMessage;
|
import engine.gameManager.DispatchManager;
|
||||||
|
import engine.mbEnums.DispatchChannel;
|
||||||
import engine.net.client.msg.ApplyRuneMsg;
|
import engine.net.client.msg.ApplyRuneMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -54,7 +54,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
|
|||||||
PromotionClass promo = pc.getPromotionClass();
|
PromotionClass promo = pc.getPromotionClass();
|
||||||
if (promo != null) {
|
if (promo != null) {
|
||||||
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
|
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.NPC;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class SetRaceCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public SetRaceCmd() {
|
||||||
|
super("setRace");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
int newRace = Integer.parseInt(words[0]);
|
||||||
|
|
||||||
|
if (target.getObjectType().equals(mbEnums.GameObjectType.NPC) == false) {
|
||||||
|
throwbackError(player, "You Must Target An NPC");
|
||||||
|
}
|
||||||
|
|
||||||
|
NPC npc = (NPC) target;
|
||||||
|
npc.loadID = newRace;
|
||||||
|
DbManager.NPCQueries.UPDATE_RACE(npc, newRace);
|
||||||
|
InterestManager.reloadCharacter(npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Sets NPC race";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /setrace ID'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.net.DispatchMessage;
|
import engine.gameManager.DispatchManager;
|
||||||
|
import engine.mbEnums.DispatchChannel;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -42,7 +42,7 @@ public class SetStaminaCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// Update all surrounding clients.
|
// Update all surrounding clients.
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.net.DispatchMessage;
|
import engine.gameManager.DispatchManager;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.net.client.msg.ApplyBuildingEffectMsg;
|
import engine.net.client.msg.ApplyBuildingEffectMsg;
|
||||||
import engine.net.client.msg.UpdateCharOrMobMessage;
|
import engine.net.client.msg.UpdateCharOrMobMessage;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
@@ -39,13 +39,13 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
if (raceID == 0)
|
if (raceID == 0)
|
||||||
raceID = player.getRaceID();
|
raceID = player.getRaceID();
|
||||||
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
|
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
|
||||||
DispatchMessage.sendToAllInRange(player, ucm);
|
DispatchManager.sendToAllInRange(player, ucm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (words[0].equals("all")) {
|
if (words[0].equals("all")) {
|
||||||
for (int i = 15999; i < 16337; i++) {
|
for (int i = 15999; i < 16337; i++) {
|
||||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
|
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
|
||||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -56,7 +56,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
|
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
|
||||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.mbEnums.BuildingGroup;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.util.StringUtils;
|
import engine.util.StringUtils;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -90,9 +90,9 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// User requests list of current groups.
|
// User requests list of current groups.
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("LIST")) {
|
if (args.length == 0 || args[0].equalsIgnoreCase("LIST")) {
|
||||||
|
|
||||||
outString = "Current: " + contract.getAllowedBuildings();
|
outString = "Current: " + contract.allowedBuildings;
|
||||||
|
|
||||||
throwbackInfo(pc, outString);
|
throwbackInfo(pc, outString);
|
||||||
return;
|
return;
|
||||||
@@ -110,9 +110,9 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
switch (args[1].toUpperCase()) {
|
switch (args[1].toUpperCase()) {
|
||||||
|
|
||||||
case "ON":
|
case "ON":
|
||||||
contract.getAllowedBuildings().add(buildingGroup);
|
contract.allowedBuildings.add(buildingGroup);
|
||||||
|
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract)) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
||||||
return;
|
return;
|
||||||
@@ -121,8 +121,9 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
throwbackInfo(pc, "SlotNpc " + buildingGroup.name() + " added to npc");
|
throwbackInfo(pc, "SlotNpc " + buildingGroup.name() + " added to npc");
|
||||||
break;
|
break;
|
||||||
case "OFF":
|
case "OFF":
|
||||||
contract.getAllowedBuildings().remove(buildingGroup);
|
contract.allowedBuildings.remove(buildingGroup);
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
|
||||||
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract)) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
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;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -111,7 +111,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, serverZone, null, null, "", 1, mbEnums.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.net.client.msg.UnloadObjectsMsg;
|
import engine.net.client.msg.UnloadObjectsMsg;
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.mobileAI.MobAI;
|
import engine.mobileAI.MobAI;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
@@ -67,7 +67,7 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (mob.isPlayerGuard() == true) {
|
if (mob.isPlayerGuard() == true) {
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION))
|
||||||
contractID = mob.guardCaptain.contract.getContractID();
|
contractID = mob.guardCaptain.contract.getContractID();
|
||||||
else
|
else
|
||||||
contractID = mob.contract.getContractID();
|
contractID = mob.contract.getContractID();
|
||||||
@@ -75,7 +75,7 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (contractID != 0) {
|
if (contractID != 0) {
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION)) {
|
||||||
output += "Captain Contract: " + contractID + newline;
|
output += "Captain Contract: " + contractID + newline;
|
||||||
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
||||||
} else
|
} else
|
||||||
@@ -128,7 +128,7 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
if (mob.contract != null)
|
if (mob.contract != null)
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION))
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||||
|
|
||||||
powerEntries.addAll(contractEntries);
|
powerEntries.addAll(contractEntries);
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.exception;
|
|
||||||
|
|
||||||
public class MsgSendException extends MBServerException {
|
|
||||||
private static final long serialVersionUID = 6927044139998382254L;
|
|
||||||
|
|
||||||
public MsgSendException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MsgSendException(String arg0, Throwable arg1) {
|
|
||||||
super(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MsgSendException(String arg0) {
|
|
||||||
super(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MsgSendException(Throwable arg0) {
|
|
||||||
super(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.exception;
|
|
||||||
|
|
||||||
public class SerializationException extends MBServerException {
|
|
||||||
private static final long serialVersionUID = 6927044139998382254L;
|
|
||||||
|
|
||||||
public SerializationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SerializationException(String arg0, Throwable arg1) {
|
|
||||||
super(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SerializationException(String arg0) {
|
|
||||||
super(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SerializationException(Throwable arg0) {
|
|
||||||
super(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,16 +9,17 @@
|
|||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.InterestManager;
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.UpgradeBuildingJob;
|
import engine.jobs.UpgradeBuildingJob;
|
||||||
|
import engine.loot.WorkOrder;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.BuildingGroup;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
@@ -49,8 +50,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
// Some meshes might not have slot locations assigned.
|
// Some meshes might not have slot locations assigned.
|
||||||
|
|
||||||
if (slotLocations == null ||
|
if (slotLocations == null || slotLocations.isEmpty())
|
||||||
slotLocations.isEmpty())
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||||
@@ -69,17 +69,15 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
// Some meshes might not have slot locations assigned.
|
// Some meshes might not have slot locations assigned.
|
||||||
|
|
||||||
if (slotLocations == null ||
|
if (slotLocations == null || slotLocations.isEmpty())
|
||||||
slotLocations.isEmpty())
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||||
|
|
||||||
for (int i = numOfSlots; i > 0; i--) {
|
for (int i = numOfSlots; i > 0; i--)
|
||||||
|
|
||||||
if (!building.getHirelings().containsValue(i))
|
if (!building.getHirelings().containsValue(i))
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +90,8 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
||||||
|
|
||||||
if (buildingLocation == null) {
|
if (buildingLocation == null)
|
||||||
Logger.error("Invalid slot for building: " + building.getObjectUUID());
|
Logger.error("Invalid slot for building: " + building.getObjectUUID());
|
||||||
}
|
|
||||||
|
|
||||||
return buildingLocation;
|
return buildingLocation;
|
||||||
}
|
}
|
||||||
@@ -114,6 +111,7 @@ public enum BuildingManager {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
//individual friend.
|
//individual friend.
|
||||||
|
|
||||||
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -127,22 +125,16 @@ public enum BuildingManager {
|
|||||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
|
||||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//TODO test friends list once added
|
//TODO test friends list once added
|
||||||
//does not meet above criteria. Cannot access.
|
//does not meet above criteria. Cannot access.
|
||||||
@@ -158,7 +150,6 @@ public enum BuildingManager {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
if (building.getRank() == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -168,9 +159,9 @@ public enum BuildingManager {
|
|||||||
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
||||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
return true;
|
return true;
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -213,7 +204,7 @@ public enum BuildingManager {
|
|||||||
if (!player.charItemManager.hasRoomInventory(template.item_wt))
|
if (!player.charItemManager.hasRoomInventory(template.item_wt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Item.MakeItemForPlayer(template.template_id, player, amount))
|
if (!ItemManager.MakeItemForPlayer(template.template_id, player, amount))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
shrine.setFavors(0);
|
shrine.setFavors(0);
|
||||||
@@ -230,7 +221,7 @@ public enum BuildingManager {
|
|||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (Enum.ResourceType resourceType : EnumSet.allOf(Enum.ResourceType.class)) {
|
for (mbEnums.ResourceType resourceType : EnumSet.allOf(mbEnums.ResourceType.class)) {
|
||||||
|
|
||||||
if (!player.charItemManager.hasRoomInventory(resourceType.template.item_wt)) {
|
if (!player.charItemManager.hasRoomInventory(resourceType.template.item_wt)) {
|
||||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||||
@@ -274,9 +265,7 @@ public enum BuildingManager {
|
|||||||
// Submit upgrade job for future date or current instant
|
// Submit upgrade job for future date or current instant
|
||||||
|
|
||||||
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
|
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
|
||||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building),
|
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
||||||
building.getUpgradeDateTime().atZone(ZoneId.systemDefault())
|
|
||||||
.toInstant().toEpochMilli());
|
|
||||||
} else
|
} else
|
||||||
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
|
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
|
||||||
}
|
}
|
||||||
@@ -323,7 +312,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
// Clear minions from database if a guard captain
|
// Clear minions from database if a guard captain
|
||||||
|
|
||||||
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
if (guardCaptain.agentType.equals(mbEnums.AIAgentType.GUARDCAPTAIN))
|
||||||
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,8 +324,35 @@ public enum BuildingManager {
|
|||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
WorldGrid.unloadObject(minionMob);
|
WorldGrid.unloadObject(minionMob);
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
if (minionMob.parentZone != null)
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
minionMob.parentZone.zoneMobSet.remove(minionMob);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear all workorders for this hireling
|
||||||
|
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||||
|
|
||||||
|
NPC hirelingNPC = (NPC) hireling;
|
||||||
|
|
||||||
|
if (ForgeManager.vendorWorkOrderLookup.get(hirelingNPC) != null)
|
||||||
|
|
||||||
|
for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hirelingNPC)) {
|
||||||
|
workOrder.runCompleted.set(true);
|
||||||
|
workOrder.vendor = null;
|
||||||
|
|
||||||
|
// Remove any cooking items from collections
|
||||||
|
// to ensure we don't leak memory.
|
||||||
|
|
||||||
|
for (Item item : workOrder.cooking) {
|
||||||
|
DbManager.removeFromCache(item);
|
||||||
|
ForgeManager.itemWorkOrderLookup.remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally remove the NPC from ForgeManager
|
||||||
|
|
||||||
|
ForgeManager.vendorWorkOrderLookup.remove(hirelingNPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove hireling from building
|
// Remove hireling from building
|
||||||
@@ -349,10 +365,9 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Mob hirelingMob = (Mob) hireling;
|
Mob hirelingMob = (Mob) hireling;
|
||||||
|
|
||||||
if (hirelingMob.getParentZone() != null)
|
if (hirelingMob.parentZone != null)
|
||||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob))
|
||||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
hirelingMob.parentZone.zoneMobSet.remove(hireling);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||||
@@ -377,10 +392,8 @@ public enum BuildingManager {
|
|||||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
||||||
else
|
else
|
||||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
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
|
||||||
@@ -392,22 +405,17 @@ public enum BuildingManager {
|
|||||||
// Remove all hirelings for destroyed buildings
|
// Remove all hirelings for destroyed buildings
|
||||||
|
|
||||||
if (building.getRank() < 1) {
|
if (building.getRank() < 1) {
|
||||||
|
|
||||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
||||||
BuildingManager.removeHireling(building, slottedNPC);
|
BuildingManager.removeHireling(building, slottedNPC);
|
||||||
|
|
||||||
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())
|
||||||
|
|
||||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||||
BuildingManager.removeHireling(building, hireling);
|
BuildingManager.removeHireling(building, hireling);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshHirelings(building);
|
refreshHirelings(building);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +426,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Building building;
|
Building building;
|
||||||
|
|
||||||
building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, id);
|
building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, id);
|
||||||
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
return building;
|
return building;
|
||||||
@@ -439,6 +447,7 @@ public enum BuildingManager {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//lets pass true if player is owner anyway.
|
//lets pass true if player is owner anyway.
|
||||||
|
|
||||||
if (building.getOwner().equals(player))
|
if (building.getOwner().equals(player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -451,22 +460,7 @@ public enum BuildingManager {
|
|||||||
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
|
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) != false || GuildStatusController.isInnerCouncil(player.getGuildStatus()) != false;
|
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||||
}
|
|
||||||
|
|
||||||
//This is mainly used for Rolling and gold sharing between building and warehouse.
|
|
||||||
|
|
||||||
public static int GetWithdrawAmountForRolling(Building building, int cost) {
|
|
||||||
|
|
||||||
//all funds are available to roll.
|
|
||||||
|
|
||||||
if (cost <= GetAvailableGold(building))
|
|
||||||
return cost;
|
|
||||||
|
|
||||||
// cost is more than available gold, return available gold
|
|
||||||
|
|
||||||
return GetAvailableGold(building);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetAvailableGold(Building building) {
|
public static int GetAvailableGold(Building building) {
|
||||||
@@ -480,11 +474,6 @@ public enum BuildingManager {
|
|||||||
return building.getStrongboxValue() - building.reserve;
|
return building.getStrongboxValue() - building.reserve;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetOverdraft(Building building, int cost) {
|
|
||||||
int availableGold = GetWithdrawAmountForRolling(building, cost);
|
|
||||||
return cost - availableGold;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||||
|
|
||||||
//Nation Members and Guild members are not hostile.
|
//Nation Members and Guild members are not hostile.
|
||||||
@@ -548,7 +537,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(NpcID.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(NpcID.getMobbaseID());
|
||||||
|
|
||||||
NPC npc = null;
|
NPC npc;
|
||||||
|
|
||||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
||||||
|
|
||||||
@@ -564,7 +553,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) {
|
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) {
|
||||||
|
|
||||||
int rank = 1;
|
int rank;
|
||||||
|
|
||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
@@ -584,14 +573,14 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
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);
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, mbEnums.AIAgentType.GUARDWALLARCHER);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
mobile.behaviourType = mbEnums.MobBehaviourType.GuardWallArcher;
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
// Spawn new mobile
|
// Spawn new mobile
|
||||||
@@ -603,14 +592,14 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
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);
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, mbEnums.AIAgentType.GUARDCAPTAIN);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
mobile.behaviourType = mbEnums.MobBehaviourType.GuardCaptain;
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
// Spawn new mobile
|
// Spawn new mobile
|
||||||
@@ -623,14 +612,15 @@ public enum BuildingManager {
|
|||||||
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);
|
|
||||||
|
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, mbEnums.AIAgentType.GUARDCAPTAIN);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mobile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
// Configure AI and write new mobile to disk
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
mobile.behaviourType = mbEnums.MobBehaviourType.GuardCaptain;
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||||
|
|
||||||
// Spawn new mobile
|
// Spawn new mobile
|
||||||
@@ -682,9 +672,7 @@ public enum BuildingManager {
|
|||||||
if (building.getOwner() == null)
|
if (building.getOwner() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
return building.getOwner().getObjectUUID() == player.getObjectUUID();
|
return building.getOwner().getObjectUUID() == player.getObjectUUID();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float GetMissingHealth(Building building) {
|
public static float GetMissingHealth(Building building) {
|
||||||
@@ -696,6 +684,7 @@ public enum BuildingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Regions GetRegion(Building building, float x, float y, float z) {
|
public static Regions GetRegion(Building building, float x, float y, float z) {
|
||||||
|
|
||||||
if (building.getBounds() == null)
|
if (building.getBounds() == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -703,17 +692,18 @@ public enum BuildingManager {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
Regions currentRegion = null;
|
Regions currentRegion = null;
|
||||||
for (Regions region : building.getBounds().getRegions()) {
|
|
||||||
|
|
||||||
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z))) {
|
for (Regions region : building.getBounds().getRegions()) {
|
||||||
|
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z)))
|
||||||
if (y > (region.highLerp.y - 5))
|
if (y > (region.highLerp.y - 5))
|
||||||
currentRegion = region;
|
currentRegion = region;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentRegion;
|
return currentRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Regions GetRegion(Building building, int room, int level, float x, float z) {
|
public static Regions GetRegion(Building building, int room, int level, float x, float z) {
|
||||||
|
|
||||||
if (building.getBounds() == null)
|
if (building.getBounds() == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -724,12 +714,12 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (region.getLevel() != level)
|
if (region.getLevel() != level)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (region.getRoom() != room)
|
if (region.getRoom() != room)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z))) {
|
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z)))
|
||||||
return region;
|
return region;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -739,13 +729,12 @@ public enum BuildingManager {
|
|||||||
Vector3fImmutable bindLoc = null;
|
Vector3fImmutable bindLoc = null;
|
||||||
|
|
||||||
if (building == null)
|
if (building == null)
|
||||||
return Enum.Ruins.getRandomRuin().getLocation();
|
return mbEnums.Ruins.getRandomRuin().getLocation();
|
||||||
|
|
||||||
|
|
||||||
bindLoc = building.getLoc();
|
bindLoc = building.getLoc();
|
||||||
|
|
||||||
|
|
||||||
float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
|
float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
|
||||||
|
|
||||||
if (building.getRank() == 8) {
|
if (building.getRank() == 8) {
|
||||||
bindLoc = building.getStuckLocation();
|
bindLoc = building.getStuckLocation();
|
||||||
if (bindLoc != null)
|
if (bindLoc != null)
|
||||||
@@ -798,7 +787,6 @@ public enum BuildingManager {
|
|||||||
int newMeshUUID;
|
int newMeshUUID;
|
||||||
boolean success;
|
boolean success;
|
||||||
|
|
||||||
|
|
||||||
// If this building has no blueprint then set rank and exit immediatly.
|
// If this building has no blueprint then set rank and exit immediatly.
|
||||||
|
|
||||||
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
||||||
@@ -810,14 +798,14 @@ public enum BuildingManager {
|
|||||||
// Delete any upgrade jobs before doing anything else. It won't quite work
|
// Delete any upgrade jobs before doing anything else. It won't quite work
|
||||||
// if in a few lines we happen to delete this building.
|
// if in a few lines we happen to delete this building.
|
||||||
|
|
||||||
JobContainer jc = building.getTimers().get("UPGRADE");
|
JobContainer jobContainer = building.getTimers().get("UPGRADE");
|
||||||
|
|
||||||
if (jc != null) {
|
if (jobContainer != null) {
|
||||||
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
|
if (!JobScheduler.getInstance().cancelScheduledJob(jobContainer))
|
||||||
Logger.error("failed to cancel existing upgrade job.");
|
Logger.error("failed to cancel existing upgrade job.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt write to database, or delete the building
|
// Attempt to write to database or delete the building
|
||||||
// if we are destroying it.
|
// if we are destroying it.
|
||||||
|
|
||||||
if (rank == -1)
|
if (rank == -1)
|
||||||
@@ -825,7 +813,7 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
||||||
|
|
||||||
if (success == false) {
|
if (!success) {
|
||||||
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -856,7 +844,7 @@ public enum BuildingManager {
|
|||||||
// protection
|
// protection
|
||||||
|
|
||||||
if (building.rank == -1)
|
if (building.rank == -1)
|
||||||
building.protectionState = Enum.ProtectionState.NONE;
|
building.protectionState = mbEnums.ProtectionState.NONE;
|
||||||
|
|
||||||
// update object to clients
|
// update object to clients
|
||||||
|
|
||||||
@@ -882,7 +870,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (Bounds.collide(loc, building.getBounds()))
|
if (Bounds.collide(loc, building.getBounds()))
|
||||||
return building;
|
return building;
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,14 @@
|
|||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.Enum.ModType;
|
|
||||||
import engine.Enum.SourceType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.archive.BaneRecord;
|
import engine.db.archive.BaneRecord;
|
||||||
import engine.db.archive.PvpRecord;
|
import engine.db.archive.PvpRecord;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
|
import engine.mbEnums.ModType;
|
||||||
|
import engine.mbEnums.SourceType;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
|
||||||
import engine.net.MessageDispatcher;
|
import engine.net.MessageDispatcher;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
||||||
@@ -79,7 +78,7 @@ public enum ChatManager {
|
|||||||
ArrayList<AbstractWorldObject> distroList = new ArrayList<>();
|
ArrayList<AbstractWorldObject> distroList = new ArrayList<>();
|
||||||
for (PlayerCharacter pc : SessionManager
|
for (PlayerCharacter pc : SessionManager
|
||||||
.getAllActivePlayerCharacters()) {
|
.getAllActivePlayerCharacters()) {
|
||||||
if (pc.getAccount().status.equals(Enum.AccountStatus.BANNED) == false)
|
if (pc.getAccount().status.equals(mbEnums.AccountStatus.BANNED) == false)
|
||||||
distroList.add(pc);
|
distroList.add(pc);
|
||||||
}
|
}
|
||||||
// Send dispatch to each player
|
// Send dispatch to each player
|
||||||
@@ -87,7 +86,7 @@ public enum ChatManager {
|
|||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ public enum ChatManager {
|
|||||||
|
|
||||||
PlayerBonuses bonus = pc.getBonuses();
|
PlayerBonuses bonus = pc.getBonuses();
|
||||||
|
|
||||||
if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.NONE)) {
|
if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.None)) {
|
||||||
ChatManager.chatSayError(pc, SILENCED);
|
ChatManager.chatSayError(pc, SILENCED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -161,7 +160,7 @@ public enum ChatManager {
|
|||||||
|
|
||||||
// Make the Message
|
// Make the Message
|
||||||
ChatSayMsg chatSayMsg = new ChatSayMsg(player, text);
|
ChatSayMsg chatSayMsg = new ChatSayMsg(player, text);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, chatSayMsg, Enum.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
DispatchManager.dispatchMsgToInterestArea(pcSender, chatSayMsg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,9 +168,9 @@ public enum ChatManager {
|
|||||||
|
|
||||||
ChatSystemMsg msg = new ChatSystemMsg(null, messageString);
|
ChatSystemMsg msg = new ChatSystemMsg(null, messageString);
|
||||||
msg.setMessageType(4);
|
msg.setMessageType(4);
|
||||||
msg.setChannel(engine.Enum.ChatChannelType.SYSTEM.getChannelID());
|
msg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||||
Dispatch dispatch = Dispatch.borrow(targetPlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(targetPlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -195,7 +194,7 @@ public enum ChatManager {
|
|||||||
|
|
||||||
// Make the Message
|
// Make the Message
|
||||||
ChatShoutMsg msg = new ChatShoutMsg(sender, text);
|
ChatShoutMsg msg = new ChatShoutMsg(sender, text);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, msg, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
DispatchManager.dispatchMsgToInterestArea(pcSender, msg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +216,7 @@ public enum ChatManager {
|
|||||||
|
|
||||||
// Make the Message
|
// Make the Message
|
||||||
ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
|
ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
|
||||||
DispatchMessage.dispatchMsgToAll(sender, msg, true);
|
DispatchManager.dispatchMsgToAll(sender, msg, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,13 +283,13 @@ public enum ChatManager {
|
|||||||
// Send dispatch to each player
|
// Send dispatch to each player
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(pcRecip, chatTellMsg);
|
Dispatch dispatch = Dispatch.borrow(pcRecip, chatTellMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also send /tell to sender
|
// Also send /tell to sender
|
||||||
if (pcSender != null) {
|
if (pcSender != null) {
|
||||||
Dispatch dispatch = Dispatch.borrow(pcSender, chatTellMsg);
|
Dispatch dispatch = Dispatch.borrow(pcSender, chatTellMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -339,17 +338,17 @@ public enum ChatManager {
|
|||||||
chatGuildMsg.setSourceID(sender.getObjectUUID());
|
chatGuildMsg.setSourceID(sender.getObjectUUID());
|
||||||
chatGuildMsg.setSourceName(sender.getFirstName());
|
chatGuildMsg.setSourceName(sender.getFirstName());
|
||||||
chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
|
chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
|
||||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
|
Guild guild1 = sender.getGuild();
|
||||||
.getCharter() : 0); // Charter?
|
chatGuildMsg.setUnknown04(sender.getGuild() != null ? guild1.charter.ordinal() : 0); // Charter?
|
||||||
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
||||||
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(Enum.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(mbEnums.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
||||||
|
|
||||||
// Send dispatch to each player
|
// Send dispatch to each player
|
||||||
|
|
||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGuildMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGuildMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -404,7 +403,7 @@ public enum ChatManager {
|
|||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatICMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatICMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -463,7 +462,7 @@ public enum ChatManager {
|
|||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGroupMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGroupMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -490,14 +489,14 @@ public enum ChatManager {
|
|||||||
msg.setName(sender.getFirstName());
|
msg.setName(sender.getFirstName());
|
||||||
msg.setGuildTitle(GuildStatusController.getTitle(sender.getGuildStatus()));
|
msg.setGuildTitle(GuildStatusController.getTitle(sender.getGuildStatus()));
|
||||||
msg.setGuildUUID(guild.getObjectUUID());
|
msg.setGuildUUID(guild.getObjectUUID());
|
||||||
msg.setCharter(guild.getCharter());
|
msg.setCharter(guild.charter.ordinal());
|
||||||
|
|
||||||
// Send dispatch to each player
|
// Send dispatch to each player
|
||||||
|
|
||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,7 +535,7 @@ public enum ChatManager {
|
|||||||
if (item != null) //Steal
|
if (item != null) //Steal
|
||||||
if (success) {
|
if (success) {
|
||||||
String name = "";
|
String name = "";
|
||||||
if (item.template.item_type.equals(Enum.ItemType.GOLD))
|
if (item.template.item_type.equals(mbEnums.ItemType.GOLD))
|
||||||
name = amount + " gold ";
|
name = amount + " gold ";
|
||||||
else {
|
else {
|
||||||
String vowels = "aeiou";
|
String vowels = "aeiou";
|
||||||
@@ -733,7 +732,7 @@ public enum ChatManager {
|
|||||||
public static void chatPVP(String text) {
|
public static void chatPVP(String text) {
|
||||||
// Create message
|
// Create message
|
||||||
ChatPvPMsg msg = new ChatPvPMsg(null, text);
|
ChatPvPMsg msg = new ChatPvPMsg(null, text);
|
||||||
DispatchMessage.dispatchMsgToAll(msg);
|
DispatchManager.dispatchMsgToAll(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
||||||
@@ -844,7 +843,7 @@ public enum ChatManager {
|
|||||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -993,7 +992,7 @@ public enum ChatManager {
|
|||||||
chatSystemMsg.setChannel(channel);
|
chatSystemMsg.setChannel(channel);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.AttackJob;
|
import engine.jobs.AttackJob;
|
||||||
import engine.jobs.DeferredPowerJob;
|
import engine.jobs.DeferredPowerJob;
|
||||||
import engine.net.DispatchMessage;
|
import engine.mbEnums;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.net.client.msg.UpdateStateMsg;
|
import engine.net.client.msg.UpdateStateMsg;
|
||||||
@@ -15,13 +22,30 @@ import engine.powers.effectmodifiers.AbstractEffectModifier;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static java.lang.Math.pow;
|
||||||
|
|
||||||
public enum CombatManager {
|
public enum CombatManager {
|
||||||
|
|
||||||
|
|
||||||
|
// MB Dev notes:
|
||||||
|
// Class implements all combat mechanics for Magicbane.
|
||||||
|
//
|
||||||
|
// Combat initiates in "combatCycle" to determine which hands will be swung, and attack is processed based on that.
|
||||||
|
// Handles all combat for AbstractCharacter including player characters and mobiles.
|
||||||
|
// Controls toggling of combat and sit/stand for all AbstractCharacters
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
COMBAT_MANAGER;
|
COMBAT_MANAGER;
|
||||||
|
public static final int COMBAT_BLOCK_ANIMATION = 298;
|
||||||
|
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||||
|
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||||
|
|
||||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
||||||
|
|
||||||
@@ -30,55 +54,83 @@ public enum CombatManager {
|
|||||||
if (attacker == null || target == null || !attacker.isAlive() || !target.isAlive())
|
if (attacker == null || target == null || !attacker.isAlive() || !target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
|
if (((Mob) attacker).nextAttackTime > System.currentTimeMillis())
|
||||||
|
return;
|
||||||
|
|
||||||
switch (target.getObjectType()) {
|
switch (target.getObjectType()) {
|
||||||
case Building:
|
case Building:
|
||||||
if (((Building) target).isVulnerable() == false)
|
if (!((Building) target).isVulnerable())
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
case Mob:
|
case Mob:
|
||||||
PlayerBonuses bonuses = ((AbstractCharacter) target).getBonuses();
|
PlayerBonuses bonuses = ((AbstractCharacter) target).getBonuses();
|
||||||
if (bonuses != null && bonuses.getBool(Enum.ModType.ImmuneToAttack, Enum.SourceType.NONE))
|
if (bonuses != null && bonuses.getBool(mbEnums.ModType.ImmuneToAttack, mbEnums.SourceType.None))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item mainWeapon = attacker.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD);
|
Item mainWeapon = attacker.charItemManager.getEquipped().get(mbEnums.EquipSlotType.RHELD);
|
||||||
Item offWeapon = attacker.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD);
|
Item offWeapon = attacker.charItemManager.getEquipped().get(mbEnums.EquipSlotType.LHELD);
|
||||||
|
|
||||||
if (mainWeapon == null && offWeapon == null) {
|
if (mainWeapon == null && offWeapon == null) {
|
||||||
//no weapons equipped, punch with both fists
|
//no weapons equipped, punch with both fists
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.LHELD);
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||||
} else if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWeapon != null && offWeapon == null) {
|
||||||
|
//swing right hand only
|
||||||
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
|
//swing left hand only
|
||||||
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//no weapon equipped with a shield, punch with one hand
|
//no weapon equipped with a shield, punch with one hand
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||||
} else if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//one weapon equipped with a shield, swing with one hand
|
//one weapon equipped with a shield, swing with one hand
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||||
} else if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block") == false) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//two weapons equipped, swing both hands
|
//two weapons equipped, swing both hands
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.LHELD);
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||||
} else if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block") == false) {
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||||
//swing left hand only
|
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.LHELD);
|
|
||||||
} else if (mainWeapon != null && offWeapon == null) {
|
|
||||||
//swing left hand only
|
|
||||||
processAttack(attacker, target, Enum.EquipSlotType.RHELD);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, Enum.EquipSlotType slot) {
|
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot) {
|
||||||
|
|
||||||
// heck if character can even attack yet
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
|
if (!attacker.isCombat())
|
||||||
if (attacker.getTimestamps().containsKey("Attack" + slot.name()))
|
|
||||||
if (System.currentTimeMillis() < attacker.getTimestamps().get("Attack" + slot.name()))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
||||||
|
if (attacker.getTimers() != null && attacker.getTimers().containsKey("Attack" + slot.name()))
|
||||||
|
if (attacker.getTimers().get("Attack" + slot.name()).timeToExecutionLeft() <= 0)
|
||||||
|
attacker.getTimers().remove("Attack" + slot.name());
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if character is in range to attack target
|
// check if character is in range to attack target
|
||||||
|
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = attacker.getBonuses();
|
||||||
@@ -90,259 +142,333 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (weapon != null) {
|
if (weapon != null) {
|
||||||
if (bonus != null)
|
if (bonus != null)
|
||||||
rangeMod += bonus.getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.NONE);
|
rangeMod += bonus.getFloatPercentAll(mbEnums.ModType.WeaponRange, mbEnums.SourceType.None);
|
||||||
|
|
||||||
attackRange = weapon.template.item_weapon_max_range * rangeMod;
|
attackRange += weapon.template.item_weapon_max_range * rangeMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(Enum.GameObjectType.Mob))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
if (((Mob) attacker).isSiege())
|
if (((Mob) attacker).isSiege())
|
||||||
attackRange = 300;
|
attackRange = 300;
|
||||||
|
|
||||||
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||||
|
|
||||||
if (distanceSquared > attackRange * attackRange)
|
boolean inRange = false;
|
||||||
return;
|
|
||||||
|
|
||||||
// take stamina away from attacker
|
|
||||||
|
|
||||||
if (weapon != null) {
|
|
||||||
float stam = weapon.template.item_wt / 3f;
|
|
||||||
stam = (stam < 1) ? 1 : stam;
|
|
||||||
attacker.modifyStamina(-(stam), attacker, true);
|
|
||||||
} else
|
|
||||||
attacker.modifyStamina(-0.5f, attacker, true);
|
|
||||||
|
|
||||||
//cancel things that are cancelled by an attack
|
|
||||||
|
|
||||||
attacker.cancelOnAttackSwing();
|
|
||||||
|
|
||||||
//declare relevant variables
|
|
||||||
|
|
||||||
int min = attacker.minDamageHandOne;
|
|
||||||
int max = attacker.maxDamageHandOne;
|
|
||||||
int atr = attacker.atrHandOne;
|
|
||||||
|
|
||||||
//get the proper stats based on which slot is attacking
|
|
||||||
|
|
||||||
if (slot == Enum.EquipSlotType.LHELD) {
|
|
||||||
min = attacker.minDamageHandTwo;
|
|
||||||
max = attacker.maxDamageHandTwo;
|
|
||||||
atr = attacker.atrHandTwo;
|
|
||||||
}
|
|
||||||
|
|
||||||
int def = 0;
|
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
|
||||||
def = ((AbstractCharacter) target).defenseRating;
|
|
||||||
|
|
||||||
//calculate hit chance based off ATR and DEF
|
|
||||||
|
|
||||||
int hitChance;
|
|
||||||
if(def == 0)
|
|
||||||
def = 1;
|
|
||||||
float dif = atr / def;
|
|
||||||
|
|
||||||
if (dif <= 0.8f)
|
|
||||||
hitChance = 4;
|
|
||||||
else
|
|
||||||
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
|
|
||||||
|
|
||||||
if (target.getObjectType() == Enum.GameObjectType.Building)
|
|
||||||
hitChance = 100;
|
|
||||||
|
|
||||||
int passiveAnim = getSwingAnimation(null, null, slot.equals(Enum.EquipSlotType.RHELD));
|
|
||||||
if(attacker.charItemManager.getEquipped().get(slot) != null){
|
|
||||||
passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
|
||||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
|
||||||
|
|
||||||
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter)
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
else
|
|
||||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//calculate passive chances only if target is AbstractCharacter
|
|
||||||
|
|
||||||
if (EnumSet.of(Enum.GameObjectType.PlayerCharacter, Enum.GameObjectType.NPC, Enum.GameObjectType.Mob).contains(target.getObjectType())) {
|
|
||||||
Enum.PassiveType passiveType = Enum.PassiveType.None;
|
|
||||||
int hitRoll = ThreadLocalRandom.current().nextInt(100);
|
|
||||||
|
|
||||||
float dodgeChance = ((AbstractCharacter) target).getPassiveChance("Dodge", attacker.getLevel(), true);
|
|
||||||
float blockChance = ((AbstractCharacter) target).getPassiveChance("Block", attacker.getLevel(), true);
|
|
||||||
float parryChance = ((AbstractCharacter) target).getPassiveChance("Parry", attacker.getLevel(), true);
|
|
||||||
|
|
||||||
// Passive chance clamped at 75
|
|
||||||
|
|
||||||
dodgeChance = Math.max(0, Math.min(75, dodgeChance));
|
|
||||||
blockChance = Math.max(0, Math.min(75, blockChance));
|
|
||||||
parryChance = Math.max(0, Math.min(75, parryChance));
|
|
||||||
|
|
||||||
if (hitRoll < dodgeChance)
|
|
||||||
passiveType = Enum.PassiveType.Dodge;
|
|
||||||
else if (hitRoll < blockChance)
|
|
||||||
passiveType = Enum.PassiveType.Block;
|
|
||||||
else if (hitRoll < parryChance)
|
|
||||||
passiveType = Enum.PassiveType.Parry;
|
|
||||||
|
|
||||||
|
|
||||||
if (passiveType.equals(Enum.PassiveType.None) == false) {
|
|
||||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
|
|
||||||
|
|
||||||
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter)
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
else
|
|
||||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//calculate the base damage
|
|
||||||
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
|
||||||
if (damage == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//get the damage type
|
|
||||||
|
|
||||||
Enum.SourceType damageType;
|
|
||||||
|
|
||||||
if (attacker.charItemManager.getEquipped().get(slot) == null) {
|
|
||||||
damageType = Enum.SourceType.CRUSHING;
|
|
||||||
if (attacker.getObjectType().equals(Enum.GameObjectType.Mob))
|
|
||||||
if (((Mob) attacker).isSiege())
|
|
||||||
damageType = Enum.SourceType.SIEGE;
|
|
||||||
} else {
|
|
||||||
damageType = (Enum.SourceType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//get resists
|
|
||||||
|
|
||||||
Resists resists;
|
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target) == false)
|
|
||||||
resists = ((Building) target).getResists(); //this is a building
|
|
||||||
else
|
|
||||||
resists = ((AbstractCharacter) target).getResists(); //this is a character
|
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
AbstractCharacter absTarget = (AbstractCharacter) target;
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
|
} else {
|
||||||
|
|
||||||
//check damage shields
|
}
|
||||||
|
|
||||||
PlayerBonuses bonuses = absTarget.getBonuses();
|
if (attackRange > 15 && attacker.isMoving()) {
|
||||||
|
//cannot shoot bow while moving;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bonuses != null) {
|
switch (target.getObjectType()) {
|
||||||
|
case PlayerCharacter:
|
||||||
ConcurrentHashMap<AbstractEffectModifier, DamageShield> damageShields = bonuses.getDamageShields();
|
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
||||||
float total = 0;
|
if (distanceSquared < attackRange * attackRange)
|
||||||
|
inRange = true;
|
||||||
for (DamageShield ds : damageShields.values()) {
|
break;
|
||||||
|
case Mob:
|
||||||
//get amount to damage back
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
|
if (distanceSquared < attackRange * attackRange)
|
||||||
float amount;
|
inRange = true;
|
||||||
|
break;
|
||||||
if (ds.usePercent())
|
case Building:
|
||||||
amount = damage * ds.getAmount() / 100;
|
if (attackRange > 15) {
|
||||||
else
|
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
||||||
amount = ds.getAmount();
|
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||||
|
if (distanceSquared < rangeSquared) {
|
||||||
//get resisted damage for damagetype
|
inRange = true;
|
||||||
|
break;
|
||||||
if (resists != null)
|
}
|
||||||
amount = resists.getResistedDamage(absTarget, attacker, ds.getDamageType(), amount, 0);
|
} else {
|
||||||
total += amount;
|
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||||
|
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||||
|
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||||
|
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2;
|
||||||
|
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ);
|
||||||
|
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z)))
|
||||||
|
inRange = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total > 0) {
|
|
||||||
//apply Damage back
|
|
||||||
attacker.modifyHealth(-total, absTarget, true);
|
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, attacker, total, 0);
|
|
||||||
DispatchMessage.sendToAllInRange(target, cmm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resists != null) {
|
|
||||||
|
|
||||||
//check for damage type immunities
|
|
||||||
|
|
||||||
if (resists.immuneTo(damageType))
|
|
||||||
return;
|
|
||||||
|
|
||||||
//calculate resisted damage including fortitude
|
|
||||||
|
|
||||||
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove damage from target health
|
//get delay for the auto attack job
|
||||||
|
long delay = 5000;
|
||||||
if (damage > 0) {
|
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
|
||||||
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
|
||||||
else
|
|
||||||
((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage);
|
|
||||||
|
|
||||||
int attackAnim = getSwingAnimation(null,null,slot.equals(Enum.EquipSlotType.RHELD));
|
|
||||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
|
||||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template,null,slot.equals(Enum.EquipSlotType.RHELD));
|
|
||||||
}
|
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
|
||||||
DispatchMessage.sendToAllInRange(target, cmm);
|
|
||||||
}
|
|
||||||
DeferredPowerJob dpj = null;
|
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
|
||||||
|
|
||||||
if (dpj != null) {
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
|
||||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//calculate next allowed attack and update the timestamp
|
|
||||||
|
|
||||||
long delay = 20 * 100;
|
|
||||||
|
|
||||||
if (weapon != null) {
|
if (weapon != null) {
|
||||||
|
|
||||||
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||||
|
|
||||||
if (weapon.getBonusPercent(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE) != 0f) //add weapon speed bonus
|
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||||
wepSpeed *= (1 + weapon.getBonus(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE));
|
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||||
|
|
||||||
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.NONE) != 0f) //add effects speed bonus
|
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
||||||
wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.NONE));
|
wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
||||||
|
|
||||||
if (wepSpeed < 10)
|
if (wepSpeed < 10)
|
||||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||||
|
|
||||||
delay = wepSpeed * 100;
|
delay = wepSpeed * 100L;
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
|
((Mob) attacker).nextAttackTime = System.currentTimeMillis() + delay;
|
||||||
|
|
||||||
//handle auto attack job creation
|
if (inRange) {
|
||||||
|
|
||||||
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
//handle retaliate
|
||||||
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
|
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
||||||
|
((AbstractCharacter) target).combatTarget = attacker;
|
||||||
|
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && ((AbstractCharacter) target).isCombat())
|
||||||
|
combatCycle((AbstractCharacter) target, attacker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (timers != null) {
|
// take stamina away from attacker if its not a mob
|
||||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
if (weapon != null && !attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||||
JobContainer job;
|
//check if Out of Stamina
|
||||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
timers.put("Attack" + slot, job);
|
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||||
} else
|
//set auto attack job
|
||||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float stam = weapon.template.item_wt / 3f;
|
||||||
|
stam = (stam < 1) ? 1 : stam;
|
||||||
|
attacker.modifyStamina(-(stam), attacker, true);
|
||||||
|
} else
|
||||||
|
attacker.modifyStamina(1, attacker, true);
|
||||||
|
|
||||||
|
//cancel things that are cancelled by an attack
|
||||||
|
|
||||||
|
attacker.cancelOnAttackSwing();
|
||||||
|
|
||||||
|
//declare relevant variables
|
||||||
|
|
||||||
|
int min = attacker.minDamageHandOne;
|
||||||
|
int max = attacker.maxDamageHandOne;
|
||||||
|
int atr = attacker.atrHandOne;
|
||||||
|
|
||||||
|
//get the proper stats based on which slot is attacking
|
||||||
|
|
||||||
|
if (slot == mbEnums.EquipSlotType.LHELD) {
|
||||||
|
min = attacker.minDamageHandTwo;
|
||||||
|
max = attacker.maxDamageHandTwo;
|
||||||
|
atr = attacker.atrHandTwo;
|
||||||
|
}
|
||||||
|
|
||||||
|
//apply weapon powers before early exit for miss or passives
|
||||||
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
|
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||||
|
|
||||||
|
if (dpj != null) {
|
||||||
|
dpj.attack(target, attackRange);
|
||||||
|
|
||||||
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
|
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int def = 0;
|
||||||
|
|
||||||
|
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||||
|
def = ((AbstractCharacter) target).defenseRating;
|
||||||
|
|
||||||
|
//calculate hit chance based off ATR and DEF
|
||||||
|
|
||||||
|
int hitChance;
|
||||||
|
if (def == 0)
|
||||||
|
def = 1;
|
||||||
|
float dif = atr * 1f / def;
|
||||||
|
|
||||||
|
if (dif <= 0.8f)
|
||||||
|
hitChance = 4;
|
||||||
|
else
|
||||||
|
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||||
|
|
||||||
|
if (target.getObjectType() == mbEnums.GameObjectType.Building)
|
||||||
|
hitChance = 100;
|
||||||
|
int passiveAnim = getPassiveAnimation(mbEnums.PassiveType.None); // checking for a miss due to ATR vs Def
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
||||||
|
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
||||||
|
|
||||||
|
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
else
|
||||||
|
DispatchManager.sendToAllInRange(attacker, msg);
|
||||||
|
|
||||||
|
//we need to send the animation even if the attacker misses
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||||
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
|
||||||
|
//set auto attack job
|
||||||
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate passive chances only if target is AbstractCharacter
|
||||||
|
|
||||||
|
if (EnumSet.of(mbEnums.GameObjectType.PlayerCharacter, mbEnums.GameObjectType.NPC, mbEnums.GameObjectType.Mob).contains(target.getObjectType())) {
|
||||||
|
mbEnums.PassiveType passiveType = mbEnums.PassiveType.None;
|
||||||
|
int hitRoll = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
|
float dodgeChance = ((AbstractCharacter) target).getPassiveChance("Dodge", attacker.getLevel(), true);
|
||||||
|
float blockChance = ((AbstractCharacter) target).getPassiveChance("Block", attacker.getLevel(), true);
|
||||||
|
float parryChance = ((AbstractCharacter) target).getPassiveChance("Parry", attacker.getLevel(), true);
|
||||||
|
|
||||||
|
// Passive chance clamped at 75
|
||||||
|
|
||||||
|
dodgeChance = Math.max(0, Math.min(75, dodgeChance));
|
||||||
|
blockChance = Math.max(0, Math.min(75, blockChance));
|
||||||
|
parryChance = Math.max(0, Math.min(75, parryChance));
|
||||||
|
|
||||||
|
if (hitRoll < dodgeChance)
|
||||||
|
passiveType = mbEnums.PassiveType.Dodge;
|
||||||
|
else if (hitRoll < blockChance)
|
||||||
|
passiveType = mbEnums.PassiveType.Block;
|
||||||
|
else if (hitRoll < parryChance)
|
||||||
|
passiveType = mbEnums.PassiveType.Parry;
|
||||||
|
|
||||||
|
|
||||||
|
if (!passiveType.equals(mbEnums.PassiveType.None)) {
|
||||||
|
passiveAnim = getPassiveAnimation(passiveType);
|
||||||
|
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
|
||||||
|
|
||||||
|
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
|
//we need to send the animation even if the attacker misses
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||||
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
//set auto attack job
|
||||||
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate the base damage
|
||||||
|
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
|
if (damage == 0) {
|
||||||
|
//set auto attack job
|
||||||
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob) attacker).isPet())
|
||||||
|
calculatePetDamage(attacker);
|
||||||
|
|
||||||
|
//get the damage type
|
||||||
|
|
||||||
|
mbEnums.DamageType damageType;
|
||||||
|
|
||||||
|
if (attacker.charItemManager.getEquipped().get(slot) == null) {
|
||||||
|
damageType = mbEnums.DamageType.CRUSHING;
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
|
if (((Mob) attacker).isSiege())
|
||||||
|
damageType = mbEnums.DamageType.SIEGE;
|
||||||
|
} else {
|
||||||
|
damageType = (mbEnums.DamageType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//get resists
|
||||||
|
|
||||||
|
Resists resists;
|
||||||
|
|
||||||
|
if (!AbstractCharacter.IsAbstractCharacter(target))
|
||||||
|
resists = ((Building) target).getResists(); //this is a building
|
||||||
|
else
|
||||||
|
resists = ((AbstractCharacter) target).getResists(); //this is a character
|
||||||
|
|
||||||
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
|
AbstractCharacter absTarget = (AbstractCharacter) target;
|
||||||
|
|
||||||
|
//check damage shields
|
||||||
|
|
||||||
|
PlayerBonuses bonuses = absTarget.getBonuses();
|
||||||
|
|
||||||
|
if (bonuses != null) {
|
||||||
|
|
||||||
|
ConcurrentHashMap<AbstractEffectModifier, DamageShield> damageShields = bonuses.getDamageShields();
|
||||||
|
float total = 0;
|
||||||
|
|
||||||
|
for (DamageShield ds : damageShields.values()) {
|
||||||
|
|
||||||
|
//get amount to damage back
|
||||||
|
|
||||||
|
float amount;
|
||||||
|
|
||||||
|
if (ds.usePercent())
|
||||||
|
amount = damage * ds.getAmount() / 100;
|
||||||
|
else
|
||||||
|
amount = ds.getAmount();
|
||||||
|
|
||||||
|
//get resisted damage for damagetype
|
||||||
|
|
||||||
|
if (resists != null)
|
||||||
|
amount = resists.getResistedDamage(absTarget, attacker, ds.getDamageType(), amount, 0);
|
||||||
|
total += amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total > 0) {
|
||||||
|
//apply Damage back
|
||||||
|
attacker.modifyHealth(-total, absTarget, true);
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, attacker, total, 0);
|
||||||
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resists != null) {
|
||||||
|
|
||||||
|
//check for damage type immunities
|
||||||
|
|
||||||
|
if (resists.immuneTo(damageType)) {
|
||||||
|
//set auto attack job
|
||||||
|
//we need to send the animation even if the attacker misses
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||||
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//calculate resisted damage including fortitude
|
||||||
|
|
||||||
|
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove damage from target health
|
||||||
|
|
||||||
|
if (damage > 0) {
|
||||||
|
|
||||||
|
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||||
|
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
||||||
|
else
|
||||||
|
((Building) target).modifyHealth(-damage, attacker);
|
||||||
|
|
||||||
|
int attackAnim = getSwingAnimation(null, null, slot);
|
||||||
|
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
|
DeferredPowerJob weaponPower = ((PlayerCharacter) attacker).getWeaponPower();
|
||||||
|
attackAnim = getSwingAnimation(weapon.template, weaponPower, slot);
|
||||||
|
} else {
|
||||||
|
attackAnim = getSwingAnimation(weapon.template, null, slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
||||||
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//set auto attack job
|
||||||
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +486,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
rwss.setPlayer(playerCharacter);
|
rwss.setPlayer(playerCharacter);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||||
@@ -373,7 +499,7 @@ public enum CombatManager {
|
|||||||
playerCharacter.setSit(toggle);
|
playerCharacter.setSit(toggle);
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
rwss.setPlayer(playerCharacter);
|
rwss.setPlayer(playerCharacter);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -387,7 +513,7 @@ public enum CombatManager {
|
|||||||
if (attacker.equals(target))
|
if (attacker.equals(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.isMoving() && target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
if (target.isMoving() && target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.isAlive() || !attacker.isAlive())
|
if (!target.isAlive() || !attacker.isAlive())
|
||||||
@@ -401,118 +527,128 @@ public enum CombatManager {
|
|||||||
target.setCombatTarget(attacker);
|
target.setCombatTarget(attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||||
|
|
||||||
int token = 0;
|
|
||||||
|
|
||||||
if (dpj != null)
|
|
||||||
token = (dpj.getPower() != null) ? dpj.getPower().getToken() : 0;
|
|
||||||
|
|
||||||
if (token == 563721004) //kick animation
|
|
||||||
return 79;
|
|
||||||
|
|
||||||
|
//No weapon, return default animation
|
||||||
if (wb == null)
|
if (wb == null)
|
||||||
return 75;
|
return 75;
|
||||||
|
|
||||||
ItemTemplate template = wb;
|
int token;
|
||||||
|
|
||||||
if (mainHand) {
|
if (dpj != null) {
|
||||||
if (template.weapon_attack_anim_right.size() > 0) {
|
|
||||||
|
|
||||||
int animation;
|
token = (dpj.getPower() != null) ? dpj.getPower().getToken() : 0;
|
||||||
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_right.size());
|
if (token == 563721004) //kick animation
|
||||||
|
return 79;
|
||||||
try {
|
|
||||||
animation = template.weapon_attack_anim_right.get(random)[0];
|
|
||||||
return animation;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
return template.weapon_attack_anim_right.get(0)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (template.weapon_attack_anim_left.size() > 0) {
|
|
||||||
|
|
||||||
int animation;
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size());
|
|
||||||
|
|
||||||
try {
|
|
||||||
animation = template.weapon_attack_anim_left.get(random)[0];
|
|
||||||
return animation;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
return template.weapon_attack_anim_right.get(0)[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (template.weapon_attack_anim_left.size() > 0) {
|
|
||||||
|
|
||||||
int animation;
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size());
|
|
||||||
|
|
||||||
try {
|
|
||||||
animation = template.weapon_attack_anim_left.get(random)[0];
|
|
||||||
return animation;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
return template.weapon_attack_anim_right.get(0)[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (template.weapon_attack_anim_left.size() > 0) {
|
|
||||||
|
|
||||||
int animation;
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size());
|
|
||||||
|
|
||||||
try {
|
|
||||||
animation = template.weapon_attack_anim_left.get(random)[0];
|
|
||||||
return animation;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
return template.weapon_attack_anim_right.get(0)[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String required = template.item_skill_used;
|
//Item has no equipment slots and should not try to return an animation, return default instead
|
||||||
String mastery = wb.item_skill_mastery_used;
|
if (wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()) {
|
||||||
|
|
||||||
if (required.equals("Unarmed Combat"))
|
|
||||||
return 75;
|
return 75;
|
||||||
else if (required.equals("Sword")) {
|
}
|
||||||
|
|
||||||
if (ItemTemplate.isTwoHanded(template))
|
//declare variables
|
||||||
return 105;
|
int anim;
|
||||||
else
|
int random;
|
||||||
return 98;
|
|
||||||
|
|
||||||
} else if (required.equals("Staff") || required.equals("Pole Arm")) {
|
//Item can only be equipped in one slot, return animation for that slot
|
||||||
return 85;
|
if (wb.item_eq_slots_or.size() == 1) {
|
||||||
} else if (required.equals("Spear")) {
|
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||||
return 92;
|
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||||
} else if (required.equals("Hammer") || required.equals("Axe")) {
|
if (dpj != null) {
|
||||||
if (ItemTemplate.isTwoHanded(template)) {
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||||
return 105;
|
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||||
} else if (mastery.equals("Throwing")) {
|
}
|
||||||
return 115;
|
|
||||||
} else {
|
} else {
|
||||||
return 100;
|
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||||
|
if (dpj != null) {
|
||||||
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||||
|
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (required.equals("Dagger")) {
|
return anim;
|
||||||
if (mastery.equals("Throwing")) {
|
}
|
||||||
return 117;
|
|
||||||
} else {
|
//Item can be equipped in either hand, and should have animation sets for each hand
|
||||||
return 81;
|
if (slot.equals(mbEnums.EquipSlotType.RHELD)) {
|
||||||
|
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||||
|
if (dpj != null) {
|
||||||
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||||
|
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||||
}
|
}
|
||||||
} else if (required.equals("Crossbow")) {
|
|
||||||
return 110;
|
|
||||||
} else if (required.equals("Bow")) {
|
|
||||||
return 109;
|
|
||||||
} else if (ItemTemplate.isTwoHanded(template)) {
|
|
||||||
return 105;
|
|
||||||
} else {
|
} else {
|
||||||
return 100;
|
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||||
|
if (dpj != null) {
|
||||||
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||||
|
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return anim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPassiveAnimation(mbEnums.PassiveType passiveType) {
|
||||||
|
switch (passiveType) {
|
||||||
|
case Block:
|
||||||
|
return COMBAT_BLOCK_ANIMATION;
|
||||||
|
case Parry:
|
||||||
|
return COMBAT_PARRY_ANIMATION;
|
||||||
|
case Dodge:
|
||||||
|
return COMBAT_DODGE_ANIMATION;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||||
|
//calculate next allowed attack and update the timestamp
|
||||||
|
|
||||||
|
if (attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||||
|
return;
|
||||||
|
|
||||||
|
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
||||||
|
|
||||||
|
//handle auto attack job creation
|
||||||
|
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
||||||
|
|
||||||
|
if (timers != null) {
|
||||||
|
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
||||||
|
JobContainer job;
|
||||||
|
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||||
|
timers.put("Attack" + slot.name(), job);
|
||||||
|
} else
|
||||||
|
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||||
|
//damage calc for pet
|
||||||
|
float range;
|
||||||
|
float damage;
|
||||||
|
float min = 40;
|
||||||
|
float max = 60;
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(mbEnums.ModType.MeleeDamageModifier, mbEnums.SourceType.None);
|
||||||
|
double minDmg = getMinDmg(min, agent);
|
||||||
|
double maxDmg = getMaxDmg(max, agent);
|
||||||
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
|
range = (float) (maxDmg - minDmg);
|
||||||
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (damage * dmgMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMinDmg(double min, AbstractCharacter agent) {
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaxDmg(double max, AbstractCharacter agent) {
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,7 @@
|
|||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
/* This enumeration implements Magicbane's configuration data which
|
import engine.mbEnums;
|
||||||
is loaded from environment variables.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.server.login.LoginServer;
|
import engine.server.login.LoginServer;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,6 +23,14 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public enum ConfigManager {
|
public enum ConfigManager {
|
||||||
|
|
||||||
|
// MB Dev notes:
|
||||||
|
// Magicbane configuration is loaded from environment variables
|
||||||
|
//
|
||||||
|
// On boot the game first looks in /mb.conf for the file magicbane.conf.
|
||||||
|
//
|
||||||
|
// If not found, a default config is loaded from /mb.data to enable bootstrap.
|
||||||
|
// This version should never be modified.
|
||||||
|
|
||||||
MB_BIND_ADDR,
|
MB_BIND_ADDR,
|
||||||
MB_EXTERNAL_ADDR,
|
MB_EXTERNAL_ADDR,
|
||||||
|
|
||||||
@@ -105,11 +109,11 @@ public enum ConfigManager {
|
|||||||
// and determine the server type at runtime.
|
// and determine the server type at runtime.
|
||||||
|
|
||||||
public static final String DEFAULT_DATA_DIR = "mb.data/";
|
public static final String DEFAULT_DATA_DIR = "mb.data/";
|
||||||
public static Map<String, String> configMap = new HashMap(System.getenv());
|
public static final Map<String, String> configMap = new HashMap(System.getenv());
|
||||||
public static Enum.ServerType serverType = Enum.ServerType.NONE;
|
public static mbEnums.ServerType serverType = mbEnums.ServerType.NONE;
|
||||||
public static WorldServer worldServer;
|
public static WorldServer worldServer;
|
||||||
public static LoginServer loginServer;
|
public static LoginServer loginServer;
|
||||||
public static Map<ConfigManager, Pattern> regex = new HashMap<>();
|
public static final Map<ConfigManager, Pattern> regex = new HashMap<>();
|
||||||
|
|
||||||
public static String currentRepoBranch = "";
|
public static String currentRepoBranch = "";
|
||||||
|
|
||||||
@@ -124,7 +128,7 @@ public enum ConfigManager {
|
|||||||
Logger.info(configSetting.name() + ":" + configSetting.getValue());
|
Logger.info(configSetting.name() + ":" + configSetting.getValue());
|
||||||
else {
|
else {
|
||||||
Logger.error("Missing Config: " + configSetting.name());
|
Logger.error("Missing Config: " + configSetting.name());
|
||||||
Logger.error("This codebase requires >= MagicBox v1.5.1");
|
Logger.error("This codebase requires >= MagicBox v1.5.2");
|
||||||
Logger.error("docker pull magicbane/magicbox:latest");
|
Logger.error("docker pull magicbane/magicbox:latest");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.db.handlers.*;
|
import engine.db.handlers.*;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import engine.util.Hasher;
|
import engine.util.Hasher;
|
||||||
@@ -22,7 +22,6 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public enum DbManager {
|
public enum DbManager {
|
||||||
@@ -177,7 +176,7 @@ public enum DbManager {
|
|||||||
|
|
||||||
public static boolean addToCache(AbstractGameObject gameObject) {
|
public static boolean addToCache(AbstractGameObject gameObject) {
|
||||||
|
|
||||||
boolean isWorldServer = ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER);
|
boolean isWorldServer = ConfigManager.serverType.equals(mbEnums.ServerType.WORLDSERVER);
|
||||||
|
|
||||||
if (!isWorldServer) {
|
if (!isWorldServer) {
|
||||||
if (MBServerStatics.SKIP_CACHE_LOGIN)
|
if (MBServerStatics.SKIP_CACHE_LOGIN)
|
||||||
@@ -265,53 +264,6 @@ public enum DbManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E extends java.lang.Enum<E>> EnumSet<E> parseEnumSet(String mysqlSet, Class<E> enumClass) {
|
|
||||||
|
|
||||||
// Create empty output set of the passed Enum class
|
|
||||||
|
|
||||||
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
|
||||||
|
|
||||||
// Early exit for empty sets
|
|
||||||
|
|
||||||
if (mysqlSet.isEmpty())
|
|
||||||
return enumSet;
|
|
||||||
|
|
||||||
// Split set string and trim each element
|
|
||||||
|
|
||||||
String[] elements = mysqlSet.split(";");
|
|
||||||
|
|
||||||
for (String element : elements) {
|
|
||||||
|
|
||||||
element = element.trim();
|
|
||||||
|
|
||||||
// Parse the element into an enum; add to the output set
|
|
||||||
|
|
||||||
try {
|
|
||||||
E enumConstant = java.lang.Enum.valueOf(enumClass, element);
|
|
||||||
enumSet.add(enumConstant);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(" Parse error: " + mysqlSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the output set
|
|
||||||
|
|
||||||
return enumSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void printCacheCount(PlayerCharacter pc) {
|
|
||||||
ChatManager.chatSystemInfo(pc, "Cache Lists");
|
|
||||||
|
|
||||||
for (GameObjectType gameObjectType : GameObjectType.values()) {
|
|
||||||
|
|
||||||
if (objectCache.get(gameObjectType) == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
String ret = gameObjectType.name() + ": " + objectCache.get(gameObjectType).size();
|
|
||||||
ChatManager.chatSystemInfo(pc, ret + '\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the conn
|
* @return the conn
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.devcmd.cmds.*;
|
import engine.devcmd.cmds.*;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -22,6 +22,13 @@ import java.util.Map.Entry;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public enum DevCmdManager {
|
public enum DevCmdManager {
|
||||||
|
|
||||||
|
// MB Dev Notes:
|
||||||
|
// Class registers "Dev Commands" where access requires
|
||||||
|
// Status = "ADMIN" be set in the obj_account table
|
||||||
|
//
|
||||||
|
// Use these at your own risk.
|
||||||
|
|
||||||
DEV_CMD_MANAGER;
|
DEV_CMD_MANAGER;
|
||||||
|
|
||||||
public static ConcurrentHashMap<String, AbstractDevCmd> devCmds;
|
public static ConcurrentHashMap<String, AbstractDevCmd> devCmds;
|
||||||
@@ -35,9 +42,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerCommands();
|
DevCmdManager.registerCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static void registerCommands() {
|
private static void registerCommands() {
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
@@ -72,6 +76,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new SetRaceCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
||||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||||
@@ -91,7 +96,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new RenameCmd());
|
DevCmdManager.registerDevCmd(new RenameCmd());
|
||||||
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetRankCmd());
|
DevCmdManager.registerDevCmd(new SetRankCmd());
|
||||||
DevCmdManager.registerDevCmd(new MakeBaneCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
|
DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||||
@@ -156,7 +160,7 @@ public enum DevCmdManager {
|
|||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//only admin level can run dev commands on production
|
||||||
|
|
||||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
if (a.status.equals(mbEnums.AccountStatus.ADMIN) == false) {
|
||||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,15 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.net;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mbEnums.DispatchChannel;
|
||||||
|
import engine.mbEnums.GameObjectType;
|
||||||
|
import engine.net.AbstractNetMsg;
|
||||||
|
import engine.net.Dispatch;
|
||||||
|
import engine.net.MessageDispatcher;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.objects.AbstractWorldObject;
|
import engine.objects.AbstractWorldObject;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
@@ -26,12 +28,17 @@ import java.util.HashSet;
|
|||||||
import static engine.net.MessageDispatcher.dispatchCount;
|
import static engine.net.MessageDispatcher.dispatchCount;
|
||||||
import static engine.net.MessageDispatcher.maxRecipients;
|
import static engine.net.MessageDispatcher.maxRecipients;
|
||||||
|
|
||||||
/*
|
// MB Dev Notes:
|
||||||
* Dispatch Message is the main interface to Magicbane's threaded
|
// Dispatch Manager is the main interface to the threaded async message
|
||||||
* async message delivery system.
|
// delivery system used by Magicbane.
|
||||||
*/
|
//
|
||||||
|
// A Dispatch is .borrowed() and used to wrap an outgoing protocol message.
|
||||||
|
// A distribution list is created and passed to the MessageDispatcher for
|
||||||
|
// delivery.
|
||||||
|
|
||||||
public class DispatchMessage {
|
public enum DispatchManager {
|
||||||
|
|
||||||
|
DISPATCH_MANAGER;
|
||||||
|
|
||||||
public static void startMessagePump() {
|
public static void startMessagePump() {
|
||||||
|
|
||||||
@@ -83,7 +90,7 @@ public class DispatchMessage {
|
|||||||
sourcePlayer = (PlayerCharacter) sourceObject;
|
sourcePlayer = (PlayerCharacter) sourceObject;
|
||||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +158,7 @@ public class DispatchMessage {
|
|||||||
|
|
||||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -280,7 +287,7 @@ public class DispatchMessage {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void serializeDispatch(Dispatch messageDispatch) {
|
public static void serializeDispatch(Dispatch messageDispatch) {
|
||||||
ClientConnection connection;
|
ClientConnection connection;
|
||||||
|
|
||||||
if (messageDispatch.player == null) {
|
if (messageDispatch.player == null) {
|
||||||
@@ -0,0 +1,409 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.gameManager;
|
||||||
|
|
||||||
|
import engine.loot.ModTableEntry;
|
||||||
|
import engine.loot.ModTypeTableEntry;
|
||||||
|
import engine.loot.WorkOrder;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.net.client.msg.ItemProductionMsg;
|
||||||
|
import engine.objects.City;
|
||||||
|
import engine.objects.Item;
|
||||||
|
import engine.objects.ItemTemplate;
|
||||||
|
import engine.objects.NPC;
|
||||||
|
import engine.powers.EffectsBase;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.DelayQueue;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public enum ForgeManager implements Runnable {
|
||||||
|
|
||||||
|
// MB Dev notes:
|
||||||
|
// Class implements forge rolling mechanics for Magicbane.
|
||||||
|
//
|
||||||
|
// .submit(workOrder) may be called from any thread: (ItemProductionMsgHandler).
|
||||||
|
// Concurrency is managed by same lock used for warehouse (city.cityTransactionLock).
|
||||||
|
// WorkOrders are persisted then reconstituted at bootstrap using table dyn.workorders.
|
||||||
|
// Forge window (ManageNPCMsg) uses item.upgradeDate to serialize completion time.
|
||||||
|
//
|
||||||
|
// Replaces garbage code that looked as if written by a mental patient.
|
||||||
|
//
|
||||||
|
// @TODO Reuse same set of virtual items for the life of a workOrder.
|
||||||
|
|
||||||
|
FORGE_MANAGER;
|
||||||
|
|
||||||
|
public static final BlockingQueue<WorkOrder> forge = new DelayQueue<>();
|
||||||
|
public static final AtomicInteger workOrderCounter = new AtomicInteger(0);
|
||||||
|
public static final ConcurrentHashMap<NPC, ConcurrentHashMap.KeySetView<WorkOrder, Boolean>> vendorWorkOrderLookup = new ConcurrentHashMap<>();
|
||||||
|
public static final ConcurrentHashMap<Item, WorkOrder> itemWorkOrderLookup = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
WorkOrder workOrder;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
// The forge is a blocking priority queue using an epoc sort.
|
||||||
|
// workOrders are popped once the workOrder.completionTime has
|
||||||
|
// passed.
|
||||||
|
|
||||||
|
try {
|
||||||
|
workOrder = forge.take();
|
||||||
|
|
||||||
|
// Early exit for completed workOrders loaded from disk
|
||||||
|
// or vendors who were re-deeded with items still cooking.
|
||||||
|
|
||||||
|
if (workOrder.vendor == null || workOrder.runCompleted.get())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// This workOrder has completed production.
|
||||||
|
|
||||||
|
if (workOrder.total_produced >= workOrder.total_to_produce) {
|
||||||
|
|
||||||
|
// CONFIRM_PRODUCE to refresh the interface after we add
|
||||||
|
// the Identified flag to the item.
|
||||||
|
|
||||||
|
for (Item workOrderItem : workOrder.cooking) {
|
||||||
|
workOrderItem.flags.add(mbEnums.ItemFlags.Identified);
|
||||||
|
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set this workOrder to completed and update on disk
|
||||||
|
|
||||||
|
workOrder.runCompleted.set(true);
|
||||||
|
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PERSIST our current cooking batch of virtual
|
||||||
|
// items then add to the vendor inventory
|
||||||
|
|
||||||
|
completeWorkOrderBatch(workOrder);
|
||||||
|
|
||||||
|
// Create new set of in-memory only virtual items
|
||||||
|
|
||||||
|
forgeWorkOrderBatch(workOrder);
|
||||||
|
|
||||||
|
// enQueue this workOrder again; back into the oven
|
||||||
|
// until all items for this workOrder are completed.
|
||||||
|
|
||||||
|
forge.add(workOrder);
|
||||||
|
|
||||||
|
// Debugging: Logger.info(workOrder.toString());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void start() {
|
||||||
|
|
||||||
|
Thread forgeManager;
|
||||||
|
forgeManager = new Thread(FORGE_MANAGER);
|
||||||
|
forgeManager.setName("Forge Manager");
|
||||||
|
forgeManager.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int submit(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
// Must have a city to roll anything
|
||||||
|
|
||||||
|
City city = workOrder.vendor.building.getCity();
|
||||||
|
|
||||||
|
if (city == null)
|
||||||
|
return 58; //58: The formula is beyond the means of this facility
|
||||||
|
|
||||||
|
// Concurrency is rightly managed by same lock as warehouse
|
||||||
|
|
||||||
|
city.transactionLock.writeLock().lock();
|
||||||
|
|
||||||
|
// Make sure vendor can roll the formulae, warehouse can
|
||||||
|
// afford this wordOrder and other related checks.
|
||||||
|
|
||||||
|
int validation_result = WorkOrder.validate(workOrder);
|
||||||
|
|
||||||
|
// The return code is used by the caller (ItemProductionMsgHandler)
|
||||||
|
// for display of a popup error message to the player.
|
||||||
|
|
||||||
|
if (validation_result != 0)
|
||||||
|
return validation_result;
|
||||||
|
|
||||||
|
// Configure this production run.
|
||||||
|
|
||||||
|
try {
|
||||||
|
workOrder.workOrderID = workOrderCounter.incrementAndGet();
|
||||||
|
workOrder.rollingDuration = NPCManager.calcRollingDuration(workOrder.vendor, workOrder.templateID);
|
||||||
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||||
|
workOrder.slots_used.set(calcAvailableSlots(workOrder));
|
||||||
|
|
||||||
|
if (workOrder.slots_used.get() == 0)
|
||||||
|
return 58;
|
||||||
|
|
||||||
|
workOrder.total_produced = 0;
|
||||||
|
|
||||||
|
// Single item configuration from protocol message (ItemProductionMsg)
|
||||||
|
|
||||||
|
if (workOrder.multiple_slot_request == false && workOrder.total_to_produce == 0)
|
||||||
|
workOrder.total_to_produce = 1;
|
||||||
|
|
||||||
|
// Calculate total cost for this production run
|
||||||
|
|
||||||
|
workOrder.total_to_produce *= workOrder.slots_used.get();
|
||||||
|
|
||||||
|
workOrder.production_cost = calcProductionCost(workOrder);
|
||||||
|
workOrder.production_cost.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
|
||||||
|
|
||||||
|
// Withdraw gold and resources. Availability has previously been validated.
|
||||||
|
|
||||||
|
if (!WorkOrder.withdrawWorkOrderCost(workOrder))
|
||||||
|
return 58; //58: The formula is beyond the means of this facility
|
||||||
|
|
||||||
|
// Create new batch of virtual items
|
||||||
|
|
||||||
|
forgeWorkOrderBatch(workOrder);
|
||||||
|
|
||||||
|
// Assign the new workOrder to the vendor
|
||||||
|
|
||||||
|
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||||
|
|
||||||
|
// Enqueue the new workOrder
|
||||||
|
|
||||||
|
forge.add(workOrder);
|
||||||
|
|
||||||
|
// PERSIST workOrder (dyn_workorders)
|
||||||
|
|
||||||
|
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
} finally {
|
||||||
|
city.transactionLock.writeLock().unlock();
|
||||||
|
}
|
||||||
|
Logger.info(workOrder.toString());
|
||||||
|
return validation_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calcAvailableSlots(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
// Slots available in a forge are based on the npc rank
|
||||||
|
|
||||||
|
int availableSlots = workOrder.vendor.getRank();
|
||||||
|
|
||||||
|
// Subtract the slots currently assigned to other workOrders for this vendor
|
||||||
|
|
||||||
|
for (WorkOrder npcWorkOrder : ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor))
|
||||||
|
availableSlots = availableSlots - npcWorkOrder.cooking.size();
|
||||||
|
|
||||||
|
// Single item rolls are always a single slot
|
||||||
|
|
||||||
|
if (availableSlots > 0 && workOrder.multiple_slot_request == false)
|
||||||
|
availableSlots = 1;
|
||||||
|
|
||||||
|
return availableSlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<mbEnums.ResourceType, Integer> calcProductionCost(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
// Calculate production cost for a single run of the workOrder
|
||||||
|
|
||||||
|
HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
|
||||||
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||||
|
|
||||||
|
// Add gold and resource costs from template
|
||||||
|
|
||||||
|
production_cost.put(mbEnums.ResourceType.GOLD, template.item_value);
|
||||||
|
production_cost.putAll(template.item_resource_cost);
|
||||||
|
|
||||||
|
// Calculate cost of prefix and suffix
|
||||||
|
|
||||||
|
if (workOrder.prefixToken != 0) {
|
||||||
|
EffectsBase prefix = PowersManager.getEffectByToken(workOrder.prefixToken);
|
||||||
|
production_cost.putAll(PowersManager._effect_costMaps.get(prefix.getIDString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workOrder.suffixToken != 0) {
|
||||||
|
EffectsBase suffix = PowersManager.getEffectByToken(workOrder.suffixToken);
|
||||||
|
production_cost.putAll(PowersManager._effect_costMaps.get(suffix.getIDString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return production_cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Item forgeItem(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
// Create new virtual item from specified template
|
||||||
|
|
||||||
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||||
|
Item forgedItem = new Item(workOrder.templateID);
|
||||||
|
|
||||||
|
// forgedItem gets a negative id; a virtual item which is not persisted
|
||||||
|
|
||||||
|
forgedItem.objectUUID = ItemManager.lastNegativeID.getAndDecrement();
|
||||||
|
forgedItem.containerType = mbEnums.ItemContainerType.FORGE;
|
||||||
|
forgedItem.ownerID = workOrder.vendor.getObjectUUID();
|
||||||
|
|
||||||
|
// item.upgradeDate is serialized (ItemProductionMsg)
|
||||||
|
// for vendor forge window completion time.
|
||||||
|
|
||||||
|
forgedItem.setDateToUpgrade(workOrder.completionTime);
|
||||||
|
|
||||||
|
// Assign a prefix and suffix to this item if random rolled
|
||||||
|
|
||||||
|
if (workOrder.prefixToken == 0)
|
||||||
|
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
||||||
|
else
|
||||||
|
forgedItem.prefixToken = workOrder.prefixToken;
|
||||||
|
|
||||||
|
if (workOrder.suffixToken == 0)
|
||||||
|
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
||||||
|
else
|
||||||
|
forgedItem.suffixToken = workOrder.suffixToken;
|
||||||
|
|
||||||
|
// Random rolled items are unidentified until completed
|
||||||
|
|
||||||
|
if (workOrder.prefixToken == 0 && workOrder.suffixToken == 0)
|
||||||
|
forgedItem.flags.remove(mbEnums.ItemFlags.Identified);
|
||||||
|
else
|
||||||
|
forgedItem.flags.add(mbEnums.ItemFlags.Identified);
|
||||||
|
|
||||||
|
// Add virtual item to in-memory caches
|
||||||
|
|
||||||
|
workOrder.cooking.add(forgedItem);
|
||||||
|
DbManager.addToCache(forgedItem);
|
||||||
|
itemWorkOrderLookup.put(forgedItem, workOrder);
|
||||||
|
|
||||||
|
return forgedItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void completeWorkOrderBatch(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
ArrayList<Item> toRemove = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Item virutalItem : workOrder.cooking) {
|
||||||
|
|
||||||
|
// Identify completed items
|
||||||
|
|
||||||
|
virutalItem.flags.add(mbEnums.ItemFlags.Identified);
|
||||||
|
virutalItem.containerType = mbEnums.ItemContainerType.INVENTORY;
|
||||||
|
|
||||||
|
// Persist item
|
||||||
|
|
||||||
|
Item completedItem = DbManager.ItemQueries.PERSIST(virutalItem);
|
||||||
|
|
||||||
|
// Copy Prefix and Suffix tokens from virtual item.
|
||||||
|
|
||||||
|
completedItem.prefixToken = virutalItem.prefixToken;
|
||||||
|
completedItem.suffixToken = virutalItem.suffixToken;
|
||||||
|
|
||||||
|
// Add effects for the tokens. Writes to disk using
|
||||||
|
// table dyn_item_enchantment
|
||||||
|
|
||||||
|
ItemManager.applyItemEffects(completedItem);
|
||||||
|
|
||||||
|
// Add to the vendor inventory
|
||||||
|
|
||||||
|
workOrder.vendor.charItemManager.addItemToInventory(completedItem);
|
||||||
|
|
||||||
|
ItemProductionMsg outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.DEPOSIT, true);
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||||
|
ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||||
|
|
||||||
|
toRemove.add(virutalItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Item virtualItem : toRemove) {
|
||||||
|
|
||||||
|
// Remove virtual items from the forge window
|
||||||
|
|
||||||
|
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true);
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||||
|
|
||||||
|
// Remove virtual item from all collections
|
||||||
|
|
||||||
|
workOrder.cooking.remove(virtualItem);
|
||||||
|
itemWorkOrderLookup.remove(virtualItem);
|
||||||
|
DbManager.removeFromCache(virtualItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void forgeWorkOrderBatch(WorkOrder workOrder) {
|
||||||
|
|
||||||
|
// Completion time for this batch is in the future
|
||||||
|
|
||||||
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||||
|
|
||||||
|
for (int i = 0; i < workOrder.slots_used.get(); ++i) {
|
||||||
|
|
||||||
|
Item forged_item = forgeItem(workOrder);
|
||||||
|
|
||||||
|
// Update NPC window
|
||||||
|
|
||||||
|
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, forged_item, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||||
|
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||||
|
workOrder.total_produced = workOrder.total_produced + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write updated workOrder to disk
|
||||||
|
|
||||||
|
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {
|
||||||
|
|
||||||
|
// Random prefix or suffix token based on item.template.modtable
|
||||||
|
|
||||||
|
int modifier = 0;
|
||||||
|
ModTypeTableEntry modTypeTableEntry = null;
|
||||||
|
ModTableEntry modTableEntry;
|
||||||
|
int rollForModifier;
|
||||||
|
|
||||||
|
switch (itemModType) {
|
||||||
|
case PREFIX:
|
||||||
|
int randomPrefix = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(modTable));
|
||||||
|
modTypeTableEntry = ModTypeTableEntry.rollTable(randomPrefix, ThreadLocalRandom.current().nextInt(1, 100 + 1));
|
||||||
|
break;
|
||||||
|
case SUFFIX:
|
||||||
|
int randomSuffix = vendor.getModSuffixTable().get(vendor.getItemModTable().indexOf(modTable));
|
||||||
|
modTypeTableEntry = ModTypeTableEntry.rollTable(randomSuffix, ThreadLocalRandom.current().nextInt(1, 100 + 1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modTypeTableEntry == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
rollForModifier = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
|
|
||||||
|
if (rollForModifier < 80) {
|
||||||
|
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
||||||
|
modTableEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, randomModifier);
|
||||||
|
|
||||||
|
// @TODO : Figure out how a null can be returned from a defined set.
|
||||||
|
|
||||||
|
if (modTableEntry == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
EffectsBase effectsBase = PowersManager.getEffectByIDString(modTableEntry.action);
|
||||||
|
modifier = effectsBase.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
return modifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user