mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[performance] Smartscale added missing acitivity
This commit is contained in:
@@ -4101,10 +4101,12 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
if (member == bot)
|
if (member == bot)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
//IN_GROUP_WITH_REAL_PLAYER
|
||||||
PlayerbotAI* memberBotAI = GET_PLAYERBOT_AI(member);
|
PlayerbotAI* memberBotAI = GET_PLAYERBOT_AI(member);
|
||||||
if (!memberBotAI || memberBotAI->HasRealPlayerMaster())
|
if (!memberBotAI || memberBotAI->HasRealPlayerMaster())
|
||||||
return ActivePiorityType::IN_GROUP_WITH_REAL_PLAYER;
|
return ActivePiorityType::IN_GROUP_WITH_REAL_PLAYER;
|
||||||
|
|
||||||
|
//IN_GROUP_WITH_REAL_PLAYER
|
||||||
if (group->IsLeader(member->GetGUID()))
|
if (group->IsLeader(member->GetGUID()))
|
||||||
{
|
{
|
||||||
if (!memberBotAI->AllowActivity(PARTY_ACTIVITY))
|
if (!memberBotAI->AllowActivity(PARTY_ACTIVITY))
|
||||||
@@ -4113,22 +4115,27 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IN_INSTANCE
|
||||||
if (bot->IsBeingTeleported()) // Allow activity while teleportation.
|
if (bot->IsBeingTeleported()) // Allow activity while teleportation.
|
||||||
return ActivePiorityType::IN_INSTANCE;
|
return ActivePiorityType::IN_INSTANCE;
|
||||||
|
|
||||||
|
//IN_INSTANCE
|
||||||
if (!WorldPosition(bot).isOverworld())
|
if (!WorldPosition(bot).isOverworld())
|
||||||
return ActivePiorityType::IN_INSTANCE;
|
return ActivePiorityType::IN_INSTANCE;
|
||||||
|
|
||||||
if (HasPlayerNearby())
|
//VISIBLE_FOR_PLAYER
|
||||||
|
if (HasPlayerNearby(sPlayerbotAIConfig->reactDistance))
|
||||||
return ActivePiorityType::VISIBLE_FOR_PLAYER;
|
return ActivePiorityType::VISIBLE_FOR_PLAYER;
|
||||||
|
|
||||||
|
//IN_COMBAT
|
||||||
if (activityType != OUT_OF_PARTY_ACTIVITY && activityType != PACKET_ACTIVITY)
|
if (activityType != OUT_OF_PARTY_ACTIVITY && activityType != PACKET_ACTIVITY)
|
||||||
{
|
{
|
||||||
// Is in combat.Defend yourself.
|
// Is in combat, defend yourself.
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return ActivePiorityType::IN_COMBAT;
|
return ActivePiorityType::IN_COMBAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NEARBY_PLAYER
|
||||||
if (HasPlayerNearby(300.f))
|
if (HasPlayerNearby(300.f))
|
||||||
return ActivePiorityType::NEARBY_PLAYER;
|
return ActivePiorityType::NEARBY_PLAYER;
|
||||||
|
|
||||||
@@ -4153,33 +4160,38 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
if (isLFG)
|
if (isLFG)
|
||||||
return ActivePiorityType::IN_LFG;
|
return ActivePiorityType::IN_LFG;
|
||||||
|
|
||||||
// If has real players - slow down continents without player
|
//IN_EMPTY_SERVER
|
||||||
// This means we first disable bots in a different continent/area.
|
|
||||||
if (sRandomPlayerbotMgr->GetPlayers().empty())
|
if (sRandomPlayerbotMgr->GetPlayers().empty())
|
||||||
return ActivePiorityType::IN_EMPTY_SERVER;
|
return ActivePiorityType::IN_EMPTY_SERVER;
|
||||||
|
|
||||||
// friends always active
|
//PLAYER_FRIEND (on friendlist of real player) (needs to be tested for stability)
|
||||||
// for (auto& player : sRandomPlayerbotMgr->GetPlayers())
|
/*for (auto& player : sRandomPlayerbotMgr->GetPlayers())
|
||||||
// {
|
{
|
||||||
// if (!player || !player->IsInWorld())
|
if (!player || !player->IsInWorld())
|
||||||
// continue;
|
continue;
|
||||||
|
|
||||||
// if (player->GetSocial()->HasFriend(bot->GetGUID()))
|
if (player->GetSocial() &&
|
||||||
// return ActivePiorityType::PLAYER_FRIEND;
|
bot->GetGUID() &&
|
||||||
// }
|
player->GetSocial()->HasFriend(bot->GetGUID()))
|
||||||
|
return ActivePiorityType::PLAYER_FRIEND;
|
||||||
|
}*/
|
||||||
|
|
||||||
// real guild always active if member+
|
//PLAYER_GUILD (contains real player)
|
||||||
if (IsInRealGuild())
|
if (IsInRealGuild())
|
||||||
return ActivePiorityType::PLAYER_GUILD;
|
return ActivePiorityType::PLAYER_GUILD;
|
||||||
|
|
||||||
|
//IN_INACTIVE_MAP
|
||||||
if (bot->IsBeingTeleported() || !bot->IsInWorld() || !HasRealPlayers(bot->GetMap()))
|
if (bot->IsBeingTeleported() || !bot->IsInWorld() || !HasRealPlayers(bot->GetMap()))
|
||||||
return ActivePiorityType::IN_INACTIVE_MAP;
|
return ActivePiorityType::IN_INACTIVE_MAP;
|
||||||
|
|
||||||
|
//IN_ACTIVE_MAP
|
||||||
|
if (!bot->IsBeingTeleported() && bot->IsInWorld() && HasRealPlayers(bot->GetMap()))
|
||||||
|
return ActivePiorityType::IN_ACTIVE_MAP;
|
||||||
|
|
||||||
// IN_ACTIVE_AREA
|
// IN_ACTIVE_AREA
|
||||||
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
|
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
|
||||||
{
|
{
|
||||||
// Many bots nearby. Do not do heavy area checks.
|
if (HasManyPlayersNearby(20, sPlayerbotAIConfig->sightDistance))
|
||||||
if (HasManyPlayersNearby())
|
|
||||||
return ActivePiorityType::IN_ACTIVE_AREA;
|
return ActivePiorityType::IN_ACTIVE_AREA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4190,7 +4202,7 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
// Ie. { 10, 20 } means all bots in this bracket will be inactive below 10% activityMod,
|
// Ie. { 10, 20 } means all bots in this bracket will be inactive below 10% activityMod,
|
||||||
// and will be active above 20% activityMod and scale between those values.
|
// and will be active above 20% activityMod and scale between those values.
|
||||||
std::pair<uint32, uint32> PlayerbotAI::GetPriorityBracket(ActivePiorityType type)
|
std::pair<uint32, uint32> PlayerbotAI::GetPriorityBracket(ActivePiorityType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ActivePiorityType::HAS_REAL_PLAYER_MASTER:
|
case ActivePiorityType::HAS_REAL_PLAYER_MASTER:
|
||||||
@@ -4203,24 +4215,27 @@ std::pair<uint32, uint32> PlayerbotAI::GetPriorityBracket(ActivePiorityType type
|
|||||||
case ActivePiorityType::IN_COMBAT:
|
case ActivePiorityType::IN_COMBAT:
|
||||||
return {0, 10};
|
return {0, 10};
|
||||||
case ActivePiorityType::IN_BG_QUEUE:
|
case ActivePiorityType::IN_BG_QUEUE:
|
||||||
case ActivePiorityType::IN_LFG:
|
|
||||||
return {0, 20};
|
return {0, 20};
|
||||||
case ActivePiorityType::NEARBY_PLAYER:
|
case ActivePiorityType::IN_LFG:
|
||||||
return {0, 30};
|
return {0, 30};
|
||||||
case ActivePiorityType::PLAYER_FRIEND:
|
case ActivePiorityType::NEARBY_PLAYER:
|
||||||
return {0, 40};
|
return {0, 40};
|
||||||
case ActivePiorityType::IN_ACTIVE_AREA:
|
case ActivePiorityType::PLAYER_FRIEND:
|
||||||
case ActivePiorityType::PLAYER_GUILD:
|
case ActivePiorityType::PLAYER_GUILD:
|
||||||
return {0, 50};
|
return {0, 50};
|
||||||
|
case ActivePiorityType::IN_ACTIVE_AREA:
|
||||||
|
return {30, 100};
|
||||||
case ActivePiorityType::IN_ACTIVE_MAP:
|
case ActivePiorityType::IN_ACTIVE_MAP:
|
||||||
return {20, 100};
|
return {50, 100};
|
||||||
case ActivePiorityType::IN_INACTIVE_MAP:
|
case ActivePiorityType::IN_INACTIVE_MAP:
|
||||||
return {50, 100};
|
return {70, 100};
|
||||||
case ActivePiorityType::IN_EMPTY_SERVER:
|
case ActivePiorityType::IN_EMPTY_SERVER:
|
||||||
return {90, 100};
|
return {80, 100};
|
||||||
default:
|
default:
|
||||||
return {50, 100};
|
return {90, 100};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {90, 100};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerbotAI::AllowActive(ActivityType activityType)
|
bool PlayerbotAI::AllowActive(ActivityType activityType)
|
||||||
|
|||||||
Reference in New Issue
Block a user