- Redesigned stealth and invisibility handling
  - Implemented the handling of multiple stealth types
- Implemented fake inebriation
- The message deliverer no longer sends packets from a non-visible source
  - The server won't send that much garbage which just takes bandwith
  - It won't be possible to use cheats to detect invisible objects
- Removed a lot of checks for the Z-coord
  - Fixes visibility problems happening while flying
- Limited the grid activation range of creatures to use less resources
- Implemented Shroud of Death
- Implemented increased visibility range for active objects
- Removed visibility check at spellhit (only sanctuary effects should prevent it)
(And a lot of other changes...)

Closes issue 4208
Closes issue 3049
Closes issue 2097
Closes issue 2198
Closes issue 2384
Closes issue 2197
Closes issue 2319

--HG--
branch : trunk
This commit is contained in:
linencloth
2010-11-13 17:18:09 +01:00
parent 995408f0a9
commit bf888285aa
36 changed files with 780 additions and 791 deletions
@@ -117,7 +117,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
return;
if (c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
if (c->_IsWithinDist(u, c->m_SightDistance, true) && c->IsAIEnabled)
if (c->IsAIEnabled && c->canSeeOrDetect(u, false, true))
c->AI()->MoveInLineOfSight_Safe(u);
}
@@ -249,7 +249,7 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
if (!target->InSamePhase(i_phaseMask))
continue;
if (target->GetExactDistSq(i_source) > i_distSq)
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the player's vision
@@ -274,7 +274,7 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the creature's vision
@@ -296,7 +296,7 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq)
continue;
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
@@ -143,6 +143,9 @@ namespace Trinity
if (plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
return;
if (!plr->HaveAtClient(i_source))
return;
plr->GetSession()->SendPacket(i_message);
}
};
@@ -809,7 +812,7 @@ namespace Trinity
return u->isAlive()
&& i_obj->IsWithinDistInMap(u, i_range)
&& !i_funit->IsFriendlyTo(u)
&& u->isVisibleForOrDetect(i_funit, false);
&& u->canSeeOrDetect(i_funit);
}
private:
WorldObject const* i_obj;
@@ -871,7 +874,7 @@ namespace Trinity
bool operator()(Unit* u)
{
if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false))
!i_funit->IsFriendlyTo(u) && u->canSeeOrDetect(i_funit))
{
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true;
@@ -957,10 +960,12 @@ namespace Trinity
bool operator()(Unit* u) { return !u->isAlive(); }
};
/*
struct AnyStealthedCheck
{
bool operator()(Unit* u) { return u->GetVisibility() == VISIBILITY_GROUP_STEALTH; }
};
*/
// Creature checks
@@ -1002,6 +1007,9 @@ namespace Trinity
if (!me->IsWithinDistInMap(u, m_range))
return false;
if (!me->canSeeOrDetect(u))
return false;
if (m_force)
{
if (!me->canAttack(u))
@@ -42,8 +42,8 @@ Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
inline void
Trinity::ObjectUpdater::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
if (iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->getSource()->IsInWorld())
iter->getSource()->Update(i_timeDiff);
}
@@ -103,8 +103,6 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
Cell cell(cell_pair);
obj->SetCurrentCell(cell);
if (obj->isSpiritService())
obj->setDeathState(DEAD);
}
template <class T>