Merge [SD2]
r1088 Add grid searcher class PlayerAtMinimumRangeAway and create ScriptedAI function GetPlayerAtMinimumRange that return player in grid with at least the defined range away from m_creature. r1089 Remove no longer needed grid search code and use function instead. - skip r1090 Rename and clarify function variables - skip r1091 Add two new grid search functions to return list of creature and gameobject. Remove unused class. r1092 Remove more grid search code in scripts and use functions instead. r1093 Remove obsolete grid search class and rename new to a more consistent name. r1094 Speed up functions GetCreature/GameObjectListWithEntryInGrid a bit --HG-- branch : trunk
This commit is contained in:
@@ -533,6 +533,25 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 s
|
||||
return pList;
|
||||
}
|
||||
|
||||
Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
|
||||
{
|
||||
Player* pPlayer = NULL;
|
||||
|
||||
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::PlayerAtMinimumRangeAway check(m_creature, fMinimumRange);
|
||||
Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
|
||||
TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, pair);
|
||||
cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
|
||||
|
||||
return pPlayer;
|
||||
}
|
||||
|
||||
void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged)
|
||||
{
|
||||
if (bLoadDefault)
|
||||
|
||||
@@ -169,6 +169,9 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
//Returns a list of all friendly units missing a specific buff within range
|
||||
std::list<Creature*> DoFindFriendlyMissingBuff(float range, uint32 spellid);
|
||||
|
||||
//Return a player with at least minimumRange from m_creature
|
||||
Player* GetPlayerAtMinimumRange(float fMinimumRange);
|
||||
|
||||
//Spawns a creature relative to m_creature
|
||||
Creature* DoSpawnCreature(uint32 id, float x, float y, float z, float angle, uint32 type, uint32 despawntime);
|
||||
Creature *DoSummon(uint32 entry, const float pos[4], uint32 despawntime = 30000, TempSummonType type = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
@@ -248,6 +251,5 @@ struct TRINITY_DLL_DECL BossAI : public ScriptedAI
|
||||
//return closest creature alive in grid, with range from pSource
|
||||
Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user