Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
GridNotifiers.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRE_GRIDNOTIFIERS_H
7#define SKYFIRE_GRIDNOTIFIERS_H
8
9#include "ObjectGridLoader.h"
10#include "UpdateData.h"
11#include <iostream>
12
13#include "AreaTrigger.h"
14#include "Corpse.h"
15#include "CreatureAI.h"
16#include "DynamicObject.h"
17#include "GameObject.h"
18#include "Object.h"
19#include "Player.h"
20#include "Spell.h"
21#include "Unit.h"
22#include "WorldSession.h"
23
24class Player;
25//class Map;
26
27namespace Skyfire
28{
30 {
33 std::set<Unit*> i_visibleNow;
35
36 VisibleNotifier(Player& player) : i_player(player), i_data(player.GetMapId()), vis_guids(player.m_clientGUIDs) { }
37 template<class T> void Visit(GridRefManager<T>& m);
38 void SendToSelf(void);
39 };
40
42 {
44
45 explicit VisibleChangesNotifier(WorldObject& object) : i_object(object) { }
46 template<class T> void Visit(GridRefManager<T>&) { }
47 void Visit(PlayerMapType&);
50 };
51
53 {
55
56 template<class T> void Visit(GridRefManager<T>& m) { VisibleNotifier::Visit(m); }
58 void Visit(PlayerMapType&);
59 };
60
69
71 {
75 const float i_radius;
76 DelayedUnitRelocation(Cell& c, CellCoord& pair, Map& map, float radius) :
77 i_map(map), cell(c), p(pair), i_radius(radius) { }
78 template<class T> void Visit(GridRefManager<T>&) { }
80 void Visit(PlayerMapType&);
81 };
82
84 {
87 explicit AIRelocationNotifier(Unit& unit) : i_unit(unit), isCreature(unit.GetTypeId() == TypeID::TYPEID_UNIT) { }
88 template<class T> void Visit(GridRefManager<T>&) { }
90 };
91
93 {
96 GridUpdater(GridType& grid, uint32 diff) : i_grid(grid), i_timeDiff(diff) { }
97
98 template<class T> void updateObjects(GridRefManager<T>& m)
99 {
100 for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
101 iter->GetSource()->Update(i_timeDiff);
102 }
103
110 };
111
113 {
117 float i_distSq;
120 MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = NULL)
121 : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist* dist),
122 team(0), skipped_receiver(skipped)
123 {
124 if (own_team_only)
125 if (Player* player = src->ToPlayer())
126 team = player->GetTeam();
127 }
128
129 void Visit(PlayerMapType& m);
130 void Visit(CreatureMapType& m);
132 template<class SKIP> void Visit(GridRefManager<SKIP>&) { }
133
134 void SendPacket(Player* player) const
135 {
136 // never send packet to self
137 if (player == i_source || (team && player->GetTeam() != team) || skipped_receiver == player)
138 return;
139
140 if (!player->HaveAtClient(i_source))
141 return;
142
143 if (WorldSession* session = player->GetSession())
144 session->SendPacket(i_message);
145 }
146 };
147
149 {
151 explicit ObjectUpdater(const uint32 diff) : i_timeDiff(diff) { }
152 template<class T> void Visit(GridRefManager<T>& m);
155 };
156
157 // SEARCHERS & LIST SEARCHERS & WORKERS
158
159 // WorldObject searchers & workers
160
161 template<class Check>
163 {
167 Check& i_check;
168
169 WorldObjectSearcher(WorldObject const* searcher, WorldObject*& result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
170 : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
171
172 void Visit(GameObjectMapType& m);
173 void Visit(PlayerMapType& m);
174 void Visit(CreatureMapType& m);
175 void Visit(CorpseMapType& m);
177 void Visit(AreaTriggerMapType& m);
178
179 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
180 };
181
182 template<class Check>
184 {
188 Check& i_check;
189
190 WorldObjectLastSearcher(WorldObject const* searcher, WorldObject*& result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
191 : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
192
193 void Visit(GameObjectMapType& m);
194 void Visit(PlayerMapType& m);
195 void Visit(CreatureMapType& m);
196 void Visit(CorpseMapType& m);
198 void Visit(AreaTriggerMapType& m);
199
200 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
201 };
202
203 template<class Check>
205 {
208 std::list<WorldObject*>& i_objects;
209 Check& i_check;
210
211 WorldObjectListSearcher(WorldObject const* searcher, std::list<WorldObject*>& objects, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
212 : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
213
214 void Visit(PlayerMapType& m);
215 void Visit(CreatureMapType& m);
216 void Visit(CorpseMapType& m);
217 void Visit(GameObjectMapType& m);
219 void Visit(AreaTriggerMapType& m);
220
221 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
222 };
223
224 template<class Do>
226 {
229 Do const& i_do;
230
231 WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
232 : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
233
235 {
237 return;
238 for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
239 if (itr->GetSource()->InSamePhase(i_phaseMask))
240 i_do(itr->GetSource());
241 }
242
244 {
246 return;
247 for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
248 if (itr->GetSource()->InSamePhase(i_phaseMask))
249 i_do(itr->GetSource());
250 }
252 {
254 return;
255 for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
256 if (itr->GetSource()->InSamePhase(i_phaseMask))
257 i_do(itr->GetSource());
258 }
259
261 {
263 return;
264 for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
265 if (itr->GetSource()->InSamePhase(i_phaseMask))
266 i_do(itr->GetSource());
267 }
268
270 {
272 return;
273 for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
274 if (itr->GetSource()->InSamePhase(i_phaseMask))
275 i_do(itr->GetSource());
276 }
277
279 {
281 return;
282 for (AreaTriggerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
283 if (itr->GetSource()->InSamePhase(i_phaseMask))
284 i_do(itr->GetSource());
285 }
286
287 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
288 };
289
290 // Gameobject searchers
291
292 template<class Check>
294 {
297 Check& i_check;
298
299 GameObjectSearcher(WorldObject const* searcher, GameObject*& result, Check& check)
300 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
301
302 void Visit(GameObjectMapType& m);
303
304 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
305 };
306
307 // Last accepted by Check GO if any (Check can change requirements at each call)
308 template<class Check>
310 {
313 Check& i_check;
314
315 GameObjectLastSearcher(WorldObject const* searcher, GameObject*& result, Check& check)
316 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
317
318 void Visit(GameObjectMapType& m);
319
320 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
321 };
322
323 template<class Check>
325 {
327 std::list<GameObject*>& i_objects;
328 Check& i_check;
329
330 GameObjectListSearcher(WorldObject const* searcher, std::list<GameObject*>& objects, Check& check)
331 : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
332
333 void Visit(GameObjectMapType& m);
334
335 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
336 };
337
338 template<class Functor>
340 {
341 GameObjectWorker(WorldObject const* searcher, Functor& func)
342 : _func(func), _phaseMask(searcher->GetPhaseMask()) { }
343
345 {
346 for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
347 if (itr->GetSource()->InSamePhase(_phaseMask))
348 _func(itr->GetSource());
349 }
350
351 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
352
353 private:
354 Functor& _func;
356 };
357
358 // Unit searchers
359
360 // First accepted by Check Unit if any
361 template<class Check>
363 {
366 Check& i_check;
367
368 UnitSearcher(WorldObject const* searcher, Unit*& result, Check& check)
369 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
370
371 void Visit(CreatureMapType& m);
372 void Visit(PlayerMapType& m);
373
374 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
375 };
376
377 // Last accepted by Check Unit if any (Check can change requirements at each call)
378 template<class Check>
380 {
383 Check& i_check;
384
385 UnitLastSearcher(WorldObject const* searcher, Unit*& result, Check& check)
386 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
387
388 void Visit(CreatureMapType& m);
389 void Visit(PlayerMapType& m);
390
391 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
392 };
393
394 // All accepted by Check units if any
395 template<class Check>
397 {
399 std::list<Unit*>& i_objects;
400 Check& i_check;
401
402 UnitListSearcher(WorldObject const* searcher, std::list<Unit*>& objects, Check& check)
403 : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
404
405 void Visit(PlayerMapType& m);
406 void Visit(CreatureMapType& m);
407
408 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
409 };
410
411 // Creature searchers
412
413 template<class Check>
415 {
418 Check& i_check;
419
420 CreatureSearcher(WorldObject const* searcher, Creature*& result, Check& check)
421 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
422
423 void Visit(CreatureMapType& m);
424
425 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
426 };
427
428 // Last accepted by Check Creature if any (Check can change requirements at each call)
429 template<class Check>
431 {
434 Check& i_check;
435
436 CreatureLastSearcher(WorldObject const* searcher, Creature*& result, Check& check)
437 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
438
439 void Visit(CreatureMapType& m);
440
441 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
442 };
443
444 template<class Check>
446 {
448 std::list<Creature*>& i_objects;
449 Check& i_check;
450
451 CreatureListSearcher(WorldObject const* searcher, std::list<Creature*>& objects, Check& check)
452 : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
453
454 void Visit(CreatureMapType& m);
455
456 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
457 };
458
459 template<class Do>
461 {
463 Do& i_do;
464
465 CreatureWorker(WorldObject const* searcher, Do& _do)
466 : i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
467
469 {
470 for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
471 if (itr->GetSource()->InSamePhase(i_phaseMask))
472 i_do(itr->GetSource());
473 }
474
475 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
476 };
477
478 // Player searchers
479
480 template<class Check>
482 {
485 Check& i_check;
486
487 PlayerSearcher(WorldObject const* searcher, Player*& result, Check& check)
488 : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
489
490 void Visit(PlayerMapType& m);
491
492 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
493 };
494
495 template<class Check>
497 {
499 std::list<Player*>& i_objects;
500 Check& i_check;
501
502 PlayerListSearcher(WorldObject const* searcher, std::list<Player*>& objects, Check& check)
503 : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
504
505 void Visit(PlayerMapType& m);
506
507 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
508 };
509
510 template<class Check>
512 {
515 Check& i_check;
516
517 PlayerLastSearcher(WorldObject const* searcher, Player*& result, Check& check) : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check)
518 {
519 }
520
521 void Visit(PlayerMapType& m);
522
523 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
524 };
525
526 template<class Do>
528 {
530 Do& i_do;
531
532 PlayerWorker(WorldObject const* searcher, Do& _do)
533 : i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
534
536 {
537 for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
538 if (itr->GetSource()->InSamePhase(i_phaseMask))
539 i_do(itr->GetSource());
540 }
541
542 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
543 };
544
545 template<class Do>
547 {
549 float i_dist;
550 Do& i_do;
551
552 PlayerDistWorker(WorldObject const* searcher, float _dist, Do& _do)
553 : i_searcher(searcher), i_dist(_dist), i_do(_do) { }
554
556 {
557 for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
558 if (itr->GetSource()->InSamePhase(i_searcher) && itr->GetSource()->IsWithinDist(i_searcher, i_dist))
559 i_do(itr->GetSource());
560 }
561
562 template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) { }
563 };
564
565 // CHECKS && DO classes
566
567 // WorldObject check classes
568
570 {
571 public:
572 AnyDeadUnitObjectInRangeCheck(Unit* searchObj, float range) : i_searchObj(searchObj), i_range(range) { }
573 bool operator()(Player* u);
574 bool operator()(Corpse* u);
575 bool operator()(Creature* u);
576 template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
577 protected:
578 Unit const* const i_searchObj;
579 float i_range;
580 };
581
583 {
584 public:
585 AnyDeadUnitSpellTargetInRangeCheck(Unit* searchObj, float range, SpellInfo const* spellInfo, SpellTargetCheckTypes check)
586 : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(searchObj, searchObj, spellInfo, check, NULL)
587 { }
588 bool operator()(Player* u);
589 bool operator()(Corpse* u);
590 bool operator()(Creature* u);
591 template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
592 protected:
595 };
596
597 // WorldObject do classes
598
600 {
601 public:
603 void operator()(Creature* u) const { u->Respawn(); }
604 void operator()(GameObject* u) const { u->Respawn(); }
605 void operator()(WorldObject*) const { }
606 void operator()(Corpse*) const { }
607 };
608
609 // GameObject checks
610
612 {
613 public:
614 GameObjectFocusCheck(Unit const* unit, uint32 focusId) : i_unit(unit), i_focusId(focusId) { }
615 bool operator()(GameObject* go) const
616 {
618 return false;
619
621 return false;
622
623 float dist = (float)((go->GetGOInfo()->spellFocus.dist) / 2);
624
625 return go->IsWithinDistInMap(i_unit, dist);
626 }
627 private:
628 Unit const* i_unit;
630 };
631
632 // Find the nearest Fishing hole and return true only if source object is in range of hole
634 {
635 public:
636 NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) { }
638 {
639 if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius))
640 {
641 i_range = i_obj.GetDistance(go);
642 return true;
643 }
644 return false;
645 }
646 float GetLastRange() const { return i_range; }
647 private:
649 float i_range;
650
651 // prevent clone
653 };
654
656 {
657 public:
658 NearestGameObjectCheck(WorldObject const& obj) : i_obj(obj), i_range(999) { }
660 {
661 if (i_obj.IsWithinDistInMap(go, i_range))
662 {
663 i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
664 return true;
665 }
666 return false;
667 }
668 float GetLastRange() const { return i_range; }
669 private:
671 float i_range;
672
673 // prevent clone this object
675 };
676
677 // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
679 {
680 public:
681 NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) { }
683 {
684 if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
685 {
686 i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
687 return true;
688 }
689 return false;
690 }
691 float GetLastRange() const { return i_range; }
692 private:
695 float i_range;
696
697 // prevent clone this object
699 };
700
701 // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO with a certain type)
703 {
704 public:
705 NearestGameObjectTypeInObjectRangeCheck(WorldObject const& obj, GameobjectTypes type, float range) : i_obj(obj), i_type(type), i_range(range) { }
707 {
708 if (go->GetGoType() == i_type && i_obj.IsWithinDistInMap(go, i_range))
709 {
710 i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
711 return true;
712 }
713 return false;
714 }
715 float GetLastRange() const { return i_range; }
716 private:
719 float i_range;
720
721 // prevent clone this object
723 };
724
726 {
727 public:
728 GameObjectWithDbGUIDCheck(WorldObject const& /*obj*/, uint32 db_guid) : i_db_guid(db_guid) { }
729 bool operator()(GameObject const* go) const
730 {
731 return go->GetDBTableGUIDLow() == i_db_guid;
732 }
733 private:
735 };
736
737 // Unit checks
738
740 {
741 public:
742 MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) { }
744 {
745 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
746 {
747 i_hp = u->GetMaxHealth() - u->GetHealth();
748 return true;
749 }
750 return false;
751 }
752 private:
753 Unit const* i_obj;
754 float i_range;
756 };
757
759 {
760 public:
761 FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) { }
763 {
764 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
766 {
767 return true;
768 }
769 return false;
770 }
771 private:
772 Unit const* i_obj;
773 float i_range;
774 };
775
777 {
778 public:
779 FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) { }
781 {
782 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
783 !(u->HasAura(i_spell)))
784 {
785 return true;
786 }
787 return false;
788 }
789 private:
790 Unit const* i_obj;
791 float i_range;
793 };
794
796 {
797 public:
798 AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
800 {
801 if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
802 return true;
803 else
804 return false;
805 }
806 private:
808 Unit const* i_funit;
809 float i_range;
810 };
811
813 {
814 public:
815 AnyUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
817 {
818 if (!u->IsAlive())
819 return false;
820
822 return false;
823
824 if (u->GetTypeId() == TypeID::TYPEID_UNIT && ((Creature*)u)->IsTotem())
825 return false;
826
827 if (!u->isTargetableForAttack(false))
828 return false;
829
830 return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u);
831 }
832 private:
834 Unit const* i_funit;
835 float i_range;
836 };
837
839 {
840 public:
842 : i_funit(funit), i_range(range) { }
843
844 bool operator()(const Unit* u)
845 {
846 return u->IsAlive()
847 && i_funit->IsWithinDistInMap(u, i_range)
848 && !i_funit->IsFriendlyTo(u)
849 && i_funit->IsValidAttackTarget(u)
851 && i_funit->CanSeeOrDetect(u);
852 }
853 private:
854 Unit const* i_funit;
855 float i_range;
856 };
857
859 {
860 public:
861 CreatureWithDbGUIDCheck(WorldObject const* /*obj*/, uint32 lowguid) : i_lowguid(lowguid) { }
863 {
864 return u->GetDBTableGUIDLow() == i_lowguid;
865 }
866 private:
868 };
869
871 {
872 public:
873 AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) { }
875 {
876 if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TypeID::TYPEID_PLAYER))
877 return true;
878 else
879 return false;
880 }
881 private:
883 Unit const* i_funit;
884 float i_range;
886 };
887
889 {
890 public:
891 AnyGroupedUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool raid) : _source(obj), _refUnit(funit), _range(range), _raid(raid) { }
893 {
894 if (G3D::fuzzyEq(_range, 0))
895 return false;
896
897 if (_raid)
898 {
899 if (!_refUnit->IsInRaidWith(u))
900 return false;
901 }
902 else if (!_refUnit->IsInPartyWith(u))
903 return false;
904
905 return !_refUnit->IsHostileTo(u) && u->IsAlive() && _source->IsWithinDistInMap(u, _range);
906 }
907
908 private:
911 float _range;
912 bool _raid;
913 };
914
916 {
917 public:
918 AnyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) { }
920 {
921 if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
922 return true;
923
924 return false;
925 }
926 private:
928 float i_range;
929 };
930
931 // Success at unit in range, range update for next check (this can be use with UnitLastSearcher to find nearest unit)
933 {
934 public:
935 NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
937 {
938 if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
939 !i_funit->IsFriendlyTo(u) && i_funit->CanSeeOrDetect(u))
940 {
941 i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
942 return true;
943 }
944
945 return false;
946 }
947 private:
949 Unit const* i_funit;
950 float i_range;
951
952 // prevent clone this object
954 };
955
957 {
958 public:
959 AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
960 : i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
961 {
962 Unit const* check = i_funit;
963 Unit const* owner = i_funit->GetOwner();
964 if (owner)
965 check = owner;
967 if (i_obj->GetTypeId() == TypeID::TYPEID_DYNAMICOBJECT)
968 _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
969 }
971 {
972 // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
973 if (u->GetTypeId() == TypeID::TYPEID_UNIT && ((Creature*)u)->IsTotem())
974 return false;
975
976 if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TypeID::TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range))
977 return true;
978
979 return false;
980 }
981 private:
984 Unit const* i_funit;
986 float i_range;
987 };
988
989 // do attack at call of help to friendly crearture
991 {
992 public:
993 CallOfHelpCreatureInRangeDo(Unit* funit, Unit* enemy, float range)
994 : i_funit(funit), i_enemy(enemy), i_range(range)
995 { }
997 {
998 if (u == i_funit)
999 return;
1000
1001 if (!u->CanAssistTo(i_funit, i_enemy, false))
1002 return;
1003
1004 // too far
1006 return;
1007
1008 // only if see assisted creature's enemy
1009 if (!u->IsWithinLOSInMap(i_enemy))
1010 return;
1011
1012 if (u->AI())
1013 u->AI()->AttackStart(i_enemy);
1014 }
1015 private:
1018 float i_range;
1019 };
1020
1022 {
1023 bool operator()(Unit* u) { return !u->IsAlive(); }
1024 };
1025
1026 /*
1027 struct AnyStealthedCheck
1028 {
1029 bool operator()(Unit* u) { return u->GetVisibility() == VISIBILITY_GROUP_STEALTH; }
1030 };
1031 */
1032
1033 // Creature checks
1034
1036 {
1037 public:
1038 explicit NearestHostileUnitCheck(Creature const* creature, float dist = 0, bool playerOnly = false) : me(creature), i_playerOnly(playerOnly)
1039 {
1040 m_range = (dist == 0 ? 9999 : dist);
1041 }
1043 {
1044 if (!me->IsWithinDistInMap(u, m_range))
1045 return false;
1046
1047 if (!me->IsValidAttackTarget(u))
1048 return false;
1049
1051 return false;
1052
1053 m_range = me->GetDistance(u); // use found unit range as new range limit for next check
1054 return true;
1055 }
1056
1057 private:
1058 Creature const* me;
1059 float m_range;
1062 };
1063
1065 {
1066 public:
1067 explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist = 0) : me(creature)
1068 {
1069 m_range = (dist == 0 ? 9999 : dist);
1070 m_force = (dist == 0 ? false : true);
1071 }
1073 {
1074 if (!me->IsWithinDistInMap(u, m_range))
1075 return false;
1076
1077 if (!me->CanSeeOrDetect(u))
1078 return false;
1079
1080 if (!me->IsWithinLOSInMap(u))
1081 return false;
1082
1083 if (m_force)
1084 {
1085 if (!me->IsValidAttackTarget(u))
1086 return false;
1087 }
1088 else if (!me->CanStartAttack(u, false))
1089 return false;
1090
1091 m_range = me->GetDistance(u); // use found unit range as new range limit for next check
1092 return true;
1093 }
1094 float GetLastRange() const { return m_range; }
1095 private:
1096 Creature const* me;
1097 float m_range;
1100 };
1101
1103 {
1104 public:
1105 explicit NearestHostileUnitInAggroRangeCheck(Creature const* creature, bool useLOS = false) : _me(creature), _useLOS(useLOS)
1106 {
1107 }
1109 {
1110 if (!u->IsHostileTo(_me))
1111 return false;
1112
1113 if (!u->IsWithinDistInMap(_me, _me->GetAggroRange(u)))
1114 return false;
1115
1116 if (!_me->IsValidAttackTarget(u))
1117 return false;
1118
1119 if (_useLOS && !u->IsWithinLOSInMap(_me))
1120 return false;
1121
1122 return true;
1123 }
1124
1125 private:
1129 };
1130
1132 {
1133 public:
1134 AnyAssistCreatureInRangeCheck(Unit* funit, Unit* enemy, float range)
1135 : i_funit(funit), i_enemy(enemy), i_range(range)
1136 {
1137 }
1139 {
1140 if (u == i_funit)
1141 return false;
1142
1143 if (!u->CanAssistTo(i_funit, i_enemy))
1144 return false;
1145
1146 // too far
1147 if (!i_funit->IsWithinDistInMap(u, i_range))
1148 return false;
1149
1150 // only if see assisted creature
1151 if (!i_funit->IsWithinLOSInMap(u))
1152 return false;
1153
1154 return true;
1155 }
1156 private:
1159 float i_range;
1160 };
1161
1163 {
1164 public:
1166 : i_obj(obj), i_enemy(enemy), i_range(range) { }
1167
1169 {
1170 if (u == i_obj)
1171 return false;
1172 if (!u->CanAssistTo(i_obj, i_enemy))
1173 return false;
1174
1175 if (!i_obj->IsWithinDistInMap(u, i_range))
1176 return false;
1177
1178 if (!i_obj->IsWithinLOSInMap(u))
1179 return false;
1180
1181 i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
1182 return true;
1183 }
1184 float GetLastRange() const { return i_range; }
1185 private:
1188 float i_range;
1189
1190 // prevent clone this object
1192 };
1193
1194 // Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
1196 {
1197 public:
1199 : i_obj(obj), i_entry(entry), i_alive(alive), i_range(range) { }
1200
1202 {
1203 if (u->GetEntry() == i_entry && u->IsAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range))
1204 {
1205 i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
1206 return true;
1207 }
1208 return false;
1209 }
1210 float GetLastRange() const { return i_range; }
1211 private:
1215 float i_range;
1216
1217 // prevent clone this object
1219 };
1220
1222 {
1223 public:
1224 AnyPlayerInObjectRangeCheck(WorldObject const* obj, float range, bool reqAlive = true) : _obj(obj), _range(range), _reqAlive(reqAlive) { }
1226 {
1227 if (_reqAlive && !u->IsAlive())
1228 return false;
1229
1230 if (!_obj->IsWithinDistInMap(u, _range))
1231 return false;
1232
1233 return true;
1234 }
1235
1236 private:
1238 float _range;
1240 };
1241
1243 {
1244 public:
1245 NearestPlayerInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range)
1246 {
1247 }
1248
1250 {
1251 if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
1252 {
1253 i_range = i_obj->GetDistance(u);
1254 return true;
1255 }
1256
1257 return false;
1258 }
1259 private:
1261 float i_range;
1262
1264 };
1265
1267 {
1268 public:
1269 AllFriendlyCreaturesInGrid(Unit const* obj) : unit(obj) { }
1271 {
1272 if (u->IsAlive() && u->IsVisible() && u->IsFriendlyTo(unit))
1273 return true;
1274
1275 return false;
1276 }
1277 private:
1278 Unit const* unit;
1279 };
1280
1282 {
1283 public:
1284 AllGameObjectsWithEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { }
1286 {
1287 if (go->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(go, m_fRange, false))
1288 return true;
1289
1290 return false;
1291 }
1292 private:
1296 };
1297
1299 {
1300 public:
1301 AllCreaturesOfEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { }
1302 bool operator() (Unit* unit)
1303 {
1304 if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false))
1305 return true;
1306
1307 return false;
1308 }
1309
1310 private:
1314 };
1315
1317 {
1318 public:
1319 PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : unit(unit), fRange(fMinRange) { }
1320 bool operator() (Player* player)
1321 {
1322 //No threat list check, must be done explicit if expected to be in combat with creature
1323 if (!player->IsGameMaster() && player->IsAlive() && !unit->IsWithinDist(player, fRange, false))
1324 return true;
1325
1326 return false;
1327 }
1328
1329 private:
1330 Unit const* unit;
1331 float fRange;
1332 };
1333
1335 {
1336 public:
1337 GameObjectInRangeCheck(float _x, float _y, float _z, float _range, uint32 _entry = 0) :
1338 x(_x), y(_y), z(_z), range(_range), entry(_entry) { }
1340 {
1341 if (!entry || (go->GetGOInfo() && go->GetGOInfo()->entry == entry))
1342 return go->IsInRange(x, y, z, range);
1343 else return false;
1344 }
1345 private:
1346 float x, y, z, range;
1348 };
1349
1351 {
1352 public:
1353 AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) { }
1355 {
1356 return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go);
1357 }
1358 private:
1361 };
1362
1364 {
1365 public:
1366 ObjectTypeIdCheck(TypeID typeId, bool equals) : _typeId(typeId), _equals(equals) { }
1368 {
1369 return (object->GetTypeId() == _typeId) == _equals;
1370 }
1371
1372 private:
1375 };
1376
1378 {
1379 public:
1380 ObjectGUIDCheck(uint64 GUID) : _GUID(GUID) { }
1382 {
1383 return object->GetGUID() == _GUID;
1384 }
1385
1386 private:
1388 };
1389
1391 {
1392 public:
1393 HeightDifferenceCheck(WorldObject* go, float diff, bool reverse)
1394 : _baseObject(go), _difference(diff), _reverse(reverse)
1395 {
1396 }
1397
1398 bool operator()(WorldObject* unit) const
1399 {
1400 return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
1401 }
1402
1403 private:
1407 };
1408
1410 {
1411 public:
1412 UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { }
1413 bool operator()(Unit* unit) const
1414 {
1415 return unit->HasAura(_spellId, _casterGUID) == _present;
1416 }
1417
1418 bool operator()(WorldObject* object) const
1419 {
1420 return object->ToUnit() && object->ToUnit()->HasAura(_spellId, _casterGUID) == _present;
1421 }
1422
1423 private:
1427 };
1428
1429 // Player checks and do
1430
1431 // Prepare using Builder localized packets with caching and send to player
1432 template<class Builder>
1434 {
1435 public:
1436 explicit LocalizedPacketDo(Builder& builder) : i_builder(builder) { }
1437
1439 {
1440 for (size_t i = 0; i < i_data_cache.size(); ++i)
1441 delete i_data_cache[i];
1442 }
1443 void operator()(Player* p);
1444
1445 private:
1446 Builder& i_builder;
1447 std::vector<WorldPacket*> i_data_cache; // 0 = default, i => i-1 locale index
1448 };
1449
1450 // Prepare using Builder localized packets with caching and send to player
1451 template<class Builder>
1453 {
1454 public:
1455 typedef std::vector<WorldPacket*> WorldPacketList;
1456 explicit LocalizedPacketListDo(Builder& builder) : i_builder(builder) { }
1457
1459 {
1460 for (size_t i = 0; i < i_data_cache.size(); ++i)
1461 for (size_t j = 0; j < i_data_cache[i].size(); ++j)
1462 delete i_data_cache[i][j];
1463 }
1464 void operator()(Player* p);
1465
1466 private:
1467 Builder& i_builder;
1468 std::vector<WorldPacketList> i_data_cache;
1469 // 0 = default, i => i-1 locale index
1470 };
1471}
1472#endif
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
static constexpr TypeID TYPEID_UNIT
GridRefManager< Corpse > CorpseMapType
Definition GridDefines.h:50
GridRefManager< DynamicObject > DynamicObjectMapType
Definition GridDefines.h:52
GridRefManager< Creature > CreatureMapType
Definition GridDefines.h:51
GridRefManager< Player > PlayerMapType
Definition GridDefines.h:54
GridRefManager< AreaTrigger > AreaTriggerMapType
Definition GridDefines.h:55
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
@ GRID_MAP_TYPE_MASK_PLAYER
Definition GridDefines.h:63
@ GRID_MAP_TYPE_MASK_CREATURE
Definition GridDefines.h:60
@ GRID_MAP_TYPE_MASK_ALL
Definition GridDefines.h:65
@ GRID_MAP_TYPE_MASK_GAMEOBJECT
Definition GridDefines.h:62
@ GRID_MAP_TYPE_MASK_DYNAMICOBJECT
Definition GridDefines.h:61
@ GRID_MAP_TYPE_MASK_CORPSE
Definition GridDefines.h:59
@ GRID_MAP_TYPE_MASK_AREATRIGGER
Definition GridDefines.h:64
GridRefManager< GameObject > GameObjectMapType
Definition GridDefines.h:53
Grid< Player, AllWorldObjectTypes, AllGridObjectTypes > GridType
Definition GridDefines.h:68
TypeID
Definition Object.h:50
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_DYNAMICOBJECT
Definition Object.h:57
@ TYPEID_UNIT
Definition Object.h:54
GameobjectTypes
@ GAMEOBJECT_TYPE_SPELL_FOCUS
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ CREATURE_TYPE_CRITTER
@ CREATURE_TYPE_NON_COMBAT_PET
#define sSpellMgr
Definition SpellMgr.h:744
SpellTargetCheckTypes
@ UNIT_STATE_CONFUSED
Definition Unit.h:523
@ UNIT_STATE_STUNNED
Definition Unit.h:515
void Respawn(bool force=false)
uint32 GetDBTableGUIDLow() const
Definition Creature.h:445
bool CanAssistTo(const Unit *u, const Unit *enemy, bool checkfaction=true) const
CreatureAI * AI() const
Definition Creature.h:483
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:643
uint32 GetDBTableGUIDLow() const
Definition GameObject.h:651
bool isSpawned() const
Definition GameObject.h:705
bool IsInRange(float x, float y, float z, float radius) const
GameobjectTypes GetGoType() const
Definition GameObject.h:719
LinkedListHead::Iterator< GridReference< OBJECT > > iterator
iterator begin()
Definition Map.h:238
Player * ToPlayer()
Definition Object.h:204
TypeID GetTypeId() const
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:125
uint32 GetTeam() const
Definition Player.h:2527
std::set< uint64 > ClientGUIDs
Definition Player.h:2856
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:18066
WorldSession * GetSession() const
Definition Player.h:2417
bool IsGameMaster() const
Definition Player.h:1369
uint32 m_uiEntry
AllCreaturesOfEntryInRange(const WorldObject *object, uint32 entry, float maxRange)
float m_fRange
const WorldObject * m_pObject
bool operator()(Unit *unit)
bool operator()(GameObject *go)
AllGameObjectsWithEntryInRange(const WorldObject *object, uint32 entry, float maxRange)
uint32 m_uiEntry
const WorldObject * m_pObject
float m_fRange
bool operator()(WorldObject *go)
AllWorldObjectsInRange(const WorldObject *object, float maxRange)
AnyAoETargetUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
AnyAssistCreatureInRangeCheck(Unit *funit, Unit *enemy, float range)
AnyDeadUnitObjectInRangeCheck(Unit *searchObj, float range)
AnyDeadUnitSpellTargetInRangeCheck(Unit *searchObj, float range, SpellInfo const *spellInfo, SpellTargetCheckTypes check)
AnyFriendlyUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range, bool playerOnly=false)
AnyGroupedUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range, bool raid)
AnyPlayerInObjectRangeCheck(WorldObject const *obj, float range, bool reqAlive=true)
AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck(Unit const *funit, float range)
AnyUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
AnyUnitInObjectRangeCheck(WorldObject const *obj, float range)
CallOfHelpCreatureInRangeDo(Unit *funit, Unit *enemy, float range)
CreatureWithDbGUIDCheck(WorldObject const *, uint32 lowguid)
FriendlyCCedInRange(Unit const *obj, float range)
FriendlyMissingBuffInRange(Unit const *obj, float range, uint32 spellid)
GameObjectFocusCheck(Unit const *unit, uint32 focusId)
bool operator()(GameObject *go) const
GameObjectInRangeCheck(float _x, float _y, float _z, float _range, uint32 _entry=0)
bool operator()(GameObject *go)
bool operator()(GameObject const *go) const
GameObjectWithDbGUIDCheck(WorldObject const &, uint32 db_guid)
HeightDifferenceCheck(WorldObject *go, float diff, bool reverse)
bool operator()(WorldObject *unit) const
LocalizedPacketDo(Builder &builder)
std::vector< WorldPacket * > i_data_cache
std::vector< WorldPacket * > WorldPacketList
std::vector< WorldPacketList > i_data_cache
LocalizedPacketListDo(Builder &builder)
MostHPMissingInRange(Unit const *obj, float range, uint32 hp)
NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const &)
NearestAssistCreatureInCreatureRangeCheck(Creature *obj, Unit *enemy, float range)
NearestAttackableUnitInObjectRangeCheck(NearestAttackableUnitInObjectRangeCheck const &)
NearestAttackableUnitInObjectRangeCheck(WorldObject const *obj, Unit const *funit, float range)
uint32 i_entry
bool operator()(Creature *u)
bool i_alive
NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const &obj, uint32 entry, bool alive, float range)
NearestCreatureEntryWithLiveStateInObjectRangeCheck(NearestCreatureEntryWithLiveStateInObjectRangeCheck const &)
WorldObject const & i_obj
float GetLastRange() const
float i_range
NearestGameObjectCheck(WorldObject const &obj)
bool operator()(GameObject *go)
NearestGameObjectCheck(NearestGameObjectCheck const &)
float i_range
uint32 i_entry
float GetLastRange() const
NearestGameObjectEntryInObjectRangeCheck(WorldObject const &obj, uint32 entry, float range)
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const &)
WorldObject const & i_obj
bool operator()(GameObject *go)
NearestGameObjectFishingHole(NearestGameObjectFishingHole const &)
NearestGameObjectFishingHole(WorldObject const &obj, float range)
NearestGameObjectTypeInObjectRangeCheck(WorldObject const &obj, GameobjectTypes type, float range)
NearestGameObjectTypeInObjectRangeCheck(NearestGameObjectTypeInObjectRangeCheck const &)
NearestHostileUnitCheck(Creature const *creature, float dist=0, bool playerOnly=false)
NearestHostileUnitCheck(NearestHostileUnitCheck const &)
NearestHostileUnitInAggroRangeCheck(NearestHostileUnitInAggroRangeCheck const &)
NearestHostileUnitInAggroRangeCheck(Creature const *creature, bool useLOS=false)
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const &)
NearestHostileUnitInAttackDistanceCheck(Creature const *creature, float dist=0)
NearestPlayerInObjectRangeCheck(NearestPlayerInObjectRangeCheck const &)
NearestPlayerInObjectRangeCheck(WorldObject const *obj, float range)
bool operator()(WorldObject *object)
ObjectTypeIdCheck(TypeID typeId, bool equals)
bool operator()(WorldObject *object)
PlayerAtMinimumRangeAway(Unit const *unit, float fMinRange)
void operator()(GameObject *u) const
void operator()(WorldObject *) const
void operator()(Creature *u) const
void operator()(Corpse *) const
bool operator()(Unit *unit) const
UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID=0)
bool operator()(WorldObject *object) const
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:16
Definition Unit.h:1367
bool IsCharmed() const
Definition Unit.h:2136
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition Unit.cpp:3795
bool isFrozen() const
Definition Unit.cpp:5796
uint32 GetMaxHealth() const
Definition Unit.h:1604
bool IsAlive() const
Definition Unit.h:2032
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
bool isFeared() const
Definition Unit.h:1925
uint32 GetCreatureType() const
Definition Unit.cpp:4910
uint32 GetHealth() const
Definition Unit.h:1600
bool IsVisible() const
Definition Unit.cpp:4158
bool HasUnitState(const uint32 f) const
Definition Unit.h:1485
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:2283
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:2278
bool IsInCombat() const
Definition Unit.h:1896
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition Object.cpp:1735
bool IsWithinLOSInMap(WorldObject const *obj) const
Definition Object.cpp:1656
Player session in the World.
Definition Cell.h:37
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@076241013146174060203322361030304357327036335177 spellFocus
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@243266127071011160240350104214013054067132104252 fishinghole
float GetPositionZ() const
Definition Object.h:330
void Visit(GridRefManager< T > &)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(CreatureMapType &m)
CreatureLastSearcher(WorldObject const *searcher, Creature *&result, Check &check)
CreatureListSearcher(WorldObject const *searcher, std::list< Creature * > &objects, Check &check)
std::list< Creature * > & i_objects
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(CreatureMapType &m)
void Visit(GridRefManager< T > &)
void Visit(CreatureMapType &m)
CreatureSearcher(WorldObject const *searcher, Creature *&result, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(CreatureMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
CreatureWorker(WorldObject const *searcher, Do &_do)
void Visit(GridRefManager< T > &)
DelayedUnitRelocation(Cell &c, CellCoord &pair, Map &map, float radius)
void Visit(GameObjectMapType &m)
GameObjectLastSearcher(WorldObject const *searcher, GameObject *&result, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
std::list< GameObject * > & i_objects
GameObjectListSearcher(WorldObject const *searcher, std::list< GameObject * > &objects, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(GameObjectMapType &m)
void Visit(GameObjectMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
GameObjectSearcher(WorldObject const *searcher, GameObject *&result, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(GameObjectMapType &m)
GameObjectWorker(WorldObject const *searcher, Functor &func)
void Visit(GameObjectMapType &m)
void updateObjects(GridRefManager< T > &m)
GridUpdater(GridType &grid, uint32 diff)
void Visit(DynamicObjectMapType &m)
void Visit(CreatureMapType &m)
void Visit(PlayerMapType &m)
void Visit(AreaTriggerMapType &m)
void Visit(CorpseMapType &m)
void Visit(PlayerMapType &m)
void Visit(GridRefManager< SKIP > &)
void SendPacket(Player *player) const
MessageDistDeliverer(WorldObject *src, WorldPacket *msg, float dist, bool own_team_only=false, Player const *skipped=NULL)
void Visit(PlayerMapType &)
void Visit(GridRefManager< T > &m)
void Visit(CorpseMapType &)
ObjectUpdater(const uint32 diff)
void Visit(GridRefManager< NOT_INTERESTED > &)
PlayerDistWorker(WorldObject const *searcher, float _dist, Do &_do)
WorldObject const * i_searcher
void Visit(PlayerMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
PlayerLastSearcher(WorldObject const *searcher, Player *&result, Check &check)
void Visit(PlayerMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(PlayerMapType &m)
std::list< Player * > & i_objects
PlayerListSearcher(WorldObject const *searcher, std::list< Player * > &objects, Check &check)
void Visit(GridRefManager< T > &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(PlayerMapType &m)
PlayerSearcher(WorldObject const *searcher, Player *&result, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
PlayerWorker(WorldObject const *searcher, Do &_do)
void Visit(PlayerMapType &m)
void Visit(CreatureMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
UnitLastSearcher(WorldObject const *searcher, Unit *&result, Check &check)
void Visit(PlayerMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
UnitListSearcher(WorldObject const *searcher, std::list< Unit * > &objects, Check &check)
std::list< Unit * > & i_objects
void Visit(CreatureMapType &m)
UnitSearcher(WorldObject const *searcher, Unit *&result, Check &check)
void Visit(GridRefManager< NOT_INTERESTED > &)
VisibleChangesNotifier(WorldObject &object)
void Visit(GridRefManager< T > &)
void Visit(GridRefManager< T > &m)
std::set< Unit * > i_visibleNow
VisibleNotifier(Player &player)
Player::ClientGUIDs vis_guids
void Visit(GameObjectMapType &m)
WorldObjectLastSearcher(WorldObject const *searcher, WorldObject *&result, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
void Visit(GridRefManager< NOT_INTERESTED > &)
WorldObjectListSearcher(WorldObject const *searcher, std::list< WorldObject * > &objects, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
std::list< WorldObject * > & i_objects
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(GameObjectMapType &m)
void Visit(GridRefManager< NOT_INTERESTED > &)
WorldObjectSearcher(WorldObject const *searcher, WorldObject *&result, Check &check, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
void Visit(GridRefManager< NOT_INTERESTED > &)
void Visit(CreatureMapType &m)
void Visit(DynamicObjectMapType &m)
void Visit(GameObjectMapType &m)
void Visit(PlayerMapType &m)
WorldObjectWorker(WorldObject const *searcher, Do const &_do, uint32 mapTypeMask=GRID_MAP_TYPE_MASK_ALL)
void Visit(AreaTriggerMapType &m)
void Visit(CorpseMapType &m)