TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
go_ethereum_prison Class Reference

Public Member Functions

 go_ethereum_prison ()
 
bool OnGossipHello (Player *player, GameObject *go) override
 
- Public Member Functions inherited from GameObjectScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, GameObject *)
 
virtual bool OnGossipSelect (Player *, GameObject *, uint32, uint32)
 
virtual bool OnGossipSelectCode (Player *, GameObject *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, GameObject *, Quest const *)
 
virtual bool OnQuestReward (Player *, GameObject *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, GameObject *)
 
virtual void OnDestroyed (GameObject *, Player *)
 
virtual void OnDamaged (GameObject *, Player *)
 
virtual void OnLootStateChanged (GameObject *, uint32, Unit *)
 
virtual void OnGameObjectStateChanged (GameObject *, uint32)
 
virtual GameObjectAIGetAI (GameObject *) const
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 
- Public Member Functions inherited from UpdatableScript< GameObject >
virtual void OnUpdate (GameObject *, uint32)
 

Additional Inherited Members

- Protected Member Functions inherited from GameObjectScript
 GameObjectScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< GameObject >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

go_ethereum_prison::go_ethereum_prison ( )
inline
222 : GameObjectScript("go_ethereum_prison") { }
GameObjectScript(const char *name)
Definition: ScriptMgr.cpp:1592

Member Function Documentation

bool go_ethereum_prison::OnGossipHello ( Player player,
GameObject go 
)
inlineoverridevirtual

Reimplemented from GameObjectScript.

225  {
226  go->UseDoorOrButton();
227  int Random = rand32() % (sizeof(NpcPrisonEntry) / sizeof(uint32));
228 
229  if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player),
231  {
232  if (!creature->IsHostileTo(player))
233  {
234  if (FactionTemplateEntry const* pFaction = creature->GetFactionTemplateEntry())
235  {
236  uint32 Spell = 0;
237 
238  switch (pFaction->Faction)
239  {
240  case 1011: Spell = SPELL_REP_LC; break;
241  case 935: Spell = SPELL_REP_SHAT; break;
242  case 942: Spell = SPELL_REP_CE; break;
243  case 933: Spell = SPELL_REP_CON; break;
244  case 989: Spell = SPELL_REP_KT; break;
245  case 970: Spell = SPELL_REP_SPOR; break;
246  }
247 
248  if (Spell)
249  creature->CastSpell(player, Spell, false);
250  else
251  TC_LOG_ERROR("scripts", "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction());
252  }
253  }
254  }
255 
256  return false;
257  }
Definition: Creature.h:467
Definition: go_scripts.cpp:207
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
float GetAngle(Position const *pos) const
Definition: Position.cpp:63
uint32_t uint32
Definition: Define.h:150
Definition: go_scripts.cpp:205
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=NULL)
Definition: GameObject.cpp:1182
Definition: DBCStructure.h:433
Definition: go_scripts.cpp:210
Definition: go_scripts.cpp:206
const uint32 NpcPrisonEntry[]
Definition: go_scripts.cpp:213
uint32 rand32()
Definition: Random.cpp:64
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: go_scripts.cpp:209
float GetPositionX() const
Definition: Position.h:104
Definition: go_scripts.cpp:208
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: Spell.h:294

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: