Decouple zone calls, cleanup logic

This commit is contained in:
Akkadius
2020-04-19 04:36:39 -05:00
parent ebda1cf601
commit 373fb3f0e7
57 changed files with 705 additions and 467 deletions
+108 -107
View File
@@ -24,7 +24,7 @@
2. Add the function in this file.
3. In the bot_command_init function you must add a call to bot_command_add
for your function.
Notes: If you want an alias for your bot command, add an entry to the
`bot_command_settings` table in your database. The access level you
set with bot_command_add is the default setting if the bot command isn't
@@ -60,6 +60,7 @@
#include "bot_command.h"
#include "zonedb.h"
#include "zone_store.h"
#include "guild_mgr.h"
#include "map.h"
#include "doors.h"
@@ -120,18 +121,18 @@ public:
static void Load() {
bot_command_spells.clear();
bcst_levels_map bot_levels_map;
for (int i = BCEnum::SpellTypeFirst; i <= BCEnum::SpellTypeLast; ++i) {
bot_command_spells[static_cast<BCEnum::SpType>(i)];
bot_levels_map[static_cast<BCEnum::SpType>(i)];
}
for (int spell_id = 2; spell_id < SPDAT_RECORDS; ++spell_id) {
if (spells[spell_id].player_1[0] == '\0')
continue;
if (spells[spell_id].targettype != ST_Target && spells[spell_id].CastRestriction != 0) // watch
continue;
auto target_type = BCEnum::TT_None;
switch (spells[spell_id].targettype) {
case ST_GroupTeleport:
@@ -196,7 +197,7 @@ public:
}
if (target_type == BCEnum::TT_None)
continue;
uint8 class_levels[16] = { 0 };
bool player_spell = false;
for (int class_type = WARRIOR; class_type <= BERSERKER; ++class_type) {
@@ -209,7 +210,7 @@ public:
}
if (!player_spell)
continue;
STBaseEntry* entry_prototype = nullptr;
while (true) {
switch (spells[spell_id].effectid[EFFECTIDTOINDEX(1)]) {
@@ -310,7 +311,7 @@ public:
}
if (entry_prototype)
break;
switch (spells[spell_id].effectid[EFFECTIDTOINDEX(2)]) {
case SE_Succor:
entry_prototype = new STEscapeEntry;
@@ -334,7 +335,7 @@ public:
}
if (entry_prototype)
break;
while (spells[spell_id].typedescnum == 27) {
if (!spells[spell_id].goodEffect)
break;
@@ -351,7 +352,7 @@ public:
}
if (entry_prototype)
break;
switch (spells[spell_id].SpellAffectIndex) {
case 1: {
bool valid_spell = false;
@@ -453,7 +454,7 @@ public:
}
if (!entry_prototype)
continue;
if (target_type == BCEnum::TT_Self && (entry_prototype->BCST() != BCEnum::SpT_Stance && entry_prototype->BCST() != BCEnum::SpT_SummonCorpse)) {
#ifdef BCSTSPELLDUMP
LogError("DELETING entry_prototype (primary clause) - name: [{}], target_type: [{}], BCST: [{}]",
@@ -532,12 +533,12 @@ public:
spell_entry = new STBaseEntry(entry_prototype);
break;
}
assert(spell_entry);
spell_entry->caster_class = class_type;
spell_entry->spell_level = class_levels[class_index];
bot_command_spells[spell_entry->BCST()].push_back(spell_entry);
if (bot_levels.find(class_type) == bot_levels.end() || bot_levels[class_type] > class_levels[class_index])
@@ -546,7 +547,7 @@ public:
delete(entry_prototype);
}
remove_inactive();
order_all();
load_teleport_zone_names();
@@ -1152,7 +1153,7 @@ private:
auto bcst_id = static_cast<BCEnum::SpType>(i);
spell_dump << StringFormat("BCSpells::spell_dump(): - '%s' returned %u spells:\n",
BCEnum::SpellTypeEnumToString(bcst_id).c_str(), bot_command_spells[bcst_id].size());
bcst_list& map_entry = bot_command_spells[bcst_id];
for (auto list_iter = map_entry.begin(); list_iter != map_entry.end(); ++list_iter) {
STBaseEntry* list_entry = *list_iter;
@@ -1229,7 +1230,7 @@ private:
spell_dump << "\n";
++entry_count;
}
spell_dump << StringFormat("required_bots_map[%s] = \"%s\"\n",
BCEnum::SpellTypeEnumToString(static_cast<BCEnum::SpType>(i)).c_str(), required_bots_map[static_cast<BCEnum::SpType>(i)].c_str());
@@ -1477,7 +1478,7 @@ int bot_command_init(void)
working_bcl_iter.first.c_str()
);
}
continue;
}
@@ -1487,7 +1488,7 @@ int bot_command_init(void)
working_bcl_iter.first.c_str(),
bcs_iter->second.first
);
if (bcs_iter->second.second.empty()) {
continue;
}
@@ -1522,11 +1523,11 @@ int bot_command_init(void)
LogInfo("Failed to process 'Injected Bot Commands' update operation.");
}
}
bot_command_dispatch = bot_command_real_dispatch;
BCSpells::Load();
return bot_command_count;
}
@@ -1710,10 +1711,10 @@ namespace MyBots
auto test_bot = my_bot->CastToBot();
if (!test_bot->GetOwner() || !test_bot->GetOwner()->IsClient() || test_bot->GetOwner()->CastToClient() != bot_owner)
return false;
return true;
}
static bool IsMyBotInTargetsGroup(Client *bot_owner, Mob *grouped_bot) {
if (!bot_owner || !grouped_bot || !grouped_bot->GetGroup() || !IsMyBot(bot_owner, grouped_bot))
return false;
@@ -1724,7 +1725,7 @@ namespace MyBots
if (!target_mob->GetGroup() || (!target_mob->IsClient() && !target_mob->IsBot()))
return false;
return (grouped_bot->GetGroup() == target_mob->GetGroup());
}
@@ -1757,7 +1758,7 @@ namespace MyBots
sbl.clear();
if (!bot_owner || !name)
return;
auto selectable_bot_list = entity_list.GetBotsByBotOwnerCharacterID(bot_owner->CharacterID());
for (auto bot_iter : selectable_bot_list) {
if (!strcasecmp(bot_iter->GetCleanName(), name)) {
@@ -1765,7 +1766,7 @@ namespace MyBots
return;
}
}
if (!clear_list)
UniquifySBL(sbl);
}
@@ -1785,7 +1786,7 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
@@ -1806,7 +1807,7 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
@@ -1835,11 +1836,11 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
static void PopulateSBL_ByHealRotation(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list)
sbl.clear();
@@ -1890,11 +1891,11 @@ namespace MyBots
if (IsMyBot(bot_owner, hrm_iter))
sbl.push_back(hrm_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list)
sbl.clear();
@@ -1915,7 +1916,7 @@ namespace MyBots
if (IsMyBot(bot_owner, hrm_iter))
sbl.push_back(static_cast<Bot*>(hrm_iter));
}
if (!clear_list)
UniquifySBL(sbl);
}
@@ -2461,7 +2462,7 @@ namespace ActionableBots
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([bot_owner](Bot* l) { return (!l->IsBotArcher()); });
}
static void Filter_ByHighestSkill(Client* bot_owner, std::list<Bot*>& sbl, EQEmu::skills::SkillType skill_type, float& skill_value) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
skill_value = 0.0f;
@@ -2610,7 +2611,7 @@ void bot_command_apply_poison(Client *c, const Seperator *sep)
c->Message(m_fail, "Your rogue bot must be level 18 before %s can apply poison!", (my_rogue_bot->GetGender() == 1 ? "she" : "he"));
return;
}
const auto poison_instance = c->GetInv().GetItem(EQEmu::invslot::slotCursor);
if (!poison_instance) {
@@ -2748,7 +2749,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
return;
}
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: <enemy_target> %s [actionable: byname | ownergroup | botgroup | namesgroup | healrotation | default: spawned] ([actionable_name])", sep->arg[0]);
return;
}
@@ -2756,7 +2757,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
Mob* target_mob = ActionableTarget::AsSingle_ByAttackable(c);
if (!target_mob) {
c->Message(m_fail, "You must <target> an enemy to use this command");
return;
}
@@ -2765,7 +2766,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
if (ab_arg.empty()) {
ab_arg = "spawned";
}
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, ab_arg.c_str(), sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return;
@@ -2831,7 +2832,7 @@ void bot_command_bind_affinity(Client *c, const Seperator *sep)
c->Message(m_fail, "Failed to bind %s to this location", target_mob->GetCleanName());
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -2866,7 +2867,7 @@ void bot_command_bot(Client *c, const Seperator *sep)
"botlist", "botoutofcombat", "botreport", "botspawn", "botstance", "botsummon", "bottogglearcher", "bottogglehelm", "botupdate"
};
*/
if (helper_command_alias_fail(c, "bot_command_bot", sep->arg[0], "bot"))
return;
@@ -2890,7 +2891,7 @@ void bot_command_botgroup(Client *c, const Seperator *sep)
"botgroupaddmember", "botgroupcreate", "botgroupdelete", "botgrouplist", "botgroupload", "botgroupremovemember"
};
*/
if (helper_command_alias_fail(c, "bot_command_botgroup", sep->arg[0], "botgroup"))
return;
@@ -2946,7 +2947,7 @@ void bot_command_charm(Client *c, const Seperator *sep)
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3016,7 +3017,7 @@ void bot_command_cure(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3031,7 +3032,7 @@ void bot_command_defensive(Client *c, const Seperator *sep)
return;
}
const int ab_mask = ActionableBots::ABM_Type1;
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return;
@@ -3127,7 +3128,7 @@ void bot_command_depart(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3170,7 +3171,7 @@ void bot_command_escape(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3182,7 +3183,7 @@ void bot_command_find_aliases(Client *c, const Seperator *sep)
c->Message(m_usage, "usage: %s [alias | command]", sep->arg[0]);
return;
}
auto find_iter = bot_command_aliases.find(sep->arg[1]);
if (find_iter == bot_command_aliases.end()) {
c->Message(m_fail, "No bot commands or aliases match '%s'", sep->arg[1]);
@@ -3248,7 +3249,7 @@ void bot_command_follow(Client *c, const Seperator *sep)
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[name_arg]) == ActionableBots::ABT_None)
return;
sbl.remove(nullptr);
for (auto bot_iter : sbl) {
bot_iter->WipeHateList();
@@ -3366,7 +3367,7 @@ void bot_command_heal_rotation(Client *c, const Seperator *sep)
subcommand_list.push_back("healrotationstart");
subcommand_list.push_back("healrotationstop");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = {
"healrotationadaptivetargeting", "healrotationaddmember", "healrotationaddtarget", "healrotationadjustcritical", "healrotationadjustsafe",
@@ -3375,7 +3376,7 @@ void bot_command_heal_rotation(Client *c, const Seperator *sep)
"healrotationresetlimits", "healrotationsethot", "healrotationstart", "healrotationstop"
};
*/
if (helper_command_alias_fail(c, "bot_command_heal_rotation", sep->arg[0], "healrotation"))
return;
@@ -3401,7 +3402,7 @@ void bot_command_help(Client *c, const Seperator *sep)
{
if (helper_command_alias_fail(c, "bot_command_help", sep->arg[0], "help"))
return;
c->Message(m_message, "Available EQEMu bot commands:");
int bot_commands_shown = 0;
@@ -3505,7 +3506,7 @@ void bot_command_identify(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3581,7 +3582,7 @@ void bot_command_invisibility(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3647,7 +3648,7 @@ void bot_command_item_use(Client* c, const Seperator* sep)
msg = StringFormat("%cinventorygive byname %s", BOT_COMMAND_CHAR, bot_iter->GetCleanName());
text_link = bot_iter->CreateSayLink(c, msg.c_str(), bot_iter->GetCleanName());
for (auto slot_iter : equipable_slot_list) {
// needs more failure criteria - this should cover the bulk for now
@@ -3717,7 +3718,7 @@ void bot_command_levitation(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3787,7 +3788,7 @@ void bot_command_mesmerize(Client *c, const Seperator *sep)
auto target_mob = actionable_targets.Select(c, local_entry->target_type, ENEMY);
if (!target_mob)
continue;
if (spells[local_entry->spell_id].max[EFFECTIDTOINDEX(1)] < target_mob->GetLevel())
continue;
@@ -3850,7 +3851,7 @@ void bot_command_movement_speed(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -3859,7 +3860,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: %s [option] [argument]", sep->arg[0]);
std::string window_title = "Bot Owner Options";
std::string window_text =
"<table>"
@@ -3944,7 +3945,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
"<td><c \"#888888\">show current settings</td>"
"</tr>"
"</table>";
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
@@ -3964,7 +3965,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
else {
c->SetBotOption(Client::booDeathMarquee, !c->GetBotOption(Client::booDeathMarquee));
}
database.botdb.SaveOwnerOption(c->CharacterID(), Client::booDeathMarquee, c->GetBotOption(Client::booDeathMarquee));
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOption(Client::booDeathMarquee) == true ? "enabled" : "disabled"));
@@ -4054,7 +4055,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
c->Message(m_action, "Bot 'spawn message' is now %s.", argument.c_str());
}
else if (!owner_option.compare("altcombat")) {
if (RuleB(Bots, AllowOwnerOptionAltCombat)) {
if (!argument.compare("enable")) {
@@ -4130,7 +4131,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
c->Message(m_action, "Bot 'monk wu message' is now %s.", (c->GetBotOption(Client::booMonkWuMessage) == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("current")) {
std::string window_title = "Current Bot Owner Options Settings";
std::string window_text = fmt::format(
"<table>"
@@ -4156,7 +4157,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
(c->GetBotOption(Client::booBuffCounter) ? "enabled" : "disabled"),
(c->GetBotOption(Client::booMonkWuMessage) ? "enabled" : "disabled")
);
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
}
else {
@@ -4172,7 +4173,7 @@ void bot_command_pet(Client *c, const Seperator *sep)
subcommand_list.push_back("petremove");
subcommand_list.push_back("petsettype");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = { "petgetlost", "petremove", "petsettype" };
*/
@@ -4205,7 +4206,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
}
Bot* my_bot = sbl.front();
my_bot->InterruptSpell();
Bot::BotGroupSay(my_bot, "Attempting to pick the lock..");
@@ -4310,7 +4311,7 @@ void bot_command_pull(Client *c, const Seperator *sep)
if (bot_iter->GetAppearance() == eaDead || bot_iter->GetBotStance() == EQEmu::constants::stancePassive) {
continue;
}
switch (bot_iter->GetClass()) {
case ROGUE:
case MONK:
@@ -4385,7 +4386,7 @@ void bot_command_pull(Client *c, const Seperator *sep)
if (bot_puller) {
bot_puller->SetPullFlag();
}
helper_no_available_bots(c, bot_puller);
}
@@ -4452,7 +4453,7 @@ void bot_command_resistance(Client *c, const Seperator *sep)
return true;
if (_l->resist_value[RESISTANCEIDTOINDEX(resistance_type)] == _r->resist_value[RESISTANCEIDTOINDEX(resistance_type)] && spells[_l->spell_id].mana == spells[_r->spell_id].mana && _l->resist_total > _r->resist_total)
return true;
return false;
});
@@ -4480,14 +4481,14 @@ void bot_command_resistance(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
void bot_command_resurrect(Client *c, const Seperator *sep)
{
// Obscure bot spell code prohibits the aoe portion from working correctly...
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_Resurrect];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_Resurrect) || helper_command_alias_fail(c, "bot_command_resurrect", sep->arg[0], "resurrect"))
return;
@@ -4516,7 +4517,7 @@ void bot_command_resurrect(Client *c, const Seperator *sep)
// continue;
if (local_entry->aoe)
continue;
auto target_mob = actionable_targets.Select(c, local_entry->target_type, FRIENDLY);
//if (!target_mob && !local_entry->aoe)
// continue;
@@ -4573,14 +4574,14 @@ void bot_command_rune(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
void bot_command_send_home(Client *c, const Seperator *sep)
{
// Obscure bot spell code prohibits the aoe portion from working correctly...
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_SendHome];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_SendHome) || helper_command_alias_fail(c, "bot_command_send_home", sep->arg[0], "sendhome"))
return;
@@ -4607,7 +4608,7 @@ void bot_command_send_home(Client *c, const Seperator *sep)
continue;
if (local_entry->group != group)
continue;
auto target_mob = actionable_targets.Select(c, local_entry->target_type, FRIENDLY);
if (!target_mob)
continue;
@@ -4668,7 +4669,7 @@ void bot_command_size(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -4679,7 +4680,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
// temp
c->Message(m_fail, "This command is currently unavailable...");
return;
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_SummonCorpse];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_SummonCorpse) || helper_command_alias_fail(c, "bot_command_summon_corpse", sep->arg[0], "summoncorpse"))
return;
@@ -4698,7 +4699,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
auto local_entry = list_iter;
if (helper_spell_check_fail(local_entry))
continue;
auto target_mob = ActionableTarget::AsSingle_ByPlayer(c);
if (!target_mob)
continue;
@@ -4711,7 +4712,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
continue;
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
@@ -4771,12 +4772,12 @@ void bot_command_taunt(Client *c, const Seperator *sep)
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[(ab_arg + 1)]) == ActionableBots::ABT_None)
return;
sbl.remove(nullptr);
int taunting_count = 0;
for (auto bot_iter : sbl) {
if (!bot_iter->GetSkill(EQEmu::skills::SkillTaunt))
continue;
if (toggle_taunt)
bot_iter->SetTaunting(!bot_iter->IsTaunting());
else
@@ -4814,10 +4815,10 @@ void bot_command_track(Client *c, const Seperator *sep)
std::list<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
uint16 class_mask = (PLAYER_CLASS_RANGER_BIT | PLAYER_CLASS_DRUID_BIT | PLAYER_CLASS_BARD_BIT);
ActionableBots::Filter_ByClasses(c, sbl, class_mask);
Bot* my_bot = ActionableBots::AsSpawned_ByMinLevelAndClass(c, sbl, 1, RANGER);
if (tracking_scope.empty()) {
if (!my_bot)
@@ -4903,7 +4904,7 @@ void bot_command_water_breathing(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -4926,14 +4927,14 @@ void bot_subcommand_bot_appearance(Client *c, const Seperator *sep)
subcommand_list.push_back("bottattoo");
subcommand_list.push_back("botwoad");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = {
"botbeardcolor", "botbeardstyle", "botdetails", "boteyes", "botface",
"bothaircolor", "bothairstyle", "botheritage", "bottattoo", "botwoad"
};
*/
if (helper_command_alias_fail(c, "bot_subcommand_bot_appearance", sep->arg[0], "botappearance"))
return;
@@ -5102,7 +5103,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
if (!database.botdb.CreateCloneBotInventory(c->CharacterID(), my_bot->GetBotID(), clone_id))
c->Message(m_fail, "%s for clone '%s'", BotDatabase::fail::CreateCloneBotInventory(), bot_name.c_str());
c->Message(m_action, "Bot '%s' was successfully cloned to bot '%s'", my_bot->GetCleanName(), bot_name.c_str());
}
@@ -5257,7 +5258,7 @@ void bot_subcommand_bot_delete(Client *c, const Seperator *sep)
void bot_subcommand_bot_details(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_details", sep->arg[0], "botdetails"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@@ -5296,10 +5297,10 @@ void bot_subcommand_bot_details(Client *c, const Seperator *sep)
void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
const std::string msg_matslot = StringFormat("mat_slot: %c(All), %i(Head), %i(Chest), %i(Arms), %i(Wrists), %i(Hands), %i(Legs), %i(Feet)",
'*', EQEmu::textures::armorHead, EQEmu::textures::armorChest, EQEmu::textures::armorArms, EQEmu::textures::armorWrist, EQEmu::textures::armorHands, EQEmu::textures::armorLegs, EQEmu::textures::armorFeet);
if (helper_command_alias_fail(c, "bot_subcommand_bot_dye_armor", sep->arg[0], "botdyearmor"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@@ -5377,7 +5378,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
void bot_subcommand_bot_eyes(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
// not sure if left/right bias is allowed in pc-type entities (something is keeping them from being different)
if (helper_command_alias_fail(c, "bot_subcommand_bot_eyes", sep->arg[0], "boteyes"))
return;
@@ -5611,7 +5612,7 @@ void bot_subcommand_bot_hairstyle(Client *c, const Seperator *sep)
void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_heritage", sep->arg[0], "botheritage"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@@ -5640,7 +5641,7 @@ void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
fail_type = BCEnum::AFT_Value;
else
my_bot->SetDrakkinHeritage(uvalue);
if (helper_bot_appearance_fail(c, my_bot, fail_type, "heritage"))
return;
@@ -5856,7 +5857,7 @@ void bot_subcommand_bot_out_of_combat(Client *c, const Seperator *sep)
bot_iter->SetAltOutOfCombatBehavior(!bot_iter->GetAltOutOfCombatBehavior());
else
bot_iter->SetAltOutOfCombatBehavior(behavior_state);
helper_bot_out_of_combat(c, bot_iter);
}
}
@@ -6069,7 +6070,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
c->Message(m_fail, "You can't spawn bots while you are engaged.");
return;
}
//if (c->IsEngaged()) {
// c->Message(m_fail, "You can't spawn bots while you are engaged.");
// return;
@@ -6143,7 +6144,7 @@ void bot_subcommand_bot_stance(Client *c, const Seperator *sep)
bool current_flag = false;
auto bst = EQEmu::constants::stanceUnknown;
if (!strcasecmp(sep->arg[1], "current"))
current_flag = true;
else if (sep->IsNumber(1)) {
@@ -6268,7 +6269,7 @@ void bot_subcommand_bot_summon(Client *c, const Seperator *sep)
void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_tattoo", sep->arg[0], "bottattoo"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@@ -6336,7 +6337,7 @@ void bot_subcommand_bot_toggle_archer(Client *c, const Seperator *sep)
for (auto bot_iter : sbl) {
if (!bot_iter)
continue;
if (toggle_archer)
bot_iter->SetBotArcher(!bot_iter->IsBotArcher());
else
@@ -6925,7 +6926,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
safe_delete(botgroup_leader);
return;
}
Group* group_inst = new Group(botgroup_leader);
entity_list.AddGroup(group_inst);
@@ -7052,7 +7053,7 @@ void bot_subcommand_circle(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@@ -7536,7 +7537,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
sep->arg[0], CASTING_CYCLE_DEFAULT_INTERVAL_S, CASTING_CYCLE_MINIMUM_INTERVAL_S, CASTING_CYCLE_MAXIMUM_INTERVAL_S);
return;
}
std::string interval_arg;
std::string fast_heals_arg;
std::string adaptive_targeting_arg;
@@ -7594,10 +7595,10 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
hr_fast_heals = true;
hr_interval_s = atoi(interval_arg.c_str());
}
if (hr_interval_s < CASTING_CYCLE_MINIMUM_INTERVAL_S || hr_interval_s > CASTING_CYCLE_MAXIMUM_INTERVAL_S)
hr_interval_s = CASTING_CYCLE_DEFAULT_INTERVAL_S;
hr_interval_s *= 1000; // convert to milliseconds for Bot/HealRotation constructor
if (!creator_member->CreateHealRotation(hr_interval_s, hr_fast_heals, hr_adaptive_targeting, hr_casting_override)) {
@@ -7613,12 +7614,12 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
if (!database.botdb.LoadHealRotation(creator_member, member_list, target_list, load_flag, member_fail, target_fail))
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotation());
if (!load_flag) {
c->Message(m_action, "Successfully added %s as a current member to a new Heal Rotation", creator_member->GetCleanName());
return;
}
if (!member_fail) {
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
for (auto member_iter : member_list) {
@@ -7663,7 +7664,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
else {
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotationTargets());
}
c->Message(m_action, "Successfully loaded %s's Heal Rotation", creator_member->GetCleanName());
}
@@ -8198,7 +8199,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
c->Message(m_message, "I need something for my %s (slot %i)", EQEmu::invslot::GetInvPossessionsSlotName(i), i);
continue;
}
item = inst->GetItem();
if ((i == EQEmu::invslot::slotPrimary) && item->IsType2HWeapon()) {
is2Hweapon = true;
@@ -8272,7 +8273,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
c->MessageString(Chat::White, PICK_LORE);
return;
}
std::string error_message;
if (itm) {
c->PushItemOnCursor(*itminst, true);
@@ -8517,7 +8518,7 @@ void bot_subcommand_pet_set_type(Client *c, const Seperator *sep)
c->Message(m_fail, "You have no spawned Magician bots capable of using this pet type: '%s'", pet_arg.c_str());
return;
}
uint16 reclaim_energy_id = 331;
for (auto bot_iter : sbl) {
if (!bot_iter)
@@ -8588,7 +8589,7 @@ void bot_subcommand_portal(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}