TrinityCore
GridNotifiers.h
Go to the documentation of this file.
1 /*
2  * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRINITY_GRIDNOTIFIERS_H
19 #define TRINITY_GRIDNOTIFIERS_H
20 
21 #include "AreaTrigger.h"
22 #include "Creature.h"
23 #include "Corpse.h"
24 #include "Conversation.h"
25 #include "DynamicObject.h"
26 #include "GameObject.h"
27 #include "Packet.h"
28 #include "Player.h"
29 #include "SceneObject.h"
30 #include "Spell.h"
31 #include "SpellInfo.h"
32 #include "UnitAI.h"
33 #include "UpdateData.h"
34 
35 namespace Trinity
36 {
38  {
41  std::set<Unit*> i_visibleNow;
43 
44  VisibleNotifier(Player &player) : i_player(player), i_data(player.GetMapId()), vis_guids(player.m_clientGUIDs) { }
45  template<class T> void Visit(GridRefManager<T> &m);
46  void SendToSelf(void);
47  };
48 
50  {
52 
53  explicit VisibleChangesNotifier(IteratorPair<WorldObject**> objects) : i_objects(objects) { }
54  template<class T> void Visit(GridRefManager<T> &) { }
55  void Visit(PlayerMapType &);
56  void Visit(CreatureMapType &);
57  void Visit(DynamicObjectMapType &);
58  };
59 
61  {
63 
64  template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
65  void Visit(CreatureMapType &);
66  void Visit(PlayerMapType &);
67  };
68 
70  {
72  CreatureRelocationNotifier(Creature &c) : i_creature(c) { }
73  template<class T> void Visit(GridRefManager<T> &) { }
74  void Visit(CreatureMapType &);
75  void Visit(PlayerMapType &);
76  };
77 
79  {
83  const float i_radius;
84  DelayedUnitRelocation(Cell &c, CellCoord &pair, Map &map, float radius) :
85  i_map(map), cell(c), p(pair), i_radius(radius) { }
86  template<class T> void Visit(GridRefManager<T> &) { }
87  void Visit(CreatureMapType &);
88  void Visit(PlayerMapType &);
89  };
90 
92  {
94  bool isCreature;
95  explicit AIRelocationNotifier(Unit &unit) : i_unit(unit), isCreature(unit.GetTypeId() == TYPEID_UNIT) { }
96  template<class T> void Visit(GridRefManager<T> &) { }
97  void Visit(CreatureMapType &);
98  };
99 
100  struct GridUpdater
101  {
104  GridUpdater(GridType &grid, uint32 diff) : i_grid(grid), i_timeDiff(diff) { }
105 
106  template<class T> void updateObjects(GridRefManager<T> &m)
107  {
108  for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
109  iter->GetSource()->Update(i_timeDiff);
110  }
111 
112  void Visit(PlayerMapType &m) { updateObjects<Player>(m); }
113  void Visit(CreatureMapType &m){ updateObjects<Creature>(m); }
114  void Visit(GameObjectMapType &m) { updateObjects<GameObject>(m); }
115  void Visit(DynamicObjectMapType &m) { updateObjects<DynamicObject>(m); }
116  void Visit(CorpseMapType &m) { updateObjects<Corpse>(m); }
117  void Visit(AreaTriggerMapType &m) { updateObjects<AreaTrigger>(m); }
118  void Visit(SceneObjectMapType &m) { updateObjects<SceneObject>(m); }
119  void Visit(ConversationMapType &m) { updateObjects<Conversation>(m); }
120  };
121 
123  {
125 
126  PacketSenderRef(WorldPacket const* message) : Data(message) { }
127 
128  void operator()(Player const* player) const
129  {
130  player->SendDirectMessage(Data);
131  }
132  };
133 
134  template<typename Packet>
136  {
137  Packet Data;
138 
139  void operator()(Player const* player) const
140  {
141  player->SendDirectMessage(Data.GetRawPacket());
142  }
143  };
144 
145  template<typename PacketSender>
147  {
149  PacketSender& i_packetSender;
150  float i_distSq;
153  MessageDistDeliverer(WorldObject const* src, PacketSender& packetSender, float dist, bool own_team_only = false, Player const* skipped = nullptr)
154  : i_source(src), i_packetSender(packetSender), i_distSq(dist * dist)
155  , team(TEAM_OTHER)
156  , skipped_receiver(skipped)
157  {
158  if (own_team_only)
159  if (Player const* player = src->ToPlayer())
160  team = player->GetEffectiveTeam();
161  }
162 
163  void Visit(PlayerMapType &m) const;
164  void Visit(CreatureMapType &m) const;
165  void Visit(DynamicObjectMapType &m) const;
166  template<class SKIP> void Visit(GridRefManager<SKIP> &) const { }
167 
168  void SendPacket(Player const* player) const
169  {
170  // never send packet to self
171  if (player == i_source || (team && player->GetEffectiveTeam() != team) || skipped_receiver == player)
172  return;
173 
174  if (!player->HaveAtClient(i_source))
175  return;
176 
177  i_packetSender(player);
178  }
179  };
180 
181  template<typename PacketSender>
183  {
185  PacketSender& i_packetSender;
186  float i_distSq;
187 
188  MessageDistDelivererToHostile(Unit* src, PacketSender& packetSender, float dist)
189  : i_source(src), i_packetSender(packetSender), i_distSq(dist * dist)
190  {
191  }
192 
193  void Visit(PlayerMapType &m) const;
194  void Visit(CreatureMapType &m) const;
195  void Visit(DynamicObjectMapType &m) const;
196  template<class SKIP> void Visit(GridRefManager<SKIP> &) const { }
197 
198  void SendPacket(Player const* player) const
199  {
200  // never send packet to self
201  if (player == i_source || !player->HaveAtClient(i_source) || player->IsFriendlyTo(i_source))
202  return;
203 
204  i_packetSender(player);
205  }
206  };
207 
209  {
211  explicit ObjectUpdater(const uint32 diff) : i_timeDiff(diff) { }
212  template<class T> void Visit(GridRefManager<T> &m);
213  void Visit(PlayerMapType &) { }
214  void Visit(CorpseMapType &) { }
215  };
216 
217  // SEARCHERS & LIST SEARCHERS & WORKERS
218 
219  // WorldObject searchers & workers
220 
221  // Generic base class to insert elements into arbitrary containers using push_back
222  template<typename Type>
224  {
225  using InserterType = void(*)(void*, Type&&);
226 
227  void* ref;
229 
230  protected:
231  template<typename T>
232  ContainerInserter(T& ref_) : ref(&ref_)
233  {
234  inserter = [](void* containerRaw, Type&& object)
235  {
236  T* container = reinterpret_cast<T*>(containerRaw);
237  container->insert(container->end(), std::move(object));
238  };
239  }
240 
241  void Insert(Type object)
242  {
243  inserter(ref, std::move(object));
244  }
245  };
246 
247  template<class Check>
249  {
252  Check &i_check;
254 
255  WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
256  : _searcher(searcher), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) { }
257 
258  void Visit(GameObjectMapType &m);
259  void Visit(PlayerMapType &m);
260  void Visit(CreatureMapType &m);
261  void Visit(CorpseMapType &m);
262  void Visit(DynamicObjectMapType &m);
263  void Visit(AreaTriggerMapType &m);
264  void Visit(SceneObjectMapType &m);
265  void Visit(ConversationMapType &m);
266 
267  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
268  };
269 
270  template<class Check>
272  {
275  Check &i_check;
277 
278  WorldObjectLastSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
279  : _searcher(searcher), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) { }
280 
281  void Visit(GameObjectMapType &m);
282  void Visit(PlayerMapType &m);
283  void Visit(CreatureMapType &m);
284  void Visit(CorpseMapType &m);
285  void Visit(DynamicObjectMapType &m);
286  void Visit(AreaTriggerMapType &m);
287  void Visit(SceneObjectMapType &m);
288  void Visit(ConversationMapType &m);
289 
290  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
291  };
292 
293  template<class Check>
295  {
298  Check& i_check;
299 
300  template<typename Container>
301  WorldObjectListSearcher(WorldObject const* searcher, Container& container, Check & check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
302  : ContainerInserter<WorldObject*>(container),
303  i_mapTypeMask(mapTypeMask), _searcher(searcher), i_check(check) { }
304 
305  void Visit(PlayerMapType &m);
306  void Visit(CreatureMapType &m);
307  void Visit(CorpseMapType &m);
308  void Visit(GameObjectMapType &m);
309  void Visit(DynamicObjectMapType &m);
310  void Visit(AreaTriggerMapType &m);
311  void Visit(SceneObjectMapType &m);
312  void Visit(ConversationMapType &m);
313 
314  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
315  };
316 
317  template<class Do>
319  {
322  Do const& i_do;
323 
324  WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
325  : i_mapTypeMask(mapTypeMask), _searcher(searcher), i_do(_do) { }
326 
328  {
329  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
330  return;
331  for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
332  if (itr->GetSource()->IsInPhase(_searcher))
333  i_do(itr->GetSource());
334  }
335 
337  {
338  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
339  return;
340  for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
341  if (itr->GetSource()->IsInPhase(_searcher))
342  i_do(itr->GetSource());
343  }
345  {
346  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
347  return;
348  for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
349  if (itr->GetSource()->IsInPhase(_searcher))
350  i_do(itr->GetSource());
351  }
352 
354  {
355  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
356  return;
357  for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
358  if (itr->GetSource()->IsInPhase(_searcher))
359  i_do(itr->GetSource());
360  }
361 
363  {
364  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
365  return;
366  for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
367  if (itr->GetSource()->IsInPhase(_searcher))
368  i_do(itr->GetSource());
369  }
370 
372  {
373  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_AREATRIGGER))
374  return;
375  for (AreaTriggerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
376  if (itr->GetSource()->IsInPhase(_searcher))
377  i_do(itr->GetSource());
378  }
379 
381  {
382  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_SCENEOBJECT))
383  return;
384  for (SceneObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
385  if (itr->GetSource()->IsInPhase(_searcher))
386  i_do(itr->GetSource());
387  }
388 
390  {
391  if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CONVERSATION))
392  return;
393  for (ConversationMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
394  if (itr->GetSource()->IsInPhase(_searcher))
395  i_do(itr->GetSource());
396  }
397 
398  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
399  };
400 
401  // Gameobject searchers
402 
403  template<class Check>
405  {
408  Check &i_check;
409 
410  GameObjectSearcher(WorldObject const* searcher, GameObject* & result, Check& check)
411  : _searcher(searcher), i_object(result), i_check(check) { }
412 
413  void Visit(GameObjectMapType &m);
414 
415  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
416  };
417 
418  // Last accepted by Check GO if any (Check can change requirements at each call)
419  template<class Check>
421  {
424  Check& i_check;
425 
426  GameObjectLastSearcher(WorldObject const* searcher, GameObject* & result, Check& check)
427  : _searcher(searcher), i_object(result), i_check(check) { }
428 
429  void Visit(GameObjectMapType &m);
430 
431  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
432  };
433 
434  template<class Check>
436  {
438  Check& i_check;
439 
440  template<typename Container>
441  GameObjectListSearcher(WorldObject const* searcher, Container& container, Check & check)
442  : ContainerInserter<GameObject*>(container),
443  _searcher(searcher), i_check(check) { }
444 
445  void Visit(GameObjectMapType &m);
446 
447  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
448  };
449 
450  template<class Functor>
452  {
453  GameObjectWorker(WorldObject const* searcher, Functor& func)
454  : _func(func), _searcher(searcher) { }
455 
457  {
458  for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
459  if (itr->GetSource()->IsInPhase(_searcher))
460  _func(itr->GetSource());
461  }
462 
463  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
464 
465  private:
466  Functor& _func;
468  };
469 
470  // Unit searchers
471 
472  // First accepted by Check Unit if any
473  template<class Check>
475  {
478  Check & i_check;
479 
480  UnitSearcher(WorldObject const* searcher, Unit* & result, Check & check)
481  : _searcher(searcher), i_object(result), i_check(check) { }
482 
483  void Visit(CreatureMapType &m);
484  void Visit(PlayerMapType &m);
485 
486  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
487  };
488 
489  // Last accepted by Check Unit if any (Check can change requirements at each call)
490  template<class Check>
492  {
495  Check & i_check;
496 
497  UnitLastSearcher(WorldObject const* searcher, Unit* & result, Check & check)
498  : _searcher(searcher), i_object(result), i_check(check) { }
499 
500  void Visit(CreatureMapType &m);
501  void Visit(PlayerMapType &m);
502 
503  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
504  };
505 
506  // All accepted by Check units if any
507  template<class Check>
509  {
511  Check& i_check;
512 
513  template<typename Container>
514  UnitListSearcher(WorldObject const* searcher, Container& container, Check& check)
515  : ContainerInserter<Unit*>(container),
516  _searcher(searcher), i_check(check) { }
517 
518  void Visit(PlayerMapType &m);
519  void Visit(CreatureMapType &m);
520 
521  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
522  };
523 
524  // Creature searchers
525 
526  template<class Check>
528  {
531  Check & i_check;
532 
533  CreatureSearcher(WorldObject const* searcher, Creature* & result, Check & check)
534  : _searcher(searcher), i_object(result), i_check(check) { }
535 
536  void Visit(CreatureMapType &m);
537 
538  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
539  };
540 
541  // Last accepted by Check Creature if any (Check can change requirements at each call)
542  template<class Check>
544  {
547  Check & i_check;
548 
549  CreatureLastSearcher(WorldObject const* searcher, Creature* & result, Check & check)
550  : _searcher(searcher), i_object(result), i_check(check) { }
551 
552  void Visit(CreatureMapType &m);
553 
554  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
555  };
556 
557  template<class Check>
559  {
561  Check& i_check;
562 
563  template<typename Container>
564  CreatureListSearcher(WorldObject const* searcher, Container& container, Check & check)
565  : ContainerInserter<Creature*>(container),
566  _searcher(searcher), i_check(check) { }
567 
568  void Visit(CreatureMapType &m);
569 
570  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
571  };
572 
573  template<class Do>
575  {
577  Do& i_do;
578 
579  CreatureWorker(WorldObject const* searcher, Do& _do)
580  : _searcher(searcher), i_do(_do) { }
581 
583  {
584  for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
585  if (itr->GetSource()->IsInPhase(_searcher))
586  i_do(itr->GetSource());
587  }
588 
589  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
590  };
591 
592  // Player searchers
593 
594  template<class Check>
596  {
599  Check & i_check;
600 
601  PlayerSearcher(WorldObject const* searcher, Player* & result, Check & check)
602  : _searcher(searcher), i_object(result), i_check(check) { }
603 
604  void Visit(PlayerMapType &m);
605 
606  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
607  };
608 
609  template<class Check>
611  {
613  Check& i_check;
614 
615  template<typename Container>
616  PlayerListSearcher(WorldObject const* searcher, Container& container, Check & check)
617  : ContainerInserter<Player*>(container),
618  _searcher(searcher), i_check(check) { }
619 
620  void Visit(PlayerMapType &m);
621 
622  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
623  };
624 
625  template<class Check>
627  {
630  Check& i_check;
631 
632  PlayerLastSearcher(WorldObject const* searcher, Player*& result, Check& check) : _searcher(searcher), i_object(result), i_check(check)
633  {
634  }
635 
636  void Visit(PlayerMapType& m);
637 
638  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
639  };
640 
641  template<class Do>
643  {
645  Do& i_do;
646 
647  PlayerWorker(WorldObject const* searcher, Do& _do)
648  : _searcher(searcher), i_do(_do) { }
649 
651  {
652  for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
653  if (itr->GetSource()->IsInPhase(_searcher))
654  i_do(itr->GetSource());
655  }
656 
657  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
658  };
659 
660  template<class Do>
662  {
664  float i_dist;
665  Do& i_do;
666 
667  PlayerDistWorker(WorldObject const* searcher, float _dist, Do& _do)
668  : i_searcher(searcher), i_dist(_dist), i_do(_do) { }
669 
671  {
672  for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
673  if (itr->GetSource()->IsInPhase(i_searcher) && itr->GetSource()->IsWithinDist(i_searcher, i_dist))
674  i_do(itr->GetSource());
675  }
676 
677  template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) { }
678  };
679 
680  // CHECKS && DO classes
681 
682  // WorldObject check classes
683 
685  {
686  public:
687  AnyDeadUnitObjectInRangeCheck(WorldObject* searchObj, float range) : i_searchObj(searchObj), i_range(range) { }
688  bool operator()(Player* u);
689  bool operator()(Corpse* u);
690  bool operator()(Creature* u);
691  template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
692  protected:
693  WorldObject const* const i_searchObj;
694  float i_range;
695  };
696 
698  {
699  public:
700  AnyDeadUnitSpellTargetInRangeCheck(WorldObject* searchObj, float range, SpellInfo const* spellInfo, SpellTargetCheckTypes check, SpellTargetObjectTypes objectType)
701  : AnyDeadUnitObjectInRangeCheck(searchObj, range), WorldObjectSpellTargetCheck(searchObj, searchObj, spellInfo, check, nullptr, objectType)
702  { }
703  bool operator()(Player* u);
704  bool operator()(Corpse* u);
705  bool operator()(Creature* u);
706  template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
707  };
708 
709  // WorldObject do classes
710 
711  class RespawnDo
712  {
713  public:
714  RespawnDo() { }
715  void operator()(Creature* u) const { u->Respawn(); }
716  void operator()(GameObject* u) const { u->Respawn(); }
717  void operator()(WorldObject*) const { }
718  void operator()(Corpse*) const { }
719  };
720 
721  // GameObject checks
722 
724  {
725  public:
726  GameObjectFocusCheck(WorldObject const* caster, uint32 focusId) : _caster(caster), _focusId(focusId) { }
727 
728  bool operator()(GameObject* go) const
729  {
730  if (go->GetGOInfo()->GetSpellFocusType() != _focusId)
731  return false;
732 
733  if (!go->isSpawned())
734  return false;
735 
736  float const dist = go->GetGOInfo()->GetSpellFocusRadius();
737  return go->IsWithinDistInMap(_caster, dist);
738  }
739 
740  private:
743  };
744 
745  // Find the nearest Fishing hole and return true only if source object is in range of hole
747  {
748  public:
749  NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) { }
750 
752  {
753  if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishingHole.radius))
754  {
755  i_range = i_obj.GetDistance(go);
756  return true;
757  }
758  return false;
759  }
760 
761  private:
763  float i_range;
764 
765  // prevent clone
767  };
768 
770  {
771  public:
772  NearestGameObjectCheck(WorldObject const& obj) : i_obj(obj), i_range(999.f) { }
773 
775  {
776  if (i_obj.IsWithinDistInMap(go, i_range))
777  {
778  i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
779  return true;
780  }
781  return false;
782  }
783 
784  private:
786  float i_range;
787 
788  // prevent clone this object
790  };
791 
792  // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
794  {
795  public:
796  NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range, bool spawnedOnly = true) : i_obj(obj), i_entry(entry), i_range(range), i_spawnedOnly(spawnedOnly) { }
797 
799  {
800  if ((!i_spawnedOnly || go->isSpawned()) && go->GetEntry() == i_entry && go->GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(go, i_range))
801  {
802  i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
803  return true;
804  }
805  return false;
806  }
807 
808  private:
811  float i_range;
813 
814  // prevent clone this object
816  };
817 
818  // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest unspawned GO)
820  {
821  public:
822  NearestUnspawnedGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) { }
823 
825  {
826  if (!go->isSpawned() && go->GetEntry() == i_entry && go->GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(go, i_range))
827  {
828  i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
829  return true;
830  }
831  return false;
832  }
833 
834  private:
837  float i_range;
838 
839  // prevent clone this object
841  };
842 
843  // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO with a certain type)
845  {
846  public:
847  NearestGameObjectTypeInObjectRangeCheck(WorldObject const& obj, GameobjectTypes type, float range) : i_obj(obj), i_type(type), i_range(range) { }
848 
850  {
851  if (go->GetGoType() == i_type && i_obj.IsWithinDistInMap(go, i_range))
852  {
853  i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
854  return true;
855  }
856  return false;
857  }
858 
859  private:
862  float i_range;
863 
864  // prevent clone this object
866  };
867 
868  // Unit checks
869 
871  {
872  public:
873  MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) { }
874 
875  bool operator()(Unit* u)
876  {
877  if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
878  {
879  i_hp = u->GetMaxHealth() - u->GetHealth();
880  return true;
881  }
882  return false;
883  }
884 
885  private:
886  Unit const* i_obj;
887  float i_range;
889  };
890 
892  {
893  public:
894  MostHPPercentMissingInRange(Unit const* obj, float range, uint32 minHpPct, uint32 maxHpPct) : i_obj(obj), i_range(range), i_minHpPct(minHpPct), i_maxHpPct(maxHpPct), i_hpPct(101.f) { }
895 
896  bool operator()(Unit* u)
897  {
898  if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && i_minHpPct <= u->GetHealthPct() && u->GetHealthPct() <= i_maxHpPct && u->GetHealthPct() < i_hpPct)
899  {
900  i_hpPct = u->GetHealthPct();
901  return true;
902  }
903  return false;
904  }
905 
906  private:
907  Unit const* i_obj;
908  float i_range;
909  float i_minHpPct, i_maxHpPct, i_hpPct;
910  };
911 
913  {
914  public:
915  FriendlyBelowHpPctEntryInRange(Unit const* obj, uint32 entry, float range, uint8 pct, bool excludeSelf) : i_obj(obj), i_entry(entry), i_range(range), i_pct(pct), i_excludeSelf(excludeSelf) { }
916 
917  bool operator()(Unit* u)
918  {
919  if (i_excludeSelf && i_obj->GetGUID() == u->GetGUID())
920  return false;
921  if (u->GetEntry() == i_entry && u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->HealthBelowPct(i_pct))
922  return true;
923  return false;
924  }
925 
926  private:
927  Unit const* i_obj;
929  float i_range;
932  };
933 
935  {
936  public:
937  FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) { }
938 
939  bool operator()(Unit* u) const
940  {
941  if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
943  {
944  return true;
945  }
946  return false;
947  }
948 
949  private:
950  Unit const* i_obj;
951  float i_range;
952  };
953 
955  {
956  public:
957  FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) { }
958 
959  bool operator()(Unit* u) const
960  {
961  if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && !u->HasAura(i_spell))
962  return true;
963 
964  return false;
965  }
966 
967  private:
968  Unit const* i_obj;
969  float i_range;
971  };
972 
974  {
975  public:
976  AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
977 
978  bool operator()(Unit* u) const
979  {
980  if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
981  return true;
982 
983  return false;
984  }
985 
986  private:
988  Unit const* i_funit;
989  float i_range;
990  };
991 
993  {
994  public:
995  NearestAttackableNoTotemUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) { }
996 
997  bool operator()(Unit* u)
998  {
999  if (!u->IsAlive())
1000  return false;
1001 
1003  return false;
1004 
1005  if (u->GetTypeId() == TYPEID_UNIT && u->ToCreature()->IsTotem())
1006  return false;
1007 
1008  if (!u->isTargetableForAttack(false))
1009  return false;
1010 
1011  if (!i_obj->IsWithinDistInMap(u, i_range) || !i_obj->IsValidAttackTarget(u))
1012  return false;
1013 
1014  i_range = i_obj->GetDistance(*u);
1015  return true;
1016  }
1017 
1018  private:
1020  float i_range;
1021  };
1022 
1024  {
1025  public:
1026  AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false, bool incOwnRadius = true, bool incTargetRadius = true)
1027  : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly), i_incOwnRadius(incOwnRadius), i_incTargetRadius(incTargetRadius) { }
1028 
1029  bool operator()(Unit* u) const
1030  {
1031  if (!u->IsAlive())
1032  return false;
1033 
1034  float searchRadius = i_range;
1035  if (i_incOwnRadius)
1036  searchRadius += i_obj->GetCombatReach();
1037  if (i_incTargetRadius)
1038  searchRadius += u->GetCombatReach();
1039 
1040  if (!u->IsInMap(i_obj) || !u->IsInPhase(i_obj) || !u->IsWithinDoubleVerticalCylinder(i_obj, searchRadius, searchRadius))
1041  return false;
1042 
1043  if (!i_funit->IsFriendlyTo(u))
1044  return false;
1045 
1046  return !i_playerOnly || u->GetTypeId() == TYPEID_PLAYER;
1047  }
1048 
1049  private:
1051  Unit const* i_funit;
1052  float i_range;
1056  };
1057 
1059  {
1060  public:
1061  AnyGroupedUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool raid, bool playerOnly = false, bool incOwnRadius = true, bool incTargetRadius = true)
1062  : _source(obj), _refUnit(funit), _range(range), _raid(raid), _playerOnly(playerOnly), i_incOwnRadius(incOwnRadius), i_incTargetRadius(incTargetRadius) { }
1063 
1064  bool operator()(Unit* u) const
1065  {
1066  if (_playerOnly && u->GetTypeId() != TYPEID_PLAYER)
1067  return false;
1068 
1069  if (_raid)
1070  {
1071  if (!_refUnit->IsInRaidWith(u))
1072  return false;
1073  }
1074  else if (!_refUnit->IsInPartyWith(u))
1075  return false;
1076 
1077  if (_refUnit->IsHostileTo(u))
1078  return false;
1079 
1080  if (!u->IsAlive())
1081  return false;
1082 
1083  float searchRadius = _range;
1084  if (i_incOwnRadius)
1085  searchRadius += _source->GetCombatReach();
1086  if (i_incTargetRadius)
1087  searchRadius += u->GetCombatReach();
1088 
1089  return u->IsInMap(_source) && u->IsInPhase(_source) && u->IsWithinDoubleVerticalCylinder(_source, searchRadius, searchRadius);
1090  }
1091 
1092  private:
1094  Unit const* _refUnit;
1095  float _range;
1096  bool _raid;
1100  };
1101 
1103  {
1104  public:
1105  AnyUnitInObjectRangeCheck(WorldObject const* obj, float range, bool check3D = true) : i_obj(obj), i_range(range), i_check3D(check3D) { }
1106 
1107  bool operator()(Unit* u) const
1108  {
1109  if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range, i_check3D))
1110  return true;
1111 
1112  return false;
1113  }
1114 
1115  private:
1117  float i_range;
1119  };
1120 
1121  // Success at unit in range, range update for next check (this can be use with UnitLastSearcher to find nearest unit)
1123  {
1124  public:
1125  NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
1126 
1127  bool operator()(Unit* u)
1128  {
1129  if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
1130  (i_funit->IsInCombatWith(u) || i_funit->IsHostileTo(u)) && i_obj->CanSeeOrDetect(u))
1131  {
1132  i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
1133  return true;
1134  }
1135 
1136  return false;
1137  }
1138 
1139  private:
1141  Unit const* i_funit;
1142  float i_range;
1143 
1144  // prevent clone this object
1146  };
1147 
1149  {
1150  public:
1151  AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, SpellInfo const* spellInfo = nullptr, bool incOwnRadius = true, bool incTargetRadius = true)
1152  : i_obj(obj), i_funit(funit), _spellInfo(spellInfo), i_range(range), i_incOwnRadius(incOwnRadius), i_incTargetRadius(incTargetRadius)
1153  {
1154  }
1155 
1156  bool operator()(Unit* u) const
1157  {
1158  // Check contains checks for: live, uninteractible, non-attackable flags, flight check and GM check, ignore totems
1159  if (u->GetTypeId() == TYPEID_UNIT && u->IsTotem())
1160  return false;
1161 
1162  if (_spellInfo)
1163  {
1164  if (!u->IsPlayer())
1165  {
1166  if (_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_ON_PLAYER))
1167  return false;
1168 
1169  if (_spellInfo->HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER_CONTROLLED_NPC) && u->IsControlledByPlayer())
1170  return false;
1171  }
1172  else if (_spellInfo->HasAttribute(SPELL_ATTR5_NOT_ON_PLAYER))
1173  return false;
1174  }
1175 
1176  if (!i_funit->IsValidAttackTarget(u, _spellInfo))
1177  return false;
1178 
1179  float searchRadius = i_range;
1180  if (i_incOwnRadius)
1181  searchRadius += i_obj->GetCombatReach();
1182  if (i_incTargetRadius)
1183  searchRadius += u->GetCombatReach();
1184 
1185  return u->IsInMap(i_obj) && u->IsInPhase(i_obj) && u->IsWithinDoubleVerticalCylinder(i_obj, searchRadius, searchRadius);
1186  }
1187 
1188  private:
1190  Unit const* i_funit;
1192  float i_range;
1195  };
1196 
1197  // do attack at call of help to friendly crearture
1199  {
1200  public:
1201  CallOfHelpCreatureInRangeDo(Unit* funit, Unit* enemy, float range)
1202  : i_funit(funit), i_enemy(enemy), i_range(range) { }
1203 
1204  void operator()(Creature* u) const
1205  {
1206  if (u == i_funit)
1207  return;
1208 
1209  if (!u->CanAssistTo(i_funit, i_enemy, false))
1210  return;
1211 
1212  // too far
1213  // Don't use combat reach distance, range must be an absolute value, otherwise the chain aggro range will be too big
1214  if (!u->IsWithinDistInMap(i_funit, i_range, true, false, false))
1215  return;
1216 
1217  // only if see assisted creature's enemy
1218  if (!u->IsWithinLOSInMap(i_enemy))
1219  return;
1220 
1221  u->EngageWithTarget(i_enemy);
1222  }
1223  private:
1224  Unit* const i_funit;
1225  Unit* const i_enemy;
1226  float i_range;
1227  };
1228 
1230  {
1231  bool operator()(Unit* u) const
1232  {
1233  return !u->IsAlive();
1234  }
1235  };
1236 
1237  // Creature checks
1238 
1240  {
1241  public:
1242  explicit NearestHostileUnitCheck(Creature const* creature, float dist = 0.f, bool playerOnly = false) : me(creature), i_playerOnly(playerOnly)
1243  {
1244  m_range = (dist == 0.f ? 9999.f : dist);
1245  }
1246 
1247  bool operator()(Unit* u)
1248  {
1249  if (!me->IsWithinDistInMap(u, m_range))
1250  return false;
1251 
1252  if (!me->IsValidAttackTarget(u))
1253  return false;
1254 
1255  if (i_playerOnly && u->GetTypeId() != TYPEID_PLAYER)
1256  return false;
1257 
1258  m_range = me->GetDistance(u); // use found unit range as new range limit for next check
1259  return true;
1260  }
1261 
1262  private:
1263  Creature const* me;
1264  float m_range;
1267  };
1268 
1270  {
1271  public:
1272  explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist = 0.f) : me(creature)
1273  {
1274  m_range = (dist == 0.f ? 9999.f : dist);
1275  m_force = (dist == 0.f ? false : true);
1276  }
1277 
1278  bool operator()(Unit* u)
1279  {
1280  if (!me->IsWithinDistInMap(u, m_range))
1281  return false;
1282 
1283  if (!me->CanSeeOrDetect(u))
1284  return false;
1285 
1286  if (m_force)
1287  {
1288  if (!me->IsValidAttackTarget(u))
1289  return false;
1290  }
1291  else if (!me->CanStartAttack(u, false))
1292  return false;
1293 
1294  m_range = me->GetDistance(u); // use found unit range as new range limit for next check
1295  return true;
1296  }
1297 
1298  private:
1299  Creature const* me;
1300  float m_range;
1301  bool m_force;
1303  };
1304 
1306  {
1307  public:
1308  explicit NearestHostileUnitInAggroRangeCheck(Creature const* creature, bool useLOS = false, bool ignoreCivilians = false) : _me(creature), _useLOS(useLOS), _ignoreCivilians(ignoreCivilians) { }
1309 
1310  bool operator()(Unit* u) const
1311  {
1312  if (!u->IsHostileTo(_me))
1313  return false;
1314 
1315  if (!u->IsWithinDistInMap(_me, _me->GetAggroRange(u)))
1316  return false;
1317 
1318  if (!_me->IsValidAttackTarget(u))
1319  return false;
1320 
1321  if (_useLOS && !u->IsWithinLOSInMap(_me))
1322  return false;
1323 
1324  // pets in aggressive do not attack civilians
1325  if (_ignoreCivilians)
1326  if (Creature* c = u->ToCreature())
1327  if (c->IsCivilian())
1328  return false;
1329 
1330  return true;
1331  }
1332 
1333  private:
1334  Creature const* _me;
1335  bool _useLOS;
1338  };
1339 
1341  {
1342  public:
1343  AnyAssistCreatureInRangeCheck(Unit* funit, Unit* enemy, float range)
1344  : i_funit(funit), i_enemy(enemy), i_range(range) { }
1345 
1346  bool operator()(Creature* u) const
1347  {
1348  if (u == i_funit)
1349  return false;
1350 
1351  if (!u->CanAssistTo(i_funit, i_enemy))
1352  return false;
1353 
1354  // too far
1355  // Don't use combat reach distance, range must be an absolute value, otherwise the chain aggro range will be too big
1356  if (!i_funit->IsWithinDistInMap(u, i_range, true, false, false))
1357  return false;
1358 
1359  // only if see assisted creature
1360  if (!i_funit->IsWithinLOSInMap(u))
1361  return false;
1362 
1363  return true;
1364  }
1365 
1366  private:
1367  Unit* const i_funit;
1368  Unit* const i_enemy;
1369  float i_range;
1370  };
1371 
1373  {
1374  public:
1376  : i_obj(obj), i_enemy(enemy), i_range(range) { }
1377 
1379  {
1380  if (u == i_obj)
1381  return false;
1382  if (!u->CanAssistTo(i_obj, i_enemy))
1383  return false;
1384 
1385  // Don't use combat reach distance, range must be an absolute value, otherwise the chain aggro range will be too big
1386  if (!i_obj->IsWithinDistInMap(u, i_range, true, false, false))
1387  return false;
1388 
1389  if (!i_obj->IsWithinLOSInMap(u))
1390  return false;
1391 
1392  i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
1393  return true;
1394  }
1395 
1396  private:
1397  Creature* const i_obj;
1398  Unit* const i_enemy;
1399  float i_range;
1400 
1401  // prevent clone this object
1403  };
1404 
1405  // Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
1407  {
1408  public:
1409  NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj, uint32 entry, bool alive, float range)
1410  : i_obj(obj), i_entry(entry), i_alive(alive), i_range(range) { }
1411 
1413  {
1414  if (u->getDeathState() != DEAD
1415  && u->GetEntry() == i_entry
1416  && u->IsAlive() == i_alive
1417  && u->GetGUID() != i_obj.GetGUID()
1418  && i_obj.IsWithinDistInMap(u, i_range)
1419  && u->CheckPrivateObjectOwnerVisibility(&i_obj))
1420  {
1421  i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
1422  return true;
1423  }
1424  return false;
1425  }
1426 
1427  private:
1430  bool i_alive;
1431  float i_range;
1432 
1433  // prevent clone this object
1435  };
1436 
1438  {
1439  public:
1440  AnyPlayerInObjectRangeCheck(WorldObject const* obj, float range, bool reqAlive = true) : _obj(obj), _range(range), _reqAlive(reqAlive) { }
1441 
1442  bool operator()(Player* u) const
1443  {
1444  if (_reqAlive && !u->IsAlive())
1445  return false;
1446 
1447  if (!_obj->IsWithinDistInMap(u, _range))
1448  return false;
1449 
1450  return true;
1451  }
1452 
1453  private:
1455  float _range;
1457  };
1458 
1460  {
1461  public:
1462  AnyPlayerInPositionRangeCheck(Position const* pos, float range, bool reqAlive = true) : _pos(pos), _range(range), _reqAlive(reqAlive) { }
1464  {
1465  if (_reqAlive && !u->IsAlive())
1466  return false;
1467 
1468  if (!u->IsWithinDist3d(_pos, _range))
1469  return false;
1470 
1471  return true;
1472  }
1473 
1474  private:
1475  Position const* _pos;
1476  float _range;
1478  };
1479 
1481  {
1482  public:
1483  NearestPlayerInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) { }
1484 
1486  {
1487  if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
1488  {
1489  i_range = i_obj->GetDistance(u);
1490  return true;
1491  }
1492 
1493  return false;
1494  }
1495  private:
1497  float i_range;
1498 
1500  };
1501 
1503  {
1504  public:
1505  AllFriendlyCreaturesInGrid(Unit const* obj) : unit(obj) { }
1506 
1507  bool operator()(Unit* u) const
1508  {
1509  if (u->IsAlive() && u->IsVisible() && u->IsFriendlyTo(unit))
1510  return true;
1511 
1512  return false;
1513  }
1514 
1515  private:
1516  Unit const* unit;
1517  };
1518 
1520  {
1521  public:
1522  AllGameObjectsWithEntryInRange(WorldObject const* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { }
1523 
1524  bool operator()(GameObject* go) const
1525  {
1526  if ((!m_uiEntry || go->GetEntry() == m_uiEntry) && m_pObject->IsWithinDist(go, m_fRange, false))
1527  return true;
1528 
1529  return false;
1530  }
1531 
1532  private:
1535  float m_fRange;
1536  };
1537 
1539  {
1540  public:
1541  AllCreaturesOfEntryInRange(WorldObject const* object, uint32 entry, float maxRange = 0.0f) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { }
1542 
1543  bool operator()(Unit* unit) const
1544  {
1545  if (m_uiEntry)
1546  {
1547  if (unit->GetEntry() != m_uiEntry)
1548  return false;
1549  }
1550 
1551  if (m_fRange)
1552  {
1553  if (m_fRange > 0.0f && !m_pObject->IsWithinDist(unit, m_fRange, false))
1554  return false;
1555  if (m_fRange < 0.0f && m_pObject->IsWithinDist(unit, m_fRange, false))
1556  return false;
1557  }
1558 
1559  return true;
1560  }
1561 
1562  private:
1565  float m_fRange;
1566  };
1567 
1569  {
1570  public:
1571  PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : unit(unit), fRange(fMinRange) { }
1572 
1573  bool operator()(Player* player) const
1574  {
1575  //No threat list check, must be done explicit if expected to be in combat with creature
1576  if (!player->IsGameMaster() && player->IsAlive() && !unit->IsWithinDist(player, fRange, false))
1577  return true;
1578 
1579  return false;
1580  }
1581 
1582  private:
1583  Unit const* unit;
1584  float fRange;
1585  };
1586 
1588  {
1589  public:
1590  GameObjectInRangeCheck(float _x, float _y, float _z, float _range, uint32 _entry = 0) :
1591  x(_x), y(_y), z(_z), range(_range), entry(_entry) { }
1592 
1593  bool operator()(GameObject* go) const
1594  {
1595  if (!entry || (go->GetGOInfo() && go->GetGOInfo()->entry == entry))
1596  return go->IsInRange(x, y, z, range);
1597  else return false;
1598  }
1599 
1600  private:
1601  float x, y, z, range;
1603  };
1604 
1606  {
1607  public:
1608  AllWorldObjectsInRange(WorldObject const* object, float maxRange) : m_pObject(object), m_fRange(maxRange) { }
1609 
1610  bool operator()(WorldObject* go) const
1611  {
1612  return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->IsInPhase(go);
1613  }
1614 
1615  private:
1617  float m_fRange;
1618  };
1619 
1621  {
1622  public:
1623  ObjectTypeIdCheck(TypeID typeId, bool equals) : _typeId(typeId), _equals(equals) { }
1624 
1625  bool operator()(WorldObject* object) const
1626  {
1627  return (object->GetTypeId() == _typeId) == _equals;
1628  }
1629 
1630  private:
1632  bool _equals;
1633  };
1634 
1636  {
1637  public:
1638  ObjectGUIDCheck(ObjectGuid GUID) : _GUID(GUID) { }
1639 
1640  bool operator()(WorldObject* object) const
1641  {
1642  return object->GetGUID() == _GUID;
1643  }
1644 
1645  private:
1647  };
1648 
1650  {
1651  public:
1652  HeightDifferenceCheck(WorldObject* go, float diff, bool reverse)
1653  : _baseObject(go), _difference(diff), _reverse(reverse)
1654  {
1655  }
1656 
1657  bool operator()(WorldObject* unit) const
1658  {
1659  return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
1660  }
1661 
1662  private:
1665  bool _reverse;
1666  };
1667 
1669  {
1670  public:
1671  UnitAuraCheck(bool present, uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { }
1672 
1673  bool operator()(Unit* unit) const
1674  {
1675  return unit->HasAura(_spellId, _casterGUID) == _present;
1676  }
1677 
1678  bool operator()(WorldObject* object) const
1679  {
1680  return object->ToUnit() && object->ToUnit()->HasAura(_spellId, _casterGUID) == _present;
1681  }
1682 
1683  private:
1684  bool _present;
1687  };
1688 
1690  {
1691  public:
1692  ObjectEntryAndPrivateOwnerIfExistsCheck(ObjectGuid ownerGUID, uint32 entry) : _ownerGUID(ownerGUID), _entry(entry) { }
1693 
1694  bool operator()(WorldObject* object) const
1695  {
1696  return object->GetEntry() == _entry && (!object->IsPrivateObject() || object->GetPrivateObjectOwner() == _ownerGUID);
1697  }
1698 
1699  private:
1702  };
1703 
1704  // Player checks and do
1705 
1706  // Prepare using Builder localized packets with caching and send to player
1707  template<typename Localizer>
1709  {
1710  using LocalizedAction = std::remove_pointer_t<decltype(std::declval<Localizer>()(LocaleConstant{}))>;
1711 
1712  public:
1713  explicit LocalizedDo(Localizer& localizer) : _localizer(localizer) { }
1714 
1715  void operator()(Player const* p);
1716 
1717  private:
1718  Localizer& _localizer;
1719  std::vector<std::unique_ptr<LocalizedAction>> _localizedCache; // 0 = default, i => i-1 locale index
1720  };
1721 }
1722 #endif
float i_range
Definition: GridNotifiers.h:1226
void(*)(void *, GameObject * &&) InserterType
Definition: GridNotifiers.h:225
void * ref
Definition: GridNotifiers.h:227
void Visit(CreatureMapType &m)
Definition: GridNotifiers.h:344
WorldObject const * _caster
Definition: GridNotifiers.h:741
Creature *const i_obj
Definition: GridNotifiers.h:1397
float GetCombatReach() const override
Definition: Unit.h:812
Unit * i_source
Definition: GridNotifiers.h:184
float _range
Definition: GridNotifiers.h:1476
PlayerWorker(WorldObject const *searcher, Do &_do)
Definition: GridNotifiers.h:647
Functor & _func
Definition: GridNotifiers.h:466
bool operator()(NOT_INTERESTED *)
Definition: GridNotifiers.h:691
bool _reverse
Definition: GridNotifiers.h:1665
static Player * ToPlayer(Object *o)
Definition: Object.h:198
bool operator()(WorldObject *object) const
Definition: GridNotifiers.h:1678
Definition: GridNotifiers.h:1305
Definition: GridNotifiers.h:1122
bool _present
Definition: GridNotifiers.h:1684
Definition: GridDefines.h:81
Definition: GridNotifiers.h:435
Localizer & _localizer
Definition: GridNotifiers.h:1718
UpdateData i_data
Definition: GridNotifiers.h:40
uint32 GetSpellFocusRadius() const
Definition: GameObjectData.h:1064
Definition: Corpse.h:51
Definition: GridDefines.h:84
WorldObject const * _searcher
Definition: GridNotifiers.h:529
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:389
void updateObjects(GridRefManager< T > &m)
Definition: GridNotifiers.h:106
ObjectGuid _casterGUID
Definition: GridNotifiers.h:1686
bool IsTotem() const
Definition: Unit.h:860
uint32 m_uiEntry
Definition: GridNotifiers.h:1534
Definition: Unit.h:236
Definition: GridNotifiers.h:1023
Unit *const i_enemy
Definition: GridNotifiers.h:1225
bool operator()(Unit *u)
Definition: GridNotifiers.h:917
Definition: GridNotifiers.h:248
WorldObject const & i_obj
Definition: GridNotifiers.h:785
Utility class to enable range for loop syntax for multimap.equal_range uses.
Definition: IteratorPair.h:31
Team team
Definition: GridNotifiers.h:151
float i_range
Definition: GridNotifiers.h:811
AllGameObjectsWithEntryInRange(WorldObject const *object, uint32 entry, float maxRange)
Definition: GridNotifiers.h:1522
bool operator()(WorldObject *go) const
Definition: GridNotifiers.h:1610
Definition: GridNotifiers.h:1340
static ObjectGuid const Empty
Definition: ObjectGuid.h:265
Definition: GridNotifiers.h:1459
UnitListSearcher(WorldObject const *searcher, Container &container, Check &check)
Definition: GridNotifiers.h:514
WorldObject const * _searcher
Definition: GridNotifiers.h:273
uint32 i_entry
Definition: GridNotifiers.h:836
uint32 _focusId
Definition: GridNotifiers.h:742
RespawnDo()
Definition: GridNotifiers.h:714
NearestAssistCreatureInCreatureRangeCheck(Creature *obj, Unit *enemy, float range)
Definition: GridNotifiers.h:1375
NearestGameObjectFishingHole(WorldObject const &obj, float range)
Definition: GridNotifiers.h:749
float i_range
Definition: GridNotifiers.h:1020
Do const & i_do
Definition: GridNotifiers.h:322
TypeID GetTypeId() const
Definition: Object.h:170
float i_range
Definition: GridNotifiers.h:1052
Definition: GridNotifiers.h:723
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:447
Check & i_check
Definition: GridNotifiers.h:298
Definition: GridNotifiers.h:208
GameObject *& i_object
Definition: GridNotifiers.h:407
bool operator()(Player *u)
Definition: GridNotifiers.h:1485
AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
Definition: GridNotifiers.h:976
Unit const * unit
Definition: GridNotifiers.h:1516
bool i_incTargetRadius
Definition: GridNotifiers.h:1055
Definition: GridNotifiers.h:1102
float m_fRange
Definition: GridNotifiers.h:1617
bool operator()(Creature *u)
Definition: GridNotifiers.h:1378
float i_range
Definition: GridNotifiers.h:694
Definition: GridNotifiers.h:420
Definition: GridNotifiers.h:69
Definition: GridNotifiers.h:91
Definition: GridNotifiers.h:60
WorldObject const * i_obj
Definition: GridNotifiers.h:1496
bool IsInPhase(WorldObject const *obj) const
Definition: Object.h:461
bool IsCharmed() const
Definition: Unit.h:1300
Check & i_check
Definition: GridNotifiers.h:547
Definition: GridNotifiers.h:1239
Definition: GridNotifiers.h:769
Definition: GridNotifiers.h:1437
FriendlyBelowHpPctEntryInRange(Unit const *obj, uint32 entry, float range, uint8 pct, bool excludeSelf)
Definition: GridNotifiers.h:915
void Visit(GameObjectMapType &m)
Definition: GridNotifiers.h:114
Definition: SpellInfo.h:342
void operator()(Corpse *) const
Definition: GridNotifiers.h:718
bool HaveAtClient(Object const *u) const
Definition: Player.cpp:24002
bool operator()(WorldObject *object) const
Definition: GridNotifiers.h:1625
WorldObject const * i_searcher
Definition: GridNotifiers.h:663
bool operator()(Unit *unit) const
Definition: GridNotifiers.h:1673
WorldObject const * _searcher
Definition: GridNotifiers.h:560
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:622
float i_range
Definition: GridNotifiers.h:908
NearestGameObjectCheck(WorldObject const &obj)
Definition: GridNotifiers.h:772
WorldObject const & i_obj
Definition: GridNotifiers.h:809
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1055
bool operator()(GameObject *go)
Definition: GridNotifiers.h:774
Definition: GridNotifiers.h:661
Packet Data
Definition: GridNotifiers.h:137
Map & i_map
Definition: GridNotifiers.h:80
IteratorPair< WorldObject ** > i_objects
Definition: GridNotifiers.h:51
Definition: Unit.h:245
Definition: GridNotifiers.h:474
float m_fRange
Definition: GridNotifiers.h:1565
CreatureListSearcher(WorldObject const *searcher, Container &container, Check &check)
Definition: GridNotifiers.h:564
PlayerAtMinimumRangeAway(Unit const *unit, float fMinRange)
Definition: GridNotifiers.h:1571
Definition: GridNotifiers.h:574
void Visit(AreaTriggerMapType &m)
Definition: GridNotifiers.h:117
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4520
Player *& i_object
Definition: GridNotifiers.h:598
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
Do & i_do
Definition: GridNotifiers.h:577
Check & i_check
Definition: GridNotifiers.h:495
Check & i_check
Definition: GridNotifiers.h:531
bool operator()(Unit *u)
Definition: GridNotifiers.h:896
void Visit(GridRefManager< T > &)
Definition: GridNotifiers.h:54
bool operator()(Unit *u)
Definition: GridNotifiers.h:1247
void Visit(ConversationMapType &m)
Definition: GridNotifiers.h:119
NearestHostileUnitInAttackDistanceCheck(Creature const *creature, float dist=0.f)
Definition: GridNotifiers.h:1272
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:290
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1310
Definition: SharedDefines.h:4455
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1023
bool operator()(GameObject *go)
Definition: GridNotifiers.h:824
bool i_incOwnRadius
Definition: GridNotifiers.h:1193
bool IsInCombat() const
Definition: Unit.h:1149
UnitAuraCheck(bool present, uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty)
Definition: GridNotifiers.h:1671
bool operator()(Player *u)
Definition: GridNotifiers.h:1463
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:415
Definition: GridNotifiers.h:1668
Unit *& i_object
Definition: GridNotifiers.h:477
float z
Definition: GridNotifiers.h:1601
Definition: SharedDefines.h:526
float i_range
Definition: GridNotifiers.h:1399
InserterType inserter
Definition: GridNotifiers.h:228
NearestAttackableNoTotemUnitInObjectRangeCheck(WorldObject const *obj, float range)
Definition: GridNotifiers.h:995
Definition: ObjectGuid.h:39
WorldObject const & i_obj
Definition: GridNotifiers.h:835
void Visit(DynamicObjectMapType &m)
Definition: GridNotifiers.h:115
WorldObject const * _searcher
Definition: GridNotifiers.h:612
WorldObject const * _searcher
Definition: GridNotifiers.h:250
WorldObject const * _searcher
Definition: GridNotifiers.h:628
Definition: GridNotifiers.h:404
uint32 m_uiEntry
Definition: GridNotifiers.h:1564
Definition: GridNotifiers.h:684
PacketSender & i_packetSender
Definition: GridNotifiers.h:149
Check & i_check
Definition: GridNotifiers.h:424
void operator()(WorldObject *) const
Definition: GridNotifiers.h:717
void EngageWithTarget(Unit *who)
Definition: Unit.cpp:7818
void Visit(CreatureMapType &m)
Definition: GridNotifiers.h:113
bool i_excludeSelf
Definition: GridNotifiers.h:931
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:677
Definition: Grid.h:45
float i_distSq
Definition: GridNotifiers.h:150
bool operator()(Unit *u)
Definition: GridNotifiers.h:1278
ObjectGUIDCheck(ObjectGuid GUID)
Definition: GridNotifiers.h:1638
Definition: GridNotifiers.h:870
TypeID _typeId
Definition: GridNotifiers.h:1631
Definition: GridNotifiers.h:1519
void Visit(ConversationMapType &m)
Definition: GridNotifiers.h:389
Unit *const i_funit
Definition: GridNotifiers.h:1367
WorldObject const * m_pObject
Definition: GridNotifiers.h:1533
uint32 i_mapTypeMask
Definition: GridNotifiers.h:296
Definition: Object.h:430
Definition: Creature.h:69
Definition: Unit.h:253
GameObjectFocusCheck(WorldObject const *caster, uint32 focusId)
Definition: GridNotifiers.h:726
float i_distSq
Definition: GridNotifiers.h:186
NearestGameObjectEntryInObjectRangeCheck(WorldObject const &obj, uint32 entry, float range, bool spawnedOnly=true)
Definition: GridNotifiers.h:796
float i_range
Definition: GridNotifiers.h:1369
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:398
CreatureRelocationNotifier(Creature &c)
Definition: GridNotifiers.h:72
void Respawn()
Definition: GameObject.cpp:1838
void Visit(GridRefManager< T > &)
Definition: GridNotifiers.h:96
float i_minHpPct
Definition: GridNotifiers.h:909
Definition: GridNotifiers.h:610
Definition: GridNotifiers.h:182
WorldObject const & i_obj
Definition: GridNotifiers.h:762
FriendlyCCedInRange(Unit const *obj, float range)
Definition: GridNotifiers.h:937
float i_range
Definition: GridNotifiers.h:951
bool m_force
Definition: GridNotifiers.h:1301
UnitSearcher(WorldObject const *searcher, Unit *&result, Check &check)
Definition: GridNotifiers.h:480
Position const * _pos
Definition: GridNotifiers.h:1475
Definition: GridDefines.h:80
MostHPMissingInRange(Unit const *obj, float range, uint32 hp)
Definition: GridNotifiers.h:873
Check & i_check
Definition: GridNotifiers.h:613
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1064
GameObjectInRangeCheck(float _x, float _y, float _z, float _range, uint32 _entry=0)
Definition: GridNotifiers.h:1590
CreatureWorker(WorldObject const *searcher, Do &_do)
Definition: GridNotifiers.h:579
Unit const * _refUnit
Definition: GridNotifiers.h:1094
Definition: GridNotifiers.h:626
SpellTargetObjectTypes
Definition: SpellInfo.h:65
struct GameObjectTemplate::@212::@239 fishingHole
Creature & i_creature
Definition: GridNotifiers.h:71
float i_range
Definition: GridNotifiers.h:786
float i_range
Definition: GridNotifiers.h:862
VisibleChangesNotifier(IteratorPair< WorldObject **> objects)
Definition: GridNotifiers.h:53
Definition: UpdateData.h:36
NearestGameObjectTypeInObjectRangeCheck(WorldObject const &obj, GameobjectTypes type, float range)
Definition: GridNotifiers.h:847
Definition: GridNotifiers.h:1198
HeightDifferenceCheck(WorldObject *go, float diff, bool reverse)
Definition: GridNotifiers.h:1652
Definition: GridNotifiers.h:1058
GameobjectTypes
Definition: SharedDefines.h:2730
bool operator()(GameObject *go)
Definition: GridNotifiers.h:798
Definition: GridNotifiers.h:543
WorldObject const * _searcher
Definition: GridNotifiers.h:510
void operator()(GameObject *u) const
Definition: GridNotifiers.h:716
void Visit(SceneObjectMapType &m)
Definition: GridNotifiers.h:118
WorldObject const * i_source
Definition: GridNotifiers.h:148
WorldObject const & i_obj
Definition: GridNotifiers.h:860
void Visit(GridRefManager< SKIP > &) const
Definition: GridNotifiers.h:166
float i_range
Definition: GridNotifiers.h:929
Definition: GridNotifiers.h:595
WorldObjectListSearcher(WorldObject const *searcher, Container &container, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
Definition: GridNotifiers.h:301
Unit const * i_funit
Definition: GridNotifiers.h:1190
AllCreaturesOfEntryInRange(WorldObject const *object, uint32 entry, float maxRange=0.0f)
Definition: GridNotifiers.h:1541
uint32 GetCreatureType() const
Definition: Unit.cpp:8569
bool _reqAlive
Definition: GridNotifiers.h:1456
float m_fRange
Definition: GridNotifiers.h:1535
Check & i_check
Definition: GridNotifiers.h:511
bool _playerOnly
Definition: GridNotifiers.h:1097
Definition: SharedDefines.h:600
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:267
Do & i_do
Definition: GridNotifiers.h:645
Creature *& i_object
Definition: GridNotifiers.h:546
GameObjectSearcher(WorldObject const *searcher, GameObject *&result, Check &check)
Definition: GridNotifiers.h:410
Definition: GridNotifiers.h:508
Do & i_do
Definition: GridNotifiers.h:665
GameObjectLastSearcher(WorldObject const *searcher, GameObject *&result, Check &check)
Definition: GridNotifiers.h:426
uint32 _spellId
Definition: GridNotifiers.h:1685
GameObject *& i_object
Definition: GridNotifiers.h:423
ObjectUpdater(const uint32 diff)
Definition: GridNotifiers.h:211
void operator()(Creature *u) const
Definition: GridNotifiers.h:715
Definition: GridNotifiers.h:711
Definition: GridNotifiers.h:642
LocaleConstant
Definition: Common.h:80
WorldObject const * _searcher
Definition: GridNotifiers.h:576
bool operator()(GameObject *go) const
Definition: GridNotifiers.h:1593
PacketSender & i_packetSender
Definition: GridNotifiers.h:185
bool _equals
Definition: GridNotifiers.h:1632
uint32 i_spell
Definition: GridNotifiers.h:970
ObjectGuid _ownerGUID
Definition: GridNotifiers.h:1700
Definition: GridNotifiers.h:954
WorldObject const * _source
Definition: GridNotifiers.h:1093
SpellInfo const * _spellInfo
Definition: GridNotifiers.h:1191
Check & i_check
Definition: GridNotifiers.h:599
Team
Definition: SharedDefines.h:1134
FriendlyMissingBuffInRange(Unit const *obj, float range, uint32 spellid)
Definition: GridNotifiers.h:957
uint32 i_mapTypeMask
Definition: GridNotifiers.h:276
bool IsWithinDistInMap(Player const *player) const
Definition: GameObject.cpp:3708
bool i_playerOnly
Definition: GridNotifiers.h:1053
bool IsPlayer() const
Definition: Object.h:197
Definition: GridDefines.h:79
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:638
float _range
Definition: GridNotifiers.h:1455
uint64 GetHealth() const
Definition: Unit.h:893
bool HasRootAura() const
Definition: Unit.h:1173
LocalizedDo(Localizer &localizer)
Definition: GridNotifiers.h:1713
bool operator()(Unit *u)
Definition: GridNotifiers.h:1127
WorldObject const * _searcher
Definition: GridNotifiers.h:422
NearestHostileUnitInAggroRangeCheck(Creature const *creature, bool useLOS=false, bool ignoreCivilians=false)
Definition: GridNotifiers.h:1308
bool operator()(Unit *u) const
Definition: GridNotifiers.h:959
Definition: GridNotifiers.h:697
AnyPlayerInPositionRangeCheck(Position const *pos, float range, bool reqAlive=true)
Definition: GridNotifiers.h:1462
uint32 _entry
Definition: GridNotifiers.h:1701
void Visit(GridRefManager< T > &m)
Definition: GridNotifiersImpl.h:28
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:538
Definition: GridNotifiers.h:1635
bool IsInRange(float x, float y, float z, float radius) const
Definition: GameObject.cpp:2812
MostHPPercentMissingInRange(Unit const *obj, float range, uint32 minHpPct, uint32 maxHpPct)
Definition: GridNotifiers.h:894
uint32 i_mapTypeMask
Definition: GridNotifiers.h:320
Unit *& i_object
Definition: GridNotifiers.h:494
float fRange
Definition: GridNotifiers.h:1584
Unit const * i_obj
Definition: GridNotifiers.h:968
WorldObject const * i_obj
Definition: GridNotifiers.h:1189
WorldObject const *const i_searchObj
Definition: GridNotifiers.h:693
PlayerSearcher(WorldObject const *searcher, Player *&result, Check &check)
Definition: GridNotifiers.h:601
float i_range
Definition: GridNotifiers.h:989
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Cell & cell
Definition: GridNotifiers.h:81
const float i_radius
Definition: GridNotifiers.h:83
float i_range
Definition: GridNotifiers.h:887
Definition: GridNotifiers.h:451
bool IsAlive() const
Definition: Unit.h:1251
float m_range
Definition: GridNotifiers.h:1300
bool isSpawned() const
Definition: GameObject.h:215
AllWorldObjectsInRange(WorldObject const *object, float maxRange)
Definition: GridNotifiers.h:1608
SpellTargetCheckTypes
Definition: SpellInfo.h:81
void Visit(PlayerMapType &m)
Definition: GridNotifiers.h:650
Definition: GridNotifiers.h:100
Definition: GridNotifiers.h:49
WorldObject const * _searcher
Definition: GridNotifiers.h:467
bool operator()(Player *u) const
Definition: GridNotifiers.h:1442
bool HasUnitState(const uint32 f) const
Definition: Unit.h:850
bool i_incTargetRadius
Definition: GridNotifiers.h:1099
WorldObject const * i_obj
Definition: GridNotifiers.h:1050
UnitLastSearcher(WorldObject const *searcher, Unit *&result, Check &check)
Definition: GridNotifiers.h:497
bool IsGameMaster() const
Definition: Player.h:1202
std::remove_pointer_t< decltype(std::declval< Localizer >()(LocaleConstant{}))> LocalizedAction
Definition: GridNotifiers.h:1710
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6174
GridType & i_grid
Definition: GridNotifiers.h:102
void Visit(PlayerMapType &m)
Definition: GridNotifiers.h:670
bool operator()(WorldObject *object) const
Definition: GridNotifiers.h:1694
ObjectGuid _GUID
Definition: GridNotifiers.h:1646
Definition: GridNotifiers.h:558
WorldObject const * _searcher
Definition: GridNotifiers.h:437
Check & i_check
Definition: GridNotifiers.h:252
Definition: GridNotifiers.h:1620
Definition: GridNotifiers.h:1587
GridUpdater(GridType &grid, uint32 diff)
Definition: GridNotifiers.h:104
Definition: GridNotifiers.h:1148
WorldObject const * m_pObject
Definition: GridNotifiers.h:1616
bool IsWithinDoubleVerticalCylinder(Position const *center, float radius, float height) const
Definition: Position.cpp:93
void Visit(PlayerMapType &m)
Definition: GridNotifiers.h:112
Definition: GridNotifiers.h:1708
float i_range
Definition: GridNotifiers.h:1142
CreatureSearcher(WorldObject const *searcher, Creature *&result, Check &check)
Definition: GridNotifiers.h:533
NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const &obj, uint32 entry, bool alive, float range)
Definition: GridNotifiers.h:1409
void SendPacket(Player const *player) const
Definition: GridNotifiers.h:198
PlayerLastSearcher(WorldObject const *searcher, Player *&result, Check &check)
Definition: GridNotifiers.h:632
Definition: GridDefines.h:78
PacketSenderRef(WorldPacket const *message)
Definition: GridNotifiers.h:126
Definition: GridNotifiers.h:1502
Unit const * i_funit
Definition: GridNotifiers.h:1051
uint32_t uint32
Definition: Define.h:143
PlayerListSearcher(WorldObject const *searcher, Container &container, Check &check)
Definition: GridNotifiers.h:616
WorldObject const * _searcher
Definition: GridNotifiers.h:493
WorldObject const * i_obj
Definition: GridNotifiers.h:987
uint64_t uint64
Definition: Define.h:142
bool _reqAlive
Definition: GridNotifiers.h:1477
void SendPacket(Player const *player) const
Definition: GridNotifiers.h:168
void operator()(Creature *u) const
Definition: GridNotifiers.h:1204
Definition: GridNotifiers.h:78
Creature const * _me
Definition: GridNotifiers.h:1334
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:486
AnyAoETargetUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range, SpellInfo const *spellInfo=nullptr, bool incOwnRadius=true, bool incTargetRadius=true)
Definition: GridNotifiers.h:1151
Player const * skipped_receiver
Definition: GridNotifiers.h:152
Definition: LinkedList.h:149
WorldObject *& i_object
Definition: GridNotifiers.h:274
Definition: GridNotifiers.h:223
Definition: GridNotifiers.h:1229
Definition: GameObject.h:125
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2469
void Visit(GameObjectMapType &m)
Definition: GridNotifiers.h:327
AnyPlayerInObjectRangeCheck(WorldObject const *obj, float range, bool reqAlive=true)
Definition: GridNotifiers.h:1440
Definition: GridNotifiers.h:934
bool operator()(GameObject *go) const
Definition: GridNotifiers.h:728
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:554
bool operator()(Unit *u)
Definition: GridNotifiers.h:875
ObjectTypeIdCheck(TypeID typeId, bool equals)
Definition: GridNotifiers.h:1623
Player & i_player
Definition: GridNotifiers.h:39
float GetPositionZ() const
Definition: Position.h:79
bool operator()(Unit *unit) const
Definition: GridNotifiers.h:1543
uint32 i_entry
Definition: GridNotifiers.h:1429
WorldObject const * _searcher
Definition: GridNotifiers.h:321
uint32 entry
Definition: GameObjectData.h:32
bool operator()(Unit *u) const
Definition: GridNotifiers.h:978
void Visit(PlayerMapType &m)
Definition: GridNotifiers.h:336
Unit const * i_funit
Definition: GridNotifiers.h:1141
std::vector< std::unique_ptr< LocalizedAction > > _localizedCache
Definition: GridNotifiers.h:1719
Definition: GridNotifiers.h:1538
static Creature * ToCreature(Object *o)
Definition: Object.h:204
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:570
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
iterator end()
Definition: GridRefManager.h:36
Definition: Map.h:264
uint64 i_hp
Definition: GridNotifiers.h:888
void Visit(GridRefManager< SKIP > &) const
Definition: GridNotifiers.h:196
WorldObject const * _searcher
Definition: GridNotifiers.h:545
AnyDeadUnitSpellTargetInRangeCheck(WorldObject *searchObj, float range, SpellInfo const *spellInfo, SpellTargetCheckTypes check, SpellTargetObjectTypes objectType)
Definition: GridNotifiers.h:700
WorldObject const * i_obj
Definition: GridNotifiers.h:1140
WorldObject *& i_object
Definition: GridNotifiers.h:251
MessageDistDeliverer(WorldObject const *src, PacketSender &packetSender, float dist, bool own_team_only=false, Player const *skipped=nullptr)
Definition: GridNotifiers.h:153
VisibleNotifier(Player &player)
Definition: GridNotifiers.h:44
uint32 GetSpellFocusType() const
Definition: GameObjectData.h:1054
void Visit(CorpseMapType &)
Definition: GridNotifiers.h:214
bool operator()(GameObject *go) const
Definition: GridNotifiers.h:1524
WorldObject const * i_obj
Definition: GridNotifiers.h:1019
NearestPlayerInObjectRangeCheck(WorldObject const *obj, float range)
Definition: GridNotifiers.h:1483
bool IsVisible() const
Definition: Unit.cpp:8071
WorldObjectLastSearcher(WorldObject const *searcher, WorldObject *&result, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
Definition: GridNotifiers.h:278
Creature const * me
Definition: GridNotifiers.h:1263
AnyFriendlyUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range, bool playerOnly=false, bool incOwnRadius=true, bool incTargetRadius=true)
Definition: GridNotifiers.h:1026
WorldObject const * m_pObject
Definition: GridNotifiers.h:1563
TypeID
Definition: ObjectGuid.h:32
WorldObject const * _obj
Definition: GridNotifiers.h:1454
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:463
Definition: SharedDefines.h:2757
Check & i_check
Definition: GridNotifiers.h:478
uint8 i_pct
Definition: GridNotifiers.h:930
Unit const * i_obj
Definition: GridNotifiers.h:907
bool operator()(NOT_INTERESTED *)
Definition: GridNotifiers.h:706
DeathState getDeathState() const
Definition: Unit.h:1254
Definition: GridNotifiers.h:491
bool _ignoreCivilians
Definition: GridNotifiers.h:1336
bool i_spawnedOnly
Definition: GridNotifiers.h:812
bool i_playerOnly
Definition: GridNotifiers.h:1265
Definition: SharedDefines.h:1143
GameObjectWorker(WorldObject const *searcher, Functor &func)
Definition: GridNotifiers.h:453
Definition: GridNotifiers.h:527
Definition: GridNotifiers.h:135
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2699
uint32 i_mapTypeMask
Definition: GridNotifiers.h:253
Definition: Cell.h:46
void Visit(CorpseMapType &m)
Definition: GridNotifiers.h:116
AIRelocationNotifier(Unit &unit)
Definition: GridNotifiers.h:95
Definition: GridNotifiers.h:746
CreatureLastSearcher(WorldObject const *searcher, Creature *&result, Check &check)
Definition: GridNotifiers.h:549
float m_range
Definition: GridNotifiers.h:1264
void Respawn(bool force=false)
Definition: Creature.cpp:2192
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1231
Team GetEffectiveTeam() const
Definition: Player.h:2217
AnyAssistCreatureInRangeCheck(Unit *funit, Unit *enemy, float range)
Definition: GridNotifiers.h:1343
uint32 GetEntry() const
Definition: Object.h:158
Unit & i_unit
Definition: GridNotifiers.h:93
bool operator()(GameObject *go)
Definition: GridNotifiers.h:849
WorldObject const * _searcher
Definition: GridNotifiers.h:406
DelayedUnitRelocation(Cell &c, CellCoord &pair, Map &map, float radius)
Definition: GridNotifiers.h:84
PlayerRelocationNotifier(Player &player)
Definition: GridNotifiers.h:62
bool operator()(Unit *u) const
Definition: GridNotifiers.h:939
Definition: ObjectGuid.h:40
Check & i_check
Definition: GridNotifiers.h:408
void Visit(GridRefManager< T > &)
Definition: GridNotifiers.h:73
float GetHealthPct() const
Definition: Unit.h:901
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:657
bool _useLOS
Definition: GridNotifiers.h:1335
float i_range
Definition: GridNotifiers.h:1497
void operator()(Player const *player) const
Definition: GridNotifiers.h:139
Unit const * unit
Definition: GridNotifiers.h:1583
NearestAttackableUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
Definition: GridNotifiers.h:1125
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:7893
bool operator()(Player *player) const
Definition: GridNotifiers.h:1573
PlayerDistWorker(WorldObject const *searcher, float _dist, Do &_do)
Definition: GridNotifiers.h:667
uint32 i_entry
Definition: GridNotifiers.h:928
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:503
Unit const * i_obj
Definition: GridNotifiers.h:927
Definition: GridNotifiers.h:37
bool operator()(Unit *u)
Definition: GridNotifiers.h:997
void Visit(DynamicObjectMapType &m)
Definition: GridNotifiers.h:362
WorldPacket const * Data
Definition: GridNotifiers.h:124
bool operator()(GameObject *go)
Definition: GridNotifiers.h:751
#define TC_GAME_API
Definition: Define.h:124
Definition: GridNotifiers.h:1568
WorldObject const & i_obj
Definition: GridNotifiers.h:1428
Check & i_check
Definition: GridNotifiers.h:630
void Visit(CorpseMapType &m)
Definition: GridNotifiers.h:353
ObjectEntryAndPrivateOwnerIfExistsCheck(ObjectGuid ownerGUID, uint32 entry)
Definition: GridNotifiers.h:1692
void Visit(PlayerMapType &)
Definition: GridNotifiers.h:213
float _difference
Definition: GridNotifiers.h:1664
Check & i_check
Definition: GridNotifiers.h:438
bool _raid
Definition: GridNotifiers.h:1096
void Visit(GridRefManager< T > &m)
Definition: GridNotifiers.h:64
iterator begin()
Definition: GridRefManager.h:35
MessageDistDelivererToHostile(Unit *src, PacketSender &packetSender, float dist)
Definition: GridNotifiers.h:188
float i_dist
Definition: GridNotifiers.h:664
Definition: GridNotifiers.h:318
Definition: GridDefines.h:83
float i_range
Definition: GridNotifiers.h:1192
WorldObjectWorker(WorldObject const *searcher, Do const &_do, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
Definition: GridNotifiers.h:324
bool CheckPrivateObjectOwnerVisibility(WorldObject const *seer) const
Definition: Object.cpp:1390
uint8_t uint8
Definition: Define.h:145
Definition: GridNotifiers.h:912
Definition: Position.h:27
float i_range
Definition: GridNotifiers.h:763
void Visit(GridRefManager< T > &)
Definition: GridNotifiers.h:86
void Visit(SceneObjectMapType &m)
Definition: GridNotifiers.h:380
bool operator()(WorldObject *unit) const
Definition: GridNotifiers.h:1657
std::set< Unit * > i_visibleNow
Definition: GridNotifiers.h:41
Definition: GridDefines.h:82
GuidUnorderedSet vis_guids
Definition: GridNotifiers.h:42
AnyUnitInObjectRangeCheck(WorldObject const *obj, float range, bool check3D=true)
Definition: GridNotifiers.h:1105
Unit *const i_enemy
Definition: GridNotifiers.h:1398
Definition: GridNotifiers.h:1269
Definition: GridNotifiers.h:1689
NearestUnspawnedGameObjectEntryInObjectRangeCheck(WorldObject const &obj, uint32 entry, float range)
Definition: GridNotifiers.h:822
WorldObjectSearcher(WorldObject const *searcher, WorldObject *&result, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
Definition: GridNotifiers.h:255
CallOfHelpCreatureInRangeDo(Unit *funit, Unit *enemy, float range)
Definition: GridNotifiers.h:1201
uint32 i_timeDiff
Definition: GridNotifiers.h:103
Definition: GridDefines.h:77
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1030
Unit *const i_enemy
Definition: GridNotifiers.h:1368
Unit *const i_funit
Definition: GridNotifiers.h:1224
Definition: ObjectGuid.h:258
void operator()(Player const *player) const
Definition: GridNotifiers.h:128
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:606
Definition: AsioHacksFwd.h:52
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:589
bool i_incOwnRadius
Definition: GridNotifiers.h:1054
bool IsHostileTo(WorldObject const *target) const
Definition: Object.cpp:2694
WorldObject const * i_obj
Definition: GridNotifiers.h:1116
Check & i_check
Definition: GridNotifiers.h:561
WorldObject const * _searcher
Definition: GridNotifiers.h:297
GameObjectListSearcher(WorldObject const *searcher, Container &container, Check &check)
Definition: GridNotifiers.h:441
bool i_check3D
Definition: GridNotifiers.h:1118
float i_range
Definition: GridNotifiers.h:1117
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1107
Check & i_check
Definition: GridNotifiers.h:275
Definition: GridNotifiers.h:122
Player *& i_object
Definition: GridNotifiers.h:629
Creature *& i_object
Definition: GridNotifiers.h:530
Definition: GridNotifiers.h:146
uint64 GetMaxHealth() const
Definition: Unit.h:894
uint32 entry
Definition: GridNotifiers.h:1602
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:897
Type
Definition: Trainer.h:32
bool operator()(Creature *u) const
Definition: GridNotifiers.h:1346
Definition: GridNotifiers.h:973
Definition: GridNotifiers.h:1649
Definition: GridNotifiers.h:1480
WorldObject const * _searcher
Definition: GridNotifiers.h:476
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1507
void Insert(Type object)
Definition: GridNotifiers.h:241
AllFriendlyCreaturesInGrid(Unit const *obj)
Definition: GridNotifiers.h:1505
CellCoord & p
Definition: GridNotifiers.h:82
AnyGroupedUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range, bool raid, bool playerOnly=false, bool incOwnRadius=true, bool incTargetRadius=true)
Definition: GridNotifiers.h:1061
Definition: Unit.h:746
uint32 i_entry
Definition: GridNotifiers.h:810
uint32 i_timeDiff
Definition: GridNotifiers.h:210
void Visit(GameObjectMapType &m)
Definition: GridNotifiers.h:456
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1029
NearestHostileUnitCheck(Creature const *creature, float dist=0.f, bool playerOnly=false)
Definition: GridNotifiers.h:1242
Definition: Player.h:1131
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:521
GameobjectTypes i_type
Definition: GridNotifiers.h:861
bool isCreature
Definition: GridNotifiers.h:94
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition: Object.cpp:1089
Definition: WorldPacket.h:25
Definition: GridNotifiers.h:294
Definition: GridNotifiers.h:891
void Visit(CreatureMapType &m)
Definition: GridNotifiers.h:582
uint32 type
Definition: GameObjectData.h:33
ContainerInserter(T &ref_)
Definition: GridNotifiers.h:232
Unit const * i_obj
Definition: GridNotifiers.h:950
bool operator()(WorldObject *object) const
Definition: GridNotifiers.h:1640
Unit const * i_funit
Definition: GridNotifiers.h:988
bool operator()(Unit *u) const
Definition: GridNotifiers.h:1156
Definition: GridNotifiers.h:1605
AnyDeadUnitObjectInRangeCheck(WorldObject *searchObj, float range)
Definition: GridNotifiers.h:687
bool IsFeared() const
Definition: Unit.h:1172
bool i_incOwnRadius
Definition: GridNotifiers.h:1098
Definition: GridNotifiers.h:271
Definition: GridDefines.h:76
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:431
bool i_incTargetRadius
Definition: GridNotifiers.h:1194
WorldObject * _baseObject
Definition: GridNotifiers.h:1663
void Visit(GridRefManager< NOT_INTERESTED > &)
Definition: GridNotifiers.h:314
bool operator()(Creature *u)
Definition: GridNotifiers.h:1412
float _range
Definition: GridNotifiers.h:1095
WorldObject const * _searcher
Definition: GridNotifiers.h:597
float i_range
Definition: GridNotifiers.h:969
bool IsControlledByPlayer() const
Definition: Unit.h:1278
WorldObject const * _searcher
Definition: GridNotifiers.h:644
void Visit(AreaTriggerMapType &m)
Definition: GridNotifiers.h:371
Creature const * me
Definition: GridNotifiers.h:1299
Unit const * i_obj
Definition: GridNotifiers.h:886
Definition: SharedDefines.h:599