OregonCore  revision be9e804-git
Your Favourite TBC server
ScriptedCreature.cpp File Reference
#include "ScriptedCreature.h"
#include "Spell.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Cell.h"
#include "CellImpl.h"
#include "ObjectMgr.h"
#include "MoveSplineInit.h"

Go to the source code of this file.

Classes

struct  TSpellSummary
 

Macros

#define GOBJECT(x)   (const_cast<GameObjectInfo*>(GetGameObjectInfo(x)))
 

Enumerations

enum  eNPCs { NPC_BROODLORD = 12017, NPC_VOID_REAVER = 19516, NPC_JAN_ALAI = 23578, NPC_SARTHARION = 28860 }
 

Functions

void FillSpellSummary ()
 
void LoadOverridenSQLData ()
 
CreatureGetClosestCreatureWithEntry (WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive)
 
GameObjectGetClosestGameObjectWithEntry (WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
 

Variables

struct TSpellSummarySpellSummary
 

Macro Definition Documentation

#define GOBJECT (   x)    (const_cast<GameObjectInfo*>(GetGameObjectInfo(x)))

Definition at line 658 of file ScriptedCreature.cpp.

Referenced by LoadOverridenSQLData().

Enumeration Type Documentation

enum eNPCs
Enumerator
NPC_BROODLORD 
NPC_VOID_REAVER 
NPC_JAN_ALAI 
NPC_SARTHARION 

Definition at line 546 of file ScriptedCreature.cpp.

Function Documentation

void FillSpellSummary ( )

Definition at line 318 of file ScriptedCreature.cpp.

References SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectImplicitTargetA, TSpellSummary::Effects, GetSpellStore(), SELECT_EFFECT_AURA, SELECT_EFFECT_DAMAGE, SELECT_EFFECT_HEALING, SELECT_TARGET_ANY_ENEMY, SELECT_TARGET_ANY_FRIEND, SELECT_TARGET_AOE_ENEMY, SELECT_TARGET_AOE_FRIEND, SELECT_TARGET_SELF, SELECT_TARGET_SINGLE_ENEMY, SELECT_TARGET_SINGLE_FRIEND, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEAL_MAX_HEALTH, SPELL_EFFECT_HEAL_MECHANICAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_INSTAKILL, SPELL_EFFECT_SCHOOL_DAMAGE, SpellSummary, TARGET_DEST_DYNOBJ_ENEMY, TARGET_DST_TARGET_ENEMY, TARGET_SRC_CASTER, TARGET_UNIT_AREA_ENEMY_DST, TARGET_UNIT_AREA_ENEMY_SRC, TARGET_UNIT_CASTER, TARGET_UNIT_PARTY_CASTER, TARGET_UNIT_PARTY_TARGET, TARGET_UNIT_TARGET_ALLY, TARGET_UNIT_TARGET_ENEMY, TARGET_UNIT_TARGET_PARTY, and TSpellSummary::Targets.

Referenced by ScriptMgr::ScriptsInit().

319 {
320  SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
321 
322  SpellEntry const* pTempSpell;
323 
324  for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
325  {
326  SpellSummary[i].Effects = 0;
327  SpellSummary[i].Targets = 0;
328 
329  pTempSpell = GetSpellStore()->LookupEntry(i);
330  //This spell doesn't exist
331  if (!pTempSpell)
332  continue;
333 
334  for (uint32 j = 0; j < 3; ++j)
335  {
336  //Spell targets self
337  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER)
338  SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF - 1);
339 
340  //Spell targets a single enemy
341  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
344 
345  //Spell targets AoE at enemy
346  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
348  pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
351 
352  //Spell targets an enemy
353  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
357  pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
360 
361  //Spell targets a single friend(or self)
362  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
366 
367  //Spell targets aoe friends
368  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
370  pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
372 
373  //Spell targets any friend(or self)
374  if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
379  pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
381 
382  //Make sure that this spell includes a damage effect
383  if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ||
384  pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL ||
385  pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
386  pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
387  SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE - 1);
388 
389  //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal)
390  if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL ||
391  pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
392  pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL ||
393  (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j] == 8))
394  SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING - 1);
395 
396  //Make sure that this spell applies an aura
397  if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA)
398  SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA - 1);
399  }
400  }
401 }
DBCStorage< SpellEntry > const * GetSpellStore()
Definition: DBCStores.cpp:776
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:731
struct TSpellSummary * SpellSummary
ACE_UINT32 uint32
Definition: Define.h:71
Creature* GetClosestCreatureWithEntry ( WorldObject pSource,
uint32  uiEntry,
float  fMaxSearchRange,
bool  bAlive 
)

Definition at line 678 of file ScriptedCreature.cpp.

References WorldObject::FindNearestCreature().

Referenced by BossAI::_JustReachedHome(), SmartScript::GetTargets(), Condition::Meets(), and Map::ScriptsProcess().

679 {
680  return pSource->FindNearestCreature(uiEntry, fMaxSearchRange, bAlive);
681 }
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true)
Definition: Object.cpp:2319
GameObject* GetClosestGameObjectWithEntry ( WorldObject pSource,
uint32  uiEntry,
float  fMaxSearchRange 
)

Definition at line 682 of file ScriptedCreature.cpp.

References WorldObject::FindNearestGameObject().

Referenced by BossAI::_JustReachedHome(), SmartScript::GetTargets(), and Condition::Meets().

683 {
684  return pSource->FindNearestGameObject(uiEntry, fMaxSearchRange);
685 }
GameObject * FindNearestGameObject(uint32 entry, float range)
Definition: Object.cpp:2328
void GetCreatureListWithEntryInGrid ( std::list< Creature * > &  lList,
WorldObject pSource,
uint32  uiEntry,
float  fMaxSearchRange 
)

Definition at line 686 of file ScriptedCreature.cpp.

References WorldObject::GetCreatureListWithEntryInGrid().

Referenced by BossAI::_JustReachedHome(), and WorldObject::SummonCreature().

687 {
688  return pSource->GetCreatureListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
689 }
void GetCreatureListWithEntryInGrid(std::list< Creature * > &creatureList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
Definition: Object.cpp:2359
void GetGameObjectListWithEntryInGrid ( std::list< GameObject * > &  lList,
WorldObject pSource,
uint32  uiEntry,
float  fMaxSearchRange 
)

Definition at line 690 of file ScriptedCreature.cpp.

References WorldObject::GetGameObjectListWithEntryInGrid().

Referenced by BossAI::_JustReachedHome(), and WorldObject::SummonCreature().

691 {
692  return pSource->GetGameObjectListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
693 }
void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &gameobjectList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
Definition: Object.cpp:2346
void LoadOverridenSQLData ( )

Definition at line 660 of file ScriptedCreature.cpp.

References GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_SPELLCASTER, GAMEOBJECT_TYPE_TRAP, GOBJECT, GameObjectInfo::trap, and GameObjectInfo::type.

Referenced by ScriptMgr::ScriptsInit().

661 {
662  GameObjectInfo* goInfo;
663 
664  // Sunwell Plateau : Kalecgos : Spectral Rift
665  goInfo = GOBJECT(187055);
666  if (goInfo)
667  if (goInfo->type == GAMEOBJECT_TYPE_GOOBER)
669 
670  // Naxxramas : Sapphiron Birth
671  goInfo = GOBJECT(181356);
672  if (goInfo)
673  if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
674  goInfo->trap.radius = 50;
675 }
struct GameObjectInfo::@59::@66 trap
#define GOBJECT(x)

Variable Documentation

struct TSpellSummary* SpellSummary