TrinityCore
Loading...
Searching...
No Matches
SmartScriptMgr.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_SMARTSCRIPTMGR_H
19#define TRINITY_SMARTSCRIPTMGR_H
20
21#include "DBCEnums.h"
22#include "Define.h"
23#include "ObjectGuid.h"
24#include "WaypointDefines.h"
25#include "advstd.h"
26#include <limits>
27#include <map>
28#include <string>
29#include <unordered_map>
30
31class WorldObject;
32enum SpellEffIndex : uint8;
34
44
64
84
100
102{
103 SMART_EVENT_UPDATE_IC = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax
104 SMART_EVENT_UPDATE_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax
105 SMART_EVENT_HEALTH_PCT = 2, // HPMin%, HPMax%, RepeatMin, RepeatMax
106 SMART_EVENT_MANA_PCT = 3, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
107 SMART_EVENT_AGGRO = 4, // NONE
108 SMART_EVENT_KILL = 5, // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3
109 SMART_EVENT_DEATH = 6, // NONE
110 SMART_EVENT_EVADE = 7, // NONE
111 SMART_EVENT_SPELLHIT = 8, // SpellID, School, CooldownMin, CooldownMax
112 SMART_EVENT_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax
113 SMART_EVENT_OOC_LOS = 10, // HostilityMode, MaxRnage, CooldownMin, CooldownMax
114 SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId
115 SMART_EVENT_TARGET_HEALTH_PCT = 12, // UNUSED, DO NOT REUSE
116 SMART_EVENT_VICTIM_CASTING = 13, // RepeatMin, RepeatMax, spellid
117 SMART_EVENT_FRIENDLY_HEALTH = 14, // UNUSED, DO NOT REUSE
118 SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax
119 SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax
120 SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax
121 SMART_EVENT_TARGET_MANA_PCT = 18, // UNUSED, DO NOT REUSE
122 SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID (0 = any), CooldownMin, CooldownMax
123 SMART_EVENT_REWARD_QUEST = 20, // QuestID (0 = any), CooldownMin, CooldownMax
125 SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3
126 SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax
127 SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax
128 SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn.
129 SMART_EVENT_IC_LOS = 26, // HostilityMode, MaxRnage, CooldownMin, CooldownMax
130 SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax
131 SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax
132 SMART_EVENT_CHARMED = 29, // onRemove (0 - on apply, 1 - on remove)
133 SMART_EVENT_CHARMED_TARGET = 30, // UNUSED, DO NOT REUSE
134 SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax
135 SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax
136 SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax
137 SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID
138 SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax
141 SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax
142 SMART_EVENT_WAYPOINT_START = 39, // UNUSED, DO NOT REUSE
143 SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any)
148 SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, // Team (0 any), CooldownMin, CooldownMax
155 SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any)
156 SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax
158 SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any)
159 SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any)
160 SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any)
161 SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any)
163 SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax
164 SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly
165 SMART_EVENT_GOSSIP_SELECT = 62, // menuID, actionID
167 SMART_EVENT_GOSSIP_HELLO = 64, // noReportUse (for GOs)
169 SMART_EVENT_EVENT_PHASE_CHANGE = 66, // UNUSED, DO NOT REUSE
170 SMART_EVENT_IS_BEHIND_TARGET = 67, // UNUSED, DO NOT REUSE
171 SMART_EVENT_GAME_EVENT_START = 68, // game_event.Entry
172 SMART_EVENT_GAME_EVENT_END = 69, // game_event.Entry
175 SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId)
176 SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit)
177 SMART_EVENT_FRIENDLY_HEALTH_PCT = 74, // minHpPct, maxHpPct, repeatMin, repeatMax
178 SMART_EVENT_DISTANCE_CREATURE = 75, // guid, entry, distance, repeat
179 SMART_EVENT_DISTANCE_GAMEOBJECT = 76, // guid, entry, distance, repeat
180 SMART_EVENT_COUNTER_SET = 77, // id, value, cooldownMin, cooldownMax
182 SMART_EVENT_SCENE_TRIGGER = 79, // param_string : triggerName
185 SMART_EVENT_SUMMONED_UNIT_DIES = 82, // CreatureId(0 all), CooldownMin, CooldownMax
186 SMART_EVENT_ON_SPELL_CAST = 83, // SpellID, CooldownMin, CooldownMax
187 SMART_EVENT_ON_SPELL_FAILED = 84, // SpellID, CooldownMin, CooldownMax
188 SMART_EVENT_ON_SPELL_START = 85, // SpellID, CooldownMin, CooldownMax
192 SMART_EVENT_ON_AURA_APPLIED = 89, // SpellID, CooldownMin, CooldownMax
193 SMART_EVENT_ON_AURA_REMOVED = 90, // SpellID, CooldownMin, CooldownMax
194
195 SMART_EVENT_END = 91
197
199{
204 union
205 {
206 struct
207 {
213
214 struct
215 {
221
222 struct
223 {
229
230 struct
231 {
241
242 struct
243 {
248
249 struct
250 {
254
255 struct
256 {
261
262 struct
263 {
268
269 struct
270 {
276
277 struct
278 {
283
284 struct
285 {
290
291 struct
292 {
295
296 struct
297 {
302
303 struct
304 {
310
311 struct
312 {
315
316 struct
317 {
318 uint32 type;
319 uint32 id;
321
322 struct
323 {
324 uint32 id;
329
330 struct
331 {
335
336 struct
337 {
340
341 struct
342 {
345
346 struct
347 {
352
353 struct
354 {
358
359 struct
360 {
361 uint32 id;
363
364 struct
365 {
368
369 struct
370 {
374
375 struct
376 {
379
380 struct
381 {
384
385 struct
386 {
389
390 struct
391 {
394
395 struct
396 {
403
404 struct
405 {
411
412 struct
413 {
414 uint32 id;
419
420 struct
421 {
426
427 struct
428 {
435 };
436
437 std::string param_string;
438
440 {
441 Hostile = 0,
442 NotHostile = 1,
443 Any = 2,
444 End
445 };
446};
447
455
457{
458 SMART_ACTION_NONE = 0, // No action
459 SMART_ACTION_TALK = 1, // groupID from creature_text, duration to wait before TEXT_OVER event is triggered, useTalkTarget (0/1) - use target as talk target
460 SMART_ACTION_SET_FACTION = 2, // FactionId (or 0 for default)
461 SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL = 3, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph)
462 SMART_ACTION_SOUND = 4, // SoundId, onlySelf
465 SMART_ACTION_OFFER_QUEST = 7, // QuestID, directAdd
468 SMART_ACTION_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3...
469 SMART_ACTION_CAST = 11, // SpellId, CastFlags, TriggeredFlags
470 SMART_ACTION_SUMMON_CREATURE = 12, // CreatureID, summonType, duration in ms, stored target id, flags(SmartActionSummonCreatureFlags), count, createdBySpell
474 SMART_ACTION_SET_INGAME_PHASE_GROUP = 16, // phaseGroupId, apply
476 SMART_ACTION_SET_UNIT_FLAG = 18, // UNUSED, DO NOT REUSE
477 SMART_ACTION_REMOVE_UNIT_FLAG = 19, // UNUSED, DO NOT REUSE
478 SMART_ACTION_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking)
479 SMART_ACTION_ALLOW_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
481 SMART_ACTION_INC_EVENT_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
482 SMART_ACTION_EVADE = 24, // toRespawnPosition (0 = Move to RespawnPosition, 1 = Move to last stored home position)
484 SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // UNUSED, DO NOT REUSE
486 SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid (0 removes all auras), charges (0 removes aura)
487 SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event)
488 SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3...
489 SMART_ACTION_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax
492 SMART_ACTION_SET_INST_DATA = 34, // Field, Data, Type (0 = SetData, 1 = SetBossState)
495 SMART_ACTION_DIE = 37, // No Params
497 SMART_ACTION_CALL_FOR_HELP = 39, // Radius, With Emote
498 SMART_ACTION_SET_SHEATH = 40, // Sheath (0-unarmed, 1-melee, 2-ranged)
500 SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue(+pct, -flat)
501 SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to dismount)
502 SMART_ACTION_SET_INGAME_PHASE_ID = 44, // PhaseId, apply
503 SMART_ACTION_SET_DATA = 45, // Field, Data (only creature @todo)
508 SMART_ACTION_SUMMON_GO = 50, // GameObjectID, DespawnTime in s, summon type, stored target id
511 SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime
513 SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail?
514 SMART_ACTION_ADD_ITEM = 56, // itemID, count
515 SMART_ACTION_REMOVE_ITEM = 57, // itemID, count
516 SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // UNUSED, DO NOT REUSE
519 SMART_ACTION_SET_SWIM = 61, // UNUSED, DO NOT REUSE
520 SMART_ACTION_TELEPORT = 62, // mapID,
521 SMART_ACTION_SET_COUNTER = 63, // id, value, reset (0/1)
525 SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
527 SMART_ACTION_MOVE_TO_POS = 69, // PointId, transport, disablePathfinding, ContactDistance
528 SMART_ACTION_ENABLE_TEMP_GOBJ = 70, // despawnTimer (sec)
529 SMART_ACTION_EQUIP = 71, // entry, slotmask slot1, slot2, slot3 , only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), slots1-3 are only used if no entry is set
533 SMART_ACTION_ADD_AURA = 75, // UNUSED, DO NOT REUSE
534 SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // UNUSED, DO NOT REUSE
535 SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // UNUSED, DO NOT REUSE
537 SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle
538 SMART_ACTION_CALL_TIMED_ACTIONLIST = 80, // ID (overwrites already running actionlist), stop after combat?(0/1), timer update type(0-OOC, 1-IC, 2-ALWAYS)
542 SMART_ACTION_SIMPLE_TALK = 84, // groupID, can be used to make players say groupID, Text_over event is not triggered, whisper can not be used (Target units will say the text)
543 SMART_ACTION_SELF_CAST = 85, // spellID, castFlags
544 SMART_ACTION_CROSS_CAST = 86, // spellID, castFlags, CasterTargetType, CasterTarget param1, CasterTarget param2, CasterTarget param3, CasterTarget param4, CasterTarget ParamString ( + the original target fields as Destination target), CasterTargets will cast spellID on all Targets (use with caution if targeting multiple * multiple units)
551 SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // UNUSED, DO NOT REUSE
552 SMART_ACTION_SET_DYNAMIC_FLAG = 94, // UNUSED, DO NOT REUSE
553 SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // UNUSED, DO NOT REUSE
554 SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // UNUSED, DO NOT REUSE
555 SMART_ACTION_JUMP_TO_POS = 97, // SpeedXY, SpeedZ, Gravity, UseDefaultGravity, PointId, ContactDistance
556 SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
561 SMART_ACTION_SET_ROOT = 103, // off/on
562 SMART_ACTION_SET_GO_FLAG = 104, // UNUSED, DO NOT REUSE
563 SMART_ACTION_ADD_GO_FLAG = 105, // UNUSED, DO NOT REUSE
564 SMART_ACTION_REMOVE_GO_FLAG = 106, // UNUSED, DO NOT REUSE
565 SMART_ACTION_SUMMON_CREATURE_GROUP = 107, // Group, attackInvoker, stored target id
566 SMART_ACTION_SET_POWER = 108, // PowerType, newPower
567 SMART_ACTION_ADD_POWER = 109, // PowerType, newPower
568 SMART_ACTION_REMOVE_POWER = 110, // PowerType, newPower
569 SMART_ACTION_GAME_EVENT_STOP = 111, // GameEventId
570 SMART_ACTION_GAME_EVENT_START = 112, // GameEventId
571 SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
572 SMART_ACTION_MOVE_OFFSET = 114, // PointId
573 SMART_ACTION_RANDOM_SOUND = 115, // soundId1, soundId2, soundId3, soundId4, soundId5, onlySelf
575 SMART_ACTION_DISABLE_EVADE = 117, // 0/1 (1 = disabled, 0 = enabled)
577 SMART_ACTION_SET_CAN_FLY = 119, // UNUSED, DO NOT REUSE
578 SMART_ACTION_REMOVE_AURAS_BY_TYPE = 120, // UNUSED, DO NOT REUSE
579 SMART_ACTION_SET_SIGHT_DIST = 121, // UNUSED, DO NOT REUSE
580 SMART_ACTION_FLEE = 122, // UNUSED, DO NOT REUSE
581 SMART_ACTION_ADD_THREAT = 123, // +threat, -threat
583 SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 125, // id min range, id max range
584 SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 126, // UNUSED, DO NOT REUSE
585 SMART_ACTION_PAUSE_MOVEMENT = 127, // MovementSlot (default = 0, active = 1, controlled = 2), PauseTime (ms), Force
586 SMART_ACTION_PLAY_ANIMKIT = 128, // id, type (0 = oneShot, 1 = aiAnim, 2 = meleeAnim, 3 = movementAnim)
587 SMART_ACTION_SCENE_PLAY = 129, // sceneId
589 SMART_ACTION_SPAWN_SPAWNGROUP = 131, // Group ID, min secs, max secs, spawnflags
590 SMART_ACTION_DESPAWN_SPAWNGROUP = 132, // Group ID, min secs, max secs, spawnflags
591 SMART_ACTION_RESPAWN_BY_SPAWNID = 133, // spawnType, spawnId
592 SMART_ACTION_INVOKER_CAST = 134, // spellID, castFlags
593 SMART_ACTION_PLAY_CINEMATIC = 135, // entry, cinematic
594 SMART_ACTION_SET_MOVEMENT_SPEED = 136, // movementType, speedInteger, speedFraction
595 SMART_ACTION_PLAY_SPELL_VISUAL_KIT = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
596 SMART_ACTION_OVERRIDE_LIGHT = 138, // zoneId, overrideLightID, transitionMilliseconds
597 SMART_ACTION_OVERRIDE_WEATHER = 139, // zoneId, weatherId, intensity
598 SMART_ACTION_SET_AI_ANIM_KIT = 140, // DEPRECATED, DO REUSE (it was never used in any branch, treat as free action id)
601 SMART_ACTION_CREATE_CONVERSATION = 143, // conversation_template.id
605 SMART_ACTION_ACTIVATE_GAMEOBJECT = 147, // GameObjectActions
607 SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER = 149, // summonType 1-8, duration in ms
608 SMART_ACTION_TRIGGER_GAME_EVENT = 150, // eventId, useSaiTargetAsGameEventSource
609 SMART_ACTION_DO_ACTION = 151, // actionId
610 SMART_ACTION_COMPLETE_QUEST = 152, // QuestId. Regular quests with objectives can't be completed with this action (only quests with QUEST_FLAGS_COMPLETION_EVENT, QUEST_FLAGS_COMPLETION_AREA_TRIGGER or QUEST_FLAGS_TRACKING_EVENT)
612 SMART_ACTION_DESTROY_CONVERSATION = 154, // conversation_template.id, isPrivate, range
616 SMART_ACTION_RESUME_MOVEMENT = 158, // UNUSED NEEDS CHERRYPICK
617 SMART_ACTION_FALL = 159, // pointId
618 SMART_ACTION_END = 160
620
622{
623 None = 0,
624 PersonalSpawn = 1,
625 PreferUnit = 2,
626 AttackInvoker = 4,
627
629};
630
632
634{
636
637 union
638 {
639 struct
640 {
645
646 struct
647 {
651
652 struct
653 {
656
657 struct
658 {
662
663 struct
664 {
670
671 struct
672 {
675
676 struct
677 {
680
681 struct
682 {
686
687 struct
688 {
691
692 struct
693 {
696
697 struct
698 {
704
705 struct
706 {
715
716 struct
717 {
722 uint32 flags; // SmartActionSummonCreatureFlags
726
727 struct
728 {
732
733 struct
734 {
738
739 struct
740 {
743
744 struct
745 {
748
749 struct
750 {
753
754 struct
755 {
759
760 struct
761 {
766
767 struct
768 {
775
776 struct
777 {
780
781 struct
782 {
786
787 struct
788 {
791
792 struct
793 {
796 uint32 type;
798
799 struct
800 {
803
804 struct
805 {
809
810 struct
811 {
815
816 struct
817 {
820
821 struct
822 {
826
827 struct
828 {
832
833 struct
834 {
838
839 struct
840 {
844
845 struct
846 {
848 uint32 data;
850
851 struct
852 {
855
856 struct
857 {
860
861 struct
862 {
868
869 struct
870 {
873
874 struct
875 {
876 uint32 id;
878
879 struct
880 {
883
884 struct
885 {
886 SAIBool run; // unused defined by waypoint_path
894
895 struct
896 {
899
900 struct
901 {
906
907 struct
908 {
912
913 struct
914 {
915 SAIBool run;
917
918 struct
919 {
922
923 struct
924 {
927
928 struct
929 {
934
935 struct
936 {
937 uint32 id;
939
940 struct
941 {
942 uint32 id;
949
950 struct
951 {
954
955 struct
956 {
963
964 struct
965 {
968
969 struct
970 {
972 uint32 type;
974
975 struct
976 {
978 uint32 type;
980
981 struct
982 {
983 uint32 id;
987
988 struct
989 {
992
993 struct
994 {
998
999 struct
1000 {
1005
1006 struct
1007 {
1015
1016 struct
1017 {
1020
1021 struct
1022 {
1025
1026 struct
1027 {
1034
1035 struct
1036 {
1040
1041 struct
1042 {
1043 uint32 state;
1045
1046 struct
1047 {
1048 uint32 id;
1050
1051 struct
1052 {
1054 uint32 angle;
1056
1057 struct
1058 {
1061
1062 struct
1063 {
1066
1067 struct
1068 {
1069 uint32 state;
1071
1072 struct
1073 {
1078
1079 struct
1080 {
1084
1085 struct
1086 {
1087 uint32 id;
1089
1090 struct
1091 {
1092 uint32 id;
1094
1095 struct
1096 {
1099
1100 struct
1101 {
1105
1106 struct
1107 {
1112
1113 struct
1114 {
1118
1119 struct
1120 {
1123
1124 struct
1125 {
1131
1132 struct
1133 {
1134 uint32 id;
1137
1138 struct
1139 {
1143
1144 struct
1145 {
1148 SAIBool force;
1150
1151 struct
1152 {
1156
1157 struct
1158 {
1160 uint32 type;
1162
1163 struct
1164 {
1167
1168 struct
1169 {
1170 uint32 entry;
1172
1173 struct
1174 {
1179
1180 struct
1181 {
1186
1187 struct
1188 {
1194
1195 struct
1196 {
1197 uint32 zoneId;
1201
1202 struct
1203 {
1206
1207 struct
1208 {
1211
1212 struct
1213 {
1216
1217 struct
1218 {
1219 uint32 id;
1221
1222 struct
1223 {
1226
1227 struct
1228 {
1231
1232 struct
1233 {
1236
1237 struct
1238 {
1242
1243 struct
1244 {
1245 uint32 id;
1247
1248 struct
1249 {
1250 uint32 type;
1253
1254 struct
1255 {
1259
1260 struct
1261 {
1264
1265 struct
1266 {
1269
1270 struct
1271 {
1272 uint32 id;
1274 uint32 range;
1276
1279
1280 struct
1281 {
1290 };
1291
1292 std::string param_string;
1293};
1294
1302
1304{
1306 SMART_TARGET_SELF = 1, // Self cast
1307 SMART_TARGET_VICTIM = 2, // Our current target (ie: highest aggro)
1308 SMART_TARGET_HOSTILE_SECOND_AGGRO = 3, // Second highest aggro, maxdist, playerOnly, powerType + 1
1309 SMART_TARGET_HOSTILE_LAST_AGGRO = 4, // Dead last on aggro, maxdist, playerOnly, powerType + 1
1310 SMART_TARGET_HOSTILE_RANDOM = 5, // Just any random target on our threat list, maxdist, playerOnly, powerType + 1
1311 SMART_TARGET_HOSTILE_RANDOM_NOT_TOP = 6, // Any random target except top threat, maxdist, playerOnly, powerType + 1
1312 SMART_TARGET_ACTION_INVOKER = 7, // Unit who caused this Event to occur
1313 SMART_TARGET_POSITION = 8, // use xyz from event params
1314 SMART_TARGET_CREATURE_RANGE = 9, // CreatureEntry(0any), minDist, maxDist, maxSize, StringId
1315 SMART_TARGET_CREATURE_GUID = 10, // guid, entry
1316 SMART_TARGET_CREATURE_DISTANCE = 11, // CreatureEntry(0any), maxDist, maxSize, StringId
1317 SMART_TARGET_STORED = 12, // id, uses pre-stored target(list)
1318 SMART_TARGET_GAMEOBJECT_RANGE = 13, // entry(0any), minDist, maxDist, StringId
1319 SMART_TARGET_GAMEOBJECT_GUID = 14, // guid, entry
1320 SMART_TARGET_GAMEOBJECT_DISTANCE = 15, // entry(0any), maxDist, StringId
1321 SMART_TARGET_INVOKER_PARTY = 16, // invoker's party members
1324 SMART_TARGET_CLOSEST_CREATURE = 19, // CreatureEntry(0any), maxDist, findCreatureAliveState, StringId
1325 SMART_TARGET_CLOSEST_GAMEOBJECT = 20, // entry(0any), maxDist, StringId
1327 SMART_TARGET_ACTION_INVOKER_VEHICLE = 22, // Unit's vehicle who caused this Event to occur
1328 SMART_TARGET_OWNER_OR_SUMMONER = 23, // Unit's owner or summoner, Use Owner/Charmer of this unit
1329 SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list, maxdist
1330 SMART_TARGET_CLOSEST_ENEMY = 25, // maxDist, playerOnly
1331 SMART_TARGET_CLOSEST_FRIENDLY = 26, // maxDist, playerOnly
1332 SMART_TARGET_LOOT_RECIPIENTS = 27, // all players that have tagged this creature (for kill credit)
1333 SMART_TARGET_FARTHEST = 28, // maxDist, playerOnly, isInLos
1334 SMART_TARGET_VEHICLE_PASSENGER = 29, // seatMask (0 - all seats)
1335 SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT = 30, // entry(0any), maxDist
1336
1337 SMART_TARGET_END = 31
1339
1341{
1343 {
1344 type = t;
1345 raw.param1 = p1;
1346 raw.param2 = p2;
1347 raw.param3 = p3;
1348 raw.param4 = p4;
1349 x = 0.0f;
1350 y = 0.0f;
1351 z = 0.0f;
1352 o = 0.0f;
1353 }
1355 float x, y, z, o;
1356 union
1357 {
1358 struct
1359 {
1364
1365 struct
1366 {
1371
1372 struct
1373 {
1379
1380 struct
1381 {
1385
1386 struct
1387 {
1392
1393 struct
1394 {
1395 uint32 dist;
1397
1398 struct
1399 {
1403
1404 struct
1405 {
1408
1409 struct
1410 {
1411 uint32 entry;
1416
1417 struct
1418 {
1419 uint32 dbGuid;
1420 uint32 entry;
1422
1423 struct
1424 {
1425 uint32 entry;
1426 uint32 dist;
1429
1430 struct
1431 {
1432 uint32 entry;
1433 uint32 dist;
1436
1437 struct
1438 {
1439 uint32 entry;
1440 uint32 dist;
1442
1443 struct
1444 {
1448
1449 struct
1450 {
1454
1455 struct
1456 {
1459
1460 struct
1461 {
1464
1465 struct
1466 {
1469
1470 struct
1471 {
1477 };
1478
1479 std::string param_string;
1480};
1481
1499
1515
1532
1534{
1626};
1627
1629{
1630 SMART_EVENT_FLAG_NOT_REPEATABLE = 0x001, // Event can not repeat
1631 SMART_EVENT_FLAG_DIFFICULTY_0_DEPRECATED = 0x002, // UNUSED, DO NOT REUSE
1632 SMART_EVENT_FLAG_DIFFICULTY_1_DEPRECATED = 0x004, // UNUSED, DO NOT REUSE
1633 SMART_EVENT_FLAG_DIFFICULTY_2_DEPRECATED = 0x008, // UNUSED, DO NOT REUSE
1634 SMART_EVENT_FLAG_DIFFICULTY_3_DEPRECATED = 0x010, // UNUSED, DO NOT REUSE
1635 SMART_EVENT_FLAG_ACTIONLIST_WAITS = 0x020, // Timed action list will wait for action from this event to finish before moving on to next action
1637 SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build
1638 SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset()
1639 SMART_EVENT_FLAG_WHILE_CHARMED = 0x200, //Event occurs even if AI owner is charmed
1640
1643
1644 // Temp flags, used only at runtime, never stored in DB
1645 SMART_EVENT_FLAG_TEMP_IGNORE_CHANCE_ROLL = 0x40000000, //Event occurs no matter what roll_chance(e.event.event_chance) returns.
1646};
1647
1649{
1650 SMARTCAST_INTERRUPT_PREVIOUS = 0x01, // Interrupt any spell casting
1651 SMARTCAST_TRIGGERED = 0x02, // Triggered (this makes spell cost zero mana and have no cast time)
1652 //SMARTCAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
1653 //SMARTCAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
1654 //SMARTCAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
1655 SMARTCAST_AURA_NOT_PRESENT = 0x20, // Only casts the spell if the target does not have an aura from the spell
1656 SMARTCAST_COMBAT_MOVE = 0x40, // Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
1657 SMARTCAST_WAIT_FOR_HIT = 0x80, // When used in combination with SMART_EVENT_FLAG_ACTIONLIST_WAITS, AI will wait for the spell to hit its target instead of just cast bar to finish
1658};
1659
1660// one line in DB is one event
1662{
1666
1671 std::vector<Difficulty> Difficulties;
1672
1676
1678 uint32 GetEventType() const { return (uint32)event.type; }
1681
1687
1688 operator bool() const { return entryOrGuid != 0; }
1689 // Default comparision operator using priority field as first ordering field
1690 std::strong_ordering operator<=>(SmartScriptHolder const& right) const
1691 {
1692 if (std::strong_ordering cmp = priority <=> right.priority; advstd::is_neq(cmp))
1693 return cmp;
1694 if (std::strong_ordering cmp = entryOrGuid <=> right.entryOrGuid; advstd::is_neq(cmp))
1695 return cmp;
1696 if (std::strong_ordering cmp = source_type <=> right.source_type; advstd::is_neq(cmp))
1697 return cmp;
1698 if (std::strong_ordering cmp = event_id <=> right.event_id; advstd::is_neq(cmp))
1699 return cmp;
1700 if (std::strong_ordering cmp = link <=> right.link; advstd::is_neq(cmp))
1701 return cmp;
1702 return std::strong_ordering::equal;
1703 }
1704
1705 static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits<uint32>::max();
1706};
1707
1708typedef std::vector<WorldObject*> ObjectVector;
1709
1711{
1712 public:
1713 explicit ObjectGuidVector(ObjectVector const& objectVector);
1714
1716 {
1717 UpdateObjects(ref);
1718 return &_objectVector;
1719 }
1720
1721 void AddGuid(ObjectGuid const& guid) { _guidVector.push_back(guid); }
1722
1724
1725 private:
1728
1729 //sanitize vector using _guidVector
1730 void UpdateObjects(WorldObject const& ref) const;
1731};
1732typedef std::unordered_map<uint32, ObjectGuidVector> ObjectVectorMap;
1733
1734// all events for a single entry
1735typedef std::vector<SmartScriptHolder> SmartAIEventList;
1736typedef std::vector<SmartScriptHolder> SmartAIEventStoredList;
1737
1738// all events for all entries / guids
1739typedef std::unordered_map<int64, SmartAIEventList> SmartAIEventMap;
1740
1741// Helper Stores
1742typedef std::map<uint32 /*entry*/, std::pair<uint32 /*spellId*/, SpellEffIndex /*effIndex*/> > CacheSpellContainer;
1743typedef std::pair<CacheSpellContainer::const_iterator, CacheSpellContainer::const_iterator> CacheSpellContainerBounds;
1744
1746{
1747 private:
1750
1751 public:
1752 SmartAIMgr(SmartAIMgr const&) = delete;
1756
1757 static SmartAIMgr* instance();
1758
1759 void LoadSmartAIFromDB();
1760
1761 SmartAIEventList GetScript(int32 entry, SmartScriptType type);
1762
1763 static SmartScriptHolder& FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId);
1764
1765 static SmartScriptHolder& FindLinkedEvent(SmartAIEventList& list, uint32 link);
1766
1767 private:
1768 //event stores
1770
1771 static bool EventHasInvoker(SMART_EVENT event);
1772
1773 bool IsEventValid(SmartScriptHolder& e);
1774 bool IsTargetValid(SmartScriptHolder const& e);
1775
1776 bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max);
1777
1778 static bool NotNULL(SmartScriptHolder const& e, uint32 data);
1779 static bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry);
1780 static bool IsQuestValid(SmartScriptHolder const& e, uint32 entry);
1781 static bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry);
1782 static bool IsSpellValid(SmartScriptHolder const& e, uint32 entry);
1783 static bool IsItemValid(SmartScriptHolder const& e, uint32 entry);
1784 static bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry);
1785 static bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry);
1786 static bool IsSoundValid(SmartScriptHolder const& e, uint32 entry);
1787 static bool IsAnimKitValid(SmartScriptHolder const& e, uint32 entry);
1788 static bool IsSpellVisualKitValid(SmartScriptHolder const& e, uint32 entry);
1789 static bool IsTextValid(SmartScriptHolder const& e, uint32 id);
1790
1791 static bool CheckUnusedEventParams(SmartScriptHolder const& e);
1792 static bool CheckUnusedActionParams(SmartScriptHolder const& e);
1793 static bool CheckUnusedTargetParams(SmartScriptHolder const& e);
1794
1795 // Helpers
1796 void LoadHelperStores();
1797 void UnLoadHelperStores();
1798
1799 CacheSpellContainerBounds GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const;
1800 CacheSpellContainerBounds GetSummonGameObjectSpellContainerBounds(uint32 gameObjectEntry) const;
1801 CacheSpellContainerBounds GetKillCreditSpellContainerBounds(uint32 killCredit) const;
1802 CacheSpellContainerBounds GetCreateItemSpellContainerBounds(uint32 itemId) const;
1803
1808};
1809
1810#define sSmartScriptMgr SmartAIMgr::instance()
1811
1812#endif
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int64_t int64
Definition Define.h:149
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
SpellEffIndex
SmartScriptType
@ SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
@ SMART_SCRIPT_TYPE_MAX
@ SMART_SCRIPT_TYPE_INSTANCE
@ SMART_SCRIPT_TYPE_CREATURE
@ SMART_SCRIPT_TYPE_GOSSIP
@ SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_CUSTOM
@ SMART_SCRIPT_TYPE_GAMEOBJECT
@ SMART_SCRIPT_TYPE_AREATRIGGER
@ SMART_SCRIPT_TYPE_SPELL
@ SMART_SCRIPT_TYPE_TRANSPORT
@ SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY
@ SMART_SCRIPT_TYPE_EVENT
@ SMART_SCRIPT_TYPE_SCENE
@ SMART_SCRIPT_TYPE_QUEST
std::vector< SmartScriptHolder > SmartAIEventList
std::vector< SmartScriptHolder > SmartAIEventStoredList
SmartEventFlags
@ SMART_EVENT_FLAG_DIFFICULTY_1_DEPRECATED
@ SMART_EVENT_FLAG_WHILE_CHARMED
@ SMART_EVENT_FLAGS_DEPRECATED
@ SMART_EVENT_FLAG_DONT_RESET
@ SMART_EVENT_FLAG_ACTIONLIST_WAITS
@ SMART_EVENT_FLAG_DEBUG_ONLY
@ SMART_EVENT_FLAGS_ALL
@ SMART_EVENT_FLAG_DIFFICULTY_2_DEPRECATED
@ SMART_EVENT_FLAG_RESERVED_6
@ SMART_EVENT_FLAG_DIFFICULTY_0_DEPRECATED
@ SMART_EVENT_FLAG_DIFFICULTY_3_DEPRECATED
@ SMART_EVENT_FLAG_TEMP_IGNORE_CHANCE_ROLL
@ SMART_EVENT_FLAG_NOT_REPEATABLE
SMARTAI_TARGETS
@ SMART_TARGET_LOOT_RECIPIENTS
@ 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_VEHICLE_PASSENGER
@ SMART_TARGET_GAMEOBJECT_RANGE
@ SMART_TARGET_CREATURE_GUID
@ SMART_TARGET_PLAYER_RANGE
@ SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT
@ 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_END
@ SMART_TARGET_ACTION_INVOKER
@ SMART_TARGET_POSITION
@ SMART_TARGET_HOSTILE_LAST_AGGRO
@ SMART_TARGET_ACTION_INVOKER_VEHICLE
@ SMART_TARGET_FARTHEST
@ SMART_TARGET_THREAT_LIST
@ SMART_TARGET_CLOSEST_ENEMY
@ SMART_TARGET_NONE
@ SMART_TARGET_PLAYER_DISTANCE
@ SMART_TARGET_STORED
std::map< uint32, std::pair< uint32, SpellEffIndex > > CacheSpellContainer
const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2]
std::unordered_map< int64, SmartAIEventList > SmartAIEventMap
std::vector< WorldObject * > ObjectVector
std::unordered_map< uint32, ObjectGuidVector > ObjectVectorMap
const uint32 SmartAIEventMask[SMART_EVENT_END][2]
SMART_SCRIPT_RESPAWN_CONDITION
@ SMART_SCRIPT_RESPAWN_CONDITION_END
@ SMART_SCRIPT_RESPAWN_CONDITION_NONE
@ SMART_SCRIPT_RESPAWN_CONDITION_AREA
@ SMART_SCRIPT_RESPAWN_CONDITION_MAP
SmartAITypeMaskId
@ SMART_SCRIPT_TYPE_MASK_SPELL
@ SMART_SCRIPT_TYPE_MASK_SCENE
@ SMART_SCRIPT_TYPE_MASK_EVENT
@ SMART_SCRIPT_TYPE_MASK_QUEST
@ SMART_SCRIPT_TYPE_MASK_TIMED_ACTIONLIST
@ SMART_SCRIPT_TYPE_MASK_CREATURE
@ SMART_SCRIPT_TYPE_MASK_INSTANCE
@ SMART_SCRIPT_TYPE_MASK_AREATRIGGER
@ SMART_SCRIPT_TYPE_MASK_AREATRIGGER_ENTITY
@ SMART_SCRIPT_TYPE_MASK_GOSSIP
@ SMART_SCRIPT_TYPE_MASK_GAMEOBJECT
@ SMART_SCRIPT_TYPE_MASK_TRANSPORT
SMART_ACTION
@ SMART_ACTION_REMOVE_TIMED_EVENT
@ SMART_ACTION_NONE
@ 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_CREATE_CONVERSATION
@ SMART_ACTION_DESTROY_CONVERSATION
@ SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST
@ SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1
@ SMART_ACTION_SET_DISABLE_GRAVITY
@ SMART_ACTION_SET_INST_DATA64
@ SMART_ACTION_SET_FACTION
@ SMART_ACTION_THREAT_SINGLE_PCT
@ SMART_ACTION_OFFER_QUEST
@ SMART_ACTION_OVERRIDE_LIGHT
@ SMART_ACTION_REMOVE_ALL_GAMEOBJECTS
@ SMART_ACTION_SET_UNIT_FIELD_BYTES_1
@ SMART_ACTION_CLOSE_GOSSIP
@ SMART_ACTION_DISABLE_EVADE
@ SMART_ACTION_ADD_GO_FLAG
@ SMART_ACTION_ADD_DYNAMIC_FLAG
@ SMART_ACTION_KILL_UNIT
@ SMART_ACTION_LOAD_EQUIPMENT
@ SMART_ACTION_END
@ SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS
@ SMART_ACTION_ATTACK_START
@ SMART_ACTION_SET_UNIT_FLAG
@ SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER
@ SMART_ACTION_CALL_GROUPEVENTHAPPENS
@ SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL
@ SMART_ACTION_INVOKER_CAST
@ SMART_ACTION_SCENE_PLAY
@ SMART_ACTION_JUMP_TO_POS
@ SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST
@ SMART_ACTION_SEND_GOSSIP_MENU
@ SMART_ACTION_SET_COUNTER
@ SMART_ACTION_FLEE_FOR_ASSIST
@ SMART_ACTION_EQUIP
@ SMART_ACTION_SET_ROOT
@ SMART_ACTION_ATTACK_STOP
@ SMART_ACTION_SUMMON_GO
@ SMART_ACTION_SET_HOVER
@ SMART_ACTION_WP_PAUSE
@ SMART_ACTION_SIMPLE_TALK
@ SMART_ACTION_REMOVE_AURAS_BY_TYPE
@ SMART_ACTION_CAST
@ SMART_ACTION_SPAWN_SPAWNGROUP
@ SMART_ACTION_ALLOW_COMBAT_MOVEMENT
@ SMART_ACTION_ADD_AURA
@ SMART_ACTION_THREAT_ALL_PCT
@ SMART_ACTION_SOUND
@ SMART_ACTION_SET_MOVEMENT_SPEED
@ SMART_ACTION_PLAY_CINEMATIC
@ SMART_ACTION_ADD_NPC_FLAG
@ SMART_ACTION_EVADE
@ SMART_ACTION_FAIL_QUEST
@ SMART_ACTION_INTERRUPT_SPELL
@ SMART_ACTION_ENTER_VEHICLE
@ SMART_ACTION_ADD_POWER
@ SMART_ACTION_REMOVE_DYNAMIC_FLAG
@ SMART_ACTION_RANDOM_SOUND
@ SMART_ACTION_SET_IMMUNE_PC
@ SMART_ACTION_SCENE_CANCEL
@ SMART_ACTION_SET_AI_ANIM_KIT
@ SMART_ACTION_SET_POWER
@ SMART_ACTION_SEND_TARGET_TO_TARGET
@ SMART_ACTION_SET_INGAME_PHASE_ID
@ SMART_ACTION_REMOVE_POWER
@ SMART_ACTION_SET_DYNAMIC_FLAG
@ SMART_ACTION_FALL
@ SMART_ACTION_RESUME_MOVEMENT
@ SMART_ACTION_GO_SET_GO_STATE
@ SMART_ACTION_MOVE_OFFSET
@ 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_TRIGGER_GAME_EVENT
@ SMART_ACTION_TALK
@ SMART_ACTION_CALL_SCRIPT_RESET
@ SMART_ACTION_SET_DATA
@ SMART_ACTION_PLAY_SPELL_VISUAL_KIT
@ SMART_ACTION_WP_START
@ SMART_ACTION_BOARD_PASSENGER
@ SMART_ACTION_COMBAT_STOP
@ SMART_ACTION_EXIT_VEHICLE
@ SMART_ACTION_SET_INGAME_PHASE_GROUP
@ SMART_ACTION_SET_RUN
@ SMART_ACTION_ACTIVATE_GAMEOBJECT
@ SMART_ACTION_ADD_TO_STORED_TARGET_LIST
@ SMART_ACTION_SET_HEALTH_PCT
@ 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_CREDIT_QUEST_OBJECTIVE_TALK_TO
@ SMART_ACTION_SELF_CAST
@ SMART_ACTION_SET_SWIM
@ SMART_ACTION_SET_SIGHT_DIST
@ SMART_ACTION_SET_INST_DATA
@ SMART_ACTION_PLAY_ANIMKIT
@ SMART_ACTION_REMOVE_GO_FLAG
@ SMART_ACTION_CALL_FOR_HELP
@ SMART_ACTION_SET_UNINTERACTIBLE
@ SMART_ACTION_OVERRIDE_WEATHER
@ SMART_ACTION_ADD_THREAT
@ SMART_ACTION_TELEPORT
@ SMART_ACTION_PLAYMOVIE
@ SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT
@ SMART_ACTION_FOLLOW
@ SMART_ACTION_PLAY_EMOTE
@ SMART_ACTION_SET_EVENT_PHASE
@ SMART_ACTION_DESPAWN_SPAWNGROUP
@ SMART_ACTION_SET_CORPSE_DELAY
@ SMART_ACTION_SET_SHEATH
@ SMART_ACTION_SET_ORIENTATION
@ SMART_ACTION_RESPAWN_BY_SPAWNID
@ SMART_ACTION_SET_NPC_FLAG
@ SMART_ACTION_MOVE_TO_POS
@ SMART_ACTION_RANDOM_EMOTE
@ SMART_ACTION_INC_EVENT_PHASE
@ SMART_ACTION_ENABLE_TEMP_GOBJ
@ SMART_ACTION_CREATE_TIMED_EVENT
@ SMART_ACTION_DIE
@ SMART_ACTION_RESET_SCRIPT_BASE_OBJECT
@ SMART_ACTION_REMOVE_NPC_FLAG
@ SMART_ACTION_COMPLETE_QUEST
@ 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_DO_ACTION
@ SMART_ACTION_SET_CAN_FLY
@ SMART_ACTION_SET_HOME_POS
@ SMART_ACTION_ADD_ITEM
@ SMART_ACTION_SET_ACTIVE
@ SMART_ACTION_SET_RANGED_MOVEMENT
@ SMART_ACTION_ACTIVATE_TAXI
@ SMART_ACTION_START_CLOSEST_WAYPOINT
@ SMART_ACTION_SUMMON_CREATURE_GROUP
@ SMART_ACTION_SET_REACT_STATE
@ SMART_ACTION_RANDOM_MOVE
@ SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT
@ SMART_ACTION_SET_IMMUNE_NPC
@ SMART_ACTION_TRIGGER_TIMED_EVENT
@ SMART_ACTION_REMOVEAURASFROMSPELL
@ SMART_ACTION_FLEE
@ SMART_ACTION_PAUSE_MOVEMENT
SMART_EVENT
@ SMART_EVENT_IC_LOS
@ SMART_EVENT_EVADE
@ SMART_EVENT_ACTION_DONE
@ SMART_EVENT_SUMMON_DESPAWNED
@ SMART_EVENT_SPELLHIT
@ SMART_EVENT_SCENE_START
@ SMART_EVENT_RECEIVE_EMOTE
@ SMART_EVENT_FRIENDLY_HEALTH_PCT
@ SMART_EVENT_QUEST_FAIL
@ SMART_EVENT_ON_AURA_APPLIED
@ SMART_EVENT_DATA_SET
@ SMART_EVENT_RECEIVE_HEAL
@ SMART_EVENT_TIMED_EVENT_TRIGGERED
@ SMART_EVENT_SCENE_COMPLETE
@ SMART_EVENT_CHARMED_TARGET
@ SMART_EVENT_TARGET_MANA_PCT
@ SMART_EVENT_QUEST_COMPLETION
@ SMART_EVENT_JUST_CREATED
@ SMART_EVENT_HEALTH_PCT
@ SMART_EVENT_EVENT_PHASE_CHANGE
@ SMART_EVENT_DISTANCE_GAMEOBJECT
@ SMART_EVENT_ON_SPELLCLICK
@ SMART_EVENT_MOVEMENTINFORM
@ SMART_EVENT_RANGE
@ SMART_EVENT_MANA_PCT
@ SMART_EVENT_PASSENGER_REMOVED
@ SMART_EVENT_ON_AURA_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_AREATRIGGER_EXIT
@ SMART_EVENT_GO_LOOT_STATE_CHANGED
@ SMART_EVENT_UPDATE_IC
@ SMART_EVENT_RESET
@ SMART_EVENT_SCENE_CANCEL
@ SMART_EVENT_JUST_SUMMONED
@ SMART_EVENT_CHARMED
@ SMART_EVENT_AI_INIT
@ SMART_EVENT_WAYPOINT_START
@ SMART_EVENT_ON_SPELL_CAST
@ 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_PASSENGER_BOARDED
@ SMART_EVENT_SCENE_TRIGGER
@ SMART_EVENT_UPDATE
@ SMART_EVENT_AREATRIGGER_ENTER
@ SMART_EVENT_TRANSPORT_ADDPLAYER
@ SMART_EVENT_WAYPOINT_ENDED
@ SMART_EVENT_IS_BEHIND_TARGET
@ SMART_EVENT_UPDATE_OOC
@ SMART_EVENT_ACCEPTED_QUEST
@ SMART_EVENT_COUNTER_SET
@ SMART_EVENT_FRIENDLY_MISSING_BUFF
@ SMART_EVENT_WAYPOINT_RESUMED
@ SMART_EVENT_ON_SPELL_FAILED
@ SMART_EVENT_WAYPOINT_REACHED
@ SMART_EVENT_TARGET_BUFFED
@ SMART_EVENT_RESPAWN
@ SMART_EVENT_QUEST_ACCEPTED
@ 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_QUEST_OBJ_COMPLETION
@ SMART_EVENT_DISTANCE_CREATURE
@ SMART_EVENT_WAYPOINT_STOPPED
@ SMART_EVENT_SUMMONED_UNIT_DIES
@ SMART_EVENT_FRIENDLY_IS_CC
@ SMART_EVENT_SEND_EVENT_TRIGGER
@ SMART_EVENT_OOC_LOS
@ SMART_EVENT_ON_SPELL_START
@ SMART_EVENT_ON_DESPAWN
@ SMART_EVENT_AGGRO
@ SMART_EVENT_TARGET_HEALTH_PCT
@ SMART_EVENT_VICTIM_CASTING
@ SMART_EVENT_DAMAGED_TARGET
@ SMART_EVENT_HAS_AURA
@ SMART_EVENT_SUMMONED_UNIT
uint32 SAIBool
SmartActionSummonCreatureFlags
SMART_EVENT_PHASE_BITS
@ SMART_EVENT_PHASE_4_BIT
@ SMART_EVENT_PHASE_3_BIT
@ SMART_EVENT_PHASE_6_BIT
@ SMART_EVENT_PHASE_9_BIT
@ SMART_EVENT_PHASE_8_BIT
@ SMART_EVENT_PHASE_2_BIT
@ SMART_EVENT_PHASE_1_BIT
@ SMART_EVENT_PHASE_12_BIT
@ SMART_EVENT_PHASE_ALL
@ SMART_EVENT_PHASE_5_BIT
@ SMART_EVENT_PHASE_ALWAYS_BIT
@ SMART_EVENT_PHASE_10_BIT
@ SMART_EVENT_PHASE_11_BIT
@ SMART_EVENT_PHASE_7_BIT
eSmartAI
@ SMART_ESCORT_LAST_OOC_POINT
@ SMART_RANDOM_POINT
@ SMART_ACTION_PARAM_COUNT
@ SMART_EVENT_PARAM_COUNT
@ SMART_ESCORT_TARGETS
@ SMART_SUMMON_COUNTER
SMARTAI_SPAWN_FLAGS
@ SMARTAI_SPAWN_FLAG_FORCE_SPAWN
@ SMARTAI_SPAWN_FLAG_NOSAVE_RESPAWN
@ SMARTAI_SPAWN_FLAG_NONE
@ SMARTAI_SPAWN_FLAG_IGNORE_RESPAWN
SmartCastFlags
@ SMARTCAST_TRIGGERED
@ SMARTCAST_COMBAT_MOVE
@ SMARTCAST_INTERRUPT_PREVIOUS
@ SMARTCAST_AURA_NOT_PRESENT
@ SMARTCAST_WAIT_FOR_HIT
SMART_EVENT_PHASE
@ SMART_EVENT_PHASE_COUNT
@ SMART_EVENT_PHASE_4
@ SMART_EVENT_PHASE_1
@ SMART_EVENT_PHASE_3
@ SMART_EVENT_PHASE_7
@ SMART_EVENT_PHASE_9
@ SMART_EVENT_PHASE_11
@ SMART_EVENT_PHASE_8
@ SMART_EVENT_PHASE_2
@ SMART_EVENT_PHASE_5
@ SMART_EVENT_PHASE_12
@ SMART_EVENT_PHASE_6
@ SMART_EVENT_PHASE_ALWAYS
@ SMART_EVENT_PHASE_10
@ SMART_EVENT_PHASE_MAX
const uint32 SmartAITypeMask[SMART_SCRIPT_TYPE_MAX][2]
std::pair< CacheSpellContainer::const_iterator, CacheSpellContainer::const_iterator > CacheSpellContainerBounds
ObjectVector _objectVector
void UpdateObjects(WorldObject const &ref) const
ObjectVector const * GetObjectVector(WorldObject const &ref) const
void AddGuid(ObjectGuid const &guid)
CacheSpellContainer SummonCreatureSpellStore
SmartAIMgr & operator=(SmartAIMgr &&)=delete
SmartAIMgr(SmartAIMgr const &)=delete
CacheSpellContainer CreateItemSpellStore
SmartAIMgr & operator=(SmartAIMgr const &)=delete
CacheSpellContainer SummonGameObjectSpellStore
CacheSpellContainer KillCreditSpellStore
SmartAIMgr(SmartAIMgr &&)=delete
constexpr bool is_neq(std::partial_ordering cmp) noexcept
Definition advstd.h:35
std::string param_string
uint32 sounds[4]
uint32 targetParam2
struct SmartAction::@61::@148 scene
struct SmartAction::@61::@142 groupSpawn
struct SmartAction::@61::@70 questOffer
uint32 targetsLimit
struct SmartAction::@61::@112 timeEvent
struct SmartAction::@61::@129 setRangedMovement
struct SmartAction::@61::@116 setunitByte
struct SmartAction::@61::@168 raw
struct SmartAction::@61::@66 morphOrMount
struct SmartAction::@61::@165 doAction
struct SmartAction::@61::@125 moveToPos
struct SmartAction::@61::@164 triggerGameEvent
struct SmartAction::@61::@137 closestWaypointFromList
uint32 gameObjectAction
uint32 targetParam4
struct SmartAction::@61::@63 talk
struct SmartAction::@61::@105 wpStop
struct SmartAction::@61::@97 moveRandom
struct SmartAction::@61::@132 goState
struct SmartAction::@61::@161 activateGameObject
struct SmartAction::@61::@92 forceDespawn
struct SmartAction::@61::@160 setUninteractible
SAIBool regenHealth
uint32 wps[SMART_ACTION_PARAM_COUNT]
SAIBool allowOverride
struct SmartAction::@61::@121 interruptSpellCasting
struct SmartAction::@61::@98 visibility
struct SmartAction::@61::@77 threat
struct SmartAction::@61::@158 setImmunePC
struct SmartAction::@61::@64 simpleTalk
struct SmartAction::@61::@71 react
struct SmartAction::@61::@76 threatPCT
uint32 triggerFlags
uint32 emotes[SMART_ACTION_PARAM_COUNT]
SAIBool withDelayed
struct SmartAction::@61::@79 combatMove
struct SmartAction::@61::@103 wpStart
struct SmartAction::@61::@84 randomPhase
SAIBool withInstant
uint32 transitionMilliseconds
struct SmartAction::@61::@140 corpseDelay
struct SmartAction::@61::@81 incEventPhase
struct SmartAction::@61::@118 timedActionList
struct SmartAction::@61::@72 randomEmote
struct SmartAction::@61::@82 removeAura
struct SmartAction::@61::@95 ingamePhaseGroup
struct SmartAction::@61::@141 disableEvade
uint32 targetParam1
struct SmartAction::@61::@99 summonGO
uint32 includeDecayRatio
struct SmartAction::@61::@128 sendTargetToTarget
struct SmartAction::@61::@138 moveOffset
SAIBool toRespawnPosition
struct SmartAction::@61::@75 summonCreature
struct SmartAction::@61::@150 movementSpeed
SAIBool useTalkTarget
struct SmartAction::@61::@93 invincHP
SAIBool uninteractible
uint32 targetParam3
struct SmartAction::@61::@123 fleeAssist
struct SmartAction::@61::@65 faction
struct SmartAction::@61::@120 randRangeTimedActionList
uint32 reactState_DEPRECATED_DO_NOT_REUSE
struct SmartAction::@61::@149 cinematic
uint32 spellVisualKitId
struct SmartAction::@61::@122 jump
struct SmartAction::@61::@156 setHealthPct
struct SmartAction::@61::@154 setHover
struct SmartAction::@61::@101 taxi
struct SmartAction::@61::@94 ingamePhaseId
struct SmartAction::@61::@155 evade
struct SmartAction::@61::@96 setData
struct SmartAction::@61::@133 creatureGroup
struct SmartAction::@61::@113 movie
struct SmartAction::@61::@85 randomPhaseRange
struct SmartAction::@61::@111 storeTargets
struct SmartAction::@61::@153 overrideWeather
uint32 FadeObjectDuration
struct SmartAction::@61::@124 enableTempGO
struct SmartAction::@61::@74 crossCast
SAIBool updateLevel
uint32 actionLists[SMART_ACTION_PARAM_COUNT]
SMART_ACTION type
uint32 forceRespawnTimer
struct SmartAction::@61::@100 active
struct SmartAction::@61::@157 conversation
uint32 phases[SMART_ACTION_PARAM_COUNT]
struct SmartAction::@61::@162 addToStoredTargets
struct SmartAction::@61::@130 setHealthRegen
struct SmartAction::@61::@163 becomePersonalClone
struct SmartAction::@61::@126 sendGossipMenu
struct SmartAction::@61::@131 setRoot
SAIBool onlyOwnedAuras
struct SmartAction::@61::@90 callHelp
uint32 overrideLightId
struct SmartAction::@61::@139 randomSound
struct SmartAction::@61::@108 setDisableGravity
struct SmartAction::@61::@104 wpPause
struct SmartAction::@61::@106 item
struct SmartAction::@61::@146 respawnData
uint32 gossipNpcTextId
struct SmartAction::@61::@143 loadEquipment
struct SmartAction::@61::@117 delunitByte
SAIBool disablePathfinding
struct SmartAction::@61::@166 enterVehicle
uint32 ContactDistance
struct SmartAction::@61::@134 power
struct SmartAction::@61::@110 setCounter
struct SmartAction::@61::@78 autoAttack
struct SmartAction::@61::@159 setImmuneNPC
struct SmartAction::@61::@144 randomTimedEvent
struct SmartAction::@61::@152 overrideLight
SAIBool withEmote
SAIBool useSaiTargetAsGameEventSource
struct SmartAction::@61::@89 updateTemplate
struct SmartAction::@61::@87 setInstanceData
struct SmartAction::@61::@119 randTimedActionList
SAIBool directAdd
uint32 storedTargetId
struct SmartAction::@61::@114 equip
struct SmartAction::@61::@102 fall
struct SmartAction::@61::@86 killedMonster
uint32 createdBySpell
struct SmartAction::@61::@136 gameEventStart
struct SmartAction::@61::@107 setRun
uint32 keyBroadcastTextId
struct SmartAction::@61::@145 pauseMovement
struct SmartAction::@61::@167 destroyConversation
struct SmartAction::@61::@109 teleport
struct SmartAction::@61::@88 setInstanceData64
struct SmartAction::@61::@91 setSheath
struct SmartAction::@61::@73 cast
struct SmartAction::@61::@135 gameEventStop
struct SmartAction::@61::@127 setGoLootState
struct SmartAction::@61::@83 follow
struct SmartAction::@61::@80 setEventPhase
struct SmartAction::@61::@151 spellVisualKit
struct SmartEvent::@25::@48 textOver
uint32 event_flags
struct SmartEvent::@25::@34 friendlyCC
struct SmartEvent::@25::@52 gameEvent
struct SmartEvent::@25::@50 gossipHello
uint32 event_phase_mask
struct SmartEvent::@25::@56 friendlyHealthPct
struct SmartEvent::@25::@40 aura
struct SmartEvent::@25::@33 targetCasting
struct SmartEvent::@25::@49 timedEvent
struct SmartEvent::@25::@44 waypoint
std::string param_string
uint32 cooldownMax
struct SmartEvent::@25::@47 instancePlayerEnter
struct SmartEvent::@25::@54 eventInform
struct SmartEvent::@25::@42 movementInform
struct SmartEvent::@25::@60 raw
struct SmartEvent::@25::@31 respawn
struct SmartEvent::@25::@53 goLootStateChanged
struct SmartEvent::@25::@58 counter
struct SmartEvent::@25::@59 spellCast
struct SmartEvent::@25::@51 gossip
struct SmartEvent::@25::@28 kill
uint32 hostilityMode
Hostility mode of the event. 0: hostile, 1: not hostile, 2: any.
struct SmartEvent::@25::@46 transportRelocate
uint32 event_chance
SAIBool playerOnly
struct SmartEvent::@25::@45 transportAddCreature
struct SmartEvent::@25::@32 minMax
struct SmartEvent::@25::@30 los
uint32 creatureEntry
struct SmartEvent::@25::@36 summoned
struct SmartEvent::@25::@35 missingBuff
struct SmartEvent::@25::@38 questObjective
uint32 gameEventId
struct SmartEvent::@25::@55 doAction
uint32 textGroupID
uint32 cooldownMin
struct SmartEvent::@25::@29 spellHit
struct SmartEvent::@25::@41 charm
struct SmartEvent::@25::@57 distance
struct SmartEvent::@25::@27 minMaxRepeat
SAIBool onRemove
struct SmartEvent::@25::@43 dataSet
SMART_EVENT type
static constexpr uint32 DEFAULT_PRIORITY
std::strong_ordering operator<=>(SmartScriptHolder const &right) const
uint32 GetScriptType() const
uint32 GetEventType() const
uint32 GetTargetType() const
std::vector< Difficulty > Difficulties
SmartScriptType source_type
uint32 GetActionType() const
struct SmartTarget::@169::@186 owner
struct SmartTarget::@169::@175 unitDistance
std::string param_string
struct SmartTarget::@169::@176 playerDistance
SAIBool useCharmerOrOwner
struct SmartTarget::@169::@178 stored
struct SmartTarget::@169::@185 closestFriendly
struct SmartTarget::@169::@187 vehicle
struct SmartTarget::@169::@184 closestAttackable
struct SmartTarget::@169::@180 goGUID
struct SmartTarget::@169::@172 farthest
struct SmartTarget::@169::@177 playerRange
struct SmartTarget::@169::@183 goClosest
struct SmartTarget::@169::@182 unitClosest
struct SmartTarget::@169::@189 raw
struct SmartTarget::@169::@179 goRange
SMARTAI_TARGETS type
struct SmartTarget::@169::@171 hostilRandom
struct SmartTarget::@169::@188 threatList
struct SmartTarget::@169::@173 unitRange
uint32 findCreatureAliveState
SmartTarget(SMARTAI_TARGETS t=SMART_TARGET_NONE, uint32 p1=0, uint32 p2=0, uint32 p3=0, uint32 p4=0)
struct SmartTarget::@169::@174 unitGUID
struct SmartTarget::@169::@181 goDistance