mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[performance] Added additional circle of life, 600 yards (#655)
This commit is contained in:
@@ -4124,10 +4124,6 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
if (!WorldPosition(bot).isOverworld())
|
if (!WorldPosition(bot).isOverworld())
|
||||||
return ActivePiorityType::IN_INSTANCE;
|
return ActivePiorityType::IN_INSTANCE;
|
||||||
|
|
||||||
//VISIBLE_FOR_PLAYER
|
|
||||||
if (HasPlayerNearby(sPlayerbotAIConfig->reactDistance))
|
|
||||||
return ActivePiorityType::VISIBLE_FOR_PLAYER;
|
|
||||||
|
|
||||||
//IN_COMBAT
|
//IN_COMBAT
|
||||||
if (activityType != OUT_OF_PARTY_ACTIVITY && activityType != PACKET_ACTIVITY)
|
if (activityType != OUT_OF_PARTY_ACTIVITY && activityType != PACKET_ACTIVITY)
|
||||||
{
|
{
|
||||||
@@ -4136,9 +4132,15 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
return ActivePiorityType::IN_COMBAT;
|
return ActivePiorityType::IN_COMBAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//NEARBY_PLAYER
|
// IN_REACT_DISTANCE
|
||||||
|
if (HasPlayerNearby(sPlayerbotAIConfig->reactDistance))
|
||||||
|
return ActivePiorityType::IN_REACT_DISTANCE;
|
||||||
|
|
||||||
|
// NEARBY_PLAYER acitivity based on yards.
|
||||||
if (HasPlayerNearby(300.f))
|
if (HasPlayerNearby(300.f))
|
||||||
return ActivePiorityType::NEARBY_PLAYER;
|
return ActivePiorityType::NEARBY_PLAYER_300;
|
||||||
|
if (HasPlayerNearby(600.f))
|
||||||
|
return ActivePiorityType::NEARBY_PLAYER_600;
|
||||||
|
|
||||||
//if (sPlayerbotAIConfig->IsFreeAltBot(bot) || HasStrategy("travel once", BotState::BOT_STATE_NON_COMBAT))
|
//if (sPlayerbotAIConfig->IsFreeAltBot(bot) || HasStrategy("travel once", BotState::BOT_STATE_NON_COMBAT))
|
||||||
// return ActivePiorityType::IS_ALWAYS_ACTIVE;
|
// return ActivePiorityType::IS_ALWAYS_ACTIVE;
|
||||||
@@ -4205,7 +4207,7 @@ ActivePiorityType PlayerbotAI::GetPriorityType(ActivityType activityType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IN_ACTIVE_AREA
|
// IN_VERY_ACTIVE_AREA
|
||||||
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
|
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
|
||||||
{
|
{
|
||||||
if (HasManyPlayersNearby(20, sPlayerbotAIConfig->sightDistance))
|
if (HasManyPlayersNearby(20, sPlayerbotAIConfig->sightDistance))
|
||||||
@@ -4226,7 +4228,10 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
|
|||||||
if (activityType == PACKET_ACTIVITY)
|
if (activityType == PACKET_ACTIVITY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
uint32 botActiveAlonePerc = sPlayerbotAIConfig->botActiveAlone > 100 ? 100 : sPlayerbotAIConfig->botActiveAlone;
|
||||||
|
uint32 mod = botActiveAlonePerc;
|
||||||
ActivePiorityType type = GetPriorityType(activityType);
|
ActivePiorityType type = GetPriorityType(activityType);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ActivePiorityType::HAS_REAL_PLAYER_MASTER:
|
case ActivePiorityType::HAS_REAL_PLAYER_MASTER:
|
||||||
@@ -4234,8 +4239,8 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
|
|||||||
case ActivePiorityType::IN_GROUP_WITH_REAL_PLAYER:
|
case ActivePiorityType::IN_GROUP_WITH_REAL_PLAYER:
|
||||||
case ActivePiorityType::IN_INSTANCE:
|
case ActivePiorityType::IN_INSTANCE:
|
||||||
case ActivePiorityType::IN_COMBAT:
|
case ActivePiorityType::IN_COMBAT:
|
||||||
case ActivePiorityType::NEARBY_PLAYER:
|
case ActivePiorityType::IN_REACT_DISTANCE:
|
||||||
case ActivePiorityType::VISIBLE_FOR_PLAYER:
|
case ActivePiorityType::NEARBY_PLAYER_300:
|
||||||
case ActivePiorityType::IS_ALWAYS_ACTIVE:
|
case ActivePiorityType::IS_ALWAYS_ACTIVE:
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
@@ -4260,11 +4265,6 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
|
|||||||
// active at all times. The default is 10%. With 0.1% of all bots going active
|
// active at all times. The default is 10%. With 0.1% of all bots going active
|
||||||
// or inactive each minute.
|
// or inactive each minute.
|
||||||
if (sPlayerbotAIConfig->botActiveAlone <= 0) return false;
|
if (sPlayerbotAIConfig->botActiveAlone <= 0) return false;
|
||||||
|
|
||||||
// Normalize the configured botActiveAlone value, and set as default mod.
|
|
||||||
uint32 botActiveAlonePerc = sPlayerbotAIConfig->botActiveAlone > 100 ? 100 : sPlayerbotAIConfig->botActiveAlone;
|
|
||||||
uint32 mod = botActiveAlonePerc;
|
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->botActiveAloneSmartScale &&
|
if (sPlayerbotAIConfig->botActiveAloneSmartScale &&
|
||||||
bot->GetLevel() >= sPlayerbotAIConfig->botActiveAloneSmartScaleWhenMinLevel &&
|
bot->GetLevel() >= sPlayerbotAIConfig->botActiveAloneSmartScaleWhenMinLevel &&
|
||||||
bot->GetLevel() <= sPlayerbotAIConfig->botActiveAloneSmartScaleWhenMaxLevel)
|
bot->GetLevel() <= sPlayerbotAIConfig->botActiveAloneSmartScaleWhenMaxLevel)
|
||||||
@@ -4302,23 +4302,28 @@ uint32 PlayerbotAI::SmartScaleActivity(ActivePiorityType type, uint32 botActiveA
|
|||||||
case ActivePiorityType::IN_BG_QUEUE:
|
case ActivePiorityType::IN_BG_QUEUE:
|
||||||
case ActivePiorityType::IN_LFG:
|
case ActivePiorityType::IN_LFG:
|
||||||
if (maxDiff > 100) return 80;
|
if (maxDiff > 100) return 80;
|
||||||
if (maxDiff > 50) return 90;
|
if (maxDiff > 100) return 90;
|
||||||
|
break;
|
||||||
|
case ActivePiorityType::NEARBY_PLAYER_600:
|
||||||
|
if (maxDiff > 100) return 50;
|
||||||
|
if (maxDiff > 50) return 75;
|
||||||
break;
|
break;
|
||||||
case ActivePiorityType::PLAYER_FRIEND:
|
case ActivePiorityType::PLAYER_FRIEND:
|
||||||
case ActivePiorityType::PLAYER_GUILD:
|
case ActivePiorityType::PLAYER_GUILD:
|
||||||
case ActivePiorityType::IN_ACTIVE_MAP:
|
case ActivePiorityType::IN_ACTIVE_MAP:
|
||||||
if (maxDiff > 200) return 25;
|
if (maxDiff > 200) return 30;
|
||||||
if (maxDiff > 100) return 50;
|
if (maxDiff > 100) return 50;
|
||||||
if (maxDiff > 50) return 80;
|
if (maxDiff > 50) return 75;
|
||||||
break;
|
break;
|
||||||
case ActivePiorityType::IN_VERY_ACTIVE_AREA: // Many bots nearby. Do not do heavy area checks.
|
case ActivePiorityType::IN_VERY_ACTIVE_AREA:
|
||||||
case ActivePiorityType::IN_NOT_ACTIVE_MAP:
|
case ActivePiorityType::IN_NOT_ACTIVE_MAP:
|
||||||
if (maxDiff > 100) return 25;
|
if (maxDiff > 100) return 30;
|
||||||
if (maxDiff > 50) return 50;
|
if (maxDiff > 50) return 50;
|
||||||
|
break;
|
||||||
case ActivePiorityType::IN_EMPTY_SERVER:
|
case ActivePiorityType::IN_EMPTY_SERVER:
|
||||||
return 25;
|
return 30;
|
||||||
default:
|
default:
|
||||||
if (maxDiff > 200) return 25;
|
if (maxDiff > 200) return 30;
|
||||||
if (maxDiff > 100) return 50;
|
if (maxDiff > 100) return 50;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,19 +247,21 @@ enum class ActivePiorityType : uint8
|
|||||||
HAS_REAL_PLAYER_MASTER = 1,
|
HAS_REAL_PLAYER_MASTER = 1,
|
||||||
IN_GROUP_WITH_REAL_PLAYER = 2,
|
IN_GROUP_WITH_REAL_PLAYER = 2,
|
||||||
IN_INSTANCE = 3,
|
IN_INSTANCE = 3,
|
||||||
VISIBLE_FOR_PLAYER = 4,
|
IS_ALWAYS_ACTIVE = 4,
|
||||||
IS_ALWAYS_ACTIVE = 5,
|
IN_COMBAT = 5,
|
||||||
IN_COMBAT = 6,
|
IN_BG_QUEUE = 6,
|
||||||
IN_BG_QUEUE = 7,
|
IN_LFG = 7,
|
||||||
IN_LFG = 8,
|
IN_REACT_DISTANCE = 8,
|
||||||
NEARBY_PLAYER = 9,
|
NEARBY_PLAYER_300 = 9,
|
||||||
PLAYER_FRIEND = 10,
|
NEARBY_PLAYER_600 = 10,
|
||||||
PLAYER_GUILD = 11,
|
NEARBY_PLAYER_900 = 11,
|
||||||
IN_VERY_ACTIVE_AREA = 12,
|
PLAYER_FRIEND = 12,
|
||||||
IN_ACTIVE_MAP = 13,
|
PLAYER_GUILD = 13,
|
||||||
IN_NOT_ACTIVE_MAP = 14,
|
IN_VERY_ACTIVE_AREA = 14,
|
||||||
IN_EMPTY_SERVER = 15,
|
IN_ACTIVE_MAP = 15,
|
||||||
ALLOWED_PARTY_ACTIVITY = 16,
|
IN_NOT_ACTIVE_MAP = 16,
|
||||||
|
IN_EMPTY_SERVER = 17,
|
||||||
|
ALLOWED_PARTY_ACTIVITY = 18,
|
||||||
DEFAULT
|
DEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user