mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-10 20:22:41 +00:00
[Cleanup] Remove bot-based saylink method (#3852)
# Notes - With the new saylink functionality, bots no longer need their own saylink method.
This commit is contained in:
parent
c0769a9c29
commit
1227f35382
22
zone/bot.cpp
22
zone/bot.cpp
@ -8138,28 +8138,6 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
|
|
||||||
{
|
|
||||||
// TODO: review
|
|
||||||
|
|
||||||
int saylink_size = strlen(message);
|
|
||||||
char* escaped_string = new char[saylink_size * 2];
|
|
||||||
|
|
||||||
database.DoEscapeString(escaped_string, message, saylink_size);
|
|
||||||
|
|
||||||
uint32 saylink_id = database.LoadSaylinkID(escaped_string);
|
|
||||||
safe_delete_array(escaped_string);
|
|
||||||
|
|
||||||
EQ::SayLinkEngine linker;
|
|
||||||
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
|
||||||
linker.SetProxyItemID(SAYLINK_ITEM_ID);
|
|
||||||
linker.SetProxyAugment1ID(saylink_id);
|
|
||||||
linker.SetProxyText(name);
|
|
||||||
|
|
||||||
auto saylink = linker.GenerateLink();
|
|
||||||
return saylink;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bot::Signal(int signal_id)
|
void Bot::Signal(int signal_id)
|
||||||
{
|
{
|
||||||
if (parse->BotHasQuestSub(EVENT_SIGNAL)) {
|
if (parse->BotHasQuestSub(EVENT_SIGNAL)) {
|
||||||
|
|||||||
@ -659,8 +659,6 @@ public:
|
|||||||
void SetBotEnforceSpellSetting(bool enforcespellsettings, bool save = false);
|
void SetBotEnforceSpellSetting(bool enforcespellsettings, bool save = false);
|
||||||
bool GetBotEnforceSpellSetting() const { return m_enforce_spell_settings; }
|
bool GetBotEnforceSpellSetting() const { return m_enforce_spell_settings; }
|
||||||
|
|
||||||
std::string CreateSayLink(Client* botOwner, const char* message, const char* name);
|
|
||||||
|
|
||||||
// Class Destructors
|
// Class Destructors
|
||||||
~Bot() override;
|
~Bot() override;
|
||||||
|
|
||||||
|
|||||||
@ -4003,8 +4003,6 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string text_link;
|
|
||||||
|
|
||||||
EQ::SayLinkEngine linker;
|
EQ::SayLinkEngine linker;
|
||||||
linker.SetLinkType(EQ::saylink::SayLinkItemInst);
|
linker.SetLinkType(EQ::saylink::SayLinkItemInst);
|
||||||
|
|
||||||
@ -4050,15 +4048,6 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
text_link = bot_iter->CreateSayLink(
|
|
||||||
c,
|
|
||||||
fmt::format(
|
|
||||||
"^inventorygive byname {}",
|
|
||||||
bot_iter->GetCleanName()
|
|
||||||
).c_str(),
|
|
||||||
bot_iter->GetCleanName()
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const auto& slot_iter : equipable_slot_list) {
|
for (const auto& slot_iter : equipable_slot_list) {
|
||||||
// needs more failure criteria - this should cover the bulk for now
|
// needs more failure criteria - this should cover the bulk for now
|
||||||
if (slot_iter == EQ::invslot::slotSecondary && item_data->Damage && !bot_iter->CanThisClassDualWield()) {
|
if (slot_iter == EQ::invslot::slotSecondary && item_data->Damage && !bot_iter->CanThisClassDualWield()) {
|
||||||
@ -4074,7 +4063,13 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
|||||||
Chat::Say,
|
Chat::Say,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} says, 'I can use that for my {} instead of my {}! Would you like to {} my {}?'",
|
"{} says, 'I can use that for my {} instead of my {}! Would you like to {} my {}?'",
|
||||||
text_link,
|
Saylink::Silent(
|
||||||
|
fmt::format(
|
||||||
|
"^inventorygive byname {}",
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
),
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
),
|
||||||
EQ::invslot::GetInvPossessionsSlotName(slot_iter),
|
EQ::invslot::GetInvPossessionsSlotName(slot_iter),
|
||||||
linker.GenerateLink(),
|
linker.GenerateLink(),
|
||||||
Saylink::Silent(
|
Saylink::Silent(
|
||||||
@ -4096,7 +4091,13 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
|||||||
Chat::Say,
|
Chat::Say,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} says, 'I can use that for my {}! Would you like to {} it to me?'",
|
"{} says, 'I can use that for my {}! Would you like to {} it to me?'",
|
||||||
text_link,
|
Saylink::Silent(
|
||||||
|
fmt::format(
|
||||||
|
"^inventorygive byname {}",
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
),
|
||||||
|
bot_iter->GetCleanName()
|
||||||
|
),
|
||||||
EQ::invslot::GetInvPossessionsSlotName(slot_iter),
|
EQ::invslot::GetInvPossessionsSlotName(slot_iter),
|
||||||
Saylink::Silent(
|
Saylink::Silent(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -9542,10 +9543,6 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
|||||||
if (!Bot::IsValidRaceClassCombo(bot_race, bot_class)) {
|
if (!Bot::IsValidRaceClassCombo(bot_race, bot_class)) {
|
||||||
const std::string bot_race_name = GetRaceIDName(bot_race);
|
const std::string bot_race_name = GetRaceIDName(bot_race);
|
||||||
const std::string bot_class_name = GetClassIDName(bot_class);
|
const std::string bot_class_name = GetClassIDName(bot_class);
|
||||||
const auto view_saylink = Saylink::Silent(
|
|
||||||
fmt::format("^viewcombos {}", bot_race),
|
|
||||||
"view"
|
|
||||||
);
|
|
||||||
|
|
||||||
bot_owner->Message(
|
bot_owner->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
@ -9553,7 +9550,10 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
|||||||
"{} {} is an invalid race-class combination, would you like to {} proper combinations for {}?",
|
"{} {} is an invalid race-class combination, would you like to {} proper combinations for {}?",
|
||||||
bot_race_name,
|
bot_race_name,
|
||||||
bot_class_name,
|
bot_class_name,
|
||||||
view_saylink,
|
Saylink::Silent(
|
||||||
|
fmt::format("^viewcombos {}", bot_race),
|
||||||
|
"view"
|
||||||
|
),
|
||||||
bot_race_name
|
bot_race_name
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -9871,9 +9871,6 @@ void helper_command_depart_list(Client* bot_owner, Bot* druid_bot, Bot* wizard_b
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string msg;
|
|
||||||
std::string text_link;
|
|
||||||
|
|
||||||
auto destination_count = 0;
|
auto destination_count = 0;
|
||||||
auto destination_number = 1;
|
auto destination_number = 1;
|
||||||
for (auto list_iter : *local_list) {
|
for (auto list_iter : *local_list) {
|
||||||
@ -9891,24 +9888,19 @@ void helper_command_depart_list(Client* bot_owner, Bot* druid_bot, Bot* wizard_b
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = fmt::format(
|
|
||||||
"^circle {}{}",
|
|
||||||
spells[local_entry->spell_id].teleport_zone,
|
|
||||||
single_flag ? " single" : ""
|
|
||||||
);
|
|
||||||
|
|
||||||
text_link = druid_bot->CreateSayLink(
|
|
||||||
bot_owner,
|
|
||||||
msg.c_str(),
|
|
||||||
"Goto"
|
|
||||||
);
|
|
||||||
|
|
||||||
druid_bot->OwnerMessage(
|
druid_bot->OwnerMessage(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Destination {} | {} | {}",
|
"Destination {} | {} | {}",
|
||||||
destination_number,
|
destination_number,
|
||||||
local_entry->long_name,
|
local_entry->long_name,
|
||||||
text_link
|
Saylink::Silent(
|
||||||
|
fmt::format(
|
||||||
|
"^circle {}{}",
|
||||||
|
spells[local_entry->spell_id].teleport_zone,
|
||||||
|
single_flag ? " single" : ""
|
||||||
|
),
|
||||||
|
"Goto"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -9926,24 +9918,19 @@ void helper_command_depart_list(Client* bot_owner, Bot* druid_bot, Bot* wizard_b
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = fmt::format(
|
|
||||||
"^portal {}{}",
|
|
||||||
spells[local_entry->spell_id].teleport_zone,
|
|
||||||
single_flag ? " single" : ""
|
|
||||||
);
|
|
||||||
|
|
||||||
text_link = wizard_bot->CreateSayLink(
|
|
||||||
bot_owner,
|
|
||||||
msg.c_str(),
|
|
||||||
"Goto"
|
|
||||||
);
|
|
||||||
|
|
||||||
wizard_bot->OwnerMessage(
|
wizard_bot->OwnerMessage(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Destination {} | {} | {}",
|
"Destination {} | {} | {}",
|
||||||
destination_number,
|
destination_number,
|
||||||
local_entry->long_name,
|
local_entry->long_name,
|
||||||
text_link
|
Saylink::Silent(
|
||||||
|
fmt::format(
|
||||||
|
"^portal {}{}",
|
||||||
|
spells[local_entry->spell_id].teleport_zone,
|
||||||
|
single_flag ? " single" : ""
|
||||||
|
),
|
||||||
|
"Goto"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -4321,39 +4321,6 @@ bool ZoneDatabase::DeleteCharacterCorpse(uint32 db_id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ZoneDatabase::LoadSaylinkID(const char* saylink_text, bool auto_insert)
|
|
||||||
{
|
|
||||||
if (!saylink_text || saylink_text[0] == '\0')
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT `id` FROM `saylink` WHERE `phrase` = '%s' LIMIT 1", saylink_text);
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
if (!results.Success())
|
|
||||||
return 0;
|
|
||||||
if (!results.RowCount()) {
|
|
||||||
if (auto_insert)
|
|
||||||
return SaveSaylinkID(saylink_text);
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& row = results.begin();
|
|
||||||
return Strings::ToInt(row[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 ZoneDatabase::SaveSaylinkID(const char* saylink_text)
|
|
||||||
{
|
|
||||||
if (!saylink_text || saylink_text[0] == '\0')
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
std::string query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", saylink_text);
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
if (!results.Success())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return results.LastInsertedID();
|
|
||||||
}
|
|
||||||
|
|
||||||
double ZoneDatabase::GetAAEXPModifier(uint32 character_id, uint32 zone_id, int16 instance_version) const {
|
double ZoneDatabase::GetAAEXPModifier(uint32 character_id, uint32 zone_id, int16 instance_version) const {
|
||||||
const std::string query = fmt::format(
|
const std::string query = fmt::format(
|
||||||
SQL(
|
SQL(
|
||||||
|
|||||||
@ -648,10 +648,6 @@ public:
|
|||||||
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy);
|
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy);
|
||||||
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
|
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
|
||||||
|
|
||||||
/* Saylinks */
|
|
||||||
uint32 LoadSaylinkID(const char* saylink_text, bool auto_insert = true);
|
|
||||||
uint32 SaveSaylinkID(const char* saylink_text);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Misc stuff.
|
* Misc stuff.
|
||||||
* PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD
|
* PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user