Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SmartScriptMgr.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Cell.h"
7#include "CellImpl.h"
8#include "CreatureTextMgr.h"
9#include "DatabaseEnv.h"
10#include "GameEventMgr.h"
11#include "GridDefines.h"
12#include "GridNotifiers.h"
13#include "GridNotifiersImpl.h"
14#include "InstanceScript.h"
15#include "ObjectDefines.h"
16#include "ObjectMgr.h"
17#include "ScriptedCreature.h"
18#include "SpellInfo.h"
19#include "SpellMgr.h"
20#include "SpellMgr.h"
21
22#include "SmartScriptMgr.h"
23
25{
26 uint32 oldMSTime = getMSTime();
27
28 for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
29 {
30 for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
31 delete pathItr->second;
32
33 delete itr->second;
34 }
35
36 waypoint_map.clear();
37
38 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);
39 PreparedQueryResult result = WorldDatabase.Query(stmt);
40
41 if (!result)
42 {
43 SF_LOG_INFO("server.loading", ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
44
45 return;
46 }
47
48 uint32 count = 0;
49 uint32 total = 0;
50 uint32 last_entry = 0;
51 uint32 last_id = 1;
52
53 do
54 {
55 Field* fields = result->Fetch();
56 uint32 entry = fields[0].GetUInt32();
57 uint32 id = fields[1].GetUInt32();
58 float x, y, z;
59 x = fields[2].GetFloat();
60 y = fields[3].GetFloat();
61 z = fields[4].GetFloat();
62
63 if (last_entry != entry)
64 {
65 waypoint_map[entry] = new WPPath();
66 last_id = 1;
67 count++;
68 }
69
70 if (last_id != id)
71 SF_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
72
73 last_id++;
74 (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
75
76 last_entry = entry;
77 total++;
78 } while (result->NextRow());
79
80 SF_LOG_INFO("server.loading", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
81}
82
84{
85 for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
86 {
87 for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
88 delete pathItr->second;
89
90 delete itr->second;
91 }
92}
93
95{
97
98 uint32 oldMSTime = getMSTime();
99
100 for (uint8 i = 0; i < SMART_SCRIPT_TYPE_MAX; i++)
101 mEventMap[i].clear(); //Drop Existing SmartAI List
102
103 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMART_SCRIPTS);
104 PreparedQueryResult result = WorldDatabase.Query(stmt);
105
106 if (!result)
107 {
108 SF_LOG_INFO("server.loading", ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
109
110 return;
111 }
112
113 uint32 count = 0;
114
115 do
116 {
117 Field* fields = result->Fetch();
118
120
121 temp.entryOrGuid = fields[0].GetInt32();
122 SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8();
123 if (source_type >= SMART_SCRIPT_TYPE_MAX)
124 {
125 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
126 continue;
127 }
128 if (temp.entryOrGuid >= 0)
129 {
130 switch (source_type)
131 {
133 {
134 if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
135 {
136 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
137 continue;
138 }
139 break;
140 }
142 {
143 if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
144 {
145 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
146 continue;
147 }
148 break;
149 }
151 {
152 if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid))
153 {
154 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
155 continue;
156 }
157 break;
158 }
160 break;//nothing to check, really
161 default:
162 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
163 continue;
164 }
165 }
166 else
167 {
168 if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
169 {
170 SF_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
171 continue;
172 }
173 }
174
175 temp.source_type = source_type;
176 temp.event_id = fields[2].GetUInt16();
177 temp.link = fields[3].GetUInt16();
178 temp.event.type = (SMART_EVENT)fields[4].GetUInt8();
179 temp.event.event_phase_mask = fields[5].GetUInt8();
180 temp.event.event_chance = fields[6].GetUInt8();
181 temp.event.event_flags = fields[7].GetUInt8();
182
183 temp.event.raw.param1 = fields[8].GetUInt32();
184 temp.event.raw.param2 = fields[9].GetUInt32();
185 temp.event.raw.param3 = fields[10].GetUInt32();
186 temp.event.raw.param4 = fields[11].GetUInt32();
187 temp.event.raw.param5 = fields[12].GetUInt32();
188
189 temp.action.type = (SMART_ACTION)fields[13].GetUInt8();
190 temp.action.raw.param1 = fields[14].GetUInt32();
191 temp.action.raw.param2 = fields[15].GetUInt32();
192 temp.action.raw.param3 = fields[16].GetUInt32();
193 temp.action.raw.param4 = fields[17].GetUInt32();
194 temp.action.raw.param5 = fields[18].GetUInt32();
195 temp.action.raw.param6 = fields[19].GetUInt32();
196
197 temp.target.type = (SMARTAI_TARGETS)fields[20].GetUInt8();
198 temp.target.raw.param1 = fields[21].GetUInt32();
199 temp.target.raw.param2 = fields[22].GetUInt32();
200 temp.target.raw.param3 = fields[23].GetUInt32();
201 temp.target.x = fields[24].GetFloat();
202 temp.target.y = fields[25].GetFloat();
203 temp.target.z = fields[26].GetFloat();
204 temp.target.o = fields[27].GetFloat();
205
206 //check target
207 if (!IsTargetValid(temp))
208 continue;
209
210 // check all event and action params
211 if (!IsEventValid(temp))
212 continue;
213
214 // creature entry / guid not found in storage, create empty event list for it and increase counters
215 if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())
216 {
217 ++count;
218 SmartAIEventList eventList;
219 mEventMap[source_type][temp.entryOrGuid] = eventList;
220 }
221 // store the new event
222 mEventMap[source_type][temp.entryOrGuid].push_back(temp);
223 } while (result->NextRow());
224
225 SF_LOG_INFO("server.loading", ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
226
228}
229
231{
233 return true; // AI template has special handling
234 switch (e.GetTargetType())
235 {
238 {
239 if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
240 {
241 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
242 return false;
243 }
244 break;
245 }
248 {
249 if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
250 {
251 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
252 return false;
253 }
254 break;
255 }
257 {
259 return false;
260 break;
261 }
263 {
265 return false;
266 break;
267 }
270 {
271 if (e.target.playerDistance.dist == 0)
272 {
273 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
274 return false;
275 }
276 break;
277 }
297 break;
298 default:
299 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
300 return false;
301 }
302 return true;
303}
304
306{
307 if (e.event.type >= SMART_EVENT_END)
308 {
309 SF_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
310 return false;
311 }
312 // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
314 {
315 SF_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
316 return false;
317 }
318 if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)
319 {
320 SF_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
321 return false;
322 }
324 {
325 SF_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
326 return false;
327 }
329 {
330 SF_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
331 return false;
332 }
334 {
335 e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!
337 return false;
338
340 return false;
341 }
342 else
343 {
344 uint32 type = e.event.type;
345 switch (type)
346 {
359 return false;
360
362 return false;
363 break;
366 if (e.event.spellHit.spell)
367 {
368 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
369 if (!spellInfo)
370 {
371 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
372 return false;
373 }
374 if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
375 {
376 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
377 return false;
378 }
379 }
381 return false;
382 break;
386 return false;
387 break;
390 {
391 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
392 return false;
393 }
395 {
396 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
397 return false;
398 }
399 break;
402 return false;
403
405 return false;
406 break;
409 return false;
410 break;
412 {
414 return false;
415
416 if (!NotNULL(e, e.event.missingBuff.radius))
417 return false;
418
420 return false;
421 break;
422 }
423 case SMART_EVENT_KILL:
425 return false;
426
428 return false;
429 break;
431 if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId))
432 {
433 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
434 return false;
435 }
436
438 return false;
439 break;
443 return false;
444 break;
448 return false;
449
451 return false;
452 break;
455 if (e.event.quest.quest && !IsQuestValid(e, e.event.quest.quest))
456 return false;
457 break;
459 {
460 if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
461 return false;
462
463 if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
464 return false;
465 break;
466 }
469 {
470 if (!IsSpellValid(e, e.event.aura.spell))
471 return false;
472
474 return false;
475 break;
476 }
478 {
480 return false;
481 break;
482 }
484 {
486 {
487 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
488 return false;
489 }
490 break;
491 }
493 {
495 return false;
496 break;
497 }
499 {
501 return false;
502 break;
503 }
505 //if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group!
506 break;
507 case SMART_EVENT_LINK:
508 {
509 if (e.link && e.link == e.event_id)
510 {
511 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
512 return false;
513 }
514 break;
515 }
517 {
518 if (!IsSpellValid(e, e.event.dummy.spell))
519 return false;
520
522 return false;
523 break;
524 }
526 {
528 return false;
529 break;
530 }
533 {
534 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
535 if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
536 return false;
537 break;
538 }
540 {
542 {
543 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
544 return false;
545 }
546 break;
547 }
550 return false;
551
553 {
554 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
555 return false;
556 }
557
558 switch (e.GetTargetType())
559 {
567 break;
568 default:
569 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
570 return false;
571 }
572 break;
606 break;
607 default:
608 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
609 return false;
610 }
611 }
612
613 switch (e.GetActionType())
614 {
617 {
618 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
619 return false;
620 }
621 break;
625 {
626 if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
627 {
628 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
629 return false;
630 }
631
633 {
635 {
636 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
637 return false;
638 }
639 else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
640 {
641 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
642 return false;
643 }
644 }
645 }
646 break;
648 if (!IsSoundValid(e, e.action.sound.sound))
649 return false;
650 break;
653 if (!IsEmoteValid(e, e.action.emote.emote))
654 return false;
655 break;
658 if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest))
659 return false;
660 break;
662 {
663 if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
664 {
665 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
666 return false;
667 }
668 break;
669 }
672 return false;
673
675 return false;
676
678 return false;
679
681 return false;
682
684 return false;
685
687 return false;
688 break;
690 {
692 return false;
693
695 return false;
696
698 return false;
699
701 return false;
702
704 return false;
705
706 break;
707 }
711 if (!IsSpellValid(e, e.action.cast.spell))
712 return false;
713 break;
716 if (Quest const* qid = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
717 {
718 if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
719 {
720 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
721 return false;
722 }
723 }
724 else
725 {
726 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
727 return false;
728 }
729 break;
732 {
733 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
734 return false;
735 }
736 break;
739 {
740 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
741 return false;
742 }
744 {
745 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
746 return false;
747 }
748 break;
751 return false;
752 break;
754 {
761 {
762 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
763 return false;
764 }
765 }
766 break;
767 case SMART_ACTION_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
768 {
771 {
772 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
773 return false;
774 }
776 return false;
777 break;
778 }
780 {
782 return false;
783
785 for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
786 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u creature summon: There is a summon spell for creature entry %u (SpellId: %u, effect: %u)",
787 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.creature, itr->second.first, itr->second.second);
788
790 {
791 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
792 return false;
793 }
794 break;
795 }
797 {
799 return false;
800
802 for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
803 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Kill Credit: There is a killcredit spell for creatureEntry %u (SpellId: %u effect: %u)",
804 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.killedMonster.creature, itr->second.first, itr->second.second);
805
807 {
808 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TargetType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
809 return false;
810 }
811 break;
812 }
815 return false;
816 break;
819 {
820 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
821 return false;
822 }
823 break;
825 {
827 {
828 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
829 return false;
830 }
831 break;
832 }
834 {
836 return false;
837
839 for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
840 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u gameobject summon: There is a summon spell for gameobject entry %u (SpellId: %u, effect: %u)",
841 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, itr->second.first, itr->second.second);
842 break;
843 }
846 if (!IsItemValid(e, e.action.item.entry))
847 return false;
848
849 if (!NotNULL(e, e.action.item.count))
850 return false;
851 break;
853 if (!sMapStore.LookupEntry(e.action.teleport.mapID))
854 {
855 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
856 return false;
857 }
858 break;
861 {
862 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
863 return false;
864 }
865 break;
868 return false;
869 break;
871 {
872 if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
873 {
874 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
875 return false;
876 }
878 return false;
880 {
881 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
882 return false;
883 }
884 break;
885 }
887 {
889 return false;
890
892 return false;
893 break;
894 }
899 {
900 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
901 return false;
902 }
903 break;
905 {
906 uint32 eventId = e.action.gameEventStop.id;
907
908 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
909 if (eventId < 1 || eventId >= events.size())
910 {
911 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
912 return false;
913 }
914
915 GameEventData const& eventData = events[eventId];
916 if (!eventData.isValid())
917 {
918 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
919 return false;
920 }
921 break;
922 }
924 {
925 uint32 eventId = e.action.gameEventStart.id;
926
927 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
928 if (eventId < 1 || eventId >= events.size())
929 {
930 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
931 return false;
932 }
933
934 GameEventData const& eventData = events[eventId];
935 if (!eventData.isValid())
936 {
937 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
938 return false;
939 }
940 break;
941 }
947 case SMART_ACTION_DIE:
1016 break;
1017 default:
1018 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
1019 return false;
1020 }
1021
1022 return true;
1023}
1024
1025/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
1026{
1027 bool error = false;
1028 uint32 entry = 0;
1029 if (e.entryOrGuid >= 0)
1030 entry = uint32(e.entryOrGuid);
1031 else {
1032 entry = uint32(abs(e.entryOrGuid));
1033 CreatureData const* data = sObjectMgr->GetCreatureData(entry);
1034 if (!data)
1035 {
1036 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
1037 return false;
1038 }
1039 else
1040 entry = data->id;
1041 }
1042 if (!entry || !sCreatureTextMgr->TextExist(entry, uint8(id)))
1043 error = true;
1044 if (error)
1045 {
1046 SF_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
1047 return false;
1048 }
1049 return true;
1050}*/
1051
1053{
1054 uint32 oldMSTime = getMSTime();
1055 SpellInfo const* spellInfo = NULL;
1056 for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
1057 {
1058 spellInfo = sSpellMgr->GetSpellInfo(i);
1059 if (!spellInfo)
1060 continue;
1061 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
1062 {
1063 if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON))
1064 SummonCreatureSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
1065 else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON_OBJECT_WILD))
1066 SummonGameObjectSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
1067 else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2))
1068 KillCreditSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
1069 }
1070 }
1071 SF_LOG_INFO("server.loading", ">> Loaded SmartAIMgr Helpers in %u ms", GetMSTimeDiffToNow(oldMSTime));
1072}
1080{
1081 return SummonCreatureSpellStore.equal_range(creatureEntry);
1082}
1084{
1085 return SummonGameObjectSpellStore.equal_range(gameObjectEntry);
1086}
1088{
1089 return KillCreditSpellStore.equal_range(killCredit);
1090}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< TaxiPathEntry > sTaxiPathStore(TaxiPathEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
#define MAX_SPELL_EFFECTS
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define sGameEventMgr
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define SF_LOG_INFO(filterType__,...)
Definition Log.h:137
@ NULL_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:75
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:68
#define sObjectMgr
Definition ObjectMgr.h:1617
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
@ QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT
Definition QuestDef.h:175
SpellEffIndex
@ EFFECT_2
@ MAX_POWERS
@ SPELL_EFFECT_KILL_CREDIT
@ SPELL_EFFECT_SUMMON
@ SPELL_EFFECT_KILL_CREDIT2
@ SPELL_EFFECT_SUMMON_OBJECT_WILD
@ EVENT_CHARGE
SmartScriptType
@ SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
@ SMART_SCRIPT_TYPE_MAX
@ SMART_SCRIPT_TYPE_CREATURE
@ SMART_SCRIPT_TYPE_GAMEOBJECT
@ SMART_SCRIPT_TYPE_AREATRIGGER
@ SMARTAI_TEMPLATE_END
std::vector< SmartScriptHolder > SmartAIEventList
@ SMART_EVENT_FLAGS_ALL
SMARTAI_TARGETS
@ SMART_TARGET_CLOSEST_CREATURE
@ SMART_TARGET_CREATURE_DISTANCE
@ SMART_TARGET_HOSTILE_RANDOM_NOT_TOP
@ SMART_TARGET_INVOKER_PARTY
@ SMART_TARGET_CLOSEST_FRIENDLY
@ SMART_TARGET_CLOSEST_GAMEOBJECT
@ SMART_TARGET_GAMEOBJECT_RANGE
@ SMART_TARGET_CREATURE_GUID
@ SMART_TARGET_PLAYER_RANGE
@ SMART_TARGET_VICTIM
@ SMART_TARGET_GAMEOBJECT_DISTANCE
@ SMART_TARGET_CREATURE_RANGE
@ SMART_TARGET_CLOSEST_PLAYER
@ SMART_TARGET_HOSTILE_RANDOM
@ SMART_TARGET_GAMEOBJECT_GUID
@ SMART_TARGET_HOSTILE_SECOND_AGGRO
@ SMART_TARGET_OWNER_OR_SUMMONER
@ SMART_TARGET_SELF
@ SMART_TARGET_ACTION_INVOKER
@ SMART_TARGET_POSITION
@ SMART_TARGET_HOSTILE_LAST_AGGRO
@ SMART_TARGET_ACTION_INVOKER_VEHICLE
@ SMART_TARGET_THREAT_LIST
@ SMART_TARGET_CLOSEST_ENEMY
@ SMART_TARGET_NONE
@ SMART_TARGET_PLAYER_DISTANCE
@ SMART_TARGET_STORED
#define sSmartWaypointMgr
const uint32 SmartAIEventMask[SMART_EVENT_END][2]
@ SMART_SCRIPT_RESPAWN_CONDITION_AREA
@ SMART_SCRIPT_RESPAWN_CONDITION_MAP
UNORDERED_MAP< uint32, WayPoint * > WPPath
SMART_ACTION
@ SMART_ACTION_REMOVE_TIMED_EVENT
@ SMART_ACTION_ADD_QUEST
@ SMART_ACTION_SET_GO_FLAG
@ SMART_ACTION_WP_RESUME
@ SMART_ACTION_UPDATE_TEMPLATE
@ SMART_ACTION_STORE_TARGET_LIST
@ SMART_ACTION_SET_HEALTH_REGEN
@ SMART_ACTION_ACTIVATE_GOBJECT
@ SMART_ACTION_FORCE_DESPAWN
@ SMART_ACTION_GAME_EVENT_START
@ SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST
@ SMART_ACTION_SET_INST_DATA64
@ SMART_ACTION_SET_FACTION
@ SMART_ACTION_THREAT_SINGLE_PCT
@ SMART_ACTION_SET_INGAME_PHASE_MASK
@ SMART_ACTION_CLOSE_GOSSIP
@ SMART_ACTION_ADD_GO_FLAG
@ SMART_ACTION_ADD_DYNAMIC_FLAG
@ SMART_ACTION_KILL_UNIT
@ SMART_ACTION_END
@ SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS
@ SMART_ACTION_ATTACK_START
@ SMART_ACTION_SET_UNIT_FLAG
@ SMART_ACTION_CALL_GROUPEVENTHAPPENS
@ SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL
@ SMART_ACTION_INVOKER_CAST
@ SMART_ACTION_JUMP_TO_POS
@ SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST
@ SMART_ACTION_SEND_GOSSIP_MENU
@ SMART_ACTION_FLEE_FOR_ASSIST
@ SMART_ACTION_EQUIP
@ SMART_ACTION_SET_ROOT
@ SMART_ACTION_SUMMON_GO
@ SMART_ACTION_WP_PAUSE
@ SMART_ACTION_SIMPLE_TALK
@ SMART_ACTION_CAST
@ SMART_ACTION_ALLOW_COMBAT_MOVEMENT
@ SMART_ACTION_ADD_AURA
@ SMART_ACTION_THREAT_ALL_PCT
@ SMART_ACTION_STORE_VARIABLE_DECIMAL
@ SMART_ACTION_SET_HEALTH
@ SMART_ACTION_RESPAWN_TARGET
@ SMART_ACTION_SOUND
@ SMART_ACTION_ADD_NPC_FLAG
@ SMART_ACTION_EVADE
@ SMART_ACTION_FAIL_QUEST
@ SMART_ACTION_INTERRUPT_SPELL
@ SMART_ACTION_ADD_POWER
@ SMART_ACTION_REMOVE_DYNAMIC_FLAG
@ SMART_ACTION_RANDOM_SOUND
@ SMART_ACTION_SET_POWER
@ SMART_ACTION_MOVE_FORWARD
@ SMART_ACTION_SEND_TARGET_TO_TARGET
@ SMART_ACTION_REMOVE_POWER
@ SMART_ACTION_SET_DYNAMIC_FLAG
@ SMART_ACTION_REMOVE_ITEM
@ SMART_ACTION_SEND_GO_CUSTOM_ANIM
@ SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL
@ SMART_ACTION_REMOVE_UNIT_FLAG
@ SMART_ACTION_RANDOM_PHASE
@ SMART_ACTION_SET_EMOTE_STATE
@ SMART_ACTION_CROSS_CAST
@ SMART_ACTION_WP_STOP
@ SMART_ACTION_GAME_EVENT_STOP
@ SMART_ACTION_CALL_KILLEDMONSTER
@ SMART_ACTION_TALK
@ SMART_ACTION_CALL_SCRIPT_RESET
@ SMART_ACTION_SET_DATA
@ SMART_ACTION_WP_START
@ SMART_ACTION_COMBAT_STOP
@ SMART_ACTION_SET_RUN
@ SMART_ACTION_AUTO_ATTACK
@ SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL
@ SMART_ACTION_SET_VISIBILITY
@ SMART_ACTION_RANDOM_PHASE_RANGE
@ SMART_ACTION_GO_SET_LOOT_STATE
@ SMART_ACTION_SET_SWIM
@ SMART_ACTION_SET_INST_DATA
@ SMART_ACTION_REMOVE_GO_FLAG
@ SMART_ACTION_CALL_FOR_HELP
@ SMART_ACTION_TELEPORT
@ SMART_ACTION_PLAYMOVIE
@ SMART_ACTION_FOLLOW
@ SMART_ACTION_PLAY_EMOTE
@ SMART_ACTION_SET_EVENT_PHASE
@ SMART_ACTION_SET_SHEATH
@ SMART_ACTION_SET_ORIENTATION
@ SMART_ACTION_SET_NPC_FLAG
@ SMART_ACTION_REMOVE_UNIT_FIELD_ANIM_TIER
@ SMART_ACTION_MOVE_TO_POS
@ SMART_ACTION_RANDOM_EMOTE
@ SMART_ACTION_INC_EVENT_PHASE
@ SMART_ACTION_CREATE_TIMED_EVENT
@ SMART_ACTION_DIE
@ SMART_ACTION_RESET_SCRIPT_BASE_OBJECT
@ SMART_ACTION_REMOVE_NPC_FLAG
@ SMART_ACTION_SET_FLY
@ SMART_ACTION_INSTALL_AI_TEMPLATE
@ SMART_ACTION_SUMMON_CREATURE
@ SMART_ACTION_RESET_GOBJECT
@ SMART_ACTION_CALL_TIMED_ACTIONLIST
@ SMART_ACTION_SET_IN_COMBAT_WITH_ZONE
@ SMART_ACTION_SET_UNIT_FIELD_ANIM_TIER
@ SMART_ACTION_SET_HOME_POS
@ SMART_ACTION_ADD_ITEM
@ SMART_ACTION_SET_ACTIVE
@ SMART_ACTION_SET_RANGED_MOVEMENT
@ SMART_ACTION_ACTIVATE_TAXI
@ SMART_ACTION_SUMMON_CREATURE_GROUP
@ SMART_ACTION_SET_REACT_STATE
@ SMART_ACTION_RANDOM_MOVE
@ SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT
@ SMART_ACTION_TRIGGER_TIMED_EVENT
@ SMART_ACTION_REMOVEAURASFROMSPELL
SMART_EVENT
@ SMART_EVENT_IC_LOS
@ SMART_EVENT_EVADE
@ SMART_EVENT_ACTION_DONE
@ SMART_EVENT_SUMMON_DESPAWNED
@ SMART_EVENT_SPELLHIT
@ SMART_EVENT_RECEIVE_EMOTE
@ SMART_EVENT_FRIENDLY_HEALTH_PCT
@ SMART_EVENT_QUEST_FAIL
@ SMART_EVENT_DATA_SET
@ SMART_EVENT_RECEIVE_HEAL
@ SMART_EVENT_DUMMY_EFFECT
@ SMART_EVENT_TIMED_EVENT_TRIGGERED
@ SMART_EVENT_CHARMED_TARGET
@ SMART_EVENT_TARGET_MANA_PCT
@ SMART_EVENT_QUEST_COMPLETION
@ SMART_EVENT_JUST_CREATED
@ SMART_EVENT_AREATRIGGER_ONTRIGGER
@ SMART_EVENT_ON_SPELLCLICK
@ SMART_EVENT_MOVEMENTINFORM
@ SMART_EVENT_RANGE
@ SMART_EVENT_MANA_PCT
@ SMART_EVENT_PASSENGER_REMOVED
@ SMART_EVENT_INSTANCE_PLAYER_ENTER
@ SMART_EVENT_LINK
@ SMART_EVENT_WAYPOINT_PAUSED
@ SMART_EVENT_REACHED_HOME
@ SMART_EVENT_TRANSPORT_ADDCREATURE
@ SMART_EVENT_REWARD_QUEST
@ SMART_EVENT_END
@ SMART_EVENT_GO_EVENT_INFORM
@ SMART_EVENT_UPDATE_IC
@ SMART_EVENT_RESET
@ SMART_EVENT_JUST_SUMMONED
@ SMART_EVENT_CHARMED
@ SMART_EVENT_AI_INIT
@ SMART_EVENT_WAYPOINT_START
@ SMART_EVENT_SPELLHIT_TARGET
@ SMART_EVENT_GAME_EVENT_START
@ SMART_EVENT_KILL
@ SMART_EVENT_TRANSPORT_REMOVE_PLAYER
@ SMART_EVENT_GOSSIP_HELLO
@ SMART_EVENT_GOSSIP_SELECT
@ SMART_EVENT_CORPSE_REMOVED
@ SMART_EVENT_QUEST_OBJ_COPLETETION
@ SMART_EVENT_PASSENGER_BOARDED
@ SMART_EVENT_UPDATE
@ SMART_EVENT_TRANSPORT_ADDPLAYER
@ SMART_EVENT_WAYPOINT_ENDED
@ SMART_EVENT_IS_BEHIND_TARGET
@ SMART_EVENT_UPDATE_OOC
@ SMART_EVENT_ACCEPTED_QUEST
@ SMART_EVENT_FRIENDLY_MISSING_BUFF
@ SMART_EVENT_WAYPOINT_RESUMED
@ SMART_EVENT_WAYPOINT_REACHED
@ SMART_EVENT_TARGET_BUFFED
@ SMART_EVENT_RESPAWN
@ SMART_EVENT_QUEST_ACCEPTED
@ SMART_EVENT_HEALT_PCT
@ SMART_EVENT_FRIENDLY_HEALTH
@ SMART_EVENT_QUEST_REWARDED
@ SMART_EVENT_TEXT_OVER
@ SMART_EVENT_DEATH
@ SMART_EVENT_TRANSPORT_RELOCATE
@ SMART_EVENT_GAME_EVENT_END
@ SMART_EVENT_DAMAGED
@ SMART_EVENT_FOLLOW_COMPLETED
@ SMART_EVENT_WAYPOINT_STOPPED
@ SMART_EVENT_FRIENDLY_IS_CC
@ SMART_EVENT_GO_STATE_CHANGED
@ SMART_EVENT_OOC_LOS
@ SMART_EVENT_AGGRO
@ SMART_EVENT_TARGET_HEALTH_PCT
@ SMART_EVENT_VICTIM_CASTING
@ SMART_EVENT_DAMAGED_TARGET
@ SMART_EVENT_HAS_AURA
@ SMART_EVENT_SUMMONED_UNIT
@ SMART_EVENT_PHASE_ALL
@ SMART_EVENT_PHASE_MAX
const uint32 SmartAITypeMask[SMART_SCRIPT_TYPE_MAX][2]
std::pair< CacheSpellContainer::const_iterator, CacheSpellContainer::const_iterator > CacheSpellContainerBounds
#define sSpellMgr
Definition SpellMgr.h:744
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:22
uint32 getMSTime()
Definition Timer.h:12
#define MAX_SHEATH_STATE
Definition Unit.h:250
@ REACT_AGGRESSIVE
Definition Unit.h:1158
#define UNORDERED_MAP
@ WORLD_SEL_SMARTAI_WP
@ WORLD_SEL_SMART_SCRIPTS
Definition Field.h:16
uint8 GetUInt8() const
Definition Field.h:26
uint16 GetUInt16() const
Definition Field.h:69
float GetFloat() const
Definition Field.h:177
uint32 GetUInt32() const
Definition Field.h:105
int32 GetInt32() const
Definition Field.h:123
std::vector< GameEventData > GameEventDataMap
SmartAIEventMap mEventMap[SMART_SCRIPT_TYPE_MAX]
CacheSpellContainer SummonCreatureSpellStore
void UnLoadHelperStores()
CacheSpellContainerBounds GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const
bool IsTextEmoteValid(SmartScriptHolder const &e, uint32 entry)
bool IsTargetValid(SmartScriptHolder const &e)
bool NotNULL(SmartScriptHolder const &e, uint32 data)
void LoadHelperStores()
bool IsSoundValid(SmartScriptHolder const &e, uint32 entry)
bool IsEventValid(SmartScriptHolder &e)
bool IsGameObjectValid(SmartScriptHolder const &e, uint32 entry)
bool IsMinMaxValid(SmartScriptHolder const &e, uint32 min, uint32 max)
CacheSpellContainer SummonGameObjectSpellStore
bool IsQuestValid(SmartScriptHolder const &e, uint32 entry)
bool IsCreatureValid(SmartScriptHolder const &e, uint32 entry)
bool IsAreaTriggerValid(SmartScriptHolder const &e, uint32 entry)
CacheSpellContainerBounds GetSummonGameObjectSpellContainerBounds(uint32 gameObjectEntry) const
void LoadSmartAIFromDB()
CacheSpellContainerBounds GetKillCreditSpellContainerBounds(uint32 killCredit) const
bool IsItemValid(SmartScriptHolder const &e, uint32 entry)
CacheSpellContainer KillCreditSpellStore
bool IsEmoteValid(SmartScriptHolder const &e, uint32 entry)
bool IsSpellValid(SmartScriptHolder const &e, uint32 entry)
UNORDERED_MAP< uint32, WPPath * > waypoint_map
bool IsEffect() const
Definition SpellInfo.cpp:59
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
Definition SpellInfo.h:255
uint32 SchoolMask
Definition SpellInfo.h:231
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
bool isValid() const
struct SmartAction::@137136306204214247065175315134144360247331017331::@063217247236027134221310037325112126070263107200 installTtemplate
struct SmartAction::@137136306204214247065175315134144360247331017331::@223221030233146165101047364315320356273243300160 killedMonster
struct SmartAction::@137136306204214247065175315134144360247331017331::@056037146104051216040022366365070022176220102015 setEventPhase
struct SmartAction::@137136306204214247065175315134144360247331017331::@225326137357300251213255332357005062365342332334 taxi
struct SmartAction::@137136306204214247065175315134144360247331017331::@263337113206264100344005071314123271031160215224 incEventPhase
struct SmartAction::@137136306204214247065175315134144360247331017331::@323250253076201247247032355216135323066263226166 summonGO
struct SmartAction::@137136306204214247065175315134144360247331017331::@260014043352000167110056244356272120365357113047 power
struct SmartAction::@137136306204214247065175315134144360247331017331::@105154066270000205250254221004375132270204111257 faction
struct SmartAction::@137136306204214247065175315134144360247331017331::@275255223343355134011263135140247005064156134156 removeAura
struct SmartAction::@137136306204214247065175315134144360247331017331::@340117101002077274057262132157002056007011042371 item
struct SmartAction::@137136306204214247065175315134144360247331017331::@321334216220214152324067135252322006365237051372 summonCreature
struct SmartAction::@137136306204214247065175315134144360247331017331::@271373373116125344236343321340152150140162062203 updateTemplate
struct SmartAction::@137136306204214247065175315134144360247331017331::@275214002000035051002312305231375170105074073031 react
struct SmartAction::@137136306204214247065175315134144360247331017331::@030016163313022245256210315150151222345056203275 randomPhaseRange
SMART_ACTION type
struct SmartAction::@137136306204214247065175315134144360247331017331::@364140021337216071013031072126362152213217361022 gameEventStart
struct SmartAction::@137136306204214247065175315134144360247331017331::@366346013116331267251301000101176066154005153314 wpStart
struct SmartAction::@137136306204214247065175315134144360247331017331::@154353352031206117237307025011150000165343160075 gameEventStop
struct SmartAction::@137136306204214247065175315134144360247331017331::@017204072246217361054270126345157054047267131155 timeEvent
struct SmartAction::@137136306204214247065175315134144360247331017331::@070027157377176027211043175361120005242332321041 cast
struct SmartAction::@137136306204214247065175315134144360247331017331::@361253355005363233353246257362125371204257066324 wpStop
struct SmartAction::@137136306204214247065175315134144360247331017331::@034027334375127044264311057312165257123120035111 setSheath
struct SmartAction::@137136306204214247065175315134144360247331017331::@047257325033252011304017203222214205224131346024 randomEmote
struct SmartAction::@137136306204214247065175315134144360247331017331::@146067006045202033167137301332374134247215001225 morphOrMount
struct SmartAction::@137136306204214247065175315134144360247331017331::@124325320104077343177176052310130023304351310216 randomSound
struct SmartAction::@137136306204214247065175315134144360247331017331::@017345322206322315133100210307152010072305326222 teleport
struct SmartAction::@137136306204214247065175315134144360247331017331::@110372216333363233013275026147121341347021271102 raw
struct SmartAction::@137136306204214247065175315134144360247331017331::@216226275100333317146042116304160061113317344104 randomPhase
struct SmartEvent::@166073203170024010224000246043245045265275236352::@205334221103210356102216306336035204273105217373 doAction
struct SmartEvent::@166073203170024010224000246043245045265275236352::@035124263137161112271324316211040076034364300254 friendlyHealthPct
uint32 event_flags
uint32 event_phase_mask
struct SmartEvent::@166073203170024010224000246043245045265275236352::@151214011253067366266013227241263175352330107015 spellHit
struct SmartEvent::@166073203170024010224000246043245045265275236352::@153240210013057316073206114055356342200322004153 areatrigger
struct SmartEvent::@166073203170024010224000246043245045265275236352::@331123367372304044150027144120234260063243315361 raw
struct SmartEvent::@166073203170024010224000246043245045265275236352::@071217147231100355344130024153246046254076175303 minMax
struct SmartEvent::@166073203170024010224000246043245045265275236352::@014244365015242120343050241027342311345320231372 kill
uint32 cooldownMax
struct SmartEvent::@166073203170024010224000246043245045265275236352::@221026305077317174075143035236341220146202106111 summoned
struct SmartEvent::@166073203170024010224000246043245045265275236352::@202207111237273327363141057053252156066031227127 targetCasting
struct SmartEvent::@166073203170024010224000246043245045265275236352::@143336307355047137005241062216153351167151345337 transportAddCreature
struct SmartEvent::@166073203170024010224000246043245045265275236352::@374352063271056252122325060177325011004327327320 dummy
struct SmartEvent::@166073203170024010224000246043245045265275236352::@317215266053337235107156201003013251003136307007 dataSet
struct SmartEvent::@166073203170024010224000246043245045265275236352::@316052106375244313267206021344134155050363137163 gameEvent
uint32 event_chance
struct SmartEvent::@166073203170024010224000246043245045265275236352::@231361362314252335147144320331135255146044361230 friendlyHealth
struct SmartEvent::@166073203170024010224000246043245045265275236352::@176246375035351301250241104017222341335356255101 minMaxRepeat
struct SmartEvent::@166073203170024010224000246043245045265275236352::@215225270007231027007174002122072040103111365225 aura
struct SmartEvent::@166073203170024010224000246043245045265275236352::@153222357016331217240244030161351100040203125306 missingBuff
uint32 gameEventId
uint32 cooldownMin
struct SmartEvent::@166073203170024010224000246043245045265275236352::@133146201062172166200111053367224171220224362315 movementInform
struct SmartEvent::@166073203170024010224000246043245045265275236352::@010250233120134241015123153125242336170064340121 friendlyCC
struct SmartEvent::@166073203170024010224000246043245045265275236352::@140352011036232354166330333342335043070367211016 respawn
struct SmartEvent::@166073203170024010224000246043245045265275236352::@206071060360274252071246267136154353111152272204 los
SMART_EVENT type
struct SmartEvent::@166073203170024010224000246043245045265275236352::@201273004001225050106107035207231367176035206120 behindTarget
uint32 GetScriptType() const
uint32 GetEventType() const
uint32 GetTargetType() const
SmartScriptType source_type
uint32 GetActionType() const
struct SmartTarget::@333075361354170120173166243340237372226003166270::@331304071055133014342035021265106076261007323121 raw
struct SmartTarget::@333075361354170120173166243340237372226003166270::@252242265355222362137233075236171264264255250353 goDistance
struct SmartTarget::@333075361354170120173166243340237372226003166270::@002214221374016261141032233225077144161065220344 unitGUID
SMARTAI_TARGETS type
struct SmartTarget::@333075361354170120173166243340237372226003166270::@172360030245270120053010162234377345135043301307 unitDistance
struct SmartTarget::@333075361354170120173166243340237372226003166270::@262226145054070224013345240063324147141336277263 playerDistance
struct SmartTarget::@333075361354170120173166243340237372226003166270::@163054074026206351133353217237356273245266110331 goGUID