mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
greatly improve performance
This commit is contained in:
@@ -1247,7 +1247,7 @@ void PlayerbotFactory::InitEquipment(bool incremental)
|
||||
if (CanEquipUnseenItem(slot, dest, itemId))
|
||||
items[slot].push_back(itemId);
|
||||
}
|
||||
} while (items[slot].size() < 25 && desiredQuality-- > ITEM_QUALITY_NORMAL);
|
||||
} while (items[slot].size() < 10 && desiredQuality-- > ITEM_QUALITY_NORMAL);
|
||||
}
|
||||
|
||||
for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)
|
||||
|
||||
@@ -61,13 +61,13 @@ bool DropTargetAction::Execute(Event event)
|
||||
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
||||
}
|
||||
|
||||
ObjectGuid pullTarget = context->GetValue<ObjectGuid>("pull target")->Get();
|
||||
GuidVector possible = botAI->GetAiObjectContext()->GetValue<GuidVector>("possible targets no los")->Get();
|
||||
// ObjectGuid pullTarget = context->GetValue<ObjectGuid>("pull target")->Get();
|
||||
// GuidVector possible = botAI->GetAiObjectContext()->GetValue<GuidVector>("possible targets no los")->Get();
|
||||
|
||||
if (pullTarget && find(possible.begin(), possible.end(), pullTarget) == possible.end())
|
||||
{
|
||||
context->GetValue<ObjectGuid>("pull target")->Set(ObjectGuid::Empty);
|
||||
}
|
||||
// if (pullTarget && find(possible.begin(), possible.end(), pullTarget) == possible.end())
|
||||
// {
|
||||
// context->GetValue<ObjectGuid>("pull target")->Set(ObjectGuid::Empty);
|
||||
// }
|
||||
|
||||
context->GetValue<Unit*>("current target")->Set(nullptr);
|
||||
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
|
||||
void NonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
{
|
||||
triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("check mount state", 1.0f), new NextAction("check values", 1.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("near dark portal", NextAction::array(0, new NextAction("move to dark portal", 1.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("at dark portal azeroth", NextAction::array(0, new NextAction("use dark portal azeroth", 1.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("at dark portal outland", NextAction::array(0, new NextAction("move from dark portal", 1.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("need world buff", NextAction::array(0, new NextAction("world buff", 1.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("vehicle near", NextAction::array(0, new NextAction("enter vehicle", 10.0f), nullptr)));
|
||||
triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("check mount state", 1.0f),
|
||||
// new NextAction("check values", 1.0f),
|
||||
nullptr)));
|
||||
// triggers.push_back(new TriggerNode("near dark portal", NextAction::array(0, new NextAction("move to dark portal", 1.0f), nullptr)));
|
||||
// triggers.push_back(new TriggerNode("at dark portal azeroth", NextAction::array(0, new NextAction("use dark portal azeroth", 1.0f), nullptr)));
|
||||
// triggers.push_back(new TriggerNode("at dark portal outland", NextAction::array(0, new NextAction("move from dark portal", 1.0f), nullptr)));
|
||||
// triggers.push_back(new TriggerNode("need world buff", NextAction::array(0, new NextAction("world buff", 1.0f), nullptr)));
|
||||
// triggers.push_back(new TriggerNode("vehicle near", NextAction::array(0, new NextAction("enter vehicle", 10.0f), nullptr)));
|
||||
}
|
||||
|
||||
void CollisionStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
|
||||
@@ -113,8 +113,8 @@ Unit* EnemyPlayerValue::Calculate()
|
||||
continue;
|
||||
|
||||
if (Unit* pAttacker = pMember->getAttackerForHelper())
|
||||
if (bot->IsWithinDist(pAttacker, maxAggroDistance * 2.0f) && bot->IsWithinLOSInMap(pAttacker) && pAttacker != pVictim
|
||||
&& pAttacker->CanSeeOrDetect(bot) && pAttacker->IsPlayer())
|
||||
if (pAttacker->IsPlayer() && bot->IsWithinDist(pAttacker, maxAggroDistance * 2.0f) && bot->IsWithinLOSInMap(pAttacker) && pAttacker != pVictim
|
||||
&& pAttacker->CanSeeOrDetect(bot))
|
||||
return pAttacker;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ GuidVector NearestUnitsValue::Calculate()
|
||||
GuidVector results;
|
||||
for (Unit* unit : targets)
|
||||
{
|
||||
if ((ignoreLos || bot->IsWithinLOSInMap(unit)) && AcceptUnit(unit))
|
||||
if (AcceptUnit(unit) && (ignoreLos || bot->IsWithinLOSInMap(unit)))
|
||||
results.push_back(unit->GetGUID());
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ bool PartyMemberToHeal::Check(Unit* player)
|
||||
{
|
||||
// return player && player != bot && player->GetMapId() == bot->GetMapId() && player->IsInWorld() &&
|
||||
// sServerFacade->GetDistance2d(bot, player) < (player->IsPlayer() && botAI->IsTank((Player*)player) ? 50.0f : 40.0f);
|
||||
return player && player->GetMapId() == bot->GetMapId() &&
|
||||
return player->GetMapId() == bot->GetMapId() &&
|
||||
bot->GetDistance2d(player) < sPlayerbotAIConfig->healDistance * 2 &&
|
||||
bot->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user