2008-10-02 16:23:55 -05:00
|
|
|
/*
|
2009-02-04 12:42:26 +01:00
|
|
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
2008-10-14 11:57:03 -05:00
|
|
|
*
|
2010-01-16 20:19:18 +03:00
|
|
|
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
2008-10-02 16:23:55 -05:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-10-14 11:57:03 -05:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2008-10-02 16:23:55 -05:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
2008-10-14 11:57:03 -05:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2008-10-02 16:23:55 -05:00
|
|
|
*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-14 11:57:03 -05:00
|
|
|
#ifndef TRINITY_GRIDNOTIFIERSIMPL_H
|
|
|
|
|
#define TRINITY_GRIDNOTIFIERSIMPL_H
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
#include "GridNotifiers.h"
|
|
|
|
|
#include "WorldPacket.h"
|
|
|
|
|
#include "Corpse.h"
|
|
|
|
|
#include "Player.h"
|
|
|
|
|
#include "UpdateData.h"
|
|
|
|
|
#include "CreatureAI.h"
|
|
|
|
|
#include "SpellAuras.h"
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-12-19 10:12:40 +01:00
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
|
inline void
|
|
|
|
|
Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
|
|
|
|
|
{
|
2010-04-07 19:12:44 +02:00
|
|
|
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
2009-12-19 10:12:40 +01:00
|
|
|
{
|
|
|
|
|
vis_guids.erase(iter->getSource()->GetGUID());
|
2010-02-27 15:25:14 +02:00
|
|
|
i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_visibleNow);
|
2009-12-19 10:12:40 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
inline void
|
2008-10-14 11:57:03 -05:00
|
|
|
Trinity::ObjectUpdater::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
|
2008-10-02 16:23:55 -05:00
|
|
|
iter->getSource()->Update(i_timeDiff);
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
// SEARCHERS & LIST SEARCHERS & WORKERS
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
// WorldObject searchers & workers
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-01-31 16:38:50 -06:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
// Gameobject searchers
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
i_object = itr->getSource();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
// Unit searchers
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
i_object = itr->getSource();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
i_object = itr->getSource();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
|
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
// Creature searchers
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
i_object = itr->getSource();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
2010-04-07 22:59:46 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2009-01-31 16:38:50 -06:00
|
|
|
i_objects.push_back(itr->getSource());
|
2008-10-02 16:23:55 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-05-29 00:18:41 -05:00
|
|
|
template<class Check>
|
|
|
|
|
void Trinity::PlayerListSearcher<Check>::Visit(PlayerMapType &m)
|
|
|
|
|
{
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr->getSource()->InSamePhase(i_phaseMask))
|
2010-04-07 22:59:46 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2009-05-29 00:18:41 -05:00
|
|
|
i_objects.push_back(itr->getSource());
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-02 16:23:55 -05:00
|
|
|
template<class Check>
|
2008-10-14 11:57:03 -05:00
|
|
|
void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
// already found
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_object)
|
2008-10-02 16:23:55 -05:00
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
2009-01-31 16:38:50 -06:00
|
|
|
continue;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_check(itr->getSource()))
|
2008-10-02 16:23:55 -05:00
|
|
|
{
|
|
|
|
|
i_object = itr->getSource();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
template<class Builder>
|
2010-04-07 22:59:46 +02:00
|
|
|
void Trinity::LocalizedPacketDo<Builder>::operator()(Player* p)
|
2009-02-21 17:00:47 -06:00
|
|
|
{
|
2009-05-17 10:09:06 -05:00
|
|
|
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
2009-02-21 17:00:47 -06:00
|
|
|
uint32 cache_idx = loc_idx+1;
|
|
|
|
|
WorldPacket* data;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
// create if not cached yet
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx])
|
2009-02-21 17:00:47 -06:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_data_cache.size() < cache_idx+1)
|
2009-02-21 17:00:47 -06:00
|
|
|
i_data_cache.resize(cache_idx+1);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
i_builder(*data,loc_idx);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
i_data_cache[cache_idx] = data;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
data = i_data_cache[cache_idx];
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-02-21 17:00:47 -06:00
|
|
|
p->SendDirectMessage(data);
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-03-09 17:00:31 -06:00
|
|
|
template<class Builder>
|
2010-04-07 22:59:46 +02:00
|
|
|
void Trinity::LocalizedPacketListDo<Builder>::operator()(Player* p)
|
2009-03-09 17:00:31 -06:00
|
|
|
{
|
2009-05-17 10:09:06 -05:00
|
|
|
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
2009-03-09 17:00:31 -06:00
|
|
|
uint32 cache_idx = loc_idx+1;
|
|
|
|
|
WorldPacketList* data_list;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-03-09 17:00:31 -06:00
|
|
|
// create if not cached yet
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
|
2009-03-09 17:00:31 -06:00
|
|
|
{
|
2010-04-07 19:14:10 +02:00
|
|
|
if (i_data_cache.size() < cache_idx+1)
|
2009-03-09 17:00:31 -06:00
|
|
|
i_data_cache.resize(cache_idx+1);
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-03-09 17:00:31 -06:00
|
|
|
data_list = &i_data_cache[cache_idx];
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-03-09 17:00:31 -06:00
|
|
|
i_builder(*data_list,loc_idx);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
data_list = &i_data_cache[cache_idx];
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 16:20:24 -07:00
|
|
|
for (size_t i = 0; i < data_list->size(); ++i)
|
2009-03-09 17:00:31 -06:00
|
|
|
p->SendDirectMessage((*data_list)[i]);
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-02-05 00:31:28 +01:00
|
|
|
#endif // TRINITY_GRIDNOTIFIERSIMPL_H
|