1 | /* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> |
---|
2 | * This program is free software licensed under GPL version 2 |
---|
3 | * Please see the included DOCS/LICENSE.TXT for more information */ |
---|
4 | |
---|
5 | #include "precompiled.h" |
---|
6 | #include "Config/Config.h" |
---|
7 | #include "ProgressBar.h" |
---|
8 | #include "Database/DBCStores.h" |
---|
9 | #include "Database/DatabaseMysql.h" |
---|
10 | #include "ObjectMgr.h" |
---|
11 | #include "scripts/creature/mob_event_ai.h" |
---|
12 | |
---|
13 | #define _FULLVERSION "TrinityScript" |
---|
14 | |
---|
15 | #ifndef _TSCRIPTCONFVERSION |
---|
16 | # define _TSCRIPTCONFVERSION 2008100201 |
---|
17 | #endif //_TSCRIPTCONFVERSION |
---|
18 | |
---|
19 | #ifndef _TRINITY_SCRIPT_CONFIG |
---|
20 | # define _TRINITY_SCRIPT_CONFIG "trinityscript.conf" |
---|
21 | #endif //_TRINITY_SCRIPT_CONFIG |
---|
22 | |
---|
23 | //*** Global data *** |
---|
24 | int nrscripts; |
---|
25 | Script *m_scripts[MAX_SCRIPTS]; |
---|
26 | |
---|
27 | // Text Map for Event AI |
---|
28 | HM_NAMESPACE::hash_map<uint32, std::string> EventAI_Text_Map; |
---|
29 | |
---|
30 | // Script Text used as says / yells / text emotes / whispers in scripts. |
---|
31 | struct ScriptText |
---|
32 | { |
---|
33 | uint32 SoundId; |
---|
34 | uint8 Type; |
---|
35 | uint32 Language; |
---|
36 | std::string Text; |
---|
37 | }; |
---|
38 | |
---|
39 | // Enums used by ScriptText::Type |
---|
40 | enum ChatType |
---|
41 | { |
---|
42 | CHAT_TYPE_SAY = 0, |
---|
43 | CHAT_TYPE_YELL = 1, |
---|
44 | CHAT_TYPE_TEXT_EMOTE = 2, |
---|
45 | CHAT_TYPE_BOSS_EMOTE = 3, |
---|
46 | CHAT_TYPE_WHISPER = 4, |
---|
47 | CHAT_TYPE_BOSS_WHISPER = 5, |
---|
48 | }; |
---|
49 | |
---|
50 | HM_NAMESPACE::hash_map<uint32, ScriptText> Script_TextMap; |
---|
51 | |
---|
52 | // Localized Text structure for storing locales (for EAI and SD2 scripts). |
---|
53 | struct Localized_Text |
---|
54 | { |
---|
55 | std::string locale_1; |
---|
56 | std::string locale_2; |
---|
57 | std::string locale_3; |
---|
58 | std::string locale_4; |
---|
59 | std::string locale_5; |
---|
60 | std::string locale_6; |
---|
61 | std::string locale_7; |
---|
62 | std::string locale_8; |
---|
63 | }; |
---|
64 | HM_NAMESPACE::hash_map<uint32, Localized_Text> EventAI_LocalizedTextMap; |
---|
65 | HM_NAMESPACE::hash_map<uint32, Localized_Text> Script_LocalizedTextMap; |
---|
66 | |
---|
67 | //*** End Global data *** |
---|
68 | |
---|
69 | //*** EventAI data *** |
---|
70 | //Event AI structure. Used exclusivly by mob_event_ai.cpp (60 bytes each) |
---|
71 | std::list<EventAI_Event> EventAI_Event_List; |
---|
72 | |
---|
73 | //Event AI summon structure. Used exclusivly by mob_event_ai.cpp. |
---|
74 | HM_NAMESPACE::hash_map<uint32, EventAI_Summon> EventAI_Summon_Map; |
---|
75 | |
---|
76 | //Event AI error prevention structure. Used at runtime to prevent error log spam of same creature id. |
---|
77 | //HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; |
---|
78 | |
---|
79 | uint32 EAI_ErrorLevel; |
---|
80 | |
---|
81 | //*** End EventAI data *** |
---|
82 | |
---|
83 | DatabaseMysql TScriptDB; |
---|
84 | Config TScriptConfig; |
---|
85 | uint32 Locale; |
---|
86 | |
---|
87 | void FillSpellSummary(); |
---|
88 | |
---|
89 | // -- Scripts to be added -- |
---|
90 | |
---|
91 | // -- Areatrigger -- |
---|
92 | extern void AddSC_areatrigger_scripts(); |
---|
93 | |
---|
94 | // -- Boss -- |
---|
95 | extern void AddSC_boss_emeriss(); |
---|
96 | extern void AddSC_boss_taerar(); |
---|
97 | extern void AddSC_boss_ysondre(); |
---|
98 | |
---|
99 | // -- Creature -- |
---|
100 | extern void AddSC_mob_event(); |
---|
101 | extern void AddSC_generic_creature(); |
---|
102 | |
---|
103 | // -- Custom -- |
---|
104 | extern void AddSC_custom_example(); |
---|
105 | extern void AddSC_custom_gossip_codebox(); |
---|
106 | extern void AddSC_test(); |
---|
107 | |
---|
108 | // -- GO -- |
---|
109 | extern void AddSC_go_scripts(); |
---|
110 | |
---|
111 | // -- Guard -- |
---|
112 | extern void AddSC_guards(); |
---|
113 | |
---|
114 | // -- Honor -- |
---|
115 | |
---|
116 | // -- Item -- |
---|
117 | extern void AddSC_item_scripts(); |
---|
118 | extern void AddSC_item_test(); |
---|
119 | |
---|
120 | // -- NPC -- |
---|
121 | extern void AddSC_npc_professions(); |
---|
122 | extern void AddSC_npcs_special(); |
---|
123 | |
---|
124 | // -- Servers -- |
---|
125 | |
---|
126 | //-------------------- |
---|
127 | //------ ZONE -------- |
---|
128 | |
---|
129 | //Alterac Mountains |
---|
130 | extern void AddSC_alterac_mountains(); |
---|
131 | |
---|
132 | //Arathi Highlands |
---|
133 | //Ashenvale Forest |
---|
134 | //Aunchindoun |
---|
135 | //--Auchenai Crypts |
---|
136 | extern void AddSC_boss_exarch_maladaar(); |
---|
137 | //--Mana Tombs |
---|
138 | extern void AddSC_boss_nexusprince_shaffar(); |
---|
139 | extern void AddSC_boss_pandemonius(); |
---|
140 | |
---|
141 | //--Sekketh Halls |
---|
142 | extern void AddSC_boss_darkweaver_syth(); |
---|
143 | extern void AddSC_boss_talon_king_ikiss(); |
---|
144 | extern void AddSC_instance_sethekk_halls(); |
---|
145 | |
---|
146 | //--Shadow Labyrinth |
---|
147 | extern void AddSC_boss_ambassador_hellmaw(); |
---|
148 | extern void AddSC_boss_blackheart_the_inciter(); |
---|
149 | extern void AddSC_boss_grandmaster_vorpil(); |
---|
150 | extern void AddSC_boss_murmur(); |
---|
151 | extern void AddSC_instance_shadow_labyrinth(); |
---|
152 | |
---|
153 | //Azshara |
---|
154 | extern void AddSC_boss_azuregos(); |
---|
155 | extern void AddSC_azshara(); |
---|
156 | |
---|
157 | //Azuremyst Isle |
---|
158 | extern void AddSC_azuremyst_isle(); |
---|
159 | |
---|
160 | //Badlands |
---|
161 | //Barrens |
---|
162 | extern void AddSC_the_barrens(); |
---|
163 | |
---|
164 | //Black Temple |
---|
165 | extern void AddSC_black_temple(); |
---|
166 | extern void AddSC_boss_illidan(); |
---|
167 | extern void AddSC_boss_shade_of_akama(); |
---|
168 | extern void AddSC_boss_supremus(); |
---|
169 | extern void AddSC_boss_gurtogg_bloodboil(); |
---|
170 | extern void AddSC_boss_mother_shahraz(); |
---|
171 | extern void AddSC_boss_reliquary_of_souls(); |
---|
172 | extern void AddSC_boss_teron_gorefiend(); |
---|
173 | extern void AddSC_boss_najentus(); |
---|
174 | extern void AddSC_boss_illidari_council(); |
---|
175 | extern void AddSC_instance_black_temple(); |
---|
176 | |
---|
177 | //Blackfathom Depths |
---|
178 | //Blackrock Depths |
---|
179 | extern void AddSC_blackrock_depths(); |
---|
180 | extern void AddSC_boss_ambassador_flamelash(); |
---|
181 | extern void AddSC_boss_angerrel(); |
---|
182 | extern void AddSC_boss_anubshiah(); |
---|
183 | extern void AddSC_boss_doomrel(); |
---|
184 | extern void AddSC_boss_doperel(); |
---|
185 | extern void AddSC_boss_draganthaurissan(); |
---|
186 | extern void AddSC_boss_general_angerforge(); |
---|
187 | extern void AddSC_boss_gloomrel(); |
---|
188 | extern void AddSC_boss_gorosh_the_dervish(); |
---|
189 | extern void AddSC_boss_grizzle(); |
---|
190 | extern void AddSC_boss_haterel(); |
---|
191 | extern void AddSC_boss_high_interrogator_gerstahn(); |
---|
192 | extern void AddSC_boss_magmus(); |
---|
193 | extern void AddSC_boss_moira_bronzebeard(); |
---|
194 | extern void AddSC_boss_seethrel(); |
---|
195 | extern void AddSC_boss_vilerel(); |
---|
196 | |
---|
197 | //Blackrock Spire |
---|
198 | extern void AddSC_boss_drakkisath(); |
---|
199 | extern void AddSC_boss_halycon(); |
---|
200 | extern void AddSC_boss_highlordomokk(); |
---|
201 | extern void AddSC_boss_mothersmolderweb(); |
---|
202 | extern void AddSC_boss_overlordwyrmthalak(); |
---|
203 | extern void AddSC_boss_shadowvosh(); |
---|
204 | extern void AddSC_boss_thebeast(); |
---|
205 | extern void AddSC_boss_warmastervoone(); |
---|
206 | extern void AddSC_boss_quatermasterzigris(); |
---|
207 | extern void AddSC_boss_pyroguard_emberseer(); |
---|
208 | extern void AddSC_boss_gyth(); |
---|
209 | extern void AddSC_boss_rend_blackhand(); |
---|
210 | |
---|
211 | //Blackwing lair |
---|
212 | extern void AddSC_boss_razorgore(); |
---|
213 | extern void AddSC_boss_vael(); |
---|
214 | extern void AddSC_boss_broodlord(); |
---|
215 | extern void AddSC_boss_firemaw(); |
---|
216 | extern void AddSC_boss_ebonroc(); |
---|
217 | extern void AddSC_boss_flamegor(); |
---|
218 | extern void AddSC_boss_chromaggus(); |
---|
219 | extern void AddSC_boss_nefarian(); |
---|
220 | extern void AddSC_boss_victor_nefarius(); |
---|
221 | |
---|
222 | //Blade's Edge Mountains |
---|
223 | extern void AddSC_blades_edge_mountains(); |
---|
224 | |
---|
225 | //Blasted lands |
---|
226 | extern void AddSC_boss_kruul(); |
---|
227 | extern void AddSC_blasted_lands(); |
---|
228 | |
---|
229 | //Bloodmyst Isle |
---|
230 | extern void AddSC_bloodmyst_isle(); |
---|
231 | |
---|
232 | //Burning steppes |
---|
233 | extern void AddSC_burning_steppes(); |
---|
234 | |
---|
235 | //Caverns of Time |
---|
236 | //--Battle for Mt. Hyjal |
---|
237 | extern void AddSC_hyjal(); |
---|
238 | extern void AddSC_boss_archimonde(); |
---|
239 | extern void AddSC_instance_mount_hyjal(); |
---|
240 | |
---|
241 | //--Old Hillsbrad |
---|
242 | extern void AddSC_boss_captain_skarloc(); |
---|
243 | extern void AddSC_boss_epoch_hunter(); |
---|
244 | extern void AddSC_boss_lieutenant_drake(); |
---|
245 | extern void AddSC_instance_old_hillsbrad(); |
---|
246 | extern void AddSC_old_hillsbrad(); |
---|
247 | |
---|
248 | //--The Dark Portal |
---|
249 | extern void AddSC_boss_aeonus(); |
---|
250 | extern void AddSC_boss_chrono_lord_deja(); |
---|
251 | extern void AddSC_boss_temporus(); |
---|
252 | |
---|
253 | //Coilfang Resevoir |
---|
254 | //--Serpent Shrine Cavern |
---|
255 | extern void AddSC_boss_fathomlord_karathress(); |
---|
256 | extern void AddSC_boss_hydross_the_unstable(); |
---|
257 | extern void AddSC_boss_lady_vashj(); |
---|
258 | extern void AddSC_boss_leotheras_the_blind(); |
---|
259 | extern void AddSC_boss_morogrim_tidewalker(); |
---|
260 | extern void AddSC_instance_serpentshrine_cavern(); |
---|
261 | |
---|
262 | //--Slave Pens |
---|
263 | |
---|
264 | //--Steam Vault |
---|
265 | extern void AddSC_boss_hydromancer_thespia(); |
---|
266 | extern void AddSC_boss_mekgineer_steamrigger(); |
---|
267 | extern void AddSC_boss_warlord_kalithresh(); |
---|
268 | extern void AddSC_instance_steam_vault(); |
---|
269 | |
---|
270 | //--Underbog |
---|
271 | extern void AddSC_boss_hungarfen(); |
---|
272 | |
---|
273 | //Darkshore |
---|
274 | //Darnassus |
---|
275 | //Deadmines |
---|
276 | //Deadwind pass |
---|
277 | //Desolace |
---|
278 | //Dire Maul |
---|
279 | //Dun Morogh |
---|
280 | extern void AddSC_dun_morogh(); |
---|
281 | |
---|
282 | //Durotar |
---|
283 | //Duskwood |
---|
284 | //Dustwallow marsh |
---|
285 | extern void AddSC_dustwallow_marsh(); |
---|
286 | |
---|
287 | //Eversong Woods |
---|
288 | extern void AddSC_eversong_woods(); |
---|
289 | |
---|
290 | //Exodar |
---|
291 | //Eastern Plaguelands |
---|
292 | extern void AddSC_eastern_plaguelands(); |
---|
293 | |
---|
294 | //Elwynn Forest |
---|
295 | extern void AddSC_elwynn_forest(); |
---|
296 | |
---|
297 | //Felwood |
---|
298 | extern void AddSC_felwood(); |
---|
299 | |
---|
300 | //Feralas |
---|
301 | extern void AddSC_feralas(); |
---|
302 | |
---|
303 | //Ghostlands |
---|
304 | extern void AddSC_ghostlands(); |
---|
305 | |
---|
306 | //Gnomeregan |
---|
307 | //Gruul's Lair |
---|
308 | extern void AddSC_boss_gruul(); |
---|
309 | extern void AddSC_boss_high_king_maulgar(); |
---|
310 | extern void AddSC_instance_gruuls_lair(); |
---|
311 | |
---|
312 | //Hellfire Citadel |
---|
313 | //--Blood Furnace |
---|
314 | extern void AddSC_boss_broggok(); |
---|
315 | extern void AddSC_boss_kelidan_the_breaker(); |
---|
316 | extern void AddSC_boss_the_maker(); |
---|
317 | |
---|
318 | //--Magtheridon's Lair |
---|
319 | extern void AddSC_boss_magtheridon(); |
---|
320 | extern void AddSC_instance_magtheridons_lair(); |
---|
321 | |
---|
322 | //--Shattered Halls |
---|
323 | extern void AddSC_boss_grand_warlock_nethekurse(); |
---|
324 | extern void AddSC_boss_warbringer_omrogg(); |
---|
325 | extern void AddSC_instance_shattered_halls(); |
---|
326 | |
---|
327 | //--Ramparts |
---|
328 | extern void AddSC_boss_watchkeeper_gargolmar(); |
---|
329 | extern void AddSC_boss_omor_the_unscarred(); |
---|
330 | |
---|
331 | //Hellfire Peninsula |
---|
332 | extern void AddSC_boss_doomlordkazzak(); |
---|
333 | extern void AddSC_hellfire_peninsula(); |
---|
334 | |
---|
335 | //Hillsbrad Foothills |
---|
336 | //Hinterlands |
---|
337 | //Ironforge |
---|
338 | extern void AddSC_ironforge(); |
---|
339 | |
---|
340 | //Isle of Quel'Danas |
---|
341 | extern void AddSC_isle_of_queldanas(); |
---|
342 | |
---|
343 | //Karazhan |
---|
344 | extern void AddSC_boss_attumen(); |
---|
345 | extern void AddSC_boss_curator(); |
---|
346 | extern void AddSC_boss_maiden_of_virtue(); |
---|
347 | extern void AddSC_boss_shade_of_aran(); |
---|
348 | extern void AddSC_boss_malchezaar(); |
---|
349 | extern void AddSC_boss_terestian_illhoof(); |
---|
350 | extern void AddSC_netherspite_infernal(); |
---|
351 | extern void AddSC_boss_moroes(); |
---|
352 | extern void AddSC_bosses_opera(); |
---|
353 | extern void AddSC_instance_karazhan(); |
---|
354 | extern void AddSC_karazhan(); |
---|
355 | |
---|
356 | //Loch Modan |
---|
357 | extern void AddSC_loch_modan(); |
---|
358 | |
---|
359 | //Lower Blackrock Spire |
---|
360 | |
---|
361 | // Magister's Terrace |
---|
362 | extern void AddSC_boss_felblood_kaelthas(); |
---|
363 | extern void AddSC_boss_selin_fireheart(); |
---|
364 | extern void AddSC_boss_vexallus(); |
---|
365 | extern void AddSC_boss_priestess_delrissa(); |
---|
366 | extern void AddSC_instance_magisters_terrace(); |
---|
367 | |
---|
368 | //Maraudon |
---|
369 | extern void AddSC_boss_celebras_the_cursed(); |
---|
370 | extern void AddSC_boss_landslide(); |
---|
371 | extern void AddSC_boss_noxxion(); |
---|
372 | extern void AddSC_boss_ptheradras(); |
---|
373 | |
---|
374 | //Molten core |
---|
375 | extern void AddSC_boss_lucifron(); |
---|
376 | extern void AddSC_boss_magmadar(); |
---|
377 | extern void AddSC_boss_gehennas(); |
---|
378 | extern void AddSC_boss_garr(); |
---|
379 | extern void AddSC_boss_baron_geddon(); |
---|
380 | extern void AddSC_boss_shazzrah(); |
---|
381 | extern void AddSC_boss_golemagg(); |
---|
382 | extern void AddSC_boss_sulfuron(); |
---|
383 | extern void AddSC_boss_majordomo(); |
---|
384 | extern void AddSC_boss_ragnaros(); |
---|
385 | extern void AddSC_instance_molten_core(); |
---|
386 | extern void AddSC_molten_core(); |
---|
387 | |
---|
388 | //Moonglade |
---|
389 | extern void AddSC_moonglade(); |
---|
390 | |
---|
391 | //Mulgore |
---|
392 | extern void AddSC_mulgore(); |
---|
393 | |
---|
394 | //Nagrand |
---|
395 | extern void AddSC_nagrand(); |
---|
396 | |
---|
397 | //Naxxramas |
---|
398 | extern void AddSC_boss_anubrekhan(); |
---|
399 | extern void AddSC_boss_maexxna(); |
---|
400 | extern void AddSC_boss_patchwerk(); |
---|
401 | extern void AddSC_boss_razuvious(); |
---|
402 | extern void AddSC_boss_highlord_mograine(); |
---|
403 | extern void AddSC_boss_lady_blaumeux(); |
---|
404 | extern void AddSC_boss_sir_zeliek(); |
---|
405 | extern void AddSC_boss_thane_korthazz(); |
---|
406 | extern void AddSC_boss_kelthuzad(); |
---|
407 | extern void AddSC_boss_faerlina(); |
---|
408 | extern void AddSC_boss_loatheb(); |
---|
409 | extern void AddSC_boss_noth(); |
---|
410 | extern void AddSC_boss_gluth(); |
---|
411 | extern void AddSC_boss_sapphiron(); |
---|
412 | |
---|
413 | //Netherstorm |
---|
414 | extern void AddSC_netherstorm(); |
---|
415 | |
---|
416 | //Onyxia's Lair |
---|
417 | extern void AddSC_boss_onyxia(); |
---|
418 | |
---|
419 | //Orgrimmar |
---|
420 | extern void AddSC_orgrimmar(); |
---|
421 | |
---|
422 | //Ragefire Chasm |
---|
423 | //Razorfen Downs |
---|
424 | extern void AddSC_boss_amnennar_the_coldbringer(); |
---|
425 | |
---|
426 | //Redridge Mountains |
---|
427 | //Ruins of Ahn'Qiraj |
---|
428 | //Scarlet Monastery |
---|
429 | extern void AddSC_boss_arcanist_doan(); |
---|
430 | extern void AddSC_boss_azshir_the_sleepless(); |
---|
431 | extern void AddSC_boss_bloodmage_thalnos(); |
---|
432 | extern void AddSC_boss_herod(); |
---|
433 | extern void AddSC_boss_high_inquisitor_fairbanks(); |
---|
434 | extern void AddSC_boss_high_inquisitor_whitemane(); |
---|
435 | extern void AddSC_boss_houndmaster_loksey(); |
---|
436 | extern void AddSC_boss_interrogator_vishas(); |
---|
437 | extern void AddSC_boss_scarlet_commander_mograine(); |
---|
438 | extern void AddSC_boss_scorn(); |
---|
439 | |
---|
440 | //Scholomance |
---|
441 | extern void AddSC_boss_darkmaster_gandling(); |
---|
442 | extern void AddSC_boss_death_knight_darkreaver(); |
---|
443 | extern void AddSC_boss_theolenkrastinov(); |
---|
444 | extern void AddSC_boss_illuciabarov(); |
---|
445 | extern void AddSC_boss_instructormalicia(); |
---|
446 | extern void AddSC_boss_jandicebarov(); |
---|
447 | extern void AddSC_boss_kormok(); |
---|
448 | extern void AddSC_boss_lordalexeibarov(); |
---|
449 | extern void AddSC_boss_lorekeeperpolkelt(); |
---|
450 | extern void AddSC_boss_rasfrost(); |
---|
451 | extern void AddSC_boss_theravenian(); |
---|
452 | extern void AddSC_boss_vectus(); |
---|
453 | extern void AddSC_instance_scholomance(); |
---|
454 | |
---|
455 | //Searing gorge |
---|
456 | extern void AddSC_searing_gorge(); |
---|
457 | |
---|
458 | //Shadowfang keep |
---|
459 | extern void AddSC_shadowfang_keep(); |
---|
460 | extern void AddSC_instance_shadowfang_keep(); |
---|
461 | |
---|
462 | //Shadowmoon Valley |
---|
463 | extern void AddSC_boss_doomwalker(); |
---|
464 | extern void AddSC_shadowmoon_valley(); |
---|
465 | |
---|
466 | //Shattrath |
---|
467 | extern void AddSC_shattrath_city(); |
---|
468 | |
---|
469 | //Silithus |
---|
470 | extern void AddSC_silithus(); |
---|
471 | |
---|
472 | //Silvermoon |
---|
473 | extern void AddSC_silvermoon_city(); |
---|
474 | |
---|
475 | //Silverpine forest |
---|
476 | extern void AddSC_silverpine_forest(); |
---|
477 | |
---|
478 | //Stockade |
---|
479 | //Stonetalon mountains |
---|
480 | extern void AddSC_stonetalon_mountains(); |
---|
481 | |
---|
482 | //Stormwind City |
---|
483 | extern void AddSC_stormwind_city(); |
---|
484 | |
---|
485 | //Stranglethorn Vale |
---|
486 | extern void AddSC_stranglethorn_vale(); |
---|
487 | |
---|
488 | //Stratholme |
---|
489 | extern void AddSC_boss_magistrate_barthilas(); |
---|
490 | extern void AddSC_boss_maleki_the_pallid(); |
---|
491 | extern void AddSC_boss_nerubenkan(); |
---|
492 | extern void AddSC_boss_cannon_master_willey(); |
---|
493 | extern void AddSC_boss_baroness_anastari(); |
---|
494 | extern void AddSC_boss_ramstein_the_gorger(); |
---|
495 | extern void AddSC_boss_timmy_the_cruel(); |
---|
496 | extern void AddSC_boss_postmaster_malown(); |
---|
497 | extern void AddSC_boss_baron_rivendare(); |
---|
498 | extern void AddSC_boss_dathrohan_balnazzar(); |
---|
499 | extern void AddSC_boss_order_of_silver_hand(); |
---|
500 | extern void AddSC_instance_stratholme(); |
---|
501 | extern void AddSC_stratholme(); |
---|
502 | |
---|
503 | //Sunken Temple |
---|
504 | //Tanaris |
---|
505 | extern void AddSC_tanaris(); |
---|
506 | |
---|
507 | //Teldrassil |
---|
508 | //Tempest Keep |
---|
509 | //--Arcatraz |
---|
510 | extern void AddSC_arcatraz(); |
---|
511 | extern void AddSC_boss_harbinger_skyriss(); |
---|
512 | extern void AddSC_instance_arcatraz(); |
---|
513 | |
---|
514 | //--Botanica |
---|
515 | extern void AddSC_boss_high_botanist_freywinn(); |
---|
516 | extern void AddSC_boss_laj(); |
---|
517 | extern void AddSC_boss_warp_splinter(); |
---|
518 | |
---|
519 | //--The Eye |
---|
520 | extern void AddSC_boss_kaelthas(); |
---|
521 | extern void AddSC_boss_void_reaver(); |
---|
522 | extern void AddSC_boss_high_astromancer_solarian(); |
---|
523 | extern void AddSC_instance_the_eye(); |
---|
524 | extern void AddSC_the_eye(); |
---|
525 | |
---|
526 | //--The Mechanar |
---|
527 | extern void AddSC_boss_gatewatcher_iron_hand(); |
---|
528 | extern void AddSC_boss_nethermancer_sepethrea(); |
---|
529 | |
---|
530 | //Temple of ahn'qiraj |
---|
531 | extern void AddSC_boss_cthun(); |
---|
532 | extern void AddSC_boss_fankriss(); |
---|
533 | extern void AddSC_boss_huhuran(); |
---|
534 | extern void AddSC_bug_trio(); |
---|
535 | extern void AddSC_boss_sartura(); |
---|
536 | extern void AddSC_boss_skeram(); |
---|
537 | extern void AddSC_boss_twinemperors(); |
---|
538 | extern void AddSC_mob_anubisath_sentinel(); |
---|
539 | extern void AddSC_instance_temple_of_ahnqiraj(); |
---|
540 | |
---|
541 | //Terokkar Forest |
---|
542 | extern void AddSC_terokkar_forest(); |
---|
543 | |
---|
544 | //Thousand Needles |
---|
545 | //Thunder Bluff |
---|
546 | extern void AddSC_thunder_bluff(); |
---|
547 | |
---|
548 | //Tirisfal Glades |
---|
549 | extern void AddSC_tirisfal_glades(); |
---|
550 | |
---|
551 | //Uldaman |
---|
552 | extern void AddSC_boss_ironaya(); |
---|
553 | extern void AddSC_uldaman(); |
---|
554 | |
---|
555 | //Undercity |
---|
556 | extern void AddSC_undercity(); |
---|
557 | |
---|
558 | //Un'Goro Crater |
---|
559 | //Upper blackrock spire |
---|
560 | //Wailing caverns |
---|
561 | |
---|
562 | //Western plaguelands |
---|
563 | extern void AddSC_western_plaguelands(); |
---|
564 | |
---|
565 | //Westfall |
---|
566 | //Wetlands |
---|
567 | //Winterspring |
---|
568 | extern void AddSC_winterspring(); |
---|
569 | |
---|
570 | //Zangarmarsh |
---|
571 | extern void AddSC_zangarmarsh(); |
---|
572 | |
---|
573 | //Zul'Farrak |
---|
574 | //Zul'Gurub |
---|
575 | extern void AddSC_boss_jeklik(); |
---|
576 | extern void AddSC_boss_venoxis(); |
---|
577 | extern void AddSC_boss_marli(); |
---|
578 | extern void AddSC_boss_mandokir(); |
---|
579 | extern void AddSC_boss_gahzranka(); |
---|
580 | extern void AddSC_boss_thekal(); |
---|
581 | extern void AddSC_boss_arlokk(); |
---|
582 | extern void AddSC_boss_jindo(); |
---|
583 | extern void AddSC_boss_hakkar(); |
---|
584 | extern void AddSC_boss_grilek(); |
---|
585 | extern void AddSC_boss_hazzarah(); |
---|
586 | extern void AddSC_boss_renataki(); |
---|
587 | extern void AddSC_boss_wushoolay(); |
---|
588 | extern void AddSC_instance_zulgurub(); |
---|
589 | //Zul'Aman |
---|
590 | extern void AddSC_boss_janalai(); |
---|
591 | extern void AddSC_boss_nalorakk(); |
---|
592 | extern void AddSC_instance_zulaman(); |
---|
593 | extern void AddSC_zulaman(); |
---|
594 | |
---|
595 | // ------------------- |
---|
596 | void LoadDatabase() |
---|
597 | { |
---|
598 | //Get db string from file |
---|
599 | char const* dbstring = NULL; |
---|
600 | if(!TScriptConfig.GetString("TScriptDatabaseInfo", &dbstring)) |
---|
601 | error_log("TSCR: Missing Trinity Script Database Info in configuration file"); |
---|
602 | |
---|
603 | //Initilize connection to DB |
---|
604 | if(!dbstring || !TScriptDB.Initialize(dbstring)) |
---|
605 | error_db_log("TSCR: Unable to connect to Database"); |
---|
606 | else |
---|
607 | { |
---|
608 | //***Preform all DB queries here*** |
---|
609 | QueryResult *result; |
---|
610 | |
---|
611 | //Get Version information |
---|
612 | result = TScriptDB.PQuery("SELECT `version`" |
---|
613 | "FROM `script_db_version`"); |
---|
614 | |
---|
615 | if (result) |
---|
616 | { |
---|
617 | Field *fields = result->Fetch(); |
---|
618 | outstring_log(" "); |
---|
619 | outstring_log("TSCR: Database version is: %s", fields[0].GetString()); |
---|
620 | outstring_log(" "); |
---|
621 | delete result; |
---|
622 | |
---|
623 | }else error_db_log("TSCR: Missing script_db_version information."); |
---|
624 | |
---|
625 | // Drop existing Event AI Localized Text hash map |
---|
626 | EventAI_LocalizedTextMap.clear(); |
---|
627 | |
---|
628 | // Gather EventAI Localized Texts |
---|
629 | result = TScriptDB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" |
---|
630 | "FROM `eventai_localized_texts`"); |
---|
631 | |
---|
632 | if(result) |
---|
633 | { |
---|
634 | outstring_log("TSCR: Loading EAI Localized Texts...."); |
---|
635 | barGoLink bar(result->GetRowCount()); |
---|
636 | uint32 count = 0; |
---|
637 | |
---|
638 | do |
---|
639 | { |
---|
640 | Localized_Text temp; |
---|
641 | bar.step(); |
---|
642 | |
---|
643 | Field *fields = result->Fetch(); |
---|
644 | |
---|
645 | uint32 i = fields[0].GetInt32(); |
---|
646 | |
---|
647 | temp.locale_1 = fields[1].GetString(); |
---|
648 | temp.locale_2 = fields[2].GetString(); |
---|
649 | temp.locale_3 = fields[3].GetString(); |
---|
650 | temp.locale_4 = fields[4].GetString(); |
---|
651 | temp.locale_5 = fields[5].GetString(); |
---|
652 | temp.locale_6 = fields[6].GetString(); |
---|
653 | temp.locale_7 = fields[7].GetString(); |
---|
654 | temp.locale_8 = fields[8].GetString(); |
---|
655 | |
---|
656 | EventAI_LocalizedTextMap[i] = temp; |
---|
657 | ++count; |
---|
658 | |
---|
659 | }while(result->NextRow()); |
---|
660 | |
---|
661 | delete result; |
---|
662 | |
---|
663 | outstring_log(""); |
---|
664 | outstring_log("TSCR: Loaded %u EventAI Localized Texts", count); |
---|
665 | }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI Localized Texts. Database table `eventai_localized_texts` is empty"); |
---|
666 | |
---|
667 | // Drop Existing Script Localized Text Hash Map |
---|
668 | Script_LocalizedTextMap.clear(); |
---|
669 | |
---|
670 | // Gather Script Localized Texts |
---|
671 | result = TScriptDB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" |
---|
672 | "FROM `script_localized_texts`"); |
---|
673 | |
---|
674 | if(result) |
---|
675 | { |
---|
676 | outstring_log("TSCR: Loading Script Localized Texts...."); |
---|
677 | barGoLink bar(result->GetRowCount()); |
---|
678 | uint32 count = 0; |
---|
679 | |
---|
680 | do |
---|
681 | { |
---|
682 | Localized_Text temp; |
---|
683 | bar.step(); |
---|
684 | |
---|
685 | Field *fields = result->Fetch(); |
---|
686 | |
---|
687 | uint32 i = fields[0].GetInt32(); |
---|
688 | |
---|
689 | temp.locale_1 = fields[1].GetString(); |
---|
690 | temp.locale_2 = fields[2].GetString(); |
---|
691 | temp.locale_3 = fields[3].GetString(); |
---|
692 | temp.locale_4 = fields[4].GetString(); |
---|
693 | temp.locale_5 = fields[5].GetString(); |
---|
694 | temp.locale_6 = fields[6].GetString(); |
---|
695 | temp.locale_7 = fields[7].GetString(); |
---|
696 | temp.locale_8 = fields[8].GetString(); |
---|
697 | |
---|
698 | Script_LocalizedTextMap[i] = temp; |
---|
699 | ++count; |
---|
700 | |
---|
701 | }while(result->NextRow()); |
---|
702 | |
---|
703 | delete result; |
---|
704 | |
---|
705 | outstring_log(""); |
---|
706 | outstring_log("TSCR: Loaded %u Script Localized Texts", count); |
---|
707 | }else outstring_log("TSCR: WARNING >> Loaded 0 Script Localized Texts. Database table `script_localized_texts` is empty"); |
---|
708 | |
---|
709 | //Drop existing EventAI Text hash map |
---|
710 | EventAI_Text_Map.clear(); |
---|
711 | |
---|
712 | //Gather EventAI Text Entries |
---|
713 | result = TScriptDB.PQuery("SELECT `id`,`text` FROM `eventai_texts`"); |
---|
714 | |
---|
715 | if (result) |
---|
716 | { |
---|
717 | outstring_log( "TSCR: Loading EventAI_Texts..."); |
---|
718 | barGoLink bar(result->GetRowCount()); |
---|
719 | uint32 Count = 0; |
---|
720 | |
---|
721 | do |
---|
722 | { |
---|
723 | bar.step(); |
---|
724 | Field *fields = result->Fetch(); |
---|
725 | |
---|
726 | uint32 i = fields[0].GetInt32(); |
---|
727 | |
---|
728 | std::string text = fields[1].GetString(); |
---|
729 | |
---|
730 | if (!strlen(text.c_str())) |
---|
731 | error_db_log("TSCR: EventAI text %u is empty", i); |
---|
732 | |
---|
733 | EventAI_Text_Map[i] = text; |
---|
734 | ++Count; |
---|
735 | |
---|
736 | }while (result->NextRow()); |
---|
737 | |
---|
738 | delete result; |
---|
739 | |
---|
740 | outstring_log(""); |
---|
741 | outstring_log("TSCR: >> Loaded %u EventAI_Texts", Count); |
---|
742 | |
---|
743 | }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Texts. DB table `EventAI_Texts` is empty."); |
---|
744 | |
---|
745 | //Gather event data |
---|
746 | result = TScriptDB.PQuery("SELECT `id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`" |
---|
747 | "FROM `eventai_summons`"); |
---|
748 | |
---|
749 | //Drop Existing EventSummon Map |
---|
750 | EventAI_Summon_Map.clear(); |
---|
751 | |
---|
752 | if (result) |
---|
753 | { |
---|
754 | outstring_log( "TSCR: Loading EventAI_Summons..."); |
---|
755 | barGoLink bar(result->GetRowCount()); |
---|
756 | uint32 Count = 0; |
---|
757 | |
---|
758 | do |
---|
759 | { |
---|
760 | bar.step(); |
---|
761 | Field *fields = result->Fetch(); |
---|
762 | |
---|
763 | EventAI_Summon temp; |
---|
764 | |
---|
765 | uint32 i = fields[0].GetUInt32(); |
---|
766 | temp.position_x = fields[1].GetFloat(); |
---|
767 | temp.position_y = fields[2].GetFloat(); |
---|
768 | temp.position_z = fields[3].GetFloat(); |
---|
769 | temp.orientation = fields[4].GetFloat(); |
---|
770 | temp.SpawnTimeSecs = fields[5].GetUInt32(); |
---|
771 | |
---|
772 | //Add to map |
---|
773 | EventAI_Summon_Map[i] = temp; |
---|
774 | ++Count; |
---|
775 | |
---|
776 | }while (result->NextRow()); |
---|
777 | |
---|
778 | delete result; |
---|
779 | outstring_log(""); |
---|
780 | outstring_log("TSCR: >> Loaded %u EventAI_Summons", Count); |
---|
781 | |
---|
782 | }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Summons. DB table `EventAI_Summons` is empty."); |
---|
783 | |
---|
784 | //Gather event data |
---|
785 | result = TScriptDB.PQuery("SELECT `id`,`creature_id`,`event_type`,`event_inverse_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action1_type`,`action1_param1`,`action1_param2`,`action1_param3`,`action2_type`,`action2_param1`,`action2_param2`,`action2_param3`,`action3_type`,`action3_param1`,`action3_param2`,`action3_param3`" |
---|
786 | "FROM `eventai_scripts`"); |
---|
787 | |
---|
788 | //Drop Existing EventAI List |
---|
789 | EventAI_Event_List.clear(); |
---|
790 | |
---|
791 | if (result) |
---|
792 | { |
---|
793 | outstring_log( "TSCR: Loading EventAI_Scripts..."); |
---|
794 | barGoLink bar(result->GetRowCount()); |
---|
795 | uint32 Count = 0; |
---|
796 | |
---|
797 | do |
---|
798 | { |
---|
799 | bar.step(); |
---|
800 | Field *fields = result->Fetch(); |
---|
801 | |
---|
802 | EventAI_Event temp; |
---|
803 | |
---|
804 | temp.event_id = fields[0].GetUInt32(); |
---|
805 | uint32 i = temp.event_id; |
---|
806 | temp.creature_id = fields[1].GetUInt32(); |
---|
807 | temp.event_type = fields[2].GetUInt16(); |
---|
808 | temp.event_inverse_phase_mask = fields[3].GetUInt32(); |
---|
809 | temp.event_chance = fields[4].GetUInt8(); |
---|
810 | temp.event_flags = fields[5].GetUInt8(); |
---|
811 | temp.event_param1 = fields[6].GetUInt32(); |
---|
812 | temp.event_param2 = fields[7].GetUInt32(); |
---|
813 | temp.event_param3 = fields[8].GetUInt32(); |
---|
814 | temp.event_param4 = fields[9].GetUInt32(); |
---|
815 | |
---|
816 | //Report any errors in event |
---|
817 | if (temp.event_type >= EVENT_T_END) |
---|
818 | error_db_log("TSCR: Event %u has incorrect event type. Maybe DB requires updated version of SD2.", i); |
---|
819 | |
---|
820 | //No chance of this event occuring |
---|
821 | if (temp.event_chance == 0) |
---|
822 | error_db_log("TSCR: Event %u has 0 percent chance. Event will never trigger!", i); |
---|
823 | //Chance above 100, force it to be 100 |
---|
824 | if (temp.event_chance > 100) |
---|
825 | { |
---|
826 | error_db_log("TSCR: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); |
---|
827 | temp.event_chance = 100; |
---|
828 | } |
---|
829 | |
---|
830 | //Individual event checks |
---|
831 | switch (temp.event_type) |
---|
832 | { |
---|
833 | case EVENT_T_HP: |
---|
834 | case EVENT_T_MANA: |
---|
835 | case EVENT_T_TARGET_HP: |
---|
836 | { |
---|
837 | if (temp.event_param2 > 100) |
---|
838 | error_db_log("TSCR: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); |
---|
839 | |
---|
840 | if (temp.event_param1 <= temp.event_param2) |
---|
841 | error_db_log("TSCR: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); |
---|
842 | |
---|
843 | if (temp.event_flags & EFLAG_REPEATABLE && !temp.event_param3 && !temp.event_param4) |
---|
844 | { |
---|
845 | error_db_log("TSCR: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); |
---|
846 | temp.event_flags &= ~EFLAG_REPEATABLE; |
---|
847 | } |
---|
848 | } |
---|
849 | break; |
---|
850 | |
---|
851 | case EVENT_T_SPELLHIT: |
---|
852 | { |
---|
853 | if (temp.event_param1) |
---|
854 | { |
---|
855 | SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.event_param1); |
---|
856 | if (!pSpell) |
---|
857 | { |
---|
858 | error_db_log("TSCR: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i); |
---|
859 | continue; |
---|
860 | } |
---|
861 | |
---|
862 | if (temp.event_param2_s != -1 && temp.event_param2 != pSpell->SchoolMask) |
---|
863 | error_db_log("TSCR: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.event_param1, i); |
---|
864 | } |
---|
865 | |
---|
866 | //TODO: fix this system with SPELL_SCHOOL_MASK. Current complicate things, using int32(-1) instead of just 0 |
---|
867 | //SPELL_SCHOOL_MASK_NONE = 0 and does not exist, thus it can not ever trigger or be used in SpellHit() |
---|
868 | if (temp.event_param2_s != -1 && temp.event_param2_s > SPELL_SCHOOL_MASK_ALL) |
---|
869 | error_db_log("TSCR: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.event_param2, i); |
---|
870 | |
---|
871 | if (temp.event_param4 < temp.event_param3) |
---|
872 | error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); |
---|
873 | } |
---|
874 | break; |
---|
875 | |
---|
876 | case EVENT_T_RANGE: |
---|
877 | case EVENT_T_OOC_LOS: |
---|
878 | case EVENT_T_FRIENDLY_HP: |
---|
879 | case EVENT_T_FRIENDLY_IS_CC: |
---|
880 | case EVENT_T_FRIENDLY_MISSING_BUFF: |
---|
881 | { |
---|
882 | if (temp.event_param4 < temp.event_param3) |
---|
883 | error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); |
---|
884 | } |
---|
885 | break; |
---|
886 | |
---|
887 | case EVENT_T_TIMER: |
---|
888 | case EVENT_T_TIMER_OOC: |
---|
889 | { |
---|
890 | if (temp.event_param2 < temp.event_param1) |
---|
891 | error_db_log("TSCR: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); |
---|
892 | |
---|
893 | if (temp.event_param4 < temp.event_param3) |
---|
894 | error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); |
---|
895 | } |
---|
896 | break; |
---|
897 | |
---|
898 | case EVENT_T_KILL: |
---|
899 | case EVENT_T_TARGET_CASTING: |
---|
900 | { |
---|
901 | if (temp.event_param2 < temp.event_param1) |
---|
902 | error_db_log("TSCR: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); |
---|
903 | } |
---|
904 | break; |
---|
905 | |
---|
906 | case EVENT_T_AGGRO: |
---|
907 | case EVENT_T_DEATH: |
---|
908 | case EVENT_T_EVADE: |
---|
909 | case EVENT_T_SPAWNED: |
---|
910 | { |
---|
911 | if (temp.event_flags & EFLAG_REPEATABLE) |
---|
912 | { |
---|
913 | error_db_log("TSCR: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); |
---|
914 | temp.event_flags &= ~EFLAG_REPEATABLE; |
---|
915 | } |
---|
916 | } |
---|
917 | break; |
---|
918 | }; |
---|
919 | |
---|
920 | for (uint32 j = 0; j < MAX_ACTIONS; j++) |
---|
921 | { |
---|
922 | temp.action[j].type = fields[10+(j*4)].GetUInt16(); |
---|
923 | temp.action[j].param1 = fields[11+(j*4)].GetUInt32(); |
---|
924 | temp.action[j].param2 = fields[12+(j*4)].GetUInt32(); |
---|
925 | temp.action[j].param3 = fields[13+(j*4)].GetUInt32(); |
---|
926 | |
---|
927 | //Report any errors in actions |
---|
928 | switch (temp.action[j].type) |
---|
929 | { |
---|
930 | case ACTION_T_SAY: |
---|
931 | case ACTION_T_YELL: |
---|
932 | case ACTION_T_TEXTEMOTE: |
---|
933 | if (GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) |
---|
934 | error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); |
---|
935 | break; |
---|
936 | |
---|
937 | case ACTION_T_SOUND: |
---|
938 | if (!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1)) |
---|
939 | error_db_log("TSCR: Event %u Action %u uses non-existant SoundID %u.", i, j+1, temp.action[j].param1); |
---|
940 | break; |
---|
941 | |
---|
942 | case ACTION_T_RANDOM_SAY: |
---|
943 | case ACTION_T_RANDOM_YELL: |
---|
944 | case ACTION_T_RANDOM_TEXTEMOTE: |
---|
945 | if ((temp.action[j].param1 != 0xffffffff && GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) || |
---|
946 | (temp.action[j].param2 != 0xffffffff && GetEventAIText(temp.action[j].param2) == DEFAULT_TEXT) || |
---|
947 | (temp.action[j].param3 != 0xffffffff && GetEventAIText(temp.action[j].param3) == DEFAULT_TEXT)) |
---|
948 | error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); |
---|
949 | break; |
---|
950 | |
---|
951 | case ACTION_T_CAST: |
---|
952 | { |
---|
953 | if (!GetSpellStore()->LookupEntry(temp.action[j].param1)) |
---|
954 | error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param1); |
---|
955 | |
---|
956 | if (temp.action[j].param2 >= TARGET_T_END) |
---|
957 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
958 | } |
---|
959 | break; |
---|
960 | |
---|
961 | case ACTION_T_REMOVEAURASFROMSPELL: |
---|
962 | { |
---|
963 | if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) |
---|
964 | error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); |
---|
965 | |
---|
966 | if (temp.action[j].param1 >= TARGET_T_END) |
---|
967 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
968 | } |
---|
969 | break; |
---|
970 | |
---|
971 | case ACTION_T_CASTCREATUREGO: |
---|
972 | { |
---|
973 | if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) |
---|
974 | error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); |
---|
975 | |
---|
976 | if (temp.action[j].param3 >= TARGET_T_END) |
---|
977 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
978 | } |
---|
979 | break; |
---|
980 | |
---|
981 | //2nd param target |
---|
982 | case ACTION_T_SUMMON_ID: |
---|
983 | { |
---|
984 | if (EventAI_Summon_Map.find(temp.action[j].param3) == EventAI_Summon_Map.end()) |
---|
985 | error_db_log("TSCR: Event %u Action %u summons missing EventAI_Summon %u", i, j+1, temp.action[j].param3); |
---|
986 | |
---|
987 | if (temp.action[j].param2 >= TARGET_T_END) |
---|
988 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
989 | } |
---|
990 | break; |
---|
991 | |
---|
992 | case ACTION_T_SUMMON: |
---|
993 | case ACTION_T_THREAT_SINGLE_PCT: |
---|
994 | case ACTION_T_QUEST_EVENT: |
---|
995 | case ACTION_T_SET_UNIT_FLAG: |
---|
996 | case ACTION_T_REMOVE_UNIT_FLAG: |
---|
997 | case ACTION_T_SET_INST_DATA64: |
---|
998 | if (temp.action[j].param2 >= TARGET_T_END) |
---|
999 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
1000 | break; |
---|
1001 | |
---|
1002 | //3rd param target |
---|
1003 | case ACTION_T_SET_UNIT_FIELD: |
---|
1004 | if (temp.action[j].param3 >= TARGET_T_END) |
---|
1005 | error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); |
---|
1006 | break; |
---|
1007 | |
---|
1008 | case ACTION_T_SET_PHASE: |
---|
1009 | if (temp.action[j].param1 > 31) |
---|
1010 | error_db_log("TSCR: Event %u Action %u attempts to set phase > 31. Phase mask cannot be used past phase 31.", i, j+1); |
---|
1011 | break; |
---|
1012 | |
---|
1013 | case ACTION_T_INC_PHASE: |
---|
1014 | if (!temp.action[j].param1) |
---|
1015 | error_db_log("TSCR: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); |
---|
1016 | break; |
---|
1017 | |
---|
1018 | case ACTION_T_KILLED_MONSTER: |
---|
1019 | if (temp.event_type != EVENT_T_DEATH) |
---|
1020 | outstring_log("TSCR WARNING: Event %u Action %u calling ACTION_T_KILLED_MONSTER outside of EVENT_T_DEATH", i, j+1); |
---|
1021 | break; |
---|
1022 | |
---|
1023 | case ACTION_T_SET_INST_DATA: |
---|
1024 | if (temp.action[j].param2 > 3) |
---|
1025 | error_db_log("TSCR: Event %u Action %u attempts to set instance data above encounter state 3. Custom case?", i, j+1); |
---|
1026 | break; |
---|
1027 | |
---|
1028 | default: |
---|
1029 | break; |
---|
1030 | } |
---|
1031 | |
---|
1032 | if (temp.action[j].type >= ACTION_T_END) |
---|
1033 | error_db_log("TSCR: Event %u Action %u has incorrect action type. Maybe DB requires updated version of SD2.", i, j+1); |
---|
1034 | } |
---|
1035 | |
---|
1036 | //Add to list |
---|
1037 | EventAI_Event_List.push_back(temp); |
---|
1038 | ++Count; |
---|
1039 | |
---|
1040 | }while (result->NextRow()); |
---|
1041 | |
---|
1042 | delete result; |
---|
1043 | outstring_log(""); |
---|
1044 | outstring_log("TSCR: >> Loaded %u EventAI_Events", Count); |
---|
1045 | |
---|
1046 | }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Scripts. DB table `EventAI_Scripts` is empty."); |
---|
1047 | |
---|
1048 | // Gather Script Text |
---|
1049 | result = TScriptDB.PQuery("SELECT `id`, `sound`, `type`, `language`, `text`" |
---|
1050 | "FROM `script_texts`;"); |
---|
1051 | |
---|
1052 | // Drop Existing Script Text Map |
---|
1053 | Script_TextMap.clear(); |
---|
1054 | |
---|
1055 | if(result) |
---|
1056 | { |
---|
1057 | outstring_log("TSCR: Loading Script Text..."); |
---|
1058 | barGoLink bar(result->GetRowCount()); |
---|
1059 | uint32 count = 0; |
---|
1060 | |
---|
1061 | do |
---|
1062 | { |
---|
1063 | bar.step(); |
---|
1064 | Field* fields = result->Fetch(); |
---|
1065 | ScriptText temp; |
---|
1066 | |
---|
1067 | uint32 i = fields[0].GetInt32(); |
---|
1068 | temp.SoundId = fields[1].GetInt32(); |
---|
1069 | temp.Type = fields[2].GetInt32(); |
---|
1070 | temp.Language = fields[3].GetInt32(); |
---|
1071 | temp.Text = fields[4].GetString(); |
---|
1072 | |
---|
1073 | if (temp.SoundId) |
---|
1074 | { |
---|
1075 | if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) |
---|
1076 | error_db_log("TSCR: Id %u in table script_texts has soundid %u but sound does not exist.",i,temp.SoundId); |
---|
1077 | } |
---|
1078 | |
---|
1079 | if(!strlen(temp.Text.c_str())) |
---|
1080 | error_db_log("TSCR: Id %u in table script_texts has no text.", i); |
---|
1081 | |
---|
1082 | Script_TextMap[i] = temp; |
---|
1083 | ++count; |
---|
1084 | |
---|
1085 | }while(result->NextRow()); |
---|
1086 | |
---|
1087 | delete result; |
---|
1088 | |
---|
1089 | outstring_log(""); |
---|
1090 | outstring_log("TSCR: Loaded %u Script Texts", count); |
---|
1091 | |
---|
1092 | }else outstring_log("TSCR WARNING >> Loaded 0 Script Texts. Database table `script_texts` is empty."); |
---|
1093 | |
---|
1094 | //Free database thread and resources |
---|
1095 | TScriptDB.HaltDelayThread(); |
---|
1096 | |
---|
1097 | //***End DB queries*** |
---|
1098 | } |
---|
1099 | } |
---|
1100 | |
---|
1101 | struct TSpellSummary { |
---|
1102 | uint8 Targets; // set of enum SelectTarget |
---|
1103 | uint8 Effects; // set of enum SelectEffect |
---|
1104 | }extern *SpellSummary; |
---|
1105 | |
---|
1106 | MANGOS_DLL_EXPORT |
---|
1107 | void ScriptsFree() |
---|
1108 | { |
---|
1109 | // Free Spell Summary |
---|
1110 | delete []SpellSummary; |
---|
1111 | |
---|
1112 | // Free resources before library unload |
---|
1113 | for(int i=0;i<nrscripts;i++) |
---|
1114 | delete m_scripts[i]; |
---|
1115 | |
---|
1116 | nrscripts = 0; |
---|
1117 | } |
---|
1118 | |
---|
1119 | MANGOS_DLL_EXPORT |
---|
1120 | void ScriptsInit() |
---|
1121 | { |
---|
1122 | //Trinity Script startup |
---|
1123 | outstring_log(" _____ _ _ _ ____ _ _"); |
---|
1124 | outstring_log("|_ _| __(_)_ __ (_) |_ _ _/ ___| ___ _ __(_)_ __ | |_ "); |
---|
1125 | outstring_log(" | || '__| | '_ \\| | __| | | \\___ \\ / __| \'__| | \'_ \\| __|"); |
---|
1126 | outstring_log(" | || | | | | | | | |_| |_| |___) | (__| | | | |_) | |_ "); |
---|
1127 | outstring_log(" |_||_| |_|_| |_|_|\\__|\\__, |____/ \\___|_| |_| .__/ \\__|"); |
---|
1128 | outstring_log(" |___/ |_| "); |
---|
1129 | outstring_log("Trinity Script initializing %s", _FULLVERSION); |
---|
1130 | outstring_log(""); |
---|
1131 | |
---|
1132 | //Get configuration file |
---|
1133 | if (!TScriptConfig.SetSource(_TRINITY_SCRIPT_CONFIG)) |
---|
1134 | error_log("TSCR: Unable to open configuration file, Database will be unaccessible"); |
---|
1135 | else outstring_log("TSCR: Using configuration file %s", _TRINITY_SCRIPT_CONFIG); |
---|
1136 | |
---|
1137 | |
---|
1138 | //Check config file version |
---|
1139 | if (TScriptConfig.GetIntDefault("ConfVersion", 0) != _TSCRIPTCONFVERSION) |
---|
1140 | error_log("TSCR: Configuration file version doesn't match expected version. Some config variables may be wrong or missing."); |
---|
1141 | |
---|
1142 | //Locale |
---|
1143 | Locale = TScriptConfig.GetIntDefault("Locale", 0); |
---|
1144 | |
---|
1145 | if (Locale > 8) |
---|
1146 | { |
---|
1147 | Locale = 0; |
---|
1148 | error_log("TSCR: Locale set to invalid language id. Defaulting to 0."); |
---|
1149 | } |
---|
1150 | |
---|
1151 | outstring_log("TSCR: Using locale %u", Locale); |
---|
1152 | outstring_log(""); |
---|
1153 | |
---|
1154 | EAI_ErrorLevel = TScriptConfig.GetIntDefault("EAIErrorLevel", 1); |
---|
1155 | |
---|
1156 | switch (EAI_ErrorLevel) |
---|
1157 | { |
---|
1158 | case 0: |
---|
1159 | outstring_log("TSCR: EventAI Error Reporting level set to 0 (Startup Errors only)"); |
---|
1160 | break; |
---|
1161 | |
---|
1162 | case 1: |
---|
1163 | outstring_log("TSCR: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)"); |
---|
1164 | break; |
---|
1165 | |
---|
1166 | case 2: |
---|
1167 | outstring_log("TSCR: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)"); |
---|
1168 | break; |
---|
1169 | |
---|
1170 | default: |
---|
1171 | outstring_log("TSCR: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)"); |
---|
1172 | EAI_ErrorLevel = 1; |
---|
1173 | break; |
---|
1174 | } |
---|
1175 | outstring_log(""); |
---|
1176 | |
---|
1177 | //Load database (must be called after TScriptConfig.SetSource) |
---|
1178 | LoadDatabase(); |
---|
1179 | |
---|
1180 | nrscripts = 0; |
---|
1181 | for(int i=0;i<MAX_SCRIPTS;i++) |
---|
1182 | m_scripts[i]=NULL; |
---|
1183 | |
---|
1184 | FillSpellSummary(); |
---|
1185 | |
---|
1186 | // -- Scripts to be added -- |
---|
1187 | |
---|
1188 | // -- Areatrigger -- |
---|
1189 | AddSC_areatrigger_scripts(); |
---|
1190 | |
---|
1191 | // -- Boss -- |
---|
1192 | AddSC_boss_emeriss(); |
---|
1193 | AddSC_boss_taerar(); |
---|
1194 | AddSC_boss_ysondre(); |
---|
1195 | |
---|
1196 | // -- Creature -- |
---|
1197 | AddSC_mob_event(); |
---|
1198 | AddSC_generic_creature(); |
---|
1199 | |
---|
1200 | // -- Custom -- |
---|
1201 | AddSC_custom_example(); |
---|
1202 | AddSC_custom_gossip_codebox(); |
---|
1203 | AddSC_test(); |
---|
1204 | |
---|
1205 | // -- GO -- |
---|
1206 | AddSC_go_scripts(); |
---|
1207 | |
---|
1208 | // -- Guard -- |
---|
1209 | AddSC_guards(); |
---|
1210 | |
---|
1211 | // -- Honor -- |
---|
1212 | |
---|
1213 | // -- Item -- |
---|
1214 | AddSC_item_scripts(); |
---|
1215 | AddSC_item_test(); |
---|
1216 | |
---|
1217 | // -- NPC -- |
---|
1218 | AddSC_npc_professions(); |
---|
1219 | AddSC_npcs_special(); |
---|
1220 | |
---|
1221 | // -- Servers -- |
---|
1222 | |
---|
1223 | //-------------------- |
---|
1224 | //------ ZONE -------- |
---|
1225 | |
---|
1226 | //Alterac Mountains |
---|
1227 | AddSC_alterac_mountains(); |
---|
1228 | |
---|
1229 | //Arathi Highlands |
---|
1230 | //Ashenvale Forest |
---|
1231 | //Aunchindoun |
---|
1232 | //--Auchenai Crypts |
---|
1233 | AddSC_boss_exarch_maladaar(); |
---|
1234 | |
---|
1235 | //--Mana Tombs |
---|
1236 | AddSC_boss_nexusprince_shaffar(); |
---|
1237 | AddSC_boss_pandemonius(); |
---|
1238 | |
---|
1239 | //--Sekketh Halls |
---|
1240 | AddSC_boss_darkweaver_syth(); |
---|
1241 | AddSC_boss_talon_king_ikiss(); |
---|
1242 | AddSC_instance_sethekk_halls(); |
---|
1243 | |
---|
1244 | //--Shadow Labyrinth |
---|
1245 | AddSC_boss_ambassador_hellmaw(); |
---|
1246 | AddSC_boss_blackheart_the_inciter(); |
---|
1247 | AddSC_boss_grandmaster_vorpil(); |
---|
1248 | AddSC_boss_murmur(); |
---|
1249 | AddSC_instance_shadow_labyrinth(); |
---|
1250 | |
---|
1251 | //Azshara |
---|
1252 | AddSC_boss_azuregos(); |
---|
1253 | AddSC_azshara(); |
---|
1254 | |
---|
1255 | //Azuremyst Isle |
---|
1256 | AddSC_azuremyst_isle(); |
---|
1257 | |
---|
1258 | //Badlands |
---|
1259 | //Barrens |
---|
1260 | AddSC_the_barrens(); |
---|
1261 | |
---|
1262 | //Black Temple |
---|
1263 | AddSC_black_temple(); |
---|
1264 | AddSC_boss_illidan(); |
---|
1265 | AddSC_boss_shade_of_akama(); |
---|
1266 | AddSC_boss_supremus(); |
---|
1267 | AddSC_boss_gurtogg_bloodboil(); |
---|
1268 | AddSC_boss_mother_shahraz(); |
---|
1269 | AddSC_boss_reliquary_of_souls(); |
---|
1270 | AddSC_boss_teron_gorefiend(); |
---|
1271 | AddSC_boss_najentus(); |
---|
1272 | AddSC_boss_illidari_council(); |
---|
1273 | AddSC_instance_black_temple(); |
---|
1274 | |
---|
1275 | //Blackfathom Depths |
---|
1276 | //Blackrock Depths |
---|
1277 | AddSC_blackrock_depths(); |
---|
1278 | AddSC_boss_ambassador_flamelash(); |
---|
1279 | AddSC_boss_angerrel(); |
---|
1280 | AddSC_boss_anubshiah(); |
---|
1281 | AddSC_boss_doomrel(); |
---|
1282 | AddSC_boss_doperel(); |
---|
1283 | AddSC_boss_draganthaurissan(); |
---|
1284 | AddSC_boss_general_angerforge(); |
---|
1285 | AddSC_boss_gloomrel(); |
---|
1286 | AddSC_boss_gorosh_the_dervish(); |
---|
1287 | AddSC_boss_grizzle(); |
---|
1288 | AddSC_boss_haterel(); |
---|
1289 | AddSC_boss_high_interrogator_gerstahn(); |
---|
1290 | AddSC_boss_magmus(); |
---|
1291 | AddSC_boss_moira_bronzebeard(); |
---|
1292 | AddSC_boss_seethrel(); |
---|
1293 | AddSC_boss_vilerel(); |
---|
1294 | |
---|
1295 | //Blackrock Spire |
---|
1296 | AddSC_boss_drakkisath(); |
---|
1297 | AddSC_boss_halycon(); |
---|
1298 | AddSC_boss_highlordomokk(); |
---|
1299 | AddSC_boss_mothersmolderweb(); |
---|
1300 | AddSC_boss_overlordwyrmthalak(); |
---|
1301 | AddSC_boss_shadowvosh(); |
---|
1302 | AddSC_boss_thebeast(); |
---|
1303 | AddSC_boss_warmastervoone(); |
---|
1304 | AddSC_boss_quatermasterzigris(); |
---|
1305 | AddSC_boss_pyroguard_emberseer(); |
---|
1306 | AddSC_boss_gyth(); |
---|
1307 | AddSC_boss_rend_blackhand(); |
---|
1308 | |
---|
1309 | //Blackwing lair |
---|
1310 | AddSC_boss_razorgore(); |
---|
1311 | AddSC_boss_vael(); |
---|
1312 | AddSC_boss_broodlord(); |
---|
1313 | AddSC_boss_firemaw(); |
---|
1314 | AddSC_boss_ebonroc(); |
---|
1315 | AddSC_boss_flamegor(); |
---|
1316 | AddSC_boss_chromaggus(); |
---|
1317 | AddSC_boss_nefarian(); |
---|
1318 | AddSC_boss_victor_nefarius(); |
---|
1319 | |
---|
1320 | //Blade's Edge Mountains |
---|
1321 | AddSC_blades_edge_mountains(); |
---|
1322 | |
---|
1323 | //Blasted lands |
---|
1324 | AddSC_boss_kruul(); |
---|
1325 | AddSC_blasted_lands(); |
---|
1326 | |
---|
1327 | //Bloodmyst Isle |
---|
1328 | AddSC_bloodmyst_isle(); |
---|
1329 | |
---|
1330 | //Burning steppes |
---|
1331 | AddSC_burning_steppes(); |
---|
1332 | |
---|
1333 | //Caverns of Time |
---|
1334 | //--Battle for Mt. Hyjal |
---|
1335 | AddSC_hyjal(); |
---|
1336 | AddSC_boss_archimonde(); |
---|
1337 | AddSC_instance_mount_hyjal(); |
---|
1338 | |
---|
1339 | //--Old Hillsbrad |
---|
1340 | AddSC_boss_captain_skarloc(); |
---|
1341 | AddSC_boss_epoch_hunter(); |
---|
1342 | AddSC_boss_lieutenant_drake(); |
---|
1343 | AddSC_instance_old_hillsbrad(); |
---|
1344 | AddSC_old_hillsbrad(); |
---|
1345 | |
---|
1346 | //--The Dark Portal |
---|
1347 | AddSC_boss_aeonus(); |
---|
1348 | AddSC_boss_chrono_lord_deja(); |
---|
1349 | AddSC_boss_temporus(); |
---|
1350 | |
---|
1351 | //Coilfang Resevoir |
---|
1352 | //--Serpent Shrine Cavern |
---|
1353 | AddSC_boss_fathomlord_karathress(); |
---|
1354 | AddSC_boss_hydross_the_unstable(); |
---|
1355 | AddSC_boss_lady_vashj(); |
---|
1356 | AddSC_boss_leotheras_the_blind(); |
---|
1357 | AddSC_boss_morogrim_tidewalker(); |
---|
1358 | AddSC_instance_serpentshrine_cavern(); |
---|
1359 | |
---|
1360 | //--Slave Pens |
---|
1361 | //--Steam Vault |
---|
1362 | AddSC_boss_hydromancer_thespia(); |
---|
1363 | AddSC_boss_mekgineer_steamrigger(); |
---|
1364 | AddSC_boss_warlord_kalithresh(); |
---|
1365 | AddSC_instance_steam_vault(); |
---|
1366 | |
---|
1367 | //--Underbog |
---|
1368 | AddSC_boss_hungarfen(); |
---|
1369 | |
---|
1370 | //Darkshore |
---|
1371 | //Darnassus |
---|
1372 | //Deadmines |
---|
1373 | //Deadwind pass |
---|
1374 | //Desolace |
---|
1375 | //Dire Maul |
---|
1376 | //Dun Morogh |
---|
1377 | AddSC_dun_morogh(); |
---|
1378 | |
---|
1379 | //Durotar |
---|
1380 | //Duskwood |
---|
1381 | //Dustwallow marsh |
---|
1382 | AddSC_dustwallow_marsh(); |
---|
1383 | |
---|
1384 | //Eversong Woods |
---|
1385 | AddSC_eversong_woods(); |
---|
1386 | |
---|
1387 | //Exodar |
---|
1388 | //Eastern Plaguelands |
---|
1389 | AddSC_eastern_plaguelands(); |
---|
1390 | |
---|
1391 | //Elwynn Forest |
---|
1392 | AddSC_elwynn_forest(); |
---|
1393 | |
---|
1394 | //Felwood |
---|
1395 | AddSC_felwood(); |
---|
1396 | |
---|
1397 | //Feralas |
---|
1398 | AddSC_feralas(); |
---|
1399 | |
---|
1400 | //Ghostlands |
---|
1401 | AddSC_ghostlands(); |
---|
1402 | |
---|
1403 | //Gnomeregan |
---|
1404 | //Gruul's Lair |
---|
1405 | AddSC_boss_gruul(); |
---|
1406 | AddSC_boss_high_king_maulgar(); |
---|
1407 | AddSC_instance_gruuls_lair(); |
---|
1408 | |
---|
1409 | //Hellfire Citadel |
---|
1410 | //--Blood Furnace |
---|
1411 | AddSC_boss_broggok(); |
---|
1412 | AddSC_boss_kelidan_the_breaker(); |
---|
1413 | AddSC_boss_the_maker(); |
---|
1414 | |
---|
1415 | //--Magtheridon's Lair |
---|
1416 | AddSC_boss_magtheridon(); |
---|
1417 | AddSC_instance_magtheridons_lair(); |
---|
1418 | |
---|
1419 | //--Shattered Halls |
---|
1420 | AddSC_boss_grand_warlock_nethekurse(); |
---|
1421 | AddSC_boss_warbringer_omrogg(); |
---|
1422 | AddSC_instance_shattered_halls(); |
---|
1423 | |
---|
1424 | //--Ramparts |
---|
1425 | AddSC_boss_watchkeeper_gargolmar(); |
---|
1426 | AddSC_boss_omor_the_unscarred(); |
---|
1427 | |
---|
1428 | //Hellfire Peninsula |
---|
1429 | AddSC_boss_doomlordkazzak(); |
---|
1430 | AddSC_hellfire_peninsula(); |
---|
1431 | |
---|
1432 | //Hillsbrad Foothills |
---|
1433 | //Hinterlands |
---|
1434 | //Ironforge |
---|
1435 | AddSC_ironforge(); |
---|
1436 | |
---|
1437 | //Isle of Quel'Danas |
---|
1438 | AddSC_isle_of_queldanas(); |
---|
1439 | |
---|
1440 | //Karazhan |
---|
1441 | AddSC_boss_attumen(); |
---|
1442 | AddSC_boss_curator(); |
---|
1443 | AddSC_boss_maiden_of_virtue(); |
---|
1444 | AddSC_boss_shade_of_aran(); |
---|
1445 | AddSC_boss_malchezaar(); |
---|
1446 | AddSC_boss_terestian_illhoof(); |
---|
1447 | AddSC_netherspite_infernal(); |
---|
1448 | AddSC_boss_moroes(); |
---|
1449 | AddSC_bosses_opera(); |
---|
1450 | AddSC_instance_karazhan(); |
---|
1451 | AddSC_karazhan(); |
---|
1452 | |
---|
1453 | //Loch Modan |
---|
1454 | AddSC_loch_modan(); |
---|
1455 | |
---|
1456 | //Lower Blackrock Spire |
---|
1457 | |
---|
1458 | // Magister's Terrace |
---|
1459 | AddSC_boss_felblood_kaelthas(); |
---|
1460 | AddSC_boss_selin_fireheart(); |
---|
1461 | AddSC_boss_vexallus(); |
---|
1462 | AddSC_boss_priestess_delrissa(); |
---|
1463 | AddSC_instance_magisters_terrace(); |
---|
1464 | |
---|
1465 | //Maraudon |
---|
1466 | AddSC_boss_celebras_the_cursed(); |
---|
1467 | AddSC_boss_landslide(); |
---|
1468 | AddSC_boss_noxxion(); |
---|
1469 | AddSC_boss_ptheradras(); |
---|
1470 | |
---|
1471 | //Molten core |
---|
1472 | AddSC_boss_lucifron(); |
---|
1473 | AddSC_boss_magmadar(); |
---|
1474 | AddSC_boss_gehennas(); |
---|
1475 | AddSC_boss_garr(); |
---|
1476 | AddSC_boss_baron_geddon(); |
---|
1477 | AddSC_boss_shazzrah(); |
---|
1478 | AddSC_boss_golemagg(); |
---|
1479 | AddSC_boss_sulfuron(); |
---|
1480 | AddSC_boss_majordomo(); |
---|
1481 | AddSC_boss_ragnaros(); |
---|
1482 | AddSC_instance_molten_core(); |
---|
1483 | AddSC_molten_core(); |
---|
1484 | |
---|
1485 | //Moonglade |
---|
1486 | AddSC_moonglade(); |
---|
1487 | |
---|
1488 | //Mulgore |
---|
1489 | AddSC_mulgore(); |
---|
1490 | |
---|
1491 | //Nagrand |
---|
1492 | AddSC_nagrand(); |
---|
1493 | |
---|
1494 | //Naxxramas |
---|
1495 | AddSC_boss_anubrekhan(); |
---|
1496 | AddSC_boss_maexxna(); |
---|
1497 | AddSC_boss_patchwerk(); |
---|
1498 | AddSC_boss_razuvious(); |
---|
1499 | AddSC_boss_highlord_mograine(); |
---|
1500 | AddSC_boss_lady_blaumeux(); |
---|
1501 | AddSC_boss_sir_zeliek(); |
---|
1502 | AddSC_boss_thane_korthazz(); |
---|
1503 | AddSC_boss_kelthuzad(); |
---|
1504 | AddSC_boss_faerlina(); |
---|
1505 | AddSC_boss_loatheb(); |
---|
1506 | AddSC_boss_noth(); |
---|
1507 | AddSC_boss_gluth(); |
---|
1508 | AddSC_boss_sapphiron(); |
---|
1509 | |
---|
1510 | //Netherstorm |
---|
1511 | AddSC_netherstorm(); |
---|
1512 | |
---|
1513 | //Onyxia's Lair |
---|
1514 | AddSC_boss_onyxia(); |
---|
1515 | |
---|
1516 | //Orgrimmar |
---|
1517 | AddSC_orgrimmar(); |
---|
1518 | |
---|
1519 | //Ragefire Chasm |
---|
1520 | //Razorfen Downs |
---|
1521 | AddSC_boss_amnennar_the_coldbringer(); |
---|
1522 | |
---|
1523 | //Redridge Mountains |
---|
1524 | //Ruins of Ahn'Qiraj |
---|
1525 | //Scarlet Monastery |
---|
1526 | AddSC_boss_arcanist_doan(); |
---|
1527 | AddSC_boss_azshir_the_sleepless(); |
---|
1528 | AddSC_boss_bloodmage_thalnos(); |
---|
1529 | AddSC_boss_herod(); |
---|
1530 | AddSC_boss_high_inquisitor_fairbanks(); |
---|
1531 | AddSC_boss_high_inquisitor_whitemane(); |
---|
1532 | AddSC_boss_houndmaster_loksey(); |
---|
1533 | AddSC_boss_interrogator_vishas(); |
---|
1534 | AddSC_boss_scarlet_commander_mograine(); |
---|
1535 | AddSC_boss_scorn(); |
---|
1536 | |
---|
1537 | //Scholomance |
---|
1538 | AddSC_boss_darkmaster_gandling(); |
---|
1539 | AddSC_boss_death_knight_darkreaver(); |
---|
1540 | AddSC_boss_theolenkrastinov(); |
---|
1541 | AddSC_boss_illuciabarov(); |
---|
1542 | AddSC_boss_instructormalicia(); |
---|
1543 | AddSC_boss_jandicebarov(); |
---|
1544 | AddSC_boss_kormok(); |
---|
1545 | AddSC_boss_lordalexeibarov(); |
---|
1546 | AddSC_boss_lorekeeperpolkelt(); |
---|
1547 | AddSC_boss_rasfrost(); |
---|
1548 | AddSC_boss_theravenian(); |
---|
1549 | AddSC_boss_vectus(); |
---|
1550 | AddSC_instance_scholomance(); |
---|
1551 | |
---|
1552 | //Searing gorge |
---|
1553 | AddSC_searing_gorge(); |
---|
1554 | |
---|
1555 | //Shadowfang keep |
---|
1556 | AddSC_shadowfang_keep(); |
---|
1557 | AddSC_instance_shadowfang_keep(); |
---|
1558 | |
---|
1559 | //Shadowmoon Valley |
---|
1560 | AddSC_boss_doomwalker(); |
---|
1561 | AddSC_shadowmoon_valley(); |
---|
1562 | |
---|
1563 | //Shattrath |
---|
1564 | AddSC_shattrath_city(); |
---|
1565 | |
---|
1566 | //Silithus |
---|
1567 | AddSC_silithus(); |
---|
1568 | |
---|
1569 | //Silvermoon |
---|
1570 | AddSC_silvermoon_city(); |
---|
1571 | |
---|
1572 | //Silverpine forest |
---|
1573 | AddSC_silverpine_forest(); |
---|
1574 | |
---|
1575 | //Stockade |
---|
1576 | //Stonetalon mountains |
---|
1577 | AddSC_stonetalon_mountains(); |
---|
1578 | |
---|
1579 | //Stormwind City |
---|
1580 | AddSC_stormwind_city(); |
---|
1581 | |
---|
1582 | //Stranglethorn Vale |
---|
1583 | AddSC_stranglethorn_vale(); |
---|
1584 | |
---|
1585 | //Stratholme |
---|
1586 | AddSC_boss_magistrate_barthilas(); |
---|
1587 | AddSC_boss_maleki_the_pallid(); |
---|
1588 | AddSC_boss_nerubenkan(); |
---|
1589 | AddSC_boss_cannon_master_willey(); |
---|
1590 | AddSC_boss_baroness_anastari(); |
---|
1591 | AddSC_boss_ramstein_the_gorger(); |
---|
1592 | AddSC_boss_timmy_the_cruel(); |
---|
1593 | AddSC_boss_postmaster_malown(); |
---|
1594 | AddSC_boss_baron_rivendare(); |
---|
1595 | AddSC_boss_dathrohan_balnazzar(); |
---|
1596 | AddSC_boss_order_of_silver_hand(); |
---|
1597 | AddSC_instance_stratholme(); |
---|
1598 | AddSC_stratholme(); |
---|
1599 | |
---|
1600 | //Sunken Temple |
---|
1601 | //Tanaris |
---|
1602 | AddSC_tanaris(); |
---|
1603 | |
---|
1604 | //Teldrassil |
---|
1605 | //Tempest Keep |
---|
1606 | //--Arcatraz |
---|
1607 | AddSC_arcatraz(); |
---|
1608 | AddSC_boss_harbinger_skyriss(); |
---|
1609 | AddSC_instance_arcatraz(); |
---|
1610 | |
---|
1611 | //--Botanica |
---|
1612 | AddSC_boss_high_botanist_freywinn(); |
---|
1613 | AddSC_boss_laj(); |
---|
1614 | AddSC_boss_warp_splinter(); |
---|
1615 | |
---|
1616 | //--The Eye |
---|
1617 | AddSC_boss_kaelthas(); |
---|
1618 | AddSC_boss_void_reaver(); |
---|
1619 | AddSC_boss_high_astromancer_solarian(); |
---|
1620 | AddSC_instance_the_eye(); |
---|
1621 | AddSC_the_eye(); |
---|
1622 | |
---|
1623 | //--The Mechanar |
---|
1624 | AddSC_boss_gatewatcher_iron_hand(); |
---|
1625 | AddSC_boss_nethermancer_sepethrea(); |
---|
1626 | |
---|
1627 | //Temple of ahn'qiraj |
---|
1628 | AddSC_boss_cthun(); |
---|
1629 | AddSC_boss_fankriss(); |
---|
1630 | AddSC_boss_huhuran(); |
---|
1631 | AddSC_bug_trio(); |
---|
1632 | AddSC_boss_sartura(); |
---|
1633 | AddSC_boss_skeram(); |
---|
1634 | AddSC_boss_twinemperors(); |
---|
1635 | AddSC_mob_anubisath_sentinel(); |
---|
1636 | AddSC_instance_temple_of_ahnqiraj(); |
---|
1637 | |
---|
1638 | //Terokkar Forest |
---|
1639 | AddSC_terokkar_forest(); |
---|
1640 | |
---|
1641 | //Thousand Needles |
---|
1642 | //Thunder Bluff |
---|
1643 | AddSC_thunder_bluff(); |
---|
1644 | |
---|
1645 | //Tirisfal Glades |
---|
1646 | AddSC_tirisfal_glades(); |
---|
1647 | |
---|
1648 | //Uldaman |
---|
1649 | AddSC_boss_ironaya(); |
---|
1650 | AddSC_uldaman(); |
---|
1651 | |
---|
1652 | //Undercity |
---|
1653 | AddSC_undercity(); |
---|
1654 | |
---|
1655 | //Un'Goro Crater |
---|
1656 | //Upper blackrock spire |
---|
1657 | //Wailing caverns |
---|
1658 | |
---|
1659 | //Western plaguelands |
---|
1660 | AddSC_western_plaguelands(); |
---|
1661 | |
---|
1662 | //Westfall |
---|
1663 | //Wetlands |
---|
1664 | //Winterspring |
---|
1665 | AddSC_winterspring(); |
---|
1666 | |
---|
1667 | //Zangarmarsh |
---|
1668 | AddSC_zangarmarsh(); |
---|
1669 | |
---|
1670 | //Zul'Farrak |
---|
1671 | //Zul'Gurub |
---|
1672 | AddSC_boss_jeklik(); |
---|
1673 | AddSC_boss_venoxis(); |
---|
1674 | AddSC_boss_marli(); |
---|
1675 | AddSC_boss_mandokir(); |
---|
1676 | AddSC_boss_gahzranka(); |
---|
1677 | AddSC_boss_thekal(); |
---|
1678 | AddSC_boss_arlokk(); |
---|
1679 | AddSC_boss_jindo(); |
---|
1680 | AddSC_boss_hakkar(); |
---|
1681 | AddSC_boss_grilek(); |
---|
1682 | AddSC_boss_hazzarah(); |
---|
1683 | AddSC_boss_renataki(); |
---|
1684 | AddSC_boss_wushoolay(); |
---|
1685 | AddSC_instance_zulgurub(); |
---|
1686 | |
---|
1687 | //Zul'Aman |
---|
1688 | AddSC_boss_janalai(); |
---|
1689 | AddSC_boss_nalorakk(); |
---|
1690 | AddSC_instance_zulaman(); |
---|
1691 | AddSC_zulaman(); |
---|
1692 | |
---|
1693 | // ------------------- |
---|
1694 | |
---|
1695 | outstring_log("TSCR: Loaded %u C++ Scripts", nrscripts); |
---|
1696 | outstring_log(""); |
---|
1697 | } |
---|
1698 | |
---|
1699 | //********************************* |
---|
1700 | //*** Functions used internally *** |
---|
1701 | |
---|
1702 | const char* GetEventAILocalizedText(uint32 entry) |
---|
1703 | { |
---|
1704 | if (entry == 0xffffffff) |
---|
1705 | error_log("TSCR: Entry = -1, GetEventAILocalizedText should not be called in this case."); |
---|
1706 | |
---|
1707 | const char* temp = NULL; |
---|
1708 | |
---|
1709 | HM_NAMESPACE::hash_map<uint32, Localized_Text>::iterator i = EventAI_LocalizedTextMap.find(entry); |
---|
1710 | |
---|
1711 | if (i == EventAI_LocalizedTextMap.end()) |
---|
1712 | { |
---|
1713 | error_log("TSCR: EventAI Localized Text %u not found", entry); |
---|
1714 | return DEFAULT_TEXT; |
---|
1715 | } |
---|
1716 | |
---|
1717 | switch (Locale) |
---|
1718 | { |
---|
1719 | case 1: |
---|
1720 | temp = (*i).second.locale_1.c_str(); |
---|
1721 | break; |
---|
1722 | |
---|
1723 | case 2: |
---|
1724 | temp = (*i).second.locale_2.c_str(); |
---|
1725 | break; |
---|
1726 | |
---|
1727 | case 3: |
---|
1728 | temp = (*i).second.locale_3.c_str(); |
---|
1729 | break; |
---|
1730 | |
---|
1731 | case 4: |
---|
1732 | temp = (*i).second.locale_4.c_str(); |
---|
1733 | break; |
---|
1734 | |
---|
1735 | case 5: |
---|
1736 | temp = (*i).second.locale_5.c_str(); |
---|
1737 | break; |
---|
1738 | |
---|
1739 | case 6: |
---|
1740 | temp = (*i).second.locale_6.c_str(); |
---|
1741 | break; |
---|
1742 | |
---|
1743 | case 7: |
---|
1744 | temp = (*i).second.locale_7.c_str(); |
---|
1745 | break; |
---|
1746 | |
---|
1747 | case 8: |
---|
1748 | temp = (*i).second.locale_8.c_str(); |
---|
1749 | break; |
---|
1750 | }; |
---|
1751 | |
---|
1752 | if (strlen(temp)) |
---|
1753 | return temp; |
---|
1754 | |
---|
1755 | return DEFAULT_TEXT; |
---|
1756 | } |
---|
1757 | |
---|
1758 | const char* GetScriptLocalizedText(uint32 entry) |
---|
1759 | { |
---|
1760 | const char* temp = NULL; |
---|
1761 | |
---|
1762 | HM_NAMESPACE::hash_map<uint32, Localized_Text>::iterator i = Script_LocalizedTextMap.find(entry); |
---|
1763 | |
---|
1764 | if (i == Script_LocalizedTextMap.end()) |
---|
1765 | { |
---|
1766 | error_log("TSCR: Script Localized Text %u not found", entry); |
---|
1767 | return DEFAULT_TEXT; |
---|
1768 | } |
---|
1769 | |
---|
1770 | switch (Locale) |
---|
1771 | { |
---|
1772 | case 1: |
---|
1773 | temp = (*i).second.locale_1.c_str(); |
---|
1774 | break; |
---|
1775 | |
---|
1776 | case 2: |
---|
1777 | temp = (*i).second.locale_2.c_str(); |
---|
1778 | break; |
---|
1779 | |
---|
1780 | case 3: |
---|
1781 | temp = (*i).second.locale_3.c_str(); |
---|
1782 | break; |
---|
1783 | |
---|
1784 | case 4: |
---|
1785 | temp = (*i).second.locale_4.c_str(); |
---|
1786 | break; |
---|
1787 | |
---|
1788 | case 5: |
---|
1789 | temp = (*i).second.locale_5.c_str(); |
---|
1790 | break; |
---|
1791 | |
---|
1792 | case 6: |
---|
1793 | temp = (*i).second.locale_6.c_str(); |
---|
1794 | break; |
---|
1795 | |
---|
1796 | case 7: |
---|
1797 | temp = (*i).second.locale_7.c_str(); |
---|
1798 | break; |
---|
1799 | |
---|
1800 | case 8: |
---|
1801 | temp = (*i).second.locale_8.c_str(); |
---|
1802 | break; |
---|
1803 | }; |
---|
1804 | |
---|
1805 | if (strlen(temp)) |
---|
1806 | return temp; |
---|
1807 | |
---|
1808 | return DEFAULT_TEXT; |
---|
1809 | } |
---|
1810 | |
---|
1811 | const char* GetEventAIText(uint32 entry) |
---|
1812 | { |
---|
1813 | if(entry == 0xffffffff) |
---|
1814 | error_log("TSCR: Entry = -1, GetEventAIText should not be called in this case."); |
---|
1815 | |
---|
1816 | const char* str = NULL; |
---|
1817 | |
---|
1818 | HM_NAMESPACE::hash_map<uint32, std::string>::iterator itr = EventAI_Text_Map.find(entry); |
---|
1819 | if(itr == EventAI_Text_Map.end()) |
---|
1820 | { |
---|
1821 | error_log("TSCR: Unable to find EventAI Text %u", entry); |
---|
1822 | return DEFAULT_TEXT; |
---|
1823 | } |
---|
1824 | |
---|
1825 | str = (*itr).second.c_str(); |
---|
1826 | |
---|
1827 | if(strlen(str)) |
---|
1828 | return str; |
---|
1829 | |
---|
1830 | if(strlen((*itr).second.c_str())) |
---|
1831 | return (*itr).second.c_str(); |
---|
1832 | |
---|
1833 | return DEFAULT_TEXT; |
---|
1834 | } |
---|
1835 | |
---|
1836 | void ProcessScriptText(uint32 id, WorldObject* pSource, Unit* target) |
---|
1837 | { |
---|
1838 | if (!pSource) |
---|
1839 | { |
---|
1840 | error_log("TSCR: ProcessScriptText invalid Source pointer."); |
---|
1841 | return; |
---|
1842 | } |
---|
1843 | |
---|
1844 | HM_NAMESPACE::hash_map<uint32, ScriptText>::iterator i = Script_TextMap.find(id); |
---|
1845 | |
---|
1846 | if (i == Script_TextMap.end()) |
---|
1847 | { |
---|
1848 | error_log("TSCR: ProcessScriptText could not find id %u.",id); |
---|
1849 | return; |
---|
1850 | } |
---|
1851 | |
---|
1852 | if((*i).second.SoundId) |
---|
1853 | { |
---|
1854 | if(GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) |
---|
1855 | { |
---|
1856 | pSource->SendPlaySound((*i).second.SoundId, false); |
---|
1857 | } |
---|
1858 | else |
---|
1859 | error_log("TSCR: ProcessScriptText id %u tried to process invalid soundid %u.",id,(*i).second.SoundId); |
---|
1860 | } |
---|
1861 | |
---|
1862 | switch((*i).second.Type) |
---|
1863 | { |
---|
1864 | case CHAT_TYPE_SAY: |
---|
1865 | pSource->MonsterSay((*i).second.Text.c_str(), (*i).second.Language, target ? target->GetGUID() : 0); |
---|
1866 | break; |
---|
1867 | |
---|
1868 | case CHAT_TYPE_YELL: |
---|
1869 | pSource->MonsterYell((*i).second.Text.c_str(), (*i).second.Language, target ? target->GetGUID() : 0); |
---|
1870 | break; |
---|
1871 | |
---|
1872 | case CHAT_TYPE_TEXT_EMOTE: |
---|
1873 | pSource->MonsterTextEmote((*i).second.Text.c_str(), target ? target->GetGUID() : 0); |
---|
1874 | break; |
---|
1875 | |
---|
1876 | case CHAT_TYPE_BOSS_EMOTE: |
---|
1877 | pSource->MonsterTextEmote((*i).second.Text.c_str(), target ? target->GetGUID() : 0, true); |
---|
1878 | break; |
---|
1879 | |
---|
1880 | case CHAT_TYPE_WHISPER: |
---|
1881 | { |
---|
1882 | if (target && target->GetTypeId() == TYPEID_PLAYER) |
---|
1883 | pSource->MonsterWhisper((*i).second.Text.c_str(), target->GetGUID()); |
---|
1884 | else error_log("TSCR: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); |
---|
1885 | }break; |
---|
1886 | |
---|
1887 | case CHAT_TYPE_BOSS_WHISPER: |
---|
1888 | { |
---|
1889 | if (target && target->GetTypeId() == TYPEID_PLAYER) |
---|
1890 | pSource->MonsterWhisper((*i).second.Text.c_str(), target->GetGUID(), true); |
---|
1891 | else error_log("TSCR: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); |
---|
1892 | }break; |
---|
1893 | } |
---|
1894 | } |
---|
1895 | |
---|
1896 | Script* GetScriptByName(std::string Name) |
---|
1897 | { |
---|
1898 | if(Name.empty()) |
---|
1899 | return NULL; |
---|
1900 | |
---|
1901 | for(int i=0;i<MAX_SCRIPTS;i++) |
---|
1902 | { |
---|
1903 | if( m_scripts[i] && m_scripts[i]->Name == Name ) |
---|
1904 | return m_scripts[i]; |
---|
1905 | } |
---|
1906 | return NULL; |
---|
1907 | } |
---|
1908 | |
---|
1909 | //******************************** |
---|
1910 | //*** Functions to be Exported *** |
---|
1911 | |
---|
1912 | MANGOS_DLL_EXPORT |
---|
1913 | bool GossipHello ( Player * player, Creature *_Creature ) |
---|
1914 | { |
---|
1915 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1916 | if(!tmpscript || !tmpscript->pGossipHello) return false; |
---|
1917 | |
---|
1918 | player->PlayerTalkClass->ClearMenus(); |
---|
1919 | return tmpscript->pGossipHello(player,_Creature); |
---|
1920 | } |
---|
1921 | |
---|
1922 | MANGOS_DLL_EXPORT |
---|
1923 | bool GossipSelect( Player *player, Creature *_Creature, uint32 sender, uint32 action ) |
---|
1924 | { |
---|
1925 | debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); |
---|
1926 | |
---|
1927 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1928 | if(!tmpscript || !tmpscript->pGossipSelect) return false; |
---|
1929 | |
---|
1930 | player->PlayerTalkClass->ClearMenus(); |
---|
1931 | return tmpscript->pGossipSelect(player,_Creature,sender,action); |
---|
1932 | } |
---|
1933 | |
---|
1934 | MANGOS_DLL_EXPORT |
---|
1935 | bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ) |
---|
1936 | { |
---|
1937 | debug_log("TSCR: Gossip selection with code, sender: %d, action: %d",sender, action); |
---|
1938 | |
---|
1939 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1940 | if(!tmpscript || !tmpscript->pGossipSelectWithCode) return false; |
---|
1941 | |
---|
1942 | player->PlayerTalkClass->ClearMenus(); |
---|
1943 | return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode); |
---|
1944 | } |
---|
1945 | |
---|
1946 | MANGOS_DLL_EXPORT |
---|
1947 | bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) |
---|
1948 | { |
---|
1949 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1950 | if(!tmpscript || !tmpscript->pQuestAccept) return false; |
---|
1951 | |
---|
1952 | player->PlayerTalkClass->ClearMenus(); |
---|
1953 | return tmpscript->pQuestAccept(player,_Creature,_Quest); |
---|
1954 | } |
---|
1955 | |
---|
1956 | MANGOS_DLL_EXPORT |
---|
1957 | bool QuestSelect( Player *player, Creature *_Creature, Quest const *_Quest ) |
---|
1958 | { |
---|
1959 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1960 | if(!tmpscript || !tmpscript->pQuestSelect) return false; |
---|
1961 | |
---|
1962 | player->PlayerTalkClass->ClearMenus(); |
---|
1963 | return tmpscript->pQuestSelect(player,_Creature,_Quest); |
---|
1964 | } |
---|
1965 | |
---|
1966 | MANGOS_DLL_EXPORT |
---|
1967 | bool QuestComplete( Player *player, Creature *_Creature, Quest const *_Quest ) |
---|
1968 | { |
---|
1969 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1970 | if(!tmpscript || !tmpscript->pQuestComplete) return false; |
---|
1971 | |
---|
1972 | player->PlayerTalkClass->ClearMenus(); |
---|
1973 | return tmpscript->pQuestComplete(player,_Creature,_Quest); |
---|
1974 | } |
---|
1975 | |
---|
1976 | MANGOS_DLL_EXPORT |
---|
1977 | bool ChooseReward( Player *player, Creature *_Creature, Quest const *_Quest, uint32 opt ) |
---|
1978 | { |
---|
1979 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1980 | if(!tmpscript || !tmpscript->pChooseReward) return false; |
---|
1981 | |
---|
1982 | player->PlayerTalkClass->ClearMenus(); |
---|
1983 | return tmpscript->pChooseReward(player,_Creature,_Quest,opt); |
---|
1984 | } |
---|
1985 | |
---|
1986 | MANGOS_DLL_EXPORT |
---|
1987 | uint32 NPCDialogStatus( Player *player, Creature *_Creature ) |
---|
1988 | { |
---|
1989 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
1990 | if(!tmpscript || !tmpscript->pNPCDialogStatus) return 100; |
---|
1991 | |
---|
1992 | player->PlayerTalkClass->ClearMenus(); |
---|
1993 | return tmpscript->pNPCDialogStatus(player,_Creature); |
---|
1994 | } |
---|
1995 | |
---|
1996 | MANGOS_DLL_EXPORT |
---|
1997 | uint32 GODialogStatus( Player *player, GameObject *_GO ) |
---|
1998 | { |
---|
1999 | Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); |
---|
2000 | if(!tmpscript || !tmpscript->pGODialogStatus) return 100; |
---|
2001 | |
---|
2002 | player->PlayerTalkClass->ClearMenus(); |
---|
2003 | return tmpscript->pGODialogStatus(player,_GO); |
---|
2004 | } |
---|
2005 | |
---|
2006 | MANGOS_DLL_EXPORT |
---|
2007 | bool ItemHello( Player *player, Item *_Item, Quest const *_Quest ) |
---|
2008 | { |
---|
2009 | Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); |
---|
2010 | if(!tmpscript || !tmpscript->pItemHello) return false; |
---|
2011 | |
---|
2012 | player->PlayerTalkClass->ClearMenus(); |
---|
2013 | return tmpscript->pItemHello(player,_Item,_Quest); |
---|
2014 | } |
---|
2015 | |
---|
2016 | MANGOS_DLL_EXPORT |
---|
2017 | bool ItemQuestAccept( Player *player, Item *_Item, Quest const *_Quest ) |
---|
2018 | { |
---|
2019 | Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); |
---|
2020 | if(!tmpscript || !tmpscript->pItemQuestAccept) return false; |
---|
2021 | |
---|
2022 | player->PlayerTalkClass->ClearMenus(); |
---|
2023 | return tmpscript->pItemQuestAccept(player,_Item,_Quest); |
---|
2024 | } |
---|
2025 | |
---|
2026 | MANGOS_DLL_EXPORT |
---|
2027 | bool GOHello( Player *player, GameObject *_GO ) |
---|
2028 | { |
---|
2029 | Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); |
---|
2030 | if(!tmpscript || !tmpscript->pGOHello) return false; |
---|
2031 | |
---|
2032 | player->PlayerTalkClass->ClearMenus(); |
---|
2033 | return tmpscript->pGOHello(player,_GO); |
---|
2034 | } |
---|
2035 | |
---|
2036 | MANGOS_DLL_EXPORT |
---|
2037 | bool GOQuestAccept( Player *player, GameObject *_GO, Quest const *_Quest ) |
---|
2038 | { |
---|
2039 | Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); |
---|
2040 | if(!tmpscript || !tmpscript->pGOQuestAccept) return false; |
---|
2041 | |
---|
2042 | player->PlayerTalkClass->ClearMenus(); |
---|
2043 | return tmpscript->pGOQuestAccept(player,_GO,_Quest); |
---|
2044 | } |
---|
2045 | |
---|
2046 | MANGOS_DLL_EXPORT |
---|
2047 | bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint32 opt ) |
---|
2048 | { |
---|
2049 | Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); |
---|
2050 | if(!tmpscript || !tmpscript->pGOChooseReward) return false; |
---|
2051 | |
---|
2052 | player->PlayerTalkClass->ClearMenus(); |
---|
2053 | return tmpscript->pGOChooseReward(player,_GO,_Quest,opt); |
---|
2054 | } |
---|
2055 | |
---|
2056 | MANGOS_DLL_EXPORT |
---|
2057 | bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry) |
---|
2058 | { |
---|
2059 | Script *tmpscript = NULL; |
---|
2060 | |
---|
2061 | tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id)); |
---|
2062 | if(!tmpscript || !tmpscript->pAreaTrigger) return false; |
---|
2063 | |
---|
2064 | return tmpscript->pAreaTrigger(player, atEntry); |
---|
2065 | } |
---|
2066 | |
---|
2067 | MANGOS_DLL_EXPORT |
---|
2068 | CreatureAI* GetAI(Creature *_Creature) |
---|
2069 | { |
---|
2070 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
2071 | |
---|
2072 | if(!tmpscript || !tmpscript->GetAI) return NULL; |
---|
2073 | return tmpscript->GetAI(_Creature); |
---|
2074 | } |
---|
2075 | |
---|
2076 | MANGOS_DLL_EXPORT |
---|
2077 | bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) |
---|
2078 | { |
---|
2079 | Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); |
---|
2080 | if(!tmpscript || !tmpscript->pItemUse) return false; |
---|
2081 | |
---|
2082 | return tmpscript->pItemUse(player,_Item,targets); |
---|
2083 | } |
---|
2084 | |
---|
2085 | MANGOS_DLL_EXPORT |
---|
2086 | bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote ) |
---|
2087 | { |
---|
2088 | Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); |
---|
2089 | if(!tmpscript || !tmpscript->pReceiveEmote) return false; |
---|
2090 | |
---|
2091 | return tmpscript->pReceiveEmote(player, _Creature, emote); |
---|
2092 | } |
---|
2093 | |
---|
2094 | MANGOS_DLL_EXPORT |
---|
2095 | InstanceData* CreateInstanceData(Map *map) |
---|
2096 | { |
---|
2097 | Script *tmpscript = NULL; |
---|
2098 | |
---|
2099 | if(!map->IsDungeon()) return false; |
---|
2100 | |
---|
2101 | tmpscript = GetScriptByName(((InstanceMap*)map)->GetScript()); |
---|
2102 | if(!tmpscript || !tmpscript->GetInstanceData) return false; |
---|
2103 | |
---|
2104 | return tmpscript->GetInstanceData(map); |
---|
2105 | } |
---|