Added bot command 'petgetlost' to dismiss summoned pets

This commit is contained in:
Uleat 2019-06-27 19:00:02 -04:00
parent ee49ad3ce9
commit 6c73fee075
5 changed files with 39 additions and 3 deletions

View File

@ -34,7 +34,7 @@
#define CURRENT_BINARY_DATABASE_VERSION 9139 #define CURRENT_BINARY_DATABASE_VERSION 9139
#ifdef BOTS #ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9023 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9024
#else #else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif #endif

View File

@ -22,6 +22,7 @@
9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty| 9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty|
9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty| 9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty|
9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty| 9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty|
9024|2019_06_27_bots_pet_get_lost.sql|SELECT `bot_command` FROM `bot_command_settings` WHERE `bot_command` LIKE 'petgetlost'|empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1 @@
INSERT INTO `bot_command_settings`(`bot_command`, `access`, `aliases`) VALUES ('petgetlost', '0', 'pgl');

View File

@ -1401,7 +1401,8 @@ int bot_command_init(void)
bot_command_add("movementspeed", "Orders a bot to cast a movement speed enhancement spell", 0, bot_command_movement_speed) || bot_command_add("movementspeed", "Orders a bot to cast a movement speed enhancement spell", 0, bot_command_movement_speed) ||
bot_command_add("owneroption", "Sets options available to bot owners", 0, bot_command_owner_option) || bot_command_add("owneroption", "Sets options available to bot owners", 0, bot_command_owner_option) ||
bot_command_add("pet", "Lists the available bot pet [subcommands]", 0, bot_command_pet) || bot_command_add("pet", "Lists the available bot pet [subcommands]", 0, bot_command_pet) ||
bot_command_add("petremove", "Orders a bot to remove its pet", 0, bot_subcommand_pet_remove) || bot_command_add("petgetlost", "Orders a bot to remove its summoned pet", 0, bot_subcommand_pet_get_lost) ||
bot_command_add("petremove", "Orders a bot to remove its charmed pet", 0, bot_subcommand_pet_remove) ||
bot_command_add("petsettype", "Orders a Magician bot to use a specified pet type", 0, bot_subcommand_pet_set_type) || bot_command_add("petsettype", "Orders a Magician bot to use a specified pet type", 0, bot_subcommand_pet_set_type) ||
bot_command_add("picklock", "Orders a capable bot to pick the lock of the closest door", 0, bot_command_pick_lock) || bot_command_add("picklock", "Orders a capable bot to pick the lock of the closest door", 0, bot_command_pick_lock) ||
bot_command_add("portal", "Orders a Wizard bot to open a magical doorway to a specified destination", 0, bot_subcommand_portal) || bot_command_add("portal", "Orders a Wizard bot to open a magical doorway to a specified destination", 0, bot_subcommand_portal) ||
@ -3479,12 +3480,13 @@ void bot_command_pet(Client *c, const Seperator *sep)
{ {
/* VS2012 code - begin */ /* VS2012 code - begin */
std::list<const char*> subcommand_list; std::list<const char*> subcommand_list;
subcommand_list.push_back("petgetlost");
subcommand_list.push_back("petremove"); subcommand_list.push_back("petremove");
subcommand_list.push_back("petsettype"); subcommand_list.push_back("petsettype");
/* VS2012 code - end */ /* VS2012 code - end */
/* VS2013 code /* VS2013 code
const std::list<const char*> subcommand_list = { "petremove", "petsettype" }; const std::list<const char*> subcommand_list = { "petgetlost", "petremove", "petsettype" };
*/ */
if (helper_command_alias_fail(c, "bot_command_pet", sep->arg[0], "pet")) if (helper_command_alias_fail(c, "bot_command_pet", sep->arg[0], "pet"))
@ -7433,6 +7435,37 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep)
c->SendPopupToClient(window_title.c_str(), window_text.c_str()); c->SendPopupToClient(window_title.c_str(), window_text.c_str());
} }
void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep)
{
if (helper_command_alias_fail(c, "bot_subcommand_pet_get_lost", sep->arg[0], "petgetlost"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: %s ([actionable: target | byname | ownergroup | botgroup | targetgroup | namesgroup | healrotation | spawned] ([actionable_name]))", sep->arg[0]);
return;
}
int ab_mask = ActionableBots::ABM_NoFilter;
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return;
int summoned_pet = 0;
for (auto bot_iter : sbl) {
if (!bot_iter->GetPet() || bot_iter->GetPet()->IsCharmed())
continue;
bot_iter->GetPet()->Say_StringID(PET_GETLOST_STRING);
bot_iter->GetPet()->Depop(false);
bot_iter->SetPetID(0);
database.botdb.DeletePetItems(bot_iter->GetBotID());
database.botdb.DeletePetBuffs(bot_iter->GetBotID());
database.botdb.DeletePetStats(bot_iter->GetBotID());
++summoned_pet;
}
c->Message(m_action, "%i of your bots released their summoned pet%s", summoned_pet, (summoned_pet == 1) ? "" : "s");
}
void bot_subcommand_pet_remove(Client *c, const Seperator *sep) void bot_subcommand_pet_remove(Client *c, const Seperator *sep)
{ {
if (helper_command_alias_fail(c, "bot_subcommand_pet_remove", sep->arg[0], "petremove")) if (helper_command_alias_fail(c, "bot_subcommand_pet_remove", sep->arg[0], "petremove"))

View File

@ -652,6 +652,7 @@ void bot_subcommand_inventory_give(Client *c, const Seperator *sep);
void bot_subcommand_inventory_list(Client *c, const Seperator *sep); void bot_subcommand_inventory_list(Client *c, const Seperator *sep);
void bot_subcommand_inventory_remove(Client *c, const Seperator *sep); void bot_subcommand_inventory_remove(Client *c, const Seperator *sep);
void bot_subcommand_inventory_window(Client *c, const Seperator *sep); void bot_subcommand_inventory_window(Client *c, const Seperator *sep);
void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep);
void bot_subcommand_pet_remove(Client *c, const Seperator *sep); void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep); void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
void bot_subcommand_portal(Client *c, const Seperator *sep); void bot_subcommand_portal(Client *c, const Seperator *sep);