From a0c2abfedf13e935c6438bf56a9cbd9a13590680 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Sun, 29 Dec 2024 20:01:18 -0600 Subject: [PATCH] Implement ^discipline --- .../database_update_manifest_bots.cpp | 906 ++++++++++++++++++ common/spdat.h | 8 + common/version.h | 2 +- zone/bot.cpp | 110 ++- zone/bot.h | 2 +- zone/bot_command.cpp | 2 + zone/bot_command.h | 1 + zone/bot_commands/cast.cpp | 8 +- zone/bot_commands/discipline.cpp | 296 ++++++ zone/botspellsai.cpp | 26 +- 10 files changed, 1311 insertions(+), 50 deletions(-) create mode 100644 zone/bot_commands/discipline.cpp diff --git a/common/database/database_update_manifest_bots.cpp b/common/database/database_update_manifest_bots.cpp index 999f50478..8da924e89 100644 --- a/common/database/database_update_manifest_bots.cpp +++ b/common/database/database_update_manifest_bots.cpp @@ -271,6 +271,7 @@ UPDATE `bot_command_settings` SET `aliases`= 'minmana' WHERE `bot_command`='spel UPDATE `bot_command_settings` SET `aliases`= 'minthresholds' WHERE `bot_command`='spellminthresholds'; UPDATE `bot_command_settings` SET `aliases`= 'pursuepriority' WHERE `bot_command`='spellpursuepriority'; UPDATE `bot_command_settings` SET `aliases`= 'targetcount' WHERE `bot_command`='spelltargetcount'; +UPDATE `bot_command_settings` SET `aliases`= 'disc' WHERE `bot_command`='discipline'; UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|vc') ELSE 'vc' END WHERE `bot_command`='viewcombos' AND `aliases` NOT LIKE '%vc%'; )" }, @@ -1198,6 +1199,911 @@ CREATE TABLE `bot_blocked_buffs` ( COLLATE='latin1_swedish_ci' ENGINE=InnoDB ; +)" + }, + ManifestEntry{ + .version = 9053, + .description = "2024_12_26_discipline_inserts.sql", + .check = "SELECT * FROM `bot_spells_entries` where `type` = 200", + .condition = "empty", + .match = "", + .sql = R"( +INSERT INTO `bot_spells_entries` (`npc_spells_id`, `spell_id`, `type`, `minlevel`, `maxlevel`) +VALUES +(3001, 5225, 200, 1, 254), +(3001, 25060, 200, 5, 254), +(3001, 4721, 200, 10, 62), +(3001, 4608, 200, 20, 51), +(3001, 4585, 200, 30, 254), +(3001, 4587, 200, 40, 254), +(3001, 4681, 200, 52, 55), +(3001, 4503, 200, 52, 254), +(3001, 4672, 200, 53, 254), +(3001, 4514, 200, 54, 254), +(3001, 4499, 200, 55, 64), +(3001, 8921, 200, 55, 69), +(3001, 4682, 200, 56, 62), +(3001, 4674, 200, 56, 254), +(3001, 4501, 200, 57, 254), +(3001, 4675, 200, 58, 59), +(3001, 4670, 200, 59, 254), +(3001, 4498, 200, 60, 254), +(3001, 6750, 200, 61, 68), +(3001, 4689, 200, 61, 254), +(3001, 4697, 200, 63, 64), +(3001, 4687, 200, 63, 254), +(3001, 4688, 200, 65, 71), +(3001, 5015, 200, 65, 254), +(3001, 5016, 200, 65, 254), +(3001, 6191, 200, 66, 70), +(3001, 6192, 200, 68, 73), +(3001, 8000, 200, 68, 254), +(3001, 6725, 200, 69, 73), +(3001, 6173, 200, 69, 80), +(3001, 8467, 200, 70, 74), +(3001, 8468, 200, 70, 254), +(3001, 6190, 200, 70, 254), +(3001, 10959, 200, 71, 75), +(3001, 10960, 200, 71, 75), +(3001, 10961, 200, 71, 75), +(3001, 11913, 200, 72, 76), +(3001, 11914, 200, 72, 76), +(3001, 11915, 200, 72, 76), +(3001, 10965, 200, 72, 254), +(3001, 10966, 200, 72, 254), +(3001, 10967, 200, 72, 254), +(3001, 10970, 200, 73, 254), +(3001, 10968, 200, 73, 254), +(3001, 10969, 200, 73, 254), +(3001, 10971, 200, 74, 78), +(3001, 10972, 200, 74, 78), +(3001, 10973, 200, 74, 78), +(3001, 11917, 200, 74, 254), +(3001, 11918, 200, 74, 254), +(3001, 11916, 200, 74, 254), +(3001, 10974, 200, 75, 79), +(3001, 10975, 200, 75, 79), +(3001, 10976, 200, 75, 79), +(3001, 15345, 200, 76, 80), +(3001, 15346, 200, 76, 80), +(3001, 15347, 200, 76, 80), +(3001, 14192, 200, 77, 81), +(3001, 14193, 200, 77, 81), +(3001, 14194, 200, 77, 81), +(3001, 15369, 200, 77, 254), +(3001, 15370, 200, 77, 254), +(3001, 15371, 200, 77, 254), +(3001, 15375, 200, 78, 82), +(3001, 15376, 200, 78, 82), +(3001, 15377, 200, 78, 82), +(3001, 15359, 200, 79, 83), +(3001, 15357, 200, 79, 83), +(3001, 15358, 200, 79, 83), +(3001, 15379, 200, 80, 84), +(3001, 15360, 200, 80, 84), +(3001, 15380, 200, 80, 84), +(3001, 15361, 200, 80, 84), +(3001, 15362, 200, 80, 84), +(3001, 15378, 200, 80, 84), +(3001, 19537, 200, 81, 254), +(3001, 19538, 200, 81, 254), +(3001, 19516, 200, 81, 254), +(3001, 19539, 200, 81, 254), +(3001, 19517, 200, 81, 254), +(3001, 19518, 200, 81, 254), +(3001, 18213, 200, 82, 254), +(3001, 18214, 200, 82, 254), +(3001, 18215, 200, 82, 254), +(3001, 19555, 200, 83, 254), +(3001, 19556, 200, 83, 254), +(3001, 19557, 200, 83, 254), +(3001, 19914, 200, 83, 254), +(3001, 19915, 200, 83, 254), +(3001, 19916, 200, 83, 254), +(3001, 19553, 200, 84, 254), +(3001, 19554, 200, 84, 254), +(3001, 19528, 200, 84, 254), +(3001, 19529, 200, 84, 254), +(3001, 19552, 200, 84, 254), +(3001, 19530, 200, 84, 254), +(3001, 22556, 200, 85, 254), +(3001, 19531, 200, 85, 254), +(3001, 22557, 200, 85, 254), +(3001, 19532, 200, 85, 254), +(3001, 22558, 200, 85, 254), +(3001, 19533, 200, 85, 254), +(3001, 19549, 200, 85, 254), +(3001, 19550, 200, 85, 254), +(3001, 19917, 200, 85, 254), +(3001, 19551, 200, 85, 254), +(3001, 19918, 200, 85, 254), +(3001, 19919, 200, 85, 254), +(3002, 33000, 200, 1, 254), +(3003, 4585, 200, 51, 254), +(3003, 4587, 200, 54, 254), +(3003, 4500, 200, 55, 254), +(3003, 7004, 200, 56, 60), +(3003, 4590, 200, 59, 254), +(3003, 4518, 200, 60, 254), +(3003, 6731, 200, 61, 68), +(3003, 6663, 200, 69, 72), +(3003, 11854, 200, 73, 77), +(3003, 11855, 200, 73, 77), +(3003, 11856, 200, 73, 77), +(3003, 14987, 200, 78, 82), +(3003, 14988, 200, 78, 82), +(3003, 14989, 200, 78, 82), +(3003, 19103, 200, 83, 254), +(3003, 19131, 200, 83, 254), +(3003, 19132, 200, 83, 254), +(3003, 19133, 200, 83, 254), +(3003, 22665, 200, 83, 254), +(3003, 22666, 200, 83, 254), +(3003, 22667, 200, 83, 254), +(3003, 19101, 200, 83, 254), +(3003, 19102, 200, 83, 254), +(3004, 33000, 200, 1, 254), +(3004, 4585, 200, 51, 254), +(3004, 4587, 200, 54, 254), +(3004, 4506, 200, 55, 79), +(3004, 4519, 200, 60, 254), +(3004, 8019, 200, 69, 254), +(3004, 10086, 200, 72, 76), +(3004, 10087, 200, 72, 76), +(3004, 10088, 200, 72, 76), +(3004, 15020, 200, 77, 81), +(3004, 15021, 200, 77, 81), +(3004, 15022, 200, 77, 81), +(3004, 15091, 200, 80, 84), +(3004, 15092, 200, 80, 84), +(3004, 15093, 200, 80, 84), +(3004, 19153, 200, 82, 254), +(3004, 19154, 200, 82, 254), +(3004, 19152, 200, 82, 254), +(3004, 19223, 200, 85, 254), +(3004, 19224, 200, 85, 254), +(3004, 19225, 200, 85, 254), +(3005, 4585, 200, 51, 254), +(3005, 4587, 200, 54, 254), +(3005, 4520, 200, 55, 254), +(3005, 7005, 200, 56, 60), +(3005, 4590, 200, 59, 254), +(3005, 4504, 200, 60, 254), +(3005, 6741, 200, 61, 68), +(3005, 6673, 200, 69, 72), +(3005, 11866, 200, 73, 77), +(3005, 11867, 200, 73, 77), +(3005, 11868, 200, 73, 77), +(3005, 10306, 200, 75, 77), +(3005, 10307, 200, 75, 77), +(3005, 10308, 200, 75, 77), +(3005, 15223, 200, 78, 79), +(3005, 15224, 200, 78, 79), +(3005, 15225, 200, 78, 79), +(3005, 15211, 200, 78, 82), +(3005, 15212, 200, 78, 82), +(3005, 15213, 200, 78, 82), +(3005, 15191, 200, 80, 84), +(3005, 15192, 200, 80, 84), +(3005, 15190, 200, 80, 84), +(3005, 19364, 200, 83, 254), +(3005, 19365, 200, 83, 254), +(3005, 19366, 200, 83, 254), +(3005, 22662, 200, 83, 254), +(3005, 22663, 200, 83, 254), +(3005, 19131, 200, 83, 254), +(3005, 22664, 200, 83, 254), +(3005, 19132, 200, 83, 254), +(3005, 19133, 200, 83, 254), +(3005, 19343, 200, 85, 254), +(3005, 19344, 200, 85, 254), +(3005, 19345, 200, 85, 254), +(3007, 5225, 200, 1, 254), +(3007, 25060, 200, 5, 60), +(3007, 4721, 200, 10, 62), +(3007, 4585, 200, 30, 254), +(3007, 4614, 200, 35, 49), +(3007, 4587, 200, 40, 254), +(3007, 4683, 200, 50, 56), +(3007, 4510, 200, 51, 64), +(3007, 4511, 200, 52, 59), +(3007, 4509, 200, 53, 254), +(3007, 4502, 200, 54, 254), +(3007, 8923, 200, 55, 69), +(3007, 4512, 200, 56, 78), +(3007, 4684, 200, 57, 63), +(3007, 4513, 200, 57, 254), +(3007, 4507, 200, 59, 254), +(3007, 4508, 200, 60, 73), +(3007, 4692, 200, 61, 65), +(3007, 6752, 200, 61, 68), +(3007, 4687, 200, 63, 254), +(3007, 4691, 200, 63, 254), +(3007, 4698, 200, 64, 64), +(3007, 4690, 200, 65, 71), +(3007, 5019, 200, 65, 254), +(3007, 5020, 200, 65, 254), +(3007, 6193, 200, 66, 254), +(3007, 6195, 200, 68, 254), +(3007, 8002, 200, 68, 254), +(3007, 6175, 200, 69, 70), +(3007, 6727, 200, 69, 254), +(3007, 6194, 200, 70, 254), +(3007, 8473, 200, 70, 254), +(3007, 8474, 200, 70, 254), +(3007, 10947, 200, 71, 75), +(3007, 10948, 200, 71, 75), +(3007, 10949, 200, 71, 75), +(3007, 11913, 200, 72, 76), +(3007, 11914, 200, 72, 76), +(3007, 11915, 200, 72, 76), +(3007, 10938, 200, 72, 254), +(3007, 10939, 200, 72, 254), +(3007, 10940, 200, 72, 254), +(3007, 10933, 200, 73, 77), +(3007, 10934, 200, 73, 77), +(3007, 10932, 200, 73, 77), +(3007, 10944, 200, 74, 78), +(3007, 10945, 200, 74, 78), +(3007, 10946, 200, 74, 78), +(3007, 11922, 200, 74, 254), +(3007, 11923, 200, 74, 254), +(3007, 11924, 200, 74, 254), +(3007, 10950, 200, 75, 79), +(3007, 10951, 200, 75, 79), +(3007, 10952, 200, 75, 79), +(3007, 14799, 200, 76, 80), +(3007, 14800, 200, 76, 80), +(3007, 14801, 200, 76, 80), +(3007, 14194, 200, 77, 81), +(3007, 14811, 200, 77, 81), +(3007, 14812, 200, 77, 81), +(3007, 14813, 200, 77, 81), +(3007, 14192, 200, 77, 81), +(3007, 14193, 200, 77, 81), +(3007, 14784, 200, 78, 82), +(3007, 14785, 200, 78, 82), +(3007, 14786, 200, 78, 82), +(3007, 14796, 200, 79, 80), +(3007, 14797, 200, 79, 80), +(3007, 14798, 200, 79, 80), +(3007, 14822, 200, 79, 254), +(3007, 14820, 200, 79, 254), +(3007, 14821, 200, 79, 254), +(3007, 14814, 200, 80, 84), +(3007, 14815, 200, 80, 84), +(3007, 14816, 200, 80, 84), +(3007, 14802, 200, 80, 254), +(3007, 14803, 200, 80, 254), +(3007, 14804, 200, 80, 254), +(3007, 18895, 200, 81, 83), +(3007, 18896, 200, 81, 83), +(3007, 18897, 200, 81, 83), +(3007, 18904, 200, 81, 254), +(3007, 18905, 200, 81, 254), +(3007, 18906, 200, 81, 254), +(3007, 18918, 200, 82, 254), +(3007, 18213, 200, 82, 254), +(3007, 18214, 200, 82, 254), +(3007, 18215, 200, 82, 254), +(3007, 18916, 200, 82, 254), +(3007, 18917, 200, 82, 254), +(3007, 18889, 200, 83, 254), +(3007, 18890, 200, 83, 254), +(3007, 18891, 200, 83, 254), +(3007, 19826, 200, 83, 254), +(3007, 19827, 200, 83, 254), +(3007, 19828, 200, 83, 254), +(3007, 18902, 200, 84, 254), +(3007, 18903, 200, 84, 254), +(3007, 19552, 200, 84, 254), +(3007, 19553, 200, 84, 254), +(3007, 19554, 200, 84, 254), +(3007, 18901, 200, 84, 254), +(3007, 19830, 200, 85, 254), +(3007, 18919, 200, 85, 254), +(3007, 19831, 200, 85, 254), +(3007, 18920, 200, 85, 254), +(3007, 22525, 200, 85, 254), +(3007, 18921, 200, 85, 254), +(3007, 22526, 200, 85, 254), +(3007, 22527, 200, 85, 254), +(3007, 18907, 200, 85, 254), +(3007, 18908, 200, 85, 254), +(3007, 18909, 200, 85, 254), +(3007, 19829, 200, 85, 254), +(3008, 4585, 200, 51, 254), +(3008, 4587, 200, 54, 254), +(3008, 4516, 200, 55, 254), +(3008, 4586, 200, 60, 254), +(3008, 8030, 200, 69, 254), +(3009, 5225, 200, 1, 254), +(3009, 25060, 200, 5, 82), +(3009, 4721, 200, 10, 62), +(3009, 4659, 200, 20, 51), +(3009, 4585, 200, 30, 254), +(3009, 4587, 200, 40, 254), +(3009, 4685, 200, 52, 62), +(3009, 4673, 200, 53, 254), +(3009, 4505, 200, 54, 62), +(3009, 8922, 200, 55, 69), +(3009, 4515, 200, 55, 254), +(3009, 4517, 200, 57, 254), +(3009, 4677, 200, 58, 254), +(3009, 4676, 200, 59, 74), +(3009, 6751, 200, 61, 68), +(3009, 4696, 200, 61, 254), +(3009, 4686, 200, 63, 64), +(3009, 4687, 200, 63, 254), +(3009, 4694, 200, 63, 254), +(3009, 5017, 200, 65, 68), +(3009, 5018, 200, 65, 68), +(3009, 4695, 200, 65, 254), +(3009, 6198, 200, 66, 254), +(3009, 8001, 200, 68, 254), +(3009, 6196, 200, 68, 254), +(3009, 6174, 200, 69, 69), +(3009, 6726, 200, 69, 70), +(3009, 8470, 200, 70, 79), +(3009, 6197, 200, 70, 254), +(3009, 8471, 200, 70, 254), +(3009, 10883, 200, 71, 75), +(3009, 10884, 200, 71, 75), +(3009, 10885, 200, 71, 75), +(3009, 11913, 200, 72, 76), +(3009, 11914, 200, 72, 76), +(3009, 11915, 200, 72, 76), +(3009, 10889, 200, 72, 254), +(3009, 10890, 200, 72, 254), +(3009, 10891, 200, 72, 254), +(3009, 10892, 200, 73, 77), +(3009, 10893, 200, 73, 77), +(3009, 10894, 200, 73, 77), +(3009, 11925, 200, 74, 78), +(3009, 11926, 200, 74, 78), +(3009, 11927, 200, 74, 78), +(3009, 10895, 200, 74, 254), +(3009, 10896, 200, 74, 254), +(3009, 10897, 200, 74, 254), +(3009, 10899, 200, 75, 254), +(3009, 10900, 200, 75, 254), +(3009, 10898, 200, 75, 254), +(3009, 15097, 200, 76, 80), +(3009, 15120, 200, 76, 80), +(3009, 15098, 200, 76, 80), +(3009, 15099, 200, 76, 80), +(3009, 15118, 200, 76, 80), +(3009, 15119, 200, 76, 80), +(3009, 15121, 200, 77, 81), +(3009, 15122, 200, 77, 81), +(3009, 15123, 200, 77, 81), +(3009, 14192, 200, 77, 81), +(3009, 14193, 200, 77, 81), +(3009, 14194, 200, 77, 81), +(3009, 15103, 200, 78, 82), +(3009, 15104, 200, 78, 82), +(3009, 15105, 200, 78, 82), +(3009, 15115, 200, 79, 83), +(3009, 15116, 200, 79, 83), +(3009, 15117, 200, 79, 83), +(3009, 15127, 200, 80, 84), +(3009, 15128, 200, 80, 84), +(3009, 15129, 200, 80, 84), +(3009, 15133, 200, 80, 84), +(3009, 15134, 200, 80, 84), +(3009, 15135, 200, 80, 84), +(3009, 19244, 200, 81, 254), +(3009, 19245, 200, 81, 254), +(3009, 19265, 200, 81, 254), +(3009, 19246, 200, 81, 254), +(3009, 19266, 200, 81, 254), +(3009, 19267, 200, 81, 254), +(3009, 18213, 200, 82, 254), +(3009, 18214, 200, 82, 254), +(3009, 18215, 200, 82, 254), +(3009, 19268, 200, 82, 254), +(3009, 19269, 200, 82, 254), +(3009, 19270, 200, 82, 254), +(3009, 19873, 200, 83, 84), +(3009, 19871, 200, 83, 84), +(3009, 19872, 200, 83, 84), +(3009, 19252, 200, 83, 254), +(3009, 19247, 200, 83, 254), +(3009, 19248, 200, 83, 254), +(3009, 19249, 200, 83, 254), +(3009, 19250, 200, 83, 254), +(3009, 19251, 200, 83, 254), +(3009, 19262, 200, 84, 254), +(3009, 19263, 200, 84, 254), +(3009, 19264, 200, 84, 254), +(3009, 19283, 200, 84, 254), +(3009, 19284, 200, 84, 254), +(3009, 19285, 200, 84, 254), +(3009, 19275, 200, 85, 254), +(3009, 19874, 200, 85, 254), +(3009, 19276, 200, 85, 254), +(3009, 19875, 200, 85, 254), +(3009, 19280, 200, 85, 254), +(3009, 19876, 200, 85, 254), +(3009, 19281, 200, 85, 254), +(3009, 22540, 200, 85, 254), +(3009, 19282, 200, 85, 254), +(3009, 22541, 200, 85, 254), +(3009, 22542, 200, 85, 254), +(3009, 19274, 200, 85, 254), +(3015, 4585, 200, 51, 254), +(3015, 4587, 200, 54, 254), +(3015, 4671, 200, 55, 254), +(3015, 4678, 200, 60, 68), +(3015, 8233, 200, 69, 254), +(3015, 8782, 200, 70, 79), +(3015, 14158, 200, 80, 84), +(3015, 14159, 200, 80, 84), +(3015, 14160, 200, 80, 84), +(3015, 18170, 200, 85, 254), +(3015, 18171, 200, 85, 254), +(3015, 18172, 200, 85, 254), +(3016, 5225, 200, 1, 254), +(3016, 4937, 200, 1, 4), +(3016, 4938, 200, 5, 9), +(3016, 25060, 200, 5, 254), +(3016, 4928, 200, 8, 31), +(3016, 4939, 200, 10, 14), +(3016, 4721, 200, 10, 62), +(3016, 4940, 200, 15, 19), +(3016, 4931, 200, 16, 39), +(3016, 4941, 200, 20, 24), +(3016, 4934, 200, 24, 47), +(3016, 4942, 200, 25, 29), +(3016, 4943, 200, 30, 34), +(3016, 5027, 200, 30, 49), +(3016, 4585, 200, 30, 254), +(3016, 4929, 200, 32, 53), +(3016, 4944, 200, 35, 39), +(3016, 4945, 200, 40, 44), +(3016, 4932, 200, 40, 59), +(3016, 4587, 200, 40, 254), +(3016, 4946, 200, 45, 49), +(3016, 4935, 200, 48, 64), +(3016, 4947, 200, 50, 54), +(3016, 5028, 200, 50, 56), +(3016, 5039, 200, 53, 254), +(3016, 4930, 200, 54, 66), +(3016, 5037, 200, 54, 254), +(3016, 4948, 200, 55, 59), +(3016, 8924, 200, 55, 69), +(3016, 5040, 200, 56, 254), +(3016, 5029, 200, 57, 63), +(3016, 5035, 200, 57, 254), +(3016, 5041, 200, 58, 59), +(3016, 5038, 200, 59, 254), +(3016, 4949, 200, 60, 64), +(3016, 4933, 200, 60, 67), +(3016, 5034, 200, 60, 74), +(3016, 6754, 200, 61, 68), +(3016, 5044, 200, 61, 254), +(3016, 4687, 200, 63, 254), +(3016, 5042, 200, 63, 254), +(3016, 5030, 200, 64, 64), +(3016, 4950, 200, 65, 65), +(3016, 5107, 200, 65, 65), +(3016, 4936, 200, 65, 68), +(3016, 5043, 200, 65, 254), +(3016, 5031, 200, 65, 254), +(3016, 5032, 200, 65, 254), +(3016, 6172, 200, 66, 70), +(3016, 6200, 200, 66, 254), +(3016, 6169, 200, 67, 70), +(3016, 6170, 200, 68, 72), +(3016, 6201, 200, 68, 254), +(3016, 8003, 200, 68, 254), +(3016, 6171, 200, 69, 73), +(3016, 6729, 200, 69, 73), +(3016, 8476, 200, 70, 254), +(3016, 8477, 200, 70, 254), +(3016, 6199, 200, 70, 254), +(3016, 10907, 200, 71, 75), +(3016, 10908, 200, 71, 75), +(3016, 10909, 200, 71, 75), +(3016, 10910, 200, 71, 75), +(3016, 11915, 200, 72, 76), +(3016, 10914, 200, 72, 76), +(3016, 10915, 200, 72, 76), +(3016, 11913, 200, 72, 76), +(3016, 10916, 200, 72, 76), +(3016, 11914, 200, 72, 76), +(3016, 10918, 200, 73, 77), +(3016, 10919, 200, 73, 77), +(3016, 10917, 200, 73, 77), +(3016, 11928, 200, 74, 78), +(3016, 11929, 200, 74, 78), +(3016, 10920, 200, 74, 78), +(3016, 11930, 200, 74, 78), +(3016, 10921, 200, 74, 78), +(3016, 10922, 200, 74, 78), +(3016, 10923, 200, 75, 254), +(3016, 10924, 200, 75, 254), +(3016, 10925, 200, 75, 254), +(3016, 14176, 200, 76, 80), +(3016, 14177, 200, 76, 80), +(3016, 14178, 200, 76, 80), +(3016, 14179, 200, 76, 80), +(3016, 14192, 200, 77, 81), +(3016, 14193, 200, 77, 81), +(3016, 14180, 200, 77, 81), +(3016, 14194, 200, 77, 81), +(3016, 14181, 200, 77, 81), +(3016, 14182, 200, 77, 81), +(3016, 14183, 200, 78, 82), +(3016, 14184, 200, 78, 82), +(3016, 14185, 200, 78, 82), +(3016, 14197, 200, 79, 83), +(3016, 14186, 200, 79, 83), +(3016, 14187, 200, 79, 83), +(3016, 14188, 200, 79, 83), +(3016, 14195, 200, 79, 83), +(3016, 14196, 200, 79, 83), +(3016, 14198, 200, 80, 84), +(3016, 14199, 200, 80, 84), +(3016, 14200, 200, 80, 84), +(3016, 18200, 200, 81, 254), +(3016, 16918, 200, 81, 254), +(3016, 16919, 200, 81, 254), +(3016, 16920, 200, 81, 254), +(3016, 18197, 200, 81, 254), +(3016, 18198, 200, 81, 254), +(3016, 18199, 200, 81, 254), +(3016, 18201, 200, 82, 254), +(3016, 18202, 200, 82, 254), +(3016, 18213, 200, 82, 254), +(3016, 18203, 200, 82, 254), +(3016, 18214, 200, 82, 254), +(3016, 18215, 200, 82, 254), +(3016, 18211, 200, 83, 254), +(3016, 18212, 200, 83, 254), +(3016, 19753, 200, 83, 254), +(3016, 18204, 200, 83, 254), +(3016, 19754, 200, 83, 254), +(3016, 18205, 200, 83, 254), +(3016, 19755, 200, 83, 254), +(3016, 18206, 200, 83, 254), +(3016, 18210, 200, 83, 254), +(3016, 18216, 200, 84, 254), +(3016, 18217, 200, 84, 254), +(3016, 18207, 200, 84, 254), +(3016, 18218, 200, 84, 254), +(3016, 18208, 200, 84, 254), +(3016, 18209, 200, 84, 254), +(3016, 19741, 200, 85, 254), +(3016, 19742, 200, 85, 254), +(3016, 19743, 200, 85, 254), +(3016, 22506, 200, 85, 254), +(3016, 22507, 200, 85, 254), +(3016, 18219, 200, 85, 254), +(3016, 22508, 200, 85, 254), +(3016, 18220, 200, 85, 254), +(3016, 18221, 200, 85, 254); + +DELETE +FROM bot_spells_entries +WHERE NOT EXISTS +(SELECT * +FROM spells_new +WHERE bot_spells_entries.spell_id = spells_new.id); +)" + }, + ManifestEntry{ + .version = 9054, + .description = "2024_12_29_discipline__subtypes_inserts.sql", + .check = "SELECT * FROM `bot_spells_entries` where `type` = 201", + .condition = "empty", + .match = "", + .sql = R"( +INSERT INTO `bot_spells_entries` (`npc_spells_id`, `spell_id`, `type`, `minlevel`, `maxlevel`, `priority`) +VALUES +(3001, 4672, 201, 53, 254, 3), +(3001, 4514, 201, 54, 254, 3), +(3001, 4501, 201, 57, 254, 3), +(3001, 4675, 201, 58, 59, 3), +(3001, 4498, 201, 60, 254, 3), +(3001, 6750, 201, 61, 68, 3), +(3001, 6192, 201, 68, 73, 3), +(3001, 6725, 201, 69, 73, 3), +(3001, 10970, 201, 73, 254, 1), +(3001, 10968, 201, 73, 254, 3), +(3001, 10969, 201, 73, 254, 2), +(3001, 10971, 201, 74, 78, 3), +(3001, 10972, 201, 74, 78, 2), +(3001, 10973, 201, 74, 78, 1), +(3001, 11917, 201, 74, 254, 2), +(3001, 11918, 201, 74, 254, 1), +(3001, 11916, 201, 74, 254, 3), +(3001, 15369, 201, 77, 254, 3), +(3001, 15370, 201, 77, 254, 2), +(3001, 15371, 201, 77, 254, 1), +(3001, 15375, 201, 78, 82, 3), +(3001, 15376, 201, 78, 82, 2), +(3001, 15377, 201, 78, 82, 1), +(3001, 15359, 201, 79, 83, 1), +(3001, 15357, 201, 79, 83, 3), +(3001, 15358, 201, 79, 83, 2), +(3001, 15379, 201, 80, 84, 2), +(3001, 15380, 201, 80, 84, 1), +(3001, 15378, 201, 80, 84, 3), +(3001, 19555, 201, 83, 254, 3), +(3001, 19556, 201, 83, 254, 2), +(3001, 19557, 201, 83, 254, 1), +(3001, 19553, 201, 84, 254, 2), +(3001, 19554, 201, 84, 254, 1), +(3001, 19528, 201, 84, 254, 3), +(3001, 19529, 201, 84, 254, 2), +(3001, 19552, 201, 84, 254, 3), +(3001, 19530, 201, 84, 254, 1), +(3001, 19549, 201, 85, 254, 3), +(3001, 19550, 201, 85, 254, 2), +(3001, 19551, 201, 85, 254, 1), +(3003, 4500, 201, 55, 254, 3), +(3003, 4590, 201, 59, 254, 3), +(3004, 4506, 201, 55, 79, 3), +(3004, 8019, 201, 69, 254, 3), +(3004, 10086, 201, 72, 76, 3), +(3004, 10087, 201, 72, 76, 2), +(3004, 10088, 201, 72, 76, 1), +(3004, 15020, 201, 77, 81, 3), +(3004, 15021, 201, 77, 81, 2), +(3004, 15022, 201, 77, 81, 1), +(3004, 15091, 201, 80, 84, 3), +(3004, 15092, 201, 80, 84, 2), +(3004, 15093, 201, 80, 84, 1), +(3004, 19153, 201, 82, 254, 2), +(3004, 19154, 201, 82, 254, 1), +(3004, 19152, 201, 82, 254, 3), +(3004, 19223, 201, 85, 254, 3), +(3004, 19224, 201, 85, 254, 2), +(3004, 19225, 201, 85, 254, 1), +(3005, 4520, 201, 55, 254, 3), +(3005, 4590, 201, 59, 254, 3), +(3007, 4511, 201, 52, 59, 3), +(3007, 4512, 201, 56, 78, 3), +(3007, 4513, 201, 57, 254, 3), +(3007, 4507, 201, 59, 254, 3), +(3007, 4508, 201, 60, 73, 3), +(3007, 4691, 201, 63, 254, 3), +(3007, 6194, 201, 70, 254, 3), +(3007, 8473, 201, 70, 254, 3), +(3007, 10944, 201, 74, 78, 3), +(3007, 10945, 201, 74, 78, 2), +(3007, 10946, 201, 74, 78, 1), +(3007, 11922, 201, 74, 254, 3), +(3007, 11923, 201, 74, 254, 2), +(3007, 11924, 201, 74, 254, 1), +(3007, 14796, 201, 79, 80, 3), +(3007, 14797, 201, 79, 80, 2), +(3007, 14798, 201, 79, 80, 1), +(3007, 14822, 201, 79, 254, 1), +(3007, 14820, 201, 79, 254, 3), +(3007, 14821, 201, 79, 254, 2), +(3007, 14814, 201, 80, 84, 3), +(3007, 14815, 201, 80, 84, 2), +(3007, 14816, 201, 80, 84, 1), +(3007, 18895, 201, 81, 83, 3), +(3007, 18896, 201, 81, 83, 2), +(3007, 18897, 201, 81, 83, 1), +(3007, 18902, 201, 84, 254, 2), +(3007, 18903, 201, 84, 254, 1), +(3007, 19552, 201, 84, 254, 3), +(3007, 19553, 201, 84, 254, 2), +(3007, 19554, 201, 84, 254, 1), +(3007, 18901, 201, 84, 254, 3), +(3007, 18919, 201, 85, 254, 3), +(3007, 18920, 201, 85, 254, 2), +(3007, 22525, 201, 85, 254, 3), +(3007, 18921, 201, 85, 254, 1), +(3007, 22526, 201, 85, 254, 2), +(3007, 22527, 201, 85, 254, 1), +(3008, 4586, 201, 60, 254, 3), +(3008, 8030, 201, 69, 254, 3), +(3009, 4659, 201, 20, 51, 3), +(3009, 4685, 201, 52, 62, 3), +(3009, 4505, 201, 54, 62, 3), +(3009, 4517, 201, 57, 254, 3), +(3009, 4677, 201, 58, 254, 3), +(3009, 4676, 201, 59, 74, 3), +(3009, 4696, 201, 61, 254, 3), +(3009, 4686, 201, 63, 64, 3), +(3009, 4694, 201, 63, 254, 3), +(3009, 5017, 201, 65, 68, 3), +(3009, 5018, 201, 65, 68, 3), +(3009, 4695, 201, 65, 254, 3), +(3009, 8001, 201, 68, 254, 3), +(3009, 6196, 201, 68, 254, 3), +(3009, 6174, 201, 69, 69, 3), +(3009, 8470, 201, 70, 79, 3), +(3009, 6197, 201, 70, 254, 3), +(3009, 10892, 201, 73, 77, 3), +(3009, 10893, 201, 73, 77, 2), +(3009, 10894, 201, 73, 77, 1), +(3009, 11925, 201, 74, 78, 3), +(3009, 11926, 201, 74, 78, 2), +(3009, 11927, 201, 74, 78, 1), +(3009, 10899, 201, 75, 254, 2), +(3009, 10900, 201, 75, 254, 1), +(3009, 10898, 201, 75, 254, 3), +(3009, 15103, 201, 78, 82, 3), +(3009, 15104, 201, 78, 82, 2), +(3009, 15105, 201, 78, 82, 1), +(3009, 15115, 201, 79, 83, 3), +(3009, 15116, 201, 79, 83, 2), +(3009, 15117, 201, 79, 83, 1), +(3009, 15133, 201, 80, 84, 3), +(3009, 15134, 201, 80, 84, 2), +(3009, 15135, 201, 80, 84, 1), +(3009, 19252, 201, 83, 254, 1), +(3009, 19250, 201, 83, 254, 3), +(3009, 19251, 201, 83, 254, 2), +(3009, 19262, 201, 84, 254, 3), +(3009, 19263, 201, 84, 254, 2), +(3009, 19264, 201, 84, 254, 1), +(3009, 19280, 201, 85, 254, 3), +(3009, 19281, 201, 85, 254, 2), +(3009, 19282, 201, 85, 254, 1), +(3015, 4678, 201, 60, 68, 3), +(3015, 8233, 201, 69, 254, 3), +(3015, 8782, 201, 70, 79, 3), +(3015, 14158, 201, 80, 84, 3), +(3015, 14159, 201, 80, 84, 2), +(3015, 14160, 201, 80, 84, 1), +(3015, 18170, 201, 85, 254, 3), +(3015, 18171, 201, 85, 254, 2), +(3015, 18172, 201, 85, 254, 1), +(3016, 5027, 201, 30, 49, 3), +(3016, 5028, 201, 50, 56, 3), +(3016, 5039, 201, 53, 254, 3), +(3016, 5037, 201, 54, 254, 3), +(3016, 5029, 201, 57, 63, 3), +(3016, 5035, 201, 57, 254, 3), +(3016, 5041, 201, 58, 59, 3), +(3016, 5034, 201, 60, 74, 3), +(3016, 6754, 201, 61, 68, 3), +(3016, 5030, 201, 64, 64, 3), +(3016, 5043, 201, 65, 254, 3), +(3016, 5031, 201, 65, 254, 3), +(3016, 5032, 201, 65, 254, 3), +(3016, 8003, 201, 68, 254, 3), +(3016, 6729, 201, 69, 73, 3), +(3016, 6199, 201, 70, 254, 3), +(3016, 10914, 201, 72, 76, 3), +(3016, 10915, 201, 72, 76, 2), +(3016, 10916, 201, 72, 76, 1), +(3016, 11928, 201, 74, 78, 3), +(3016, 11929, 201, 74, 78, 2), +(3016, 11930, 201, 74, 78, 1), +(3016, 10923, 201, 75, 254, 3), +(3016, 10924, 201, 75, 254, 2), +(3016, 10925, 201, 75, 254, 1), +(3016, 14180, 201, 77, 81, 3), +(3016, 14181, 201, 77, 81, 2), +(3016, 14182, 201, 77, 81, 1), +(3016, 14197, 201, 79, 83, 1), +(3016, 14195, 201, 79, 83, 3), +(3016, 14196, 201, 79, 83, 2), +(3016, 14198, 201, 80, 84, 3), +(3016, 14199, 201, 80, 84, 2), +(3016, 14200, 201, 80, 84, 1), +(3016, 16918, 201, 81, 254, 3), +(3016, 16919, 201, 81, 254, 2), +(3016, 16920, 201, 81, 254, 1), +(3016, 18201, 201, 82, 254, 3), +(3016, 18202, 201, 82, 254, 2), +(3016, 18203, 201, 82, 254, 1), +(3016, 18216, 201, 84, 254, 3), +(3016, 18217, 201, 84, 254, 2), +(3016, 18218, 201, 84, 254, 1), +(3016, 19741, 201, 85, 254, 3), +(3016, 19742, 201, 85, 254, 2), +(3016, 19743, 201, 85, 254, 1), +(3016, 22506, 201, 85, 254, 3), +(3016, 22507, 201, 85, 254, 2), +(3016, 18219, 201, 85, 254, 3), +(3016, 22508, 201, 85, 254, 1), +(3016, 18220, 201, 85, 254, 2), +(3016, 18221, 201, 85, 254, 1); + +INSERT INTO `bot_spells_entries` (`npc_spells_id`, `spell_id`, `type`, `minlevel`, `maxlevel`, `priority`) +VALUES +(3001, 4587, 202, 40, 254, 3), +(3001, 4503, 202, 52, 254, 3), +(3001, 4499, 202, 55, 64, 3), +(3001, 4674, 202, 56, 254, 3), +(3001, 4670, 202, 59, 254, 3), +(3001, 4688, 202, 65, 71, 3), +(3001, 8000, 202, 68, 254, 3), +(3001, 6190, 202, 70, 254, 3), +(3001, 10965, 202, 72, 254, 3), +(3001, 10966, 202, 72, 254, 2), +(3001, 10967, 202, 72, 254, 1), +(3003, 4587, 202, 54, 254, 3), +(3003, 7004, 202, 56, 60, 3), +(3003, 4518, 202, 60, 254, 3), +(3003, 6731, 202, 61, 68, 3), +(3003, 6663, 202, 69, 72, 3), +(3003, 11854, 202, 73, 77, 3), +(3003, 11855, 202, 73, 77, 2), +(3003, 11856, 202, 73, 77, 1), +(3003, 14987, 202, 78, 82, 3), +(3003, 14988, 202, 78, 82, 2), +(3003, 14989, 202, 78, 82, 1), +(3003, 19103, 202, 83, 254, 1), +(3003, 19131, 202, 83, 254, 3), +(3003, 19132, 202, 83, 254, 2), +(3003, 19133, 202, 83, 254, 1), +(3003, 22665, 202, 83, 254, 3), +(3003, 22666, 202, 83, 254, 2), +(3003, 22667, 202, 83, 254, 1), +(3003, 19101, 202, 83, 254, 3), +(3003, 19102, 202, 83, 254, 2), +(3004, 4587, 202, 54, 254, 3), +(3004, 4519, 202, 60, 254, 3), +(3005, 4587, 202, 54, 254, 3), +(3005, 7005, 202, 56, 60, 3), +(3005, 4504, 202, 60, 254, 3), +(3005, 6741, 202, 61, 68, 3), +(3005, 6673, 202, 69, 72, 3), +(3005, 11866, 202, 73, 77, 3), +(3005, 11867, 202, 73, 77, 2), +(3005, 11868, 202, 73, 77, 1), +(3005, 15211, 202, 78, 82, 3), +(3005, 15212, 202, 78, 82, 2), +(3005, 15213, 202, 78, 82, 1), +(3005, 19364, 202, 83, 254, 3), +(3005, 19365, 202, 83, 254, 2), +(3005, 19366, 202, 83, 254, 1), +(3005, 22662, 202, 83, 254, 3), +(3005, 22663, 202, 83, 254, 2), +(3005, 19131, 202, 83, 254, 3), +(3005, 22664, 202, 83, 254, 1), +(3005, 19132, 202, 83, 254, 2), +(3005, 19133, 202, 83, 254, 1), +(3007, 4587, 202, 40, 254, 3), +(3007, 4510, 202, 51, 64, 3), +(3007, 4509, 202, 53, 254, 3), +(3007, 4502, 202, 54, 254, 3), +(3007, 4690, 202, 65, 71, 3), +(3007, 6195, 202, 68, 254, 3), +(3007, 10938, 202, 72, 254, 3), +(3007, 10939, 202, 72, 254, 2), +(3007, 10940, 202, 72, 254, 1), +(3007, 19830, 202, 85, 254, 2), +(3007, 19831, 202, 85, 254, 1), +(3007, 19829, 202, 85, 254, 3), +(3008, 4587, 202, 54, 254, 3), +(3008, 4516, 202, 55, 254, 3), +(3009, 4587, 202, 40, 254, 3), +(3009, 4673, 202, 53, 254, 3), +(3009, 4515, 202, 55, 254, 3), +(3009, 10889, 202, 72, 254, 3), +(3009, 10890, 202, 72, 254, 2), +(3009, 10891, 202, 72, 254, 1), +(3009, 10895, 202, 74, 254, 3), +(3009, 10896, 202, 74, 254, 2), +(3009, 10897, 202, 74, 254, 1), +(3015, 4587, 202, 54, 254, 3), +(3015, 4671, 202, 55, 254, 3), +(3016, 4587, 202, 40, 254, 3), +(3016, 5040, 202, 56, 254, 3), +(3016, 5038, 202, 59, 254, 3), +(3016, 5043, 202, 65, 254, 3), +(3016, 6200, 202, 66, 254, 3), +(3016, 6201, 202, 68, 254, 3), +(3016, 8003, 202, 68, 254, 3), +(3016, 8476, 202, 70, 254, 3); + +DELETE +FROM bot_spells_entries +WHERE NOT EXISTS +(SELECT * +FROM spells_new +WHERE bot_spells_entries.spell_id = spells_new.id); )" } // -- template; copy/paste this when you need to create a new entry diff --git a/common/spdat.h b/common/spdat.h index b518dc725..4681a8584 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -727,11 +727,19 @@ namespace BotSpellTypes constexpr uint16 SendHome = 111; constexpr uint16 SummonCorpse = 112; constexpr uint16 AELull = 113; + + // Discipline Types + constexpr uint16 Discipline = 200; + constexpr uint16 DiscAggressive = 201; + constexpr uint16 DiscDefensive = 202; + constexpr uint16 DiscUtility = 203; constexpr uint16 START = BotSpellTypes::Nuke; // Do not remove or change this constexpr uint16 END = BotSpellTypes::PetResistBuffs; // Do not remove this, increment as needed constexpr uint16 COMMANDED_START = BotSpellTypes::Lull; // Do not remove or change this constexpr uint16 COMMANDED_END = BotSpellTypes::AELull; // Do not remove this, increment as needed + constexpr uint16 DISCIPLINE_START = BotSpellTypes::Discipline; // Do not remove or change this + constexpr uint16 DISCIPLINE_END = BotSpellTypes::DiscUtility; // Do not remove this, increment as needed } const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow); diff --git a/common/version.h b/common/version.h index 731ffab16..ffc83aef7 100644 --- a/common/version.h +++ b/common/version.h @@ -43,7 +43,7 @@ */ #define CURRENT_BINARY_DATABASE_VERSION 9286 -#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9052 //TODO bot rewrite +#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054 //TODO bot rewrite #endif diff --git a/zone/bot.cpp b/zone/bot.cpp index 41ab32421..b2e8e195f 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10826,7 +10826,13 @@ bool Bot::AttemptAICastSpell(uint16 spellType, Mob* tar) { } bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { - if (!tar || spells[spell_id].target_type == ST_Self) { + if (!IsValidSpell(spell_id)) { + return false; + } + + SPDat_Spell_Struct spell = spells[spell_id]; + + if (!tar || spell.target_type == ST_Self) { tar = this; } @@ -10854,7 +10860,7 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { } if (!CastChecks(spell_id, tar, UINT16_MAX)) { - GetBotOwner()->Message(Chat::Red, "%s says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, etc.'", GetCleanName()); + GetBotOwner()->Message(Chat::Red, "%s says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, target type, etc.'", GetCleanName()); return false; } @@ -10866,7 +10872,7 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { fmt::format( "Interrupting {}. I have been commanded to try to cast an AA - {} on {}.", CastingSpellID() ? spells[CastingSpellID()].name : "my spell", - spells[spell_id].name, + spell.name, tar->GetCleanName() ).c_str() ); @@ -10893,7 +10899,7 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { SetSpellRecastTimer(spell_id, timer_duration); } else { - GetBotOwner()->Message(Chat::Red, "%s says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, etc.'", GetCleanName()); + GetBotOwner()->Message(Chat::Red, "%s says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, target type, etc.'", GetCleanName()); return false; } @@ -10914,24 +10920,26 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { return true; } -bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id) { - SPDat_Spell_Struct spell = spells[spell_id]; - uint16 forcedSpellID = spell.id; +bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { + if (!IsValidSpell(spell_id)) { + return false; + } - if (!tar || (spells[spell_id].target_type == ST_Self && tar != this)) { - LogTestDebug("{} set my target to myself for {} [#{}] due to !tar.", GetCleanName(), spell.name, forcedSpellID); //deleteme + SPDat_Spell_Struct spell = spells[spell_id]; + + if (!tar || (spell.target_type == ST_Self && tar != this)) { tar = this; } - if ((IsCharmSpell(forcedSpellID) || IsPetSpell(forcedSpellID) && HasPet())) { + if ((IsCharmSpell(spell_id) || IsPetSpell(spell_id) && HasPet())) { return false; } - if (IsResurrectSpell(forcedSpellID) && (!tar->IsCorpse() || !tar->CastToCorpse()->IsPlayerCorpse())) { + if (IsResurrectSpell(spell_id) && (!tar->IsCorpse() || !tar->CastToCorpse()->IsPlayerCorpse())) { return false; } - if (IsBeneficialSpell(forcedSpellID)) { + if (IsBeneficialSpell(spell_id)) { if ( (tar->IsNPC() && !tar->GetOwner()) || (tar->GetOwner() && tar->GetOwner()->IsOfClientBot() && !GetBotOwner()->IsInGroupOrRaid(tar->GetOwner())) || @@ -10949,7 +10957,7 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id) { } } - if (IsDetrimentalSpell(forcedSpellID) && (!GetBotOwner()->IsAttackAllowed(tar) || !IsAttackAllowed(tar))) { + if (IsDetrimentalSpell(spell_id) && (!GetBotOwner()->IsAttackAllowed(tar) || !IsAttackAllowed(tar))) { GetBotOwner()->Message( Chat::Yellow, fmt::format( @@ -10962,32 +10970,35 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id) { return false; } - if (!CheckSpellRecastTimer(forcedSpellID)) { - LogTestDebug("{} failed CheckSpellRecastTimer for {} [#{}].", GetCleanName(), spell.name, forcedSpellID); //deleteme - return false; + if (!isDisc) { + if (!CheckSpellRecastTimer(spell_id)) { + return false; + } } if ( - !RuleB(Bots, EnableBotTGB) && - IsGroupSpell(forcedSpellID) && - !IsTGBCompatibleSpell(forcedSpellID) && - !IsInGroupOrRaid(tar, true) + !IsInGroupOrRaid(tar, true) && + ( + !RuleB(Bots, EnableBotTGB) || + ( + IsGroupSpell(spell_id) && + !IsTGBCompatibleSpell(spell_id) + ) + ) ) { - LogTestDebug("{} failed TGB for {} [#{}].", GetCleanName(), spell.name, forcedSpellID); //deleteme + LogTestDebug("{} failed TGB for {} [#{}].", GetCleanName(), spell.name, spell_id); //deleteme return false; } if (!DoLosChecks(this, tar)) { - LogTestDebug("{} failed LoS for {} [#{}].", GetCleanName(), spell.name, forcedSpellID); //deleteme return false; } - if (!CastChecks(forcedSpellID, tar, UINT16_MAX)) { - LogTestDebug("{} failed CastChecks for {} [#{}].", GetCleanName(), spell.name, forcedSpellID); //deleteme + if (!CastChecks(spell_id, tar, UINT16_MAX)) { GetBotOwner()->Message( Chat::Red, fmt::format( - "{} says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, etc.'", + "{} says, 'Ability failed to cast. This could be due to this to any number of things: range, mana, immune, target type, etc.'", GetBotOwner()->GetCleanName() ).c_str() ); @@ -11009,27 +11020,53 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id) { InterruptSpell(); } - if (CastSpell(forcedSpellID, tar->GetID())) { + if (CastSpell(spell_id, tar->GetID())) { BotGroupSay( this, fmt::format( "Casting {} on {}.", - GetSpellName(forcedSpellID), + GetSpellName(spell_id), (tar == this ? "myself" : tar->GetCleanName()) ).c_str() ); - int timer_duration = CalcBuffDuration(tar, this, forcedSpellID); + int timer_duration = 0; - if (timer_duration) { // negatives are perma buffs - timer_duration = GetActSpellDuration(forcedSpellID, timer_duration); + if (!isDisc) { + timer_duration = CalcBuffDuration(tar, this, spell_id); + + if (timer_duration) { + timer_duration = GetActSpellDuration(spell_id, timer_duration); + } + + if (timer_duration < 0) { + timer_duration = 0; + } + } + else { + if (spell.recast_time > 0) { + timer_duration = spell.recast_time / 1000; + auto focus = GetFocusEffect(focusReduceRecastTime, spell_id); + + if (focus > timer_duration) { + timer_duration = 0; + } + else { + timer_duration -= focus; + } + } + + if (timer_duration > 0) { + timer_duration = timer_duration * 1000; + } } - if (timer_duration < 0) { - timer_duration = 0; + if (!isDisc) { + SetSpellRecastTimer(spell_id, timer_duration); + } + else { + SetDisciplineReuseTimer(spell_id, timer_duration); } - - SetSpellRecastTimer(forcedSpellID, timer_duration); return true; } @@ -11804,7 +11841,7 @@ uint16 Bot::GetSpellByAA(int id, AA::Rank*& rank) { } uint32 points = GetAA(ability->first_rank_id); - //if (points) { LogTestDebug("{}: {} says, '{} points for {} [#{} - {}] rank {}'", __LINE__, GetCleanName(), points, zone->GetAAName(aa_ability.first->id), aa_ability.first->id, aa_ability.second->id, points); } //deleteme + if (points > 0) { aa_ability = zone->GetAlternateAdvancementAbilityAndRank(ability->id, points); } @@ -11812,14 +11849,11 @@ uint16 Bot::GetSpellByAA(int id, AA::Rank*& rank) { rank = aa_ability.second; if (!points || !rank) { - LogTestDebug("{}: {} says, 'No {} found'", __LINE__, GetCleanName(), (!points ? "points" : "rank")); //deleteme return spell_id; } spell_id = rank->spell; - LogTestDebug("{}: {} says, 'Found {} [#{}]'", __LINE__, GetCleanName(), spells[spell_id].name, spell_id); //deleteme - return spell_id; } diff --git a/zone/bot.h b/zone/bot.h index f1c8e0482..3f4c21237 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -401,7 +401,7 @@ public: bool AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTargetType = UINT16_MAX, uint16 subType = UINT16_MAX); bool AttemptAICastSpell(uint16 spellType, Mob* tar = nullptr); bool AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank); - bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id); + bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc = false); bool AttemptCloseBeneficialSpells(uint16 spellType); bool AI_EngagedCastCheck() override; bool AI_PursueCastCheck() override; diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 4eb252617..56d45cac7 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -1286,6 +1286,7 @@ int bot_command_init(void) bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", AccountStatus::Player, bot_command_update) || bot_command_add("botwoad", "Changes the Barbarian woad of a bot", AccountStatus::Player, bot_command_woad) || bot_command_add("cast", "Tells the first found specified bot to cast the given spell type", AccountStatus::Player, bot_command_cast) || + bot_command_add("discipline", "Uses aggressive/defensive disciplines or can specify spell ID", AccountStatus::Player, bot_command_discipline) || bot_command_add("distanceranged", "Controls the range casters and ranged will try to stay away from a mob", AccountStatus::Player, bot_command_distance_ranged) || bot_command_add("classracelist", "Lists the classes and races and their appropriate IDs", AccountStatus::Player, bot_command_class_race_list) || bot_command_add("clickitem", "Orders your targeted bot to click the item in the provided inventory slot.", AccountStatus::Player, bot_command_click_item) || @@ -2222,6 +2223,7 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) { #include "bot_commands/default_settings.cpp" #include "bot_commands/defensive.cpp" #include "bot_commands/depart.cpp" +#include "bot_commands/discipline.cpp" #include "bot_commands/distance_ranged.cpp" #include "bot_commands/find_aliases.cpp" #include "bot_commands/follow.cpp" diff --git a/zone/bot_command.h b/zone/bot_command.h index 6f66e8788..ca22b4d32 100644 --- a/zone/bot_command.h +++ b/zone/bot_command.h @@ -1673,6 +1673,7 @@ void bot_command_blocked_pet_buffs(Client* c, const Seperator* sep); void bot_command_bot(Client *c, const Seperator *sep); void bot_command_bot_settings(Client* c, const Seperator* sep); void bot_command_cast(Client* c, const Seperator* sep); +void bot_command_discipline(Client* c, const Seperator* sep); void bot_command_distance_ranged(Client* c, const Seperator* sep); void bot_command_class_race_list(Client* c, const Seperator* sep); void bot_command_click_item(Client* c, const Seperator* sep); diff --git a/zone/bot_commands/cast.cpp b/zone/bot_commands/cast.cpp index 054d763e4..7f1093cf2 100644 --- a/zone/bot_commands/cast.cpp +++ b/zone/bot_commands/cast.cpp @@ -184,7 +184,7 @@ void bot_command_cast(Client* c, const Seperator* sep) uint16 chosenSpellID = UINT16_MAX; if (!arg1.compare("aa") || !arg1.compare("harmtouch") || !arg1.compare("layonhands")) { - if (!RuleB(Bots, AllowForcedCastsBySpellID)) { + if (!RuleB(Bots, AllowCastAAs)) { c->Message(Chat::Yellow, "This commanded type is currently disabled."); return; } @@ -208,7 +208,7 @@ void bot_command_cast(Client* c, const Seperator* sep) } if (!arg1.compare("spellid")) { - if (!RuleB(Bots, AllowCastAAs)) { + if (!RuleB(Bots, AllowForcedCastsBySpellID)) { c->Message(Chat::Yellow, "This commanded type is currently disabled."); return; } @@ -561,13 +561,11 @@ void bot_command_cast(Client* c, const Seperator* sep) continue; } else if (bySpellID) { - SPDat_Spell_Struct spell = spells[chosenSpellID]; - if (!bot_iter->CanUseBotSpell(chosenSpellID)) { continue; } - if (!tar || (spell.target_type == ST_Self && tar != bot_iter)) { + if (!tar || (spells[chosenSpellID].target_type == ST_Self && tar != bot_iter)) { tar = bot_iter; } diff --git a/zone/bot_commands/discipline.cpp b/zone/bot_commands/discipline.cpp new file mode 100644 index 000000000..233eaae89 --- /dev/null +++ b/zone/bot_commands/discipline.cpp @@ -0,0 +1,296 @@ +#include "../bot_command.h" + +void bot_command_discipline(Client* c, const Seperator* sep) +{ + if (helper_command_alias_fail(c, "bot_command_discipline", sep->arg[0], "discipline")) { + return; + } + + if (helper_is_help_or_usage(sep->arg[1])) { + std::vector description = + { + "Tells applicable bots to use the specified disciplines" + }; + + std::vector notes = { }; + + std::vector example_format = + { + fmt::format( + "{} [aggressive | defensive | spell ID] [actionable, default: spawned]" + , sep->arg[0] + ) + }; + std::vector examples_one = + { + "To tell all bots to use an aggressive discipline:", + fmt::format( + "{} aggressive spawned", + sep->arg[0] + ) + }; + std::vector examples_two = + { + "To tell Warrior bots to use a defensive discipline:", + fmt::format( + "{} defensive byclass {}", + sep->arg[0], + Class::Warrior + ) + }; + std::vector examples_three = + { + "To tell all bots to use their Fearless discipline:", + fmt::format( + "{} 4587 spawned", + sep->arg[0] + ) + }; + + std::vector actionables = + { + "target, byname, ownergroup, ownerraid, targetgroup, namesgroup, healrotationtargets, mmr, byclass, byrace, spawned" + }; + + std::vector options = { }; + std::vector options_one = { }; + std::vector options_two = { }; + std::vector options_three = { }; + + std::string popup_text = c->SendCommandHelpWindow( + c, + description, + notes, + example_format, + examples_one, examples_two, examples_three, + actionables, + options, + options_one, options_two, options_three + ); + + popup_text = DialogueWindow::Table(popup_text); + + c->SendPopupToClient(sep->arg[0], popup_text.c_str()); + + if (RuleB(Bots, SendClassRaceOnHelp)) { + c->Message( + Chat::Yellow, + fmt::format( + "Use {} for information about race/class IDs.", + Saylink::Silent("^classracelist") + ).c_str() + ); + } + + return; + } + + std::string arg1 = sep->arg[1]; + std::string arg2 = sep->arg[2]; + int ab_arg = 2; + bool aggressive = false; + bool defensive = false; + Mob* tar = c->GetTarget(); + uint16 spell_id = UINT16_MAX; + + if (!arg1.compare("aggressive")) { + aggressive = true; + } + else if (!arg1.compare("defensive")) { + defensive = true; + } + else if (sep->IsNumber(1)) { + if (!IsValidSpell(atoi(sep->arg[1]))) { + c->Message(Chat::Yellow, "You must enter a valid spell ID."); + return; + } + + spell_id = atoi(sep->arg[1]); + } + else { + c->Message( + Chat::Yellow, + fmt::format( + "Incorrect argument, use {} for information regarding this command.", + Saylink::Silent( + fmt::format("{} help", sep->arg[0]) + ) + ).c_str() + ); + + return; + } + + const int ab_mask = ActionableBots::ABM_Type1; + std::string actionableArg = sep->arg[ab_arg]; + + if (actionableArg.empty()) { + actionableArg = "spawned"; + } + + std::string class_race_arg = sep->arg[ab_arg]; + bool class_race_check = false; + + if (!class_race_arg.compare("byclass") || !class_race_arg.compare("byrace")) { + class_race_check = true; + } + + std::vector sbl; + + if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { + return; + } + + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); + + bool isSuccess = false; + uint16 successCount = 0; + Bot* firstFound = nullptr; + + for (auto bot_iter : sbl) { + if (!bot_iter->IsInGroupOrRaid(c)) { + continue; + } + + if (bot_iter->GetBotStance() == Stance::Passive || bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsSilenced() || bot_iter->IsAmnesiad() || bot_iter->GetHP() < 0) { + continue; + } + + if (spell_id == UINT16_MAX) { // Aggressive/Defensive type + std::vector botSpellList; + + if (aggressive) { + botSpellList = bot_iter->BotGetSpellsByType(BotSpellTypes::DiscAggressive); + } + else if (defensive) { + botSpellList = bot_iter->BotGetSpellsByType(BotSpellTypes::DiscDefensive); + } + + for (int i = botSpellList.size() - 1; i >= 0; i--) { + if (!IsValidSpell(botSpellList[i].spellid)) { + continue; + } + + if (!bot_iter->CheckDisciplineReuseTimer(botSpellList[i].spellid)) { + uint32 remaining_time = (bot_iter->GetDisciplineReuseRemainingTime(botSpellList[i].spellid) / 1000); + + bot_iter->OwnerMessage( + fmt::format( + "I can use this discipline in {}.", + Strings::SecondsToTime(remaining_time) + ) + ); + + continue; + } + + if (bot_iter->GetEndurance() < spells[botSpellList[i].spellid].endurance_cost) { + continue; + } + + if (bot_iter->DivineAura() && !IsCastNotStandingSpell(botSpellList[i].spellid)) { + continue; + } + + if (spells[botSpellList[i].spellid].buff_duration_formula != 0 && spells[botSpellList[i].spellid].target_type == ST_Self && bot_iter->HasDiscBuff()) { + continue; + } + + if (!tar || (spells[botSpellList[i].spellid].target_type == ST_Self && tar != bot_iter)) { + tar = bot_iter; + } + + if (bot_iter->AttemptForcedCastSpell(tar, botSpellList[i].spellid, true)) { + if (!firstFound) { + firstFound = bot_iter; + } + + isSuccess = true; + ++successCount; + spell_id = botSpellList[i].spellid; + } + } + } + else { // Direct spell ID + if (!IsValidSpell(spell_id)) { + continue; + } + + SPDat_Spell_Struct spell = spells[spell_id]; + + if (!bot_iter->CanUseBotSpell(spell_id)) { + continue; + } + + if (!bot_iter->CheckDisciplineReuseTimer(spell_id)) { + uint32 remaining_time = (bot_iter->GetDisciplineReuseRemainingTime(spell_id) / 1000); + + bot_iter->OwnerMessage( + fmt::format( + "I can use this item in {}.", + Strings::SecondsToTime(remaining_time) + ) + ); + + continue; + } + + if (bot_iter->GetEndurance() < spell.endurance_cost) { + continue; + } + + if (bot_iter->DivineAura() && !IsCastNotStandingSpell(spell_id)) { + continue; + } + + if (spell.buff_duration_formula != 0 && spell.target_type == ST_Self && bot_iter->HasDiscBuff()) { + continue; + } + + if (!tar || (spell.target_type == ST_Self && tar != bot_iter)) { + tar = bot_iter; + } + + if (bot_iter->AttemptForcedCastSpell(tar, spell_id, true)) { + if (!firstFound) { + firstFound = bot_iter; + } + + isSuccess = true; + ++successCount; + } + } + + continue; + } + + if (!isSuccess) { + c->Message(Chat::Yellow, "No bots were selected."); + } + else { + if (aggressive || defensive) { + c->Message( + Chat::Yellow, + fmt::format( + "{} {} {} {} discipline.", + ((successCount == 1 && firstFound) ? firstFound->GetCleanName() : (fmt::format("{}", successCount).c_str())), + ((successCount == 1 && firstFound) ? "used" : "of your bots used"), + (aggressive ? "an" : "a"), + (aggressive ? "aggressive" : "defensive") + ).c_str() + ); + } + else { + c->Message( + Chat::Yellow, + fmt::format( + "{} {} their {} [#{}] discipline.", + ((successCount == 1 && firstFound) ? firstFound->GetCleanName() : (fmt::format("{}", successCount).c_str())), + ((successCount == 1 && firstFound) ? "used" : "of your bots used"), + spells[spell_id].name, + spell_id + ).c_str() + ); + } + } +} diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 963d71597..55356ad55 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -649,6 +649,10 @@ bool Bot::AI_PursueCastCheck() { continue; } + if (AIBot_spells_by_type[currentCast.spellType].empty()) { + continue; + } + result = AttemptAICastSpell(currentCast.spellType, nullptr); if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) { @@ -721,6 +725,10 @@ bool Bot::AI_IdleCastCheck() { continue; } + if (AIBot_spells_by_type[currentCast.spellType].empty()) { + continue; + } + result = AttemptAICastSpell(currentCast.spellType, nullptr); if (result) { @@ -778,6 +786,10 @@ bool Bot::AI_EngagedCastCheck() { continue; } + if (AIBot_spells_by_type[currentCast.spellType].empty()) { + continue; + } + result = AttemptAICastSpell(currentCast.spellType, nullptr); if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) { @@ -1041,11 +1053,15 @@ std::vector Bot::GetPrioritizedBotSpellsBySpellType(Bot* bot } if ( - !RuleB(Bots, EnableBotTGB) && - IsGroupSpell(botSpellList[i].spellid) && - !IsTGBCompatibleSpell(botSpellList[i].spellid) && - !botCaster->IsInGroupOrRaid(tar, true) - ) { + !botCaster->IsInGroupOrRaid(tar, true) && + ( + !RuleB(Bots, EnableBotTGB) || + ( + IsGroupSpell(botSpellList[i].spellid) && + !IsTGBCompatibleSpell(botSpellList[i].spellid) + ) + ) + ) { continue; }