Fix crash

This commit is contained in:
Atidot3
2024-07-25 17:56:53 +02:00
parent 710d89af5c
commit 916a0002e8
4 changed files with 13 additions and 10 deletions

View File

@@ -545,7 +545,7 @@ void PlayerbotHolder::OnBotLogin(Player* const bot)
if (isLfg) if (isLfg)
{ {
std::string lfgChannelName = channel->pattern[sWorld->GetDefaultDbcLocale()]; std::string lfgChannelName = channel->pattern[sWorld->GetDefaultDbcLocale()];
new_channel = cMgr->GetJoinChannel(lfgChannelName, channel->ChannelID); new_channel = cMgr->GetJoinChannel("LookingForGroup", channel->ChannelID);
} }
else else
{ {

View File

@@ -192,7 +192,6 @@ uint32 PlayerbotTextMgr::GetLocalePriority()
topLocale = i; topLocale = i;
} }
LOG_INFO("playerbots", "GetLocalePriority: {}", topLocale);
return topLocale; return topLocale;
} }

View File

@@ -661,15 +661,16 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32
LOG_ERROR("playerbots", "plr pointer is nullptr chat whisper"); LOG_ERROR("playerbots", "plr pointer is nullptr chat whisper");
} }
if (type == CHAT_MSG_SAY) else if (type == CHAT_MSG_SAY)
{ {
LOG_INFO("playerbots", "say respond: {}", respondsText);
if (bot->GetTeamId() == TEAM_ALLIANCE) if (bot->GetTeamId() == TEAM_ALLIANCE)
bot->Say(respondsText, LANG_COMMON); bot->Say(respondsText, LANG_COMMON);
else else
bot->Say(respondsText, LANG_ORCISH); bot->Say(respondsText, LANG_ORCISH);
} }
if (type == CHAT_MSG_YELL) else if (type == CHAT_MSG_YELL)
{ {
if (bot->GetTeamId() == TEAM_ALLIANCE) if (bot->GetTeamId() == TEAM_ALLIANCE)
bot->Yell(respondsText, LANG_COMMON); bot->Yell(respondsText, LANG_COMMON);
@@ -677,7 +678,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32
bot->Yell(respondsText, LANG_ORCISH); bot->Yell(respondsText, LANG_ORCISH);
} }
if (type == CHAT_MSG_GUILD) else if (type == CHAT_MSG_GUILD)
{ {
if (!bot->GetGuildId()) if (!bot->GetGuildId())
return; return;
@@ -696,4 +697,4 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32
} }
GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<time_t>("last said", "chat")->Set(time(nullptr) + urand(5, 25)); GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<time_t>("last said", "chat")->Set(time(nullptr) + urand(5, 25));
} }
} }

View File

@@ -109,7 +109,7 @@ void SuggestWhatToDoAction::instance()
instances["Halls of Reflection"] = 80; instances["Halls of Reflection"] = 80;
} }
std::vector<std::string_view> allowedInstances; std::vector<std::string> allowedInstances;
for (const auto& instance : instances) for (const auto& instance : instances)
{ {
if (bot->GetLevel() >= instance.second) if (bot->GetLevel() >= instance.second)
@@ -248,12 +248,12 @@ void SuggestWhatToDoAction::grindReputation()
factions["The Wyrmrest Accord"] = 77; factions["The Wyrmrest Accord"] = 77;
} }
std::vector<std::string_view> levels; std::vector<std::string> levels;
levels.push_back("honored"); levels.push_back("honored");
levels.push_back("revered"); levels.push_back("revered");
levels.push_back("exalted"); levels.push_back("exalted");
std::vector<std::string_view> allowedFactions; std::vector<std::string> allowedFactions;
for (const auto& i : factions) for (const auto& i : factions)
{ {
if (bot->GetLevel() >= i.second) if (bot->GetLevel() >= i.second)
@@ -310,7 +310,10 @@ void SuggestWhatToDoAction::spam(std::string msg, uint8 flags, bool worldChat, b
ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(i); ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(i);
if (!channel) continue; if (!channel) continue;
LOG_INFO("playerbots", "Loop on channel: {}", channel->pattern[_dbc_locale]); if (channel->pattern[_dbc_locale])
LOG_INFO("playerbots", "Loop on channel: {}", channel->pattern[_dbc_locale]);
else
LOG_ERROR("playerbots", "channel->pattern[_dbc_locale] is null");
for (AreaTableEntry const* current_zone : sAreaTableStore) for (AreaTableEntry const* current_zone : sAreaTableStore)
{ {