mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-14 17:39:09 +00:00
miscs(raid strategy, distance triggers, etc)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "LastMovementValue.h"
|
||||
#include "RtiTargetValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ThreatMgr.h"
|
||||
|
||||
Unit* FindTargetStrategy::GetResult()
|
||||
{
|
||||
@@ -111,3 +113,50 @@ WorldPosition HomeBindValue::Calculate()
|
||||
{
|
||||
return WorldPosition(bot->m_homebindMapId, bot->m_homebindX, bot->m_homebindY, bot->m_homebindZ, 0.f);
|
||||
}
|
||||
|
||||
Unit* FindTargetValue::Calculate()
|
||||
{
|
||||
if (qualifier == "") {
|
||||
return NULL;
|
||||
}
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group) {
|
||||
return NULL;
|
||||
}
|
||||
for (GroupReference *gref = group->GetFirstMember(); gref; gref = gref->next()) {
|
||||
Player* member = gref->GetSource();
|
||||
if (!member) {
|
||||
continue;
|
||||
}
|
||||
HostileReference *ref = member->getHostileRefMgr().getFirst();
|
||||
while (ref)
|
||||
{
|
||||
ThreatMgr *threatManager = ref->GetSource();
|
||||
Unit *unit = threatManager->GetOwner();
|
||||
std::wstring wnamepart;
|
||||
Utf8toWStr(unit->GetName(), wnamepart);
|
||||
wstrToLower(wnamepart);
|
||||
if (!qualifier.empty() && qualifier.length() == wnamepart.length() && Utf8FitTo(qualifier, wnamepart)) {
|
||||
return unit;
|
||||
}
|
||||
assert(ref);
|
||||
ref = ref->next();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FindBossTargetStrategy::CheckAttacker(Unit* attacker, ThreatMgr* threatManager)
|
||||
{
|
||||
UnitAI* unitAI = attacker->GetAI();
|
||||
BossAI* bossAI = dynamic_cast<BossAI*>(unitAI);
|
||||
if (bossAI) {
|
||||
result = attacker;
|
||||
}
|
||||
}
|
||||
|
||||
Unit* BossTargetValue::Calculate()
|
||||
{
|
||||
FindBossTargetStrategy strategy(botAI);
|
||||
return FindTarget(&strategy);
|
||||
}
|
||||
Reference in New Issue
Block a user