mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8689] implement function Unit::isInvisibleForAlive
with that i've implemented all known auras which makes units invisible for alive.. but that's currently quite hacky i think best would be if we could set a unit-flag after those auras getting applied
This commit is contained in:
parent
e990d5c509
commit
46389e4e1c
9 changed files with 31 additions and 12 deletions
|
|
@ -9603,7 +9603,7 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const
|
|||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
|
||||
return false;
|
||||
|
||||
if (!(isAlive() != inverseAlive))
|
||||
if ((isAlive() && !isInvisibleForAlive()) == inverseAlive)
|
||||
return false;
|
||||
|
||||
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
|
||||
|
|
@ -9700,7 +9700,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
|
|||
|
||||
Map& _map = *u->GetMap();
|
||||
// Grid dead/alive checks
|
||||
if( u->GetTypeId()==TYPEID_PLAYER)
|
||||
if (u->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// non visible at grid for any stealth state
|
||||
if(!IsVisibleInGridForPlayer((Player *)u))
|
||||
|
|
@ -9717,16 +9717,19 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
|
|||
return false;
|
||||
}
|
||||
|
||||
if (u->isAlive() && isInvisibleForAlive())
|
||||
return false;
|
||||
|
||||
// always seen by owner
|
||||
if(GetCharmerOrOwnerGUID()==u->GetGUID())
|
||||
if (GetCharmerOrOwnerGUID()==u->GetGUID())
|
||||
return true;
|
||||
|
||||
// always seen by far sight caster
|
||||
if( u->GetTypeId()==TYPEID_PLAYER && ((Player*)u)->GetFarSight()==GetGUID())
|
||||
if (u->GetTypeId()==TYPEID_PLAYER && ((Player*)u)->GetFarSight()==GetGUID())
|
||||
return true;
|
||||
|
||||
// different visible distance checks
|
||||
if(u->isInFlight()) // what see player in flight
|
||||
if (u->isInFlight()) // what see player in flight
|
||||
{
|
||||
// use object grey distance for all (only see objects any way)
|
||||
if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
|
|
@ -10621,6 +10624,17 @@ bool Unit::isVisibleForInState( Player const* u, WorldObject const* viewPoint, b
|
|||
return isVisibleForOrDetect(u, viewPoint, false, inVisibleList, false);
|
||||
}
|
||||
|
||||
/// returns true if creature can't be seen by alive units
|
||||
bool Unit::isInvisibleForAlive() const
|
||||
{
|
||||
// TODO: more generic check for those auras
|
||||
// TODO: maybe we also don't need an isAlive() check for visibilty.. but only those auras
|
||||
if (HasAura(10848) || HasAura(36978) || HasAura(40131) || HasAura(27978) || HasAura(33900))
|
||||
return true;
|
||||
// TODO: maybe spiritservices also have just an aura
|
||||
return isSpiritService();
|
||||
}
|
||||
|
||||
uint32 Unit::GetCreatureType() const
|
||||
{
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue