void VisibleChangesNotifier::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->GetSource()->HasSharedVision()) for (SharedVisionList::const_iterator i = iter->GetSource()->GetSharedVisionList().begin(); i != iter->GetSource()->GetSharedVisionList().end(); ++i) if ((*i)->m_seer == iter->GetSource()) (*i)->UpdateVisibilityOf(&i_object); }
void ObjectGridStoper::Visit(CreatureMapType &m) { // stop any fights at grid de-activation and remove dynobjects created at cast by creatures for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { iter->GetSource()->RemoveAllDynObjects(); if (iter->GetSource()->IsInCombat()) { iter->GetSource()->CombatStop(); iter->GetSource()->DeleteThreatList(); iter->GetSource()->AI()->EnterEvadeMode(); } } }
void ObjectGridEvacuator::Visit(CreatureMapType &m) { // creature in unloading grid can have respawn point in another grid // if it will be unloaded then it will not respawn in original grid until unload/load original grid // move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn. for (CreatureMapType::iterator iter = m.begin(); iter != m.end();) { Creature* c = iter->GetSource(); ++iter; ASSERT(!c->IsPet() && "ObjectGridRespawnMover don't must be called for pets"); Cell const& cur_cell = c->GetCurrentCell(); float resp_x, resp_y, resp_z; c->GetRespawnPosition(resp_x, resp_y, resp_z); CellCoord resp_val = Oregon::ComputeCellCoord(resp_x, resp_y); Cell resp_cell(resp_val); if (cur_cell.DiffGrid(resp_cell)) { c->GetMap()->CreatureRespawnRelocation(c); // false result ignored: will be unload with other creatures at grid } } }
void MessageDistDeliverer::Visit(CreatureMapType& m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { if (iter->GetSource()->GetExactDist2dSq(i_source) > i_distSq) continue; // Send packet to all who are sharing the creature's vision if (!iter->GetSource()->GetSharedVisionList().empty()) { SharedVisionList::const_iterator i = iter->GetSource()->GetSharedVisionList().begin(); for (; i != iter->GetSource()->GetSharedVisionList().end(); ++i) if ((*i)->m_seer == iter->GetSource()) SendPacket(*i); } } }
void AIRelocationNotifier::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); CreatureUnitRelocationWorker(c, &i_unit); if (isCreature) CreatureUnitRelocationWorker((Creature*)&i_unit, c); } }
void ObjectGridEvacuator::Visit(CreatureMapType &m) { // creature in unloading grid can have respawn point in another grid // if it will be unloaded then it will not respawn in original grid until unload/load original grid // move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn. for (CreatureMapType::iterator iter = m.begin(); iter != m.end();) { Creature* c = iter->GetSource(); ++iter; ASSERT(!c->IsPet() && "ObjectGridRespawnMover must not be called for pets"); c->GetMap()->CreatureRespawnRelocation(c, true); } }
void CreatureRelocationNotifier::Visit(CreatureMapType &m) { if (!i_creature.IsAlive()) return; for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); CreatureUnitRelocationWorker(&i_creature, c); if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) CreatureUnitRelocationWorker(c, &i_creature); } }
void AIRelocationNotifier::Visit(CreatureMapType &m) { bool self = isCreature && !((Creature*)(&i_unit))->IsMoveInLineOfSightStrictlyDisabled(); for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); // NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION does not guarantee that unit will do it itself (because distance is also checked), but screw it, it's not that important if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION) && !c->IsMoveInLineOfSightStrictlyDisabled()) CreatureUnitRelocationWorker(c, &i_unit); if (self) CreatureUnitRelocationWorker((Creature*)&i_unit, c); } }
void PlayerRelocationNotifier::Visit(CreatureMapType& m) { bool relocated_for_ai = (&i_player == i_player.m_seer); for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); vis_guids.erase(c->GetGUID()); i_player.UpdateVisibilityOf(c, i_data, i_visibleNow); if (relocated_for_ai && !c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) CreatureUnitRelocationWorker(c, &i_player); } }
void DelayedUnitRelocation::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* unit = iter->GetSource(); if (!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) continue; CreatureRelocationNotifier relocate(*unit); TypeContainerVisitor<CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocate); TypeContainerVisitor<CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocate); cell.Visit(p, c2world_relocation, i_map, *unit, i_radius); cell.Visit(p, c2grid_relocation, i_map, *unit, i_radius); } }
void MessageDistDelivererToHostile::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* target = iter->GetSource(); if (!target->HasSharedVision() || !target->InSamePhase(i_phaseMask)) continue; if (target->GetExactDist2dSq(i_source) > i_distSq) continue; // Send packet to all who are sharing the creature's vision SharedVisionList::const_iterator i = target->GetSharedVisionList().begin(); for (; i != target->GetSharedVisionList().end(); ++i) if ((*i)->m_seer == target) SendPacket(*i); } }
void CreatureRelocationNotifier::Visit(CreatureMapType& m) { if (!i_creature.IsAlive()) return; for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); //check distance to improve performance if (!i_creature._IsWithinDist(c, i_radius, true)) continue; CreatureUnitRelocationWorker(&i_creature, c); if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) CreatureUnitRelocationWorker(c, &i_creature); } }
void DynamicObjectUpdater::Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) VisitHelper(itr->GetSource()); }