Added bot commands

^bottitle, ^botsuffix
This commit is contained in:
kentai 2019-03-12 19:21:30 +11:00
parent 4425e3ab49
commit 3ec500244e
6 changed files with 89 additions and 4 deletions

View File

@ -1,6 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 3/12/2019 ==
KentaiVZ: Added two new bot commands to make use of the already present database fields.
- ^bottitle - Gives targeted bot a custom title ( I.E Pathfinder )
- ^botsuffix - Gives targeted bot a custom suffix ( I.E of The Grand Creation )
== 3/1/2019 ==
Noudess: Major faction conversion to use client data.

View File

@ -3259,7 +3259,7 @@ bool Bot::Spawn(Client* botCharacterOwner) {
else
this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName());
// Spawn the bot at the bow owner's loc
// Spawn the bot at the bot owner's loc
this->m_Position.x = botCharacterOwner->GetX();
this->m_Position.y = botCharacterOwner->GetY();
this->m_Position.z = botCharacterOwner->GetZ();
@ -3364,6 +3364,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
ns->spawn.helm = helmtexture; //(GetShowHelm() ? helmtexture : 0); //0xFF;
ns->spawn.equip_chest2 = texture; //0xFF;
ns->spawn.show_name = true;
strcpy(ns->spawn.title, GetTitle().c_str());
strcpy(ns->spawn.suffix, GetSuffix().c_str());
const EQEmu::ItemData* item = nullptr;
const EQEmu::ItemInstance* inst = nullptr;
uint32 spawnedbotid = 0;

View File

@ -272,6 +272,11 @@ public:
bool HasOrMayGetAggro();
void SetDefaultBotStance();
void setTitle(std::string bot_title) { title = bot_title; }
void setSuffix(std::string bot_suffix) { suffix = bot_suffix; }
std::string GetTitle() { return title; }
std::string GetSuffix() { return suffix; }
inline virtual int32 GetMaxStat();
inline virtual int32 GetMaxResist();
inline virtual int32 GetMaxSTR();
@ -651,6 +656,8 @@ private:
uint32 _guildId;
uint8 _guildRank;
std::string _guildName;
std::string title;
std::string suffix;
uint32 _lastZoneId;
bool _rangerAutoWeaponSelect;
BotRoleType _botRole;

View File

@ -1352,6 +1352,8 @@ int bot_command_init(void)
bot_command_add("botstopmeleelevel", "Sets the level a caster or spell-casting fighter bot will stop melee combat", 0, bot_subcommand_bot_stop_melee_level) ||
bot_command_add("botsummon", "Summons bot(s) to your location", 0, bot_subcommand_bot_summon) ||
bot_command_add("bottattoo", "Changes the Drakkin tattoo of a bot", 0, bot_subcommand_bot_tattoo) ||
bot_command_add("bottitle", "For changing the bot title", 0, bot_subcommand_bot_title) ||
bot_command_add("botsuffix", "For changing the bot suffix", 0, bot_subcommand_bot_suffix) ||
bot_command_add("bottogglearcher", "Toggles a archer bot between melee and ranged weapon use", 0, bot_subcommand_bot_toggle_archer) ||
bot_command_add("bottogglehelm", "Toggles the helm visibility of a bot between shown and hidden", 0, bot_subcommand_bot_toggle_helm) ||
bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", 0, bot_subcommand_bot_update) ||
@ -5540,6 +5542,68 @@ void bot_subcommand_bot_update(Client *c, const Seperator *sep)
c->Message(m_action, "Updated %i of your %i spawned bots", bot_count, sbl.size());
}
void bot_subcommand_bot_title(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == '\0' || sep->IsNumber(1)) {
c->Message(m_fail, "You must specify a [title] to use this command");
return;
}
auto my_bot = ActionableBots::AsTarget_ByBot(c);
if (!my_bot) {
c->Message(m_fail, "You must <target> a bot that you own to use this command");
return;
}
if (strlen(sep->arg[1]) > 31) {
c->Message(13, "Title must be 31 characters or less.");
return;
}
std::string bot_title = sep->arg[1];
my_bot->setTitle(bot_title);
if (!botdb.SaveBot(my_bot)) {
c->Message(m_fail, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetAATitle(bot_title.c_str());
c->Message(m_action, "Bot Saved.");
}
}
void bot_subcommand_bot_suffix(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == '\0' || sep->IsNumber(1)) {
c->Message(m_fail, "You must specify a [suffix] to use this command (use underscores for any spaces)");
return;
}
auto my_bot = ActionableBots::AsTarget_ByBot(c);
if (!my_bot) {
c->Message(m_fail, "You must <target> a bot that you own to use this command");
return;
}
if (strlen(sep->arg[1]) > 31) {
c->Message(13, "Suffix must be 31 characters or less.");
return;
}
std::string bot_suffix = sep->arg[1];
std::replace(bot_suffix.begin(), bot_suffix.end(), '_', ' ');
bot_suffix = bot_suffix.substr(0, 31);
my_bot->setSuffix(bot_suffix);
if (!botdb.SaveBot(my_bot)) {
c->Message(m_fail, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetTitleSuffix(bot_suffix.c_str());
c->Message(m_action, "Bot Saved.");
}
}
void bot_subcommand_bot_woad(Client *c, const Seperator *sep)
{
if (helper_command_alias_fail(c, "bot_subcommand_bot_woad", sep->arg[0], "botwoad"))

View File

@ -593,6 +593,8 @@ void bot_command_water_breathing(Client *c, const Seperator *sep);
// bot subcommands
void bot_subcommand_bot_appearance(Client *c, const Seperator *sep);
void bot_subcommand_bot_title(Client *c, const Seperator *sep);
void bot_subcommand_bot_suffix(Client *c, const Seperator *sep);
void bot_subcommand_bot_beard_color(Client *c, const Seperator *sep);
void bot_subcommand_bot_beard_style(Client *c, const Seperator *sep);
void bot_subcommand_bot_camp(Client *c, const Seperator *sep);

View File

@ -395,7 +395,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
loaded_bot = new Bot(bot_id, atoi(row[0]), atoi(row[1]), atof(row[14]), atoi(row[6]), tempNPCStruct);
if (loaded_bot) {
loaded_bot->SetShowHelm((atoi(row[43]) > 0 ? true : false));
loaded_bot->setTitle(row[4]);
loaded_bot->setSuffix(row[5]);
uint32 bfd = atoi(row[44]);
if (bfd < 1)
bfd = 1;
@ -604,7 +605,9 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
" `corruption` = '%i',"
" `show_helm` = '%i',"
" `follow_distance` = '%i',"
" `stop_melee_level` = '%u'"
" `stop_melee_level` = '%u',"
" `title` = '%s',"
" `suffix` = '%s'"
" WHERE `bot_id` = '%u'",
bot_inst->GetBotOwnerCharacterID(),
bot_inst->GetBotSpellID(),
@ -647,6 +650,8 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
((bot_inst->GetShowHelm()) ? (1) : (0)),
bot_inst->GetFollowDistance(),
bot_inst->GetStopMeleeLevel(),
bot_inst->GetTitle().c_str(),
bot_inst->GetSuffix().c_str(),
bot_inst->GetBotID()
);
auto results = QueryDatabase(query);