mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Grid:
- Simplified CellArea calculation (Original author: SilverIce) - Removed unused code in Cell class (Original author: SilverIce) - Improve some Visit functions.
This commit is contained in:
@@ -486,13 +486,12 @@ public:
|
||||
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AllCreaturesOfEntryInRange check(me, entry, 100);
|
||||
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check);
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()));
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
|
||||
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
|
||||
{
|
||||
|
||||
@@ -191,20 +191,19 @@ class boss_akilzon : public CreatureScript
|
||||
|
||||
CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Unit*> tempUnitMap;
|
||||
|
||||
{
|
||||
Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999);
|
||||
Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS);
|
||||
Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
||||
cell.Visit(p, world_unit_searcher, *(me->GetMap()));
|
||||
cell.Visit(p, grid_unit_searcher, *(me->GetMap()));
|
||||
cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS);
|
||||
cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS);
|
||||
}
|
||||
//dealdamege
|
||||
for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)
|
||||
|
||||
@@ -235,7 +235,6 @@ class boss_janalai : public CreatureScript
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AllCreaturesOfEntryInRange check(me, MOB_EGG, 100);
|
||||
@@ -243,7 +242,7 @@ class boss_janalai : public CreatureScript
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
|
||||
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()));
|
||||
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
|
||||
}
|
||||
|
||||
//sLog->outError("Eggs %d at middle", templist.size());
|
||||
@@ -269,7 +268,6 @@ class boss_janalai : public CreatureScript
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AllCreaturesOfEntryInRange check(me, MOB_FIRE_BOMB, 100);
|
||||
@@ -277,7 +275,7 @@ class boss_janalai : public CreatureScript
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
|
||||
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()));
|
||||
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
|
||||
}
|
||||
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
|
||||
{
|
||||
@@ -521,7 +519,6 @@ class mob_janalai_hatcher : public CreatureScript
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AllCreaturesOfEntryInRange check(me, 23817, 50);
|
||||
@@ -529,7 +526,7 @@ class mob_janalai_hatcher : public CreatureScript
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
|
||||
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()));
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
}
|
||||
|
||||
//sLog->outError("Eggs %d at %d", templist.size(), side);
|
||||
|
||||
@@ -164,7 +164,6 @@ class boss_nalorakk : public CreatureScript
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AllFriendlyCreaturesInGrid check(me);
|
||||
@@ -172,7 +171,7 @@ class boss_nalorakk : public CreatureScript
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher);
|
||||
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()));
|
||||
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
}
|
||||
|
||||
if (templist.empty())
|
||||
|
||||
@@ -459,7 +459,9 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
|
||||
creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20, 20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
|
||||
if (creature)
|
||||
CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
|
||||
}else{//summon at gate
|
||||
}
|
||||
else
|
||||
{//summon at gate
|
||||
creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10, 10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10, 10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
|
||||
}
|
||||
break;
|
||||
@@ -910,6 +912,7 @@ void hyjalAI::UpdateAI(const uint32 diff)
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void hyjalAI::JustDied(Unit* /*killer*/)
|
||||
{
|
||||
if (IsDummy)return;
|
||||
@@ -932,23 +935,20 @@ void hyjalAI::JustDied(Unit* /*killer*/)
|
||||
instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die
|
||||
}
|
||||
}
|
||||
|
||||
void hyjalAI::HideNearPos(float x, float y)
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
// First get all creatures.
|
||||
std::list<Creature*> creatures;
|
||||
Trinity::AllFriendlyCreaturesInGrid creature_check(me);
|
||||
Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
|
||||
TypeContainerVisitor
|
||||
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
|
||||
GridTypeMapContainer> creature_visitor(creature_searcher);
|
||||
|
||||
// Get Creatures
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()));
|
||||
TypeContainerVisitor <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher);
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
@@ -959,18 +959,19 @@ void hyjalAI::HideNearPos(float x, float y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hyjalAI::RespawnNearPos(float x, float y)
|
||||
{
|
||||
CellCoord p(Trinity::ComputeCellCoord(x, y));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::RespawnDo u_do;
|
||||
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(me, u_do);
|
||||
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
|
||||
cell.Visit(p, obj_worker, *me->GetMap());
|
||||
cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange());
|
||||
}
|
||||
|
||||
void hyjalAI::WaypointReached(uint32 i)
|
||||
{
|
||||
if (i == 1 || (i == 0 && me->GetEntry() == THRALL))
|
||||
@@ -994,7 +995,6 @@ void hyjalAI::WaypointReached(uint32 i)
|
||||
//all alive guards walk near here
|
||||
CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
// First get all creatures.
|
||||
@@ -1005,7 +1005,7 @@ void hyjalAI::WaypointReached(uint32 i)
|
||||
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
|
||||
GridTypeMapContainer> creature_visitor(creature_searcher);
|
||||
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()));
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
@@ -1036,7 +1036,6 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Creature*> creatures;
|
||||
@@ -1046,7 +1045,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
|
||||
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
|
||||
GridTypeMapContainer> creature_visitor(creature_searcher);
|
||||
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()));
|
||||
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user