Merge branch 'AzerothCore' of https://github.com/ZhengPeiRu21/mod-playerbots into AzerothCore

This commit is contained in:
郑佩茹
2022-04-19 10:43:33 -06:00
5 changed files with 21 additions and 11 deletions

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ CMakeLists.txt.user
# #
/.settings/ /.settings/
/.externalToolBuilders/* /.externalToolBuilders/*
/.vs
# exclude in all levels # exclude in all levels
nbproject/ nbproject/
.sync.ffs_db .sync.ffs_db

View File

@@ -2006,14 +2006,14 @@ void PlayerbotFactory::InitMounts()
break; break;
case RACE_NIGHTELF: case RACE_NIGHTELF:
slow = { 10789, 8394, 10793 }; slow = { 10789, 8394, 10793 };
fast = { 18766, 18767, 18902 }; fast = { 24252, 63637, 22723 };
break; break;
case RACE_UNDEAD_PLAYER: case RACE_UNDEAD_PLAYER:
slow = { 17463, 17464, 17462 }; slow = { 17463, 17464, 17462 };
fast = { 17465, 23246 }; fast = { 17465, 23246, 66846 };
break; break;
case RACE_TAUREN: case RACE_TAUREN:
slow = { 18990, 18989 }; slow = { 18990, 18989, 64657 };
fast = { 23249, 23248, 23247 }; fast = { 23249, 23248, 23247 };
break; break;
case RACE_GNOME: case RACE_GNOME:
@@ -2021,7 +2021,7 @@ void PlayerbotFactory::InitMounts()
fast = { 23225, 23223, 23222 }; fast = { 23225, 23223, 23222 };
break; break;
case RACE_TROLL: case RACE_TROLL:
slow = { 8588, 10796, 8592, 472 }; slow = { 10796, 10799, 8395, 472 };
fast = { 23241, 23242, 23243 }; fast = { 23241, 23242, 23243 };
break; break;
case RACE_DRAENEI: case RACE_DRAENEI:
@@ -2412,15 +2412,15 @@ void PlayerbotFactory::InitInventoryEquip()
void PlayerbotFactory::InitGuild() void PlayerbotFactory::InitGuild()
{ {
if (bot->GetGuildId())
return;
bot->SaveToDB(false, false); bot->SaveToDB(false, false);
// add guild tabard // add guild tabard
if (bot->GetGuildId() && !bot->HasItemCount(5976, 1)) if (bot->GetGuildId() && !bot->HasItemCount(5976, 1))
StoreItem(5976, 1); StoreItem(5976, 1);
if (bot->GetGuildId())
return;
if (sPlayerbotAIConfig->randomBotGuilds.empty()) if (sPlayerbotAIConfig->randomBotGuilds.empty())
RandomPlayerbotFactory::CreateRandomGuilds(); RandomPlayerbotFactory::CreateRandomGuilds();
@@ -2576,6 +2576,9 @@ void PlayerbotFactory::InitArenaTeam()
ObjectGuid capt = arenateam->GetCaptain(); ObjectGuid capt = arenateam->GetCaptain();
Player* botcaptain = ObjectAccessor::FindPlayer(capt); Player* botcaptain = ObjectAccessor::FindPlayer(capt);
if ((bot && bot->GetArenaTeamId(arenateam->GetSlot())) || sCharacterCache->GetCharacterArenaTeamIdByGuid(bot->GetGUID(), arenateam->GetSlot()) != 0)
return;
if (botcaptain && botcaptain->GetTeamId() == bot->GetTeamId()) //need? if (botcaptain && botcaptain->GetTeamId() == bot->GetTeamId()) //need?
{ {
arenateam->AddMember(bot->GetGUID()); arenateam->AddMember(bot->GetGUID());

View File

@@ -497,6 +497,9 @@ void RandomPlayerbotFactory::CreateRandomGuilds()
if (guildName.empty()) if (guildName.empty())
continue; continue;
if (sGuildMgr->GetGuildByName(guildName))
continue;
if (availableLeaders.empty()) if (availableLeaders.empty())
{ {
LOG_ERROR("playerbots", "No leaders for random guilds available"); LOG_ERROR("playerbots", "No leaders for random guilds available");
@@ -508,14 +511,17 @@ void RandomPlayerbotFactory::CreateRandomGuilds()
Player* player = ObjectAccessor::FindPlayer(leader); Player* player = ObjectAccessor::FindPlayer(leader);
if (!player) if (!player)
{ {
LOG_ERROR("playerbots", "Cannot find player for leader {}", player->GetName().c_str()); LOG_ERROR("playerbots", "ObjectAccessor Cannot find player to set leader for guild {} . Skipped...", guildName.c_str());
continue; continue;
} }
if (player->GetGuildId())
continue;
Guild* guild = new Guild(); Guild* guild = new Guild();
if (!guild->Create(player, guildName)) if (!guild->Create(player, guildName))
{ {
LOG_ERROR("playerbots", "Error creating guild {}", guildName.c_str()); LOG_ERROR("playerbots", "Error creating guild [ {} ] with leader [ {} ]", guildName.c_str(), player->GetName().c_str());
delete guild; delete guild;
continue; continue;
} }

View File

@@ -918,7 +918,7 @@ bool RandomPlayerbotMgr::ProcessBot(Player* player)
uint32 teleport = GetEventValue(bot, "teleport"); uint32 teleport = GetEventValue(bot, "teleport");
if (!teleport) if (!teleport)
{ {
LOG_INFO("players", "Bot #%d <%s>: sent to grind", bot, player->GetName()); LOG_INFO("players", "Bot #{} <{}>: sent to grind", bot, player->GetName());
RandomTeleportForLevel(player); RandomTeleportForLevel(player);
Refresh(player); Refresh(player);
SetEventValue(bot, "teleport", 1, sPlayerbotAIConfig->maxRandomBotInWorldTime); SetEventValue(bot, "teleport", 1, sPlayerbotAIConfig->maxRandomBotInWorldTime);

View File

@@ -205,7 +205,7 @@ void SuggestWhatToDoAction::grindReputation()
std::ostringstream itemout; std::ostringstream itemout;
itemout << "|c004040b0" << allowedFactions[urand(0, allowedFactions.size() - 1)] << "|r"; itemout << "|c004040b0" << allowedFactions[urand(0, allowedFactions.size() - 1)] << "|r";
placeholders["{}action"] = itemout.str(); placeholders["%faction"] = itemout.str();
spam(sPlayerbotTextMgr->Format("suggest_faction", placeholders)); spam(sPlayerbotTextMgr->Format("suggest_faction", placeholders));
} }