mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-31 14:32:25 +00:00
Tweaked bot title and suffix code a little
This commit is contained in:
parent
bd6e06aadb
commit
0cb425b6dd
50
zone/bot.cpp
50
zone/bot.cpp
@ -433,15 +433,61 @@ void Bot::SetBotSpellID(uint32 newSpellID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bot::SetSurname(std::string bot_surname) {
|
void Bot::SetSurname(std::string bot_surname) {
|
||||||
|
|
||||||
_surname = bot_surname.substr(0, 31);
|
_surname = bot_surname.substr(0, 31);
|
||||||
|
|
||||||
|
if (spawned) {
|
||||||
|
|
||||||
|
auto outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct));
|
||||||
|
GMLastName_Struct* gmn = (GMLastName_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
|
strcpy(gmn->name, GetCleanName());
|
||||||
|
strcpy(gmn->gmname, GetCleanName());
|
||||||
|
strcpy(gmn->lastname, GetSurname().c_str());
|
||||||
|
gmn->unknown[0] = 1;
|
||||||
|
gmn->unknown[1] = 1;
|
||||||
|
gmn->unknown[2] = 1;
|
||||||
|
gmn->unknown[3] = 1;
|
||||||
|
|
||||||
|
entity_list.QueueClients(this, outapp);
|
||||||
|
safe_delete(outapp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::SetTitle(std::string bot_title) {
|
void Bot::SetTitle(std::string bot_title) {
|
||||||
_title = bot_title.substr(0, 31);
|
|
||||||
|
_title = bot_title.substr(0, 31);
|
||||||
|
|
||||||
|
if (spawned) {
|
||||||
|
|
||||||
|
auto outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct));
|
||||||
|
SetTitleReply_Struct* strs = (SetTitleReply_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
|
strs->is_suffix = 0;
|
||||||
|
strn0cpy(strs->title, _title.c_str(), sizeof(strs->title));
|
||||||
|
strs->entity_id = GetID();
|
||||||
|
|
||||||
|
entity_list.QueueClients(this, outapp, false);
|
||||||
|
safe_delete(outapp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::SetSuffix(std::string bot_suffix) {
|
void Bot::SetSuffix(std::string bot_suffix) {
|
||||||
_suffix = bot_suffix.substr(0, 31);
|
|
||||||
|
_suffix = bot_suffix.substr(0, 31);
|
||||||
|
|
||||||
|
if (spawned) {
|
||||||
|
|
||||||
|
auto outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct));
|
||||||
|
SetTitleReply_Struct* strs = (SetTitleReply_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
|
strs->is_suffix = 1;
|
||||||
|
strn0cpy(strs->title, _suffix.c_str(), sizeof(strs->title));
|
||||||
|
strs->entity_id = GetID();
|
||||||
|
|
||||||
|
entity_list.QueueClients(this, outapp, false);
|
||||||
|
safe_delete(outapp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetBotArcheryRange() {
|
uint32 Bot::GetBotArcheryRange() {
|
||||||
|
|||||||
@ -5839,23 +5839,12 @@ void bot_subcommand_bot_surname(Client *c, const Seperator *sep)
|
|||||||
std::string bot_surname = sep->arg[1];
|
std::string bot_surname = sep->arg[1];
|
||||||
bot_surname = (bot_surname == "-remove") ? "" : bot_surname;
|
bot_surname = (bot_surname == "-remove") ? "" : bot_surname;
|
||||||
std::replace(bot_surname.begin(), bot_surname.end(), '_', ' ');
|
std::replace(bot_surname.begin(), bot_surname.end(), '_', ' ');
|
||||||
|
|
||||||
my_bot->SetSurname(bot_surname);
|
my_bot->SetSurname(bot_surname);
|
||||||
if (!database.botdb.SaveBot(my_bot)) {
|
if (!database.botdb.SaveBot(my_bot)) {
|
||||||
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
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.");
|
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];
|
std::string bot_title = sep->arg[1];
|
||||||
bot_title = (bot_title == "-remove") ? "" : bot_title;
|
bot_title = (bot_title == "-remove") ? "" : bot_title;
|
||||||
std::replace(bot_title.begin(), bot_title.end(), '_', ' ');
|
std::replace(bot_title.begin(), bot_title.end(), '_', ' ');
|
||||||
|
|
||||||
my_bot->SetTitle(bot_title);
|
my_bot->SetTitle(bot_title);
|
||||||
if (!database.botdb.SaveBot(my_bot)) {
|
if (!database.botdb.SaveBot(my_bot)) {
|
||||||
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my_bot->CastToClient()->SetAATitle(my_bot->GetTitle().c_str());
|
|
||||||
c->Message(Chat::Yellow, "Bot Title Saved.");
|
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];
|
std::string bot_suffix = sep->arg[1];
|
||||||
bot_suffix = (bot_suffix == "-remove") ? "" : bot_suffix;
|
bot_suffix = (bot_suffix == "-remove") ? "" : bot_suffix;
|
||||||
std::replace(bot_suffix.begin(), bot_suffix.end(), '_', ' ');
|
std::replace(bot_suffix.begin(), bot_suffix.end(), '_', ' ');
|
||||||
|
|
||||||
my_bot->SetSuffix(bot_suffix);
|
my_bot->SetSuffix(bot_suffix);
|
||||||
if (!database.botdb.SaveBot(my_bot)) {
|
if (!database.botdb.SaveBot(my_bot)) {
|
||||||
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my_bot->CastToClient()->SetTitleSuffix(my_bot->GetSuffix().c_str());
|
|
||||||
c->Message(Chat::Yellow, "Bot Suffix Saved.");
|
c->Message(Chat::Yellow, "Bot Suffix Saved.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user