mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
miscs: teleport & grind target
This commit is contained in:
@@ -977,8 +977,8 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
|||||||
if (bot->InBattlegroundQueue())
|
if (bot->InBattlegroundQueue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bot->getLevel() < 5)
|
// if (bot->getLevel() < 5)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->randomBotRpgChance < 0)
|
if (sPlayerbotAIConfig->randomBotRpgChance < 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void AttackersValue::RemoveNonThreating(std::set<Unit*>& targets)
|
|||||||
for(std::set<Unit *>::iterator tIter = targets.begin(); tIter != targets.end();)
|
for(std::set<Unit *>::iterator tIter = targets.begin(); tIter != targets.end();)
|
||||||
{
|
{
|
||||||
Unit* unit = *tIter;
|
Unit* unit = *tIter;
|
||||||
if(!bot->IsWithinLOSInMap(unit) || bot->GetMapId() != unit->GetMapId() || !hasRealThreat(unit))
|
if(bot->GetMapId() != unit->GetMapId() || !hasRealThreat(unit) || !IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit))
|
||||||
{
|
{
|
||||||
std::set<Unit *>::iterator tIter2 = tIter;
|
std::set<Unit *>::iterator tIter2 = tIter;
|
||||||
++tIter;
|
++tIter;
|
||||||
@@ -139,27 +139,33 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
isMemberBotGroup = true;
|
isMemberBotGroup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inCannon = botAI->IsInVehicle(false, true);
|
// bool inCannon = botAI->IsInVehicle(false, true);
|
||||||
|
|
||||||
// bool enemy = botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target")->Get();
|
// bool enemy = botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target")->Get();
|
||||||
|
return attacker &&
|
||||||
return attacker && attacker->IsInWorld() && attacker->GetMapId() == bot->GetMapId() && !attacker->isDead() && !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) &&
|
attacker->IsInWorld() &&
|
||||||
|
attacker->GetMapId() == bot->GetMapId() &&
|
||||||
|
!attacker->isDead() &&
|
||||||
|
!attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) &&
|
||||||
// (inCannon || !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) && attacker->CanSeeOrDetect(bot) &&
|
// (inCannon || !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) && attacker->CanSeeOrDetect(bot) &&
|
||||||
// !(attacker->HasUnitState(UNIT_STATE_STUNNED) && botAI->HasAura("shackle undead", attacker)) && !((attacker->IsPolymorphed() || botAI->HasAura("sap", attacker) || /*attacker->IsCharmed() ||*/ attacker->isFeared()) && !rti) &&
|
// !(attacker->HasUnitState(UNIT_STATE_STUNNED) && botAI->HasAura("shackle undead", attacker)) && !((attacker->IsPolymorphed() || botAI->HasAura("sap", attacker) || /*attacker->IsCharmed() ||*/ attacker->isFeared()) && !rti) &&
|
||||||
/*!sServerFacade->IsInRoots(attacker) &&*/!attacker->IsFriendlyTo(bot) && bot->IsWithinDistInMap(attacker, range) &&
|
/*!sServerFacade->IsInRoots(attacker) &&*/
|
||||||
|
!attacker->IsFriendlyTo(bot) && bot->IsWithinDistInMap(attacker, range) &&
|
||||||
!attacker->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) &&
|
!attacker->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) &&
|
||||||
// !(attacker->GetGUID().IsPet() && enemy) &&
|
// !(attacker->GetGUID().IsPet() && enemy) &&
|
||||||
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) && !(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) &&
|
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) &&
|
||||||
!attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && !attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
!attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) &&
|
||||||
bot->CanSeeOrDetect(attacker) &&
|
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
||||||
(attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
!(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) && bot->CanSeeOrDetect(attacker) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) &&
|
||||||
|
(!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
||||||
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
||||||
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackersValue::IsValidTarget(Unit *attacker, Player *bot)
|
bool AttackersValue::IsValidTarget(Unit *attacker, Player *bot)
|
||||||
{
|
{
|
||||||
return attacker->IsVisible() && IsPossibleTarget(attacker, bot) && (attacker->GetThreatMgr().getCurrentVictim() || attacker->GetGuidValue(UNIT_FIELD_TARGET) ||
|
return attacker->IsVisible() &&
|
||||||
|
IsPossibleTarget(attacker, bot) &&
|
||||||
|
(attacker->GetThreatMgr().getCurrentVictim() || attacker->GetGuidValue(UNIT_FIELD_TARGET) ||
|
||||||
attacker->GetGUID().IsPlayer() || attacker->GetGUID() == GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<ObjectGuid>("pull target")->Get());
|
attacker->GetGUID().IsPlayer() || attacker->GetGUID() == GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<ObjectGuid>("pull target")->Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount)
|
|||||||
if (!unit)
|
if (!unit)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// if (unit->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
if (!bot->IsHostileTo(unit) && unit->GetNpcFlags() != UNIT_NPC_FLAG_NONE) {
|
if (!bot->IsHostileTo(unit) && unit->GetNpcFlags() != UNIT_NPC_FLAG_NONE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user