Tweaked bot title and suffix code a little

This commit is contained in:
Uleat
2019-12-13 20:59:10 -05:00
parent bd6e06aadb
commit 0cb425b6dd
2 changed files with 51 additions and 18 deletions
+3 -16
View File
@@ -5839,23 +5839,12 @@ void bot_subcommand_bot_surname(Client *c, const Seperator *sep)
std::string bot_surname = sep->arg[1];
bot_surname = (bot_surname == "-remove") ? "" : bot_surname;
std::replace(bot_surname.begin(), bot_surname.end(), '_', ' ');
my_bot->SetSurname(bot_surname);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
auto outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct));
GMLastName_Struct * gmn = (GMLastName_Struct*)outapp->pBuffer;
strcpy(gmn->name, my_bot->GetCleanName());
strcpy(gmn->gmname, my_bot->GetCleanName());
strcpy(gmn->lastname, my_bot->GetSurname().c_str());
gmn->unknown[0] = 1;
gmn->unknown[1] = 1;
gmn->unknown[2] = 1;
gmn->unknown[3] = 1;
entity_list.QueueClients(my_bot->CastToClient(), outapp);
safe_delete(outapp);
c->Message(Chat::Yellow, "Bot Surname Saved.");
}
}
@@ -5878,13 +5867,12 @@ void bot_subcommand_bot_title(Client *c, const Seperator *sep)
std::string bot_title = sep->arg[1];
bot_title = (bot_title == "-remove") ? "" : bot_title;
std::replace(bot_title.begin(), bot_title.end(), '_', ' ');
my_bot->SetTitle(bot_title);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetAATitle(my_bot->GetTitle().c_str());
c->Message(Chat::Yellow, "Bot Title Saved.");
}
}
@@ -5907,13 +5895,12 @@ void bot_subcommand_bot_suffix(Client *c, const Seperator *sep)
std::string bot_suffix = sep->arg[1];
bot_suffix = (bot_suffix == "-remove") ? "" : bot_suffix;
std::replace(bot_suffix.begin(), bot_suffix.end(), '_', ' ');
my_bot->SetSuffix(bot_suffix);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetTitleSuffix(my_bot->GetSuffix().c_str());
c->Message(Chat::Yellow, "Bot Suffix Saved.");
}
}