OregonCore  revision fb2a440-git
Your Favourite TBC server
ScriptMgr.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "ScriptMgr.h"
19 #include "Config/Config.h"
20 #include "Database/DatabaseEnv.h"
21 #include "DBCStores.h"
22 #include "ObjectMgr.h"
23 #include "ScriptLoader.h"
24 #include "ScriptSystem.h"
25 #include "SpellMgr.h"
26 #include "GossipDef.h"
27 #include "CreatureAIImpl.h"
28 #include "Player.h"
29 
31 
34 
35 void FillSpellSummary();
37 
39 {
40  pSystemMgr.LoadVersion();
41  pSystemMgr.LoadScriptTexts();
42  pSystemMgr.LoadScriptTextsCustom();
43  pSystemMgr.LoadScriptWaypoints();
44 }
45 
46 struct TSpellSummary
47 {
48  uint8 Targets; // set of enum SelectTarget
49  uint8 Effects; // set of enum SelectEffect
50 } extern* SpellSummary;
51 
53 {
54 }
55 
57 {
58  // Free Spell Summary
59  delete []SpellSummary;
60 
61  // Free resources before library unload
62  for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
63  delete m_scripts[i];
64 
65  num_sc_scripts = 0;
66 }
67 
69 {
70  outstring_log(" ____ _____ _ _ ");
71  outstring_log(" / __ \\ / ____| (_) | | ");
72  outstring_log(" | | | |_ __ ___ __ _ ___ _ __ | (___ ___ _ __ _ _ __ | |_ ");
73  outstring_log(" | | | | '__/ _ \\/ _` |/ _ \\| '_ \\ \\___ \\ / __| '__| | '_ \\| __|");
74  outstring_log(" | |__| | | | __/ (_| | (_) | | | |____) | (__| | | | |_) | |_ ");
75  outstring_log(" \\____/|_| \\___|\\__, |\\___/|_| |_|_____/ \\___|_| |_| .__/ \\__|");
76  outstring_log(" __/ | | | ");
77  outstring_log(" |___/ |_| \n");
78 
79  //Load database (must be called after SD2Config.SetSource).
80  LoadDatabase();
81 
82  for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
83  m_scripts[i] = NULL;
84 
86 
87  AddScripts();
88 
89  outstring_log(">> Loaded %i C++ Scripts.", num_sc_scripts);
90 
91  outstring_log(">> Load Overriden SQL Data.");
93 }
94 
95 //*********************************
96 //*** Functions used globally ***
97 
98 void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
99 {
100  if (!pSource)
101  {
102  error_log("OSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry);
103  return;
104  }
105 
106  if (iTextEntry >= 0)
107  {
108  error_log("OSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
109  return;
110  }
111 
112  const StringTextData* pData = pSystemMgr.GetTextData(iTextEntry);
113 
114  if (!pData)
115  {
116  error_log("OSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
117  return;
118  }
119 
120  debug_log("OSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
121 
122  if (pData->uiSoundId)
123  {
124  if (GetSoundEntriesStore()->LookupEntry(pData->uiSoundId))
125  pSource->SendPlaySound(pData->uiSoundId, false);
126  else
127  error_log("OSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
128  }
129 
130  if (pData->uiEmote)
131  {
132  if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
133  ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
134  else
135  error_log("OSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
136  }
137 
138  switch (pData->uiType)
139  {
140  case CHAT_TYPE_SAY:
141  pSource->MonsterSay(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
142  break;
143  case CHAT_TYPE_YELL:
144  pSource->MonsterYell(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
145  break;
147  pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0);
148  break;
150  pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0, true);
151  break;
152  case CHAT_TYPE_WHISPER:
153  {
154  if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
155  pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID());
156  else
157  error_log("OSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
158  }
159  break;
161  {
162  if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
163  pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID(), true);
164  else
165  error_log("OSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
166  }
167  break;
168  case CHAT_TYPE_ZONE_YELL:
169  pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0);
170  break;
171  }
172 }
173 
175 {
176  // try to find scripts which try to use another script's allocated memory
177  // that means didn't allocate memory for script
178  for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
179  {
180  // somebody forgot to allocate memory for a script by a method like this: newscript = new Script
181  if (m_scripts[i] == this)
182  {
183  error_log("ScriptName: '%s' - Forgot to allocate memory, so this script and/or the script before that can't work.", Name.c_str());
184  // don't register it
185  // and don't delete it because its memory is used for another script
186  return;
187  }
188  }
189 
190  int id = GetScriptId(Name.c_str());
191  if (id)
192  {
193  // try to find the script in assigned scripts
194  bool IsExist = false;
195  for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
196  {
197  if (m_scripts[i])
198  {
199  // if the assigned script's name and the new script's name is the same
200  if (m_scripts[i]->Name == Name)
201  {
202  IsExist = true;
203  break;
204  }
205  }
206  }
207 
208  // if the script doesn't assigned -> assign it!
209  if (!IsExist)
210  {
211  m_scripts[id] = this;
212  ++num_sc_scripts;
213  }
214  // if the script is already assigned -> delete it!
215  else
216  {
217  // @todo write a better error message than this one :)
218  error_log("ScriptName: '%s' already assigned with the same ScriptName, so the script can't work.", Name.c_str());
219  delete this;
220  }
221  }
222  else
223  {
224  if (Name.find("example") == std::string::npos)
225  error_db_log("OSCR: RegisterSelf, but script named %s does not have ScriptName assigned in database.", (this)->Name.c_str());
226  delete this;
227  }
228 }
229 
231 {
232  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
233  if (!tmpscript || !tmpscript->OnLogin) return;
234  tmpscript->OnLogin(player);
235 }
236 
238 {
239  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
240  if (!tmpscript || !tmpscript->OnLogout) return;
241  tmpscript->OnLogout(player);
242 }
243 
244 void ScriptMgr::OnPVPKill(Player* killer, Player* killed)
245 {
246  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
247  if (!tmpscript || !tmpscript->OnPVPKill) return;
248  tmpscript->OnPVPKill(killer, killed);
249 }
250 
252 {
253  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
254  if (!tmpscript || !tmpscript->OnCreatureKill) return;
255  tmpscript->OnCreatureKill(killer, killed);
256 }
257 
259 {
260  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
261  if (!tmpscript || !tmpscript->OnPlayerKilledByCreature) return;
262  tmpscript->OnPlayerKilledByCreature(killer, killed);
263 }
264 
265 void ScriptMgr::OnPlayerLevelChanged(Player* player, uint8 oldLevel, uint8 newLevel)
266 {
267  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
268  if (!tmpscript || !tmpscript->OnLevelChanged) return;
269  tmpscript->OnLevelChanged(player, oldLevel, newLevel);
270 }
271 
272 void ScriptMgr::OnPlayerTalentsReset(Player* player, bool no_cost)
273 {
274  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
275  if (!tmpscript || !tmpscript->OnTalentsReset) return;
276  tmpscript->OnTalentsReset(player, no_cost);
277 }
278 
279 void ScriptMgr::OnGroupCreated(Group* pGroup, Player* pPlayer)
280 {
281  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
282  if (!tmpscript || !tmpscript->OnGroupCreated) return;
283  tmpscript->OnGroupCreated(pGroup, pPlayer);
284 }
285 
287 {
288  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
289  if (!tmpscript || !tmpscript->OnGroupPlayerInvited) return;
290  tmpscript->OnGroupPlayerInvited(pGroup, pPlayer);
291 }
292 
294 {
295  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
296  if (!tmpscript || !tmpscript->OnGroupPlayerJoined) return;
297  tmpscript->OnGroupPlayerJoined(pGroup, pPlayer);
298 }
299 
300 void ScriptMgr::OnGroupPlayerRemoved(Group* pGroup, Player* pPlayer, uint8 method, uint64 kicker, const char* reason)
301 {
302  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
303  if (!tmpscript || !tmpscript->OnGroupPlayerRemoved) return;
304  tmpscript->OnGroupPlayerRemoved(pGroup, pPlayer, method, kicker, reason);
305 }
306 
307 void ScriptMgr::OnGroupLeaderChanged(Group* pGroup, Player* pOldLeader, Player* pNewLeader)
308 {
309  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
310  if (!tmpscript || !tmpscript->OnGroupLeaderChanged) return;
311  tmpscript->OnGroupLeaderChanged(pGroup, pOldLeader, pNewLeader);
312 }
313 
314 void ScriptMgr::OnGroupDisbanded(Group* pGroup, Player* pLeader)
315 {
316  Script* tmpscript = m_scripts[GetScriptId("scripted_on_events")];
317  if (!tmpscript || !tmpscript->OnGroupDisbanded) return;
318  tmpscript->OnGroupDisbanded(pGroup, pLeader);
319 }
320 
322 {
323  return "Integrated Oregon Scripts";
324 }
325 
326 bool ScriptMgr::GossipHello (Player* pPlayer, Creature* pCreature)
327 {
328  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
329  if (!tmpscript || !tmpscript->pGossipHello) return false;
330 
331  pPlayer->PlayerTalkClass->ClearMenus();
332  return tmpscript->pGossipHello(pPlayer, pCreature);
333 }
334 
335 bool ScriptMgr::GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
336 {
337  debug_log("OSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction);
338 
339  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
340  if (!tmpscript || !tmpscript->pGossipSelect) return false;
341 
342  pPlayer->PlayerTalkClass->ClearMenus();
343  return tmpscript->pGossipSelect(pPlayer, pCreature, uiSender, uiAction);
344 }
345 
346 bool ScriptMgr::GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode)
347 {
348  debug_log("OSCR: Gossip selection with code, sender: %d, action: %d", uiSender, uiAction);
349 
350  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
351  if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false;
352 
353  pPlayer->PlayerTalkClass->ClearMenus();
354  return tmpscript->pGossipSelectWithCode(pPlayer, pCreature, uiSender, uiAction, sCode);
355 }
356 
357 bool ScriptMgr::GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction)
358 {
359  if (!pGO)
360  return false;
361  debug_log("OSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction);
362 
363  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
364  if (!tmpscript || !tmpscript->pGOSelect) return false;
365 
366  pPlayer->PlayerTalkClass->ClearMenus();
367  return tmpscript->pGOSelect(pPlayer, pGO, uiSender, uiAction);
368 }
369 
370 bool ScriptMgr::GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction, const char* sCode)
371 {
372  if (!pGO)
373  return false;
374  debug_log("OSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction);
375 
376  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
377  if (!tmpscript || !tmpscript->pGOSelectWithCode) return false;
378 
379  pPlayer->PlayerTalkClass->ClearMenus();
380  return tmpscript->pGOSelectWithCode(pPlayer, pGO, uiSender , uiAction, sCode);
381 }
382 
383 bool ScriptMgr::QuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
384 {
385  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
386  if (!tmpscript || !tmpscript->QuestAccept) return false;
387 
388  pPlayer->PlayerTalkClass->ClearMenus();
389  return tmpscript->QuestAccept(pPlayer, pCreature, pQuest);
390 }
391 
392 bool ScriptMgr::QuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
393 {
394  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
395  if (!tmpscript || !tmpscript->pQuestSelect) return false;
396 
397  pPlayer->PlayerTalkClass->ClearMenus();
398  return tmpscript->pQuestSelect(pPlayer, pCreature, pQuest);
399 }
400 
401 bool ScriptMgr::QuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
402 {
403  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
404  if (!tmpscript || !tmpscript->pQuestComplete) return false;
405 
406  pPlayer->PlayerTalkClass->ClearMenus();
407  return tmpscript->pQuestComplete(pPlayer, pCreature, pQuest);
408 }
409 
410 bool ScriptMgr::ChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt)
411 {
412  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
413  if (!tmpscript || !tmpscript->pChooseReward) return false;
414 
415  pPlayer->PlayerTalkClass->ClearMenus();
416  return tmpscript->pChooseReward(pPlayer, pCreature, pQuest, opt);
417 }
418 
420 {
421  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
422  if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100;
423 
424  pPlayer->PlayerTalkClass->ClearMenus();
425  return tmpscript->pNPCDialogStatus(pPlayer, pCreature);
426 }
427 
429 {
430  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
431  if (!tmpscript || !tmpscript->pGODialogStatus) return 100;
432 
433  pPlayer->PlayerTalkClass->ClearMenus();
434  return tmpscript->pGODialogStatus(pPlayer, pGO);
435 }
436 
437 bool ScriptMgr::ItemHello(Player* pPlayer, Item* pItem, Quest const* pQuest)
438 {
439  Script* tmpscript = m_scripts[pItem->GetProto()->ScriptId];
440  if (!tmpscript || !tmpscript->pItemHello) return false;
441 
442  pPlayer->PlayerTalkClass->ClearMenus();
443  return tmpscript->pItemHello(pPlayer, pItem, pQuest);
444 }
445 
446 bool ScriptMgr::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
447 {
448  Script* tmpscript = m_scripts[pItem->GetProto()->ScriptId];
449  if (!tmpscript || !tmpscript->OnQuestAccept) return false;
450 
451  pPlayer->PlayerTalkClass->ClearMenus();
452  return tmpscript->OnQuestAccept(pPlayer, pItem, pQuest);
453 }
454 
456 {
457  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
458  if (!tmpscript || !tmpscript->pGOHello) return false;
459 
460  pPlayer->PlayerTalkClass->ClearMenus();
461  return tmpscript->pGOHello(pPlayer, pGO);
462 }
463 
464 bool ScriptMgr::GOQuestAccept(Player* pPlayer, GameObject* pGO, Quest const* pQuest)
465 {
466  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
467  if (!tmpscript || !tmpscript->pGOQuestAccept) return false;
468 
469  pPlayer->PlayerTalkClass->ClearMenus();
470  return tmpscript->pGOQuestAccept(pPlayer, pGO, pQuest);
471 }
472 
473 bool ScriptMgr::GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQuest, uint32 opt)
474 {
475  Script* tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
476  if (!tmpscript || !tmpscript->pGOChooseReward) return false;
477 
478  pPlayer->PlayerTalkClass->ClearMenus();
479  return tmpscript->pGOChooseReward(pPlayer, pGO, pQuest, opt);
480 }
481 
482 bool ScriptMgr::AreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry)
483 {
484  Script* tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)];
485  if (!tmpscript || !tmpscript->pAreaTrigger) return false;
486 
487  return tmpscript->pAreaTrigger(pPlayer, atEntry);
488 }
489 
491 {
492  Script* tmpscript = m_scripts[pCreature->GetScriptId()];
493  if (!tmpscript || !tmpscript->GetAI) return NULL;
494 
495  return tmpscript->GetAI(pCreature);
496 }
497 
498 bool ScriptMgr::ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
499 {
500  Script* tmpscript = m_scripts[pItem->GetProto()->ScriptId];
501  if (!tmpscript || !tmpscript->pItemUse) return false;
502 
503  return tmpscript->pItemUse(pPlayer, pItem, targets);
504 }
505 
506 bool ScriptMgr::EffectDummyCreature(Unit* caster, uint32 spellId, uint32 effIndex, Creature* crTarget)
507 {
508  Script* tmpscript = m_scripts[crTarget->GetScriptId()];
509 
510  if (!tmpscript || !tmpscript->pEffectDummyCreature) return false;
511 
512  return tmpscript->pEffectDummyCreature(caster, spellId, effIndex, crTarget);
513 }
514 
516 {
517  if (!map->IsDungeon()) return NULL;
518 
519  Script* tmpscript = m_scripts[((InstanceMap*)map)->GetScriptId()];
520  if (!tmpscript || !tmpscript->GetInstanceData) return NULL;
521 
522  return tmpscript->GetInstanceData(map);
523 }
524 
525 
526 
void(* OnPlayerKilledByCreature)(Creature *, Player *)
Definition: ScriptMgr.h:69
Targets
InstanceData * CreateInstanceData(Map *map)
Definition: ScriptMgr.cpp:515
struct TSpellSummary * SpellSummary
void(* OnTalentsReset)(Player *, bool)
Definition: ScriptMgr.h:71
ItemTemplate const * GetProto() const
Definition: Item.cpp:460
void SendPlaySound(uint32 Sound, bool OnlySelf)
Definition: Object.cpp:1790
void(* OnLevelChanged)(Player *, uint8, uint8)
Definition: ScriptMgr.h:70
uint32 GetScriptId(const char *name)
Definition: ObjectMgr.cpp:7648
void(* OnLogin)(Player *)
Definition: ScriptMgr.h:65
PlayerMenu * PlayerTalkClass
Definition: Player.h:2182
bool(* pItemHello)(Player *, Item *, Quest const *)
Definition: ScriptMgr.h:91
bool(* pChooseReward)(Player *, Creature *, Quest const *, uint32)
Definition: ScriptMgr.h:90
void ClearMenus()
Definition: GossipDef.cpp:116
uint32 uiLanguage
Definition: ScriptSystem.h:63
bool(* pQuestSelect)(Player *, Creature *, Quest const *)
Definition: ScriptMgr.h:86
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1504
void OnPlayerLevelChanged(Player *player, uint8 oldLevel, uint8 newLevel)
Definition: ScriptMgr.cpp:265
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1490
void OnPVPKill(Player *killer, Player *killed)
Definition: ScriptMgr.cpp:244
void OnGroupPlayerInvited(Group *group, Player *invited)
Definition: ScriptMgr.cpp:286
void LoadOverridenSQLData()
uint32 NPCDialogStatus(Player *pPlayer, Creature *pCreature)
Definition: ScriptMgr.cpp:419
void AddScripts()
void OnLogin(Player *pPlayer)
Definition: ScriptMgr.cpp:230
ACE_INT32 int32
Definition: Define.h:67
void OnGroupPlayerJoined(Group *group, Player *player)
Definition: ScriptMgr.cpp:293
bool(* pGOHello)(Player *, GameObject *)
Definition: ScriptMgr.h:92
bool IsDungeon() const
Definition: Map.h:427
void OnCreatureKill(Player *killer, Creature *killed)
Definition: ScriptMgr.cpp:251
uint32 GetGUIDLow() const
Definition: Object.h:166
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1497
uint32(* pGODialogStatus)(Player *, GameObject *_GO)
Definition: ScriptMgr.h:89
#define debug_log
Definition: Log.h:201
int num_sc_scripts
Definition: ScriptMgr.cpp:32
bool(* pGossipSelect)(Player *, Creature *, uint32, uint32)
Definition: ScriptMgr.h:82
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1511
bool GOSelect(Player *pPlayer, GameObject *pGO, uint32 uiSender, uint32 uiAction)
Definition: ScriptMgr.cpp:357
bool GossipSelect(Player *pPlayer, Creature *pCreature, uint32 uiSender, uint32 uiAction)
Definition: ScriptMgr.cpp:335
CreatureAI *(* GetAI)(Creature *)
Definition: ScriptMgr.h:100
bool(* pAreaTrigger)(Player *, AreaTriggerEntry const *)
Definition: ScriptMgr.h:93
void OnLogout(Player *pPlayer)
Definition: ScriptMgr.cpp:237
uint8 GetTypeId() const
Definition: Object.h:210
ACE_UINT8 uint8
Definition: Define.h:73
DBCStorage< SoundEntriesEntry > const * GetSoundEntriesStore()
Definition: DBCStores.cpp:772
uint32 GetAreaTriggerScriptId(uint32 trigger_id)
Definition: ObjectMgr.cpp:7630
void DoScriptText(int32 iTextEntry, WorldObject *pSource, Unit *pTarget)
Definition: ScriptMgr.cpp:98
uint32(* pNPCDialogStatus)(Player *, Creature *)
Definition: ScriptMgr.h:88
void OnGroupPlayerRemoved(Group *group, Player *guid, uint8 method, uint64 kicker, const char *reason)
Definition: ScriptMgr.cpp:300
char const * ScriptsVersion()
Definition: ScriptMgr.cpp:321
void(* OnGroupLeaderChanged)(Group *, Player *, Player *)
Definition: ScriptMgr.h:77
void(* OnGroupPlayerRemoved)(Group *, Player *, uint8, uint64, const char *)
Definition: ScriptMgr.h:76
bool QuestAccept(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition: ScriptMgr.cpp:383
Definition: Item.h:196
#define pSystemMgr
Definition: ScriptSystem.h:67
bool ItemHello(Player *pPlayer, Item *pItem, Quest const *pQuest)
Definition: ScriptMgr.cpp:437
void RegisterSelf()
Definition: ScriptMgr.cpp:174
void ScriptsInit()
Definition: ScriptMgr.cpp:68
void(* OnGroupPlayerInvited)(Group *, Player *)
Definition: ScriptMgr.h:74
void OnGroupCreated(Group *group, Player *player)
Definition: ScriptMgr.cpp:279
void OnGroupDisbanded(Group *group, Player *leader)
Definition: ScriptMgr.cpp:314
InstanceData *(* GetInstanceData)(Map *)
Definition: ScriptMgr.h:101
bool(* pGossipHello)(Player *, Creature *)
Definition: ScriptMgr.h:80
Definition: Map.h:266
bool(* pQuestComplete)(Player *, Creature *, Quest const *)
Definition: ScriptMgr.h:87
uint32 GODialogStatus(Player *pPlayer, GameObject *pGO)
Definition: ScriptMgr.cpp:428
void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1865
uint32 ScriptId
Definition: GameObject.h:367
bool AreaTrigger(Player *pPlayer, AreaTriggerEntry const *atEntry)
Definition: ScriptMgr.cpp:482
bool QuestSelect(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition: ScriptMgr.cpp:392
Script * m_scripts[MAX_SCRIPTS]
Definition: ScriptMgr.cpp:33
bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget)
Definition: ScriptMgr.cpp:506
ACE_UINT64 uint64
Definition: Define.h:70
#define error_db_log
Definition: Log.h:203
bool(* QuestAccept)(Player *, Creature *, Quest const *)
Definition: ScriptMgr.h:81
#define error_log
Definition: Log.h:202
void(* OnLogout)(Player *)
Definition: ScriptMgr.h:66
void(* OnGroupPlayerJoined)(Group *, Player *)
Definition: ScriptMgr.h:75
void OnPlayerKilledByCreature(Creature *killer, Player *killed)
Definition: ScriptMgr.cpp:258
void(* OnGroupDisbanded)(Group *, Player *)
Definition: ScriptMgr.h:78
bool(* pGOQuestAccept)(Player *, GameObject *, Quest const *)
Definition: ScriptMgr.h:95
bool GOChooseReward(Player *pPlayer, GameObject *pGO, Quest const *pQuest, uint32 opt)
Definition: ScriptMgr.cpp:473
void(* OnPVPKill)(Player *, Player *)
Definition: ScriptMgr.h:67
bool ItemUse(Player *pPlayer, Item *pItem, SpellCastTargets const &targets)
Definition: ScriptMgr.cpp:498
void(* OnGroupCreated)(Group *, Player *)
Definition: ScriptMgr.h:73
bool QuestComplete(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition: ScriptMgr.cpp:401
GameObjectInfo const * GetGOInfo() const
Definition: GameObject.h:592
void FillSpellSummary()
uint32 uiSoundId
Definition: ScriptSystem.h:61
bool OnQuestAccept(Player *pPlayer, Item *pItem, Quest const *pQuest)
Definition: ScriptMgr.cpp:446
INSTANTIATE_SINGLETON_1(ScriptMgr)
#define outstring_log
Macros meant to be used by scripts.
Definition: Log.h:199
bool(* OnQuestAccept)(Player *, Item *, Quest const *)
Definition: ScriptMgr.h:94
bool(* pGOSelect)(Player *, GameObject *, uint32, uint32)
Definition: ScriptMgr.h:84
void LoadDatabase()
Definition: ScriptMgr.cpp:38
bool(* pGOSelectWithCode)(Player *, GameObject *, uint32, uint32, const char *)
Definition: ScriptMgr.h:85
#define MAX_SCRIPTS
Definition: ScriptMgr.h:44
uint32 GetEntry() const
Definition: Object.h:192
bool GOHello(Player *pPlayer, GameObject *pGO)
Definition: ScriptMgr.cpp:455
bool(* pEffectDummyCreature)(Unit *, uint32, uint32, Creature *)
Definition: ScriptMgr.h:98
void OnGroupLeaderChanged(Group *group, Player *oldLeader, Player *newLeader)
Definition: ScriptMgr.cpp:307
bool GossipSelectWithCode(Player *pPlayer, Creature *pCreature, uint32 uiSender, uint32 uiAction, const char *sCode)
Definition: ScriptMgr.cpp:346
ACE_UINT16 uint16
Definition: Define.h:72
bool GOQuestAccept(Player *pPlayer, GameObject *pGO, Quest const *pQuest)
Definition: ScriptMgr.cpp:464
uint32 GetScriptId()
Definition: Creature.cpp:2393
ACE_UINT32 uint32
Definition: Define.h:71
bool(* pItemUse)(Player *, Item *, SpellCastTargets const &)
Definition: ScriptMgr.h:97
bool ChooseReward(Player *pPlayer, Creature *pCreature, Quest const *pQuest, uint32 opt)
Definition: ScriptMgr.cpp:410
Definition: Unit.h:908
bool(* pGOChooseReward)(Player *, GameObject *, Quest const *, uint32)
Definition: ScriptMgr.h:96
Definition: Player.h:922
bool GOSelectWithCode(Player *pPlayer, GameObject *pGO, uint32 uiSender, uint32 uiAction, const char *sCode)
Definition: ScriptMgr.cpp:370
void OnPlayerTalentsReset(Player *player, bool no_cost)
Definition: ScriptMgr.cpp:272
bool(* pGossipSelectWithCode)(Player *, Creature *, uint32, uint32, const char *)
Definition: ScriptMgr.h:83
Definition: Group.h:154
bool GossipHello(Player *pPlayer, Creature *pCreature)
Definition: ScriptMgr.cpp:326
void(* OnCreatureKill)(Player *, Creature *)
Definition: ScriptMgr.h:68
const uint64 & GetGUID() const
Definition: Object.h:162
CreatureAI * GetAI(Creature *pCreature)
Definition: ScriptMgr.cpp:490