Implement new visibility system, based on Silverice patch for mangos

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2009-12-19 10:12:40 +01:00
parent 7a3e524df2
commit 243f33b5ea
15 changed files with 553 additions and 165 deletions
+20 -4
View File
@@ -11220,7 +11220,22 @@ void Unit::SetVisibility(UnitVisibility x)
{
m_Visibility = x;
SetToNotify();
if(IsInWorld())
{
Map *m = GetMap();
CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
Cell cell(p);
if(GetTypeId() == TYPEID_PLAYER)
{
m->UpdatePlayerVisibility((Player*)this, cell, p);
m->UpdateObjectsVisibilityFor((Player*)this, cell, p);
}
else
m->UpdateObjectVisibility(this, cell, p);
AddToNotify(NOTIFY_AI_RELOCATION);
}
if (x == VISIBILITY_GROUP_STEALTH)
DestroyForNearbyPlayers();
@@ -14034,9 +14049,10 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
void Unit::SetToNotify()
{
// it is called somewhere when obj is not in world (crash when log in instance)
if (m_NotifyListPos < 0)
GetMap()->AddUnitToNotify(this);
if (GetTypeId() == TYPEID_PLAYER)
AddToNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION | NOTIFY_PLAYER_VISIBILITY);
else
AddToNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION);
}
void Unit::Kill(Unit *pVictim, bool durabilityLoss)