Exemple #1
0
void
MessageDistDeliverer::Visit(CreatureMapType &m)
{
    for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
    {
        if (!iter->getSource()->InSamePhase(i_phaseMask))
            continue;

        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 MessageDistDeliverer::Visit(CreatureMapType &m)
{
    for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
    {
        Creature* target = iter->GetSource();
        if (!target->IsInPhase(i_source))
            continue;

        if (target->GetExactDist2dSq(i_source) > i_distSq)
            continue;

        // Send packet to all who are sharing the creature's vision
        if (target->HasSharedVision())
        {
            SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
            for (; i != target->GetSharedVisionList().end(); ++i)
                if ((*i)->m_seer == target)
                    SendPacket(*i);
        }
    }
}
void ObjectGridRespawnMover::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->GetRespawnCoord(resp_x, resp_y, resp_z);
		CellPair resp_val = Trinity::ComputeCellPair(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
		}
	}
}
Exemple #4
0
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 (i_data.IsFull())
        {
            WorldPacket packet;
            i_data.BuildPacket(&packet);
            i_player.GetSession()->SendPacket(&packet);
            i_data = UpdateData(i_player.GetMapId());
        }

        if (relocated_for_ai && !c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
            CreatureUnitRelocationWorker(c, &i_player);
    }
}
Exemple #5
0
void DynamicObjectUpdater::Visit(CreatureMapType &m)
{
    for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
        VisitHelper(itr->getSource());
}
void
ObjectGridCleaner::Visit(CreatureMapType &m)
{
    for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
        iter->getSource()->CleanupsBeforeDelete();
}