This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
/
SmartScriptMgr.h
1533 lines (1350 loc) · 55.5 KB
/
SmartScriptMgr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2011-2019 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2019 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2019 MaNGOS <https://www.getmangos.eu/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SKYFIRE_SMARTSCRIPTMGR_H
#define SKYFIRE_SMARTSCRIPTMGR_H
#include "Common.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "Unit.h"
#include "Spell.h"
#include "DB2Stores.h"
struct WayPoint
{
WayPoint(uint32 _id, float _x, float _y, float _z)
{
id = _id;
x = _x;
y = _y;
z = _z;
}
uint32 id;
float x;
float y;
float z;
};
enum SMART_EVENT_PHASE
{
SMART_EVENT_PHASE_ALWAYS = 0,
SMART_EVENT_PHASE_1 = 1,
SMART_EVENT_PHASE_2 = 2,
SMART_EVENT_PHASE_3 = 3,
SMART_EVENT_PHASE_4 = 4,
SMART_EVENT_PHASE_5 = 5,
SMART_EVENT_PHASE_6 = 6,
SMART_EVENT_PHASE_MAX = 7,
SMART_EVENT_PHASE_COUNT = 6
};
enum SMART_EVENT_PHASE_BITS
{
SMART_EVENT_PHASE_ALWAYS_BIT = 0,
SMART_EVENT_PHASE_1_BIT = 1,
SMART_EVENT_PHASE_2_BIT = 2,
SMART_EVENT_PHASE_3_BIT = 4,
SMART_EVENT_PHASE_4_BIT = 8,
SMART_EVENT_PHASE_5_BIT = 16,
SMART_EVENT_PHASE_6_BIT = 32,
SMART_EVENT_PHASE_ALL = SMART_EVENT_PHASE_1_BIT + SMART_EVENT_PHASE_2_BIT + SMART_EVENT_PHASE_3_BIT + SMART_EVENT_PHASE_4_BIT + SMART_EVENT_PHASE_5_BIT + SMART_EVENT_PHASE_6_BIT
};
const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
{
{SMART_EVENT_PHASE_1, SMART_EVENT_PHASE_1_BIT },
{SMART_EVENT_PHASE_2, SMART_EVENT_PHASE_2_BIT },
{SMART_EVENT_PHASE_3, SMART_EVENT_PHASE_3_BIT },
{SMART_EVENT_PHASE_4, SMART_EVENT_PHASE_4_BIT },
{SMART_EVENT_PHASE_5, SMART_EVENT_PHASE_5_BIT },
{SMART_EVENT_PHASE_6, SMART_EVENT_PHASE_6_BIT }
};
enum SMART_EVENT
{
SMART_EVENT_UPDATE_IC = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax
SMART_EVENT_UPDATE_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax
SMART_EVENT_HEALT_PCT = 2, // HPMin%, HPMax%, RepeatMin, RepeatMax
SMART_EVENT_MANA_PCT = 3, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
SMART_EVENT_AGGRO = 4, // NONE
SMART_EVENT_KILL = 5, // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3
SMART_EVENT_DEATH = 6, // NONE
SMART_EVENT_EVADE = 7, // NONE
SMART_EVENT_SPELLHIT = 8, // SpellID, School, CooldownMin, CooldownMax
SMART_EVENT_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax
SMART_EVENT_OOC_LOS = 10, // NoHostile, MaxRnage, CooldownMin, CooldownMax
SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId
SMART_EVENT_TARGET_HEALTH_PCT = 12, // HPMin%, HPMax%, RepeatMin, RepeatMax
SMART_EVENT_VICTIM_CASTING = 13, // RepeatMin, RepeatMax, spellid
SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax
SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax
SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax
SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax
SMART_EVENT_TARGET_MANA_PCT = 18, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID(0any)
SMART_EVENT_REWARD_QUEST = 20, // QuestID(0any)
SMART_EVENT_REACHED_HOME = 21, // NONE
SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3
SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax
SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax
SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn.
SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax
SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax
SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax
SMART_EVENT_CHARMED = 29, // NONE
SMART_EVENT_CHARMED_TARGET = 30, // NONE
SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax
SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax
SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax
SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID
SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax
SMART_EVENT_CORPSE_REMOVED = 36, // NONE
SMART_EVENT_AI_INIT = 37, // NONE
SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax
SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any)
SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE
SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any)
SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE
SMART_EVENT_TRANSPORT_RELOCATE = 44, // PointId
SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, // Team (0 any), CooldownMin, CooldownMax
SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, // TriggerId(0 any)
SMART_EVENT_QUEST_ACCEPTED = 47, // none
SMART_EVENT_QUEST_OBJ_COPLETETION = 48, // none
SMART_EVENT_QUEST_COMPLETION = 49, // none
SMART_EVENT_QUEST_REWARDED = 50, // none
SMART_EVENT_QUEST_FAIL = 51, // none
SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any)
SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax
SMART_EVENT_JUST_SUMMONED = 54, // none
SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any)
SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id
SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax
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
SMART_EVENT_GOSSIP_SELECT = 62, // menuID, actionID
SMART_EVENT_JUST_CREATED = 63, // none
SMART_EVENT_GOSSIP_HELLO = 64, // none
SMART_EVENT_FOLLOW_COMPLETED = 65, // none
SMART_EVENT_DUMMY_EFFECT = 66, // spellId, effectIndex
SMART_EVENT_IS_BEHIND_TARGET = 67, // cooldownMin, CooldownMax
SMART_EVENT_GAME_EVENT_START = 68, // game_event.Entry
SMART_EVENT_GAME_EVENT_END = 69, // game_event.Entry
SMART_EVENT_GO_STATE_CHANGED = 70, // go state
SMART_EVENT_GO_EVENT_INFORM = 71, // eventId
SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId)
SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit)
SMART_EVENT_FRIENDLY_HEALTH_PCT = 74, // minHpPct, maxHpPct, repeatMin, repeatMax
SMART_EVENT_END = 75
};
struct SmartEvent
{
SMART_EVENT type;
uint32 event_phase_mask;
uint32 event_chance;
uint32 event_flags;
union
{
struct
{
uint32 min;
uint32 max;
uint32 repeatMin;
uint32 repeatMax;
} minMaxRepeat;
struct
{
uint32 cooldownMin;
uint32 cooldownMax;
uint32 playerOnly;
uint32 creature;
} kill;
struct
{
uint32 spell;
uint32 school;
uint32 cooldownMin;
uint32 cooldownMax;
} spellHit;
struct
{
uint32 noHostile;
uint32 maxDist;
uint32 cooldownMin;
uint32 cooldownMax;
} los;
struct
{
uint32 type;
uint32 map;
uint32 area;
} respawn;
struct
{
uint32 repeatMin;
uint32 repeatMax;
} minMax;
struct
{
uint32 repeatMin;
uint32 repeatMax;
uint32 spellId;
} targetCasting;
struct
{
uint32 hpDeficit;
uint32 radius;
uint32 repeatMin;
uint32 repeatMax;
} friendlyHealth;
struct
{
uint32 radius;
uint32 repeatMin;
uint32 repeatMax;
} friendlyCC;
struct
{
uint32 spell;
uint32 radius;
uint32 repeatMin;
uint32 repeatMax;
} missingBuff;
struct
{
uint32 creature;
uint32 cooldownMin;
uint32 cooldownMax;
} summoned;
struct
{
uint32 quest;
} quest;
struct
{
uint32 emote;
uint32 cooldownMin;
uint32 cooldownMax;
} emote;
struct
{
uint32 spell;
uint32 count;
uint32 repeatMin;
uint32 repeatMax;
} aura;
struct
{
uint32 spell;
uint32 count;
uint32 repeatMin;
uint32 repeatMax;
} targetAura;
struct
{
uint32 type;
uint32 id;
} movementInform;
struct
{
uint32 id;
uint32 value;
uint32 cooldownMin;
uint32 cooldownMax;
} dataSet;
struct
{
uint32 pointID;
uint32 pathID;
} waypoint;
struct
{
uint32 creature;
} transportAddCreature;
struct
{
uint32 pointID;
} transportRelocate;
struct
{
uint32 team;
uint32 cooldownMin;
uint32 cooldownMax;
} instancePlayerEnter;
struct
{
uint32 id;
} areatrigger;
struct
{
uint32 textGroupID;
uint32 creatureEntry;
} textOver;
struct
{
uint32 id;
} timedEvent;
struct
{
uint32 sender;
uint32 action;
} gossip;
struct
{
uint32 spell;
uint32 effIndex;
} dummy;
struct
{
uint32 cooldownMin;
uint32 cooldownMax;
} behindTarget;
struct
{
uint32 gameEventId;
} gameEvent;
struct
{
uint32 state;
} goStateChanged;
struct
{
uint32 eventId;
} eventInform;
struct
{
uint32 eventId;
} doAction;
struct
{
uint32 minHpPct;
uint32 maxHpPct;
uint32 repeatMin;
uint32 repeatMax;
} friendlyHealthPct;
struct
{
uint32 param1;
uint32 param2;
uint32 param3;
uint32 param4;
} raw;
};
};
enum SMART_SCRIPT_RESPAWN_CONDITION
{
SMART_SCRIPT_RESPAWN_CONDITION_NONE = 0,
SMART_SCRIPT_RESPAWN_CONDITION_MAP = 1,
SMART_SCRIPT_RESPAWN_CONDITION_AREA = 2,
SMART_SCRIPT_RESPAWN_CONDITION_END = 3
};
enum SMART_ACTION
{
SMART_ACTION_NONE = 0, // No action
SMART_ACTION_TALK = 1, // groupID from creature_text, duration to wait before TEXT_OVER event is triggered
SMART_ACTION_SET_FACTION = 2, // FactionId (or 0 for default)
SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL = 3, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph)
SMART_ACTION_SOUND = 4, // SoundId, onlySelf
SMART_ACTION_PLAY_EMOTE = 5, // EmoteId
SMART_ACTION_FAIL_QUEST = 6, // QuestID
SMART_ACTION_ADD_QUEST = 7, // QuestID
SMART_ACTION_SET_REACT_STATE = 8, // state
SMART_ACTION_ACTIVATE_GOBJECT = 9, //
SMART_ACTION_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3...
SMART_ACTION_CAST = 11, // SpellId, CastFlags
SMART_ACTION_SUMMON_CREATURE = 12, // CreatureID, summonType, duration in ms, attackInvoker
SMART_ACTION_THREAT_SINGLE_PCT = 13, // Threat%
SMART_ACTION_THREAT_ALL_PCT = 14, // Threat%
SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS = 15, // QuestID
SMART_ACTION_UNUSED_16 = 16, // UNUSED
SMART_ACTION_SET_EMOTE_STATE = 17, // emoteID
SMART_ACTION_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target
SMART_ACTION_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target
SMART_ACTION_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking)
SMART_ACTION_ALLOW_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
SMART_ACTION_SET_EVENT_PHASE = 22, // Phase
SMART_ACTION_INC_EVENT_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
SMART_ACTION_EVADE = 24, // No Params
SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
// none = 27,
SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid, 0 removes all auras
SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event)
SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3...
SMART_ACTION_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax
SMART_ACTION_RESET_GOBJECT = 32, //
SMART_ACTION_CALL_KILLEDMONSTER = 33, // CreatureId,
SMART_ACTION_SET_INST_DATA = 34, // Field, Data
SMART_ACTION_SET_INST_DATA64 = 35, // Field,
SMART_ACTION_UPDATE_TEMPLATE = 36, // Entry, Team
SMART_ACTION_DIE = 37, // No Params
SMART_ACTION_SET_IN_COMBAT_WITH_ZONE = 38, // No Params
SMART_ACTION_CALL_FOR_HELP = 39, // Radius, With Emote
SMART_ACTION_SET_SHEATH = 40, // Sheath (0-unarmed, 1-melee, 2-ranged)
SMART_ACTION_FORCE_DESPAWN = 41, // timer
SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue(+pct, -flat)
SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to dismount)
SMART_ACTION_SET_INGAME_PHASE_MASK = 44, // mask
SMART_ACTION_SET_DATA = 45, // Field, Data (only creature @todo)
SMART_ACTION_MOVE_FORWARD = 46, // distance
SMART_ACTION_SET_VISIBILITY = 47, // on/off
SMART_ACTION_SET_ACTIVE = 48, // on/off
SMART_ACTION_ATTACK_START = 49, //
SMART_ACTION_SUMMON_GO = 50, // GameObjectID, DespawnTime in ms,
SMART_ACTION_KILL_UNIT = 51, //
SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID
SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState
SMART_ACTION_WP_PAUSE = 54, // time
SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail?
SMART_ACTION_ADD_ITEM = 56, // itemID, count
SMART_ACTION_REMOVE_ITEM = 57, // itemID, count
SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // AITemplateID
SMART_ACTION_SET_RUN = 59, // 0/1
SMART_ACTION_SET_FLY = 60, // 0/1
SMART_ACTION_SET_SWIM = 61, // 0/1
SMART_ACTION_TELEPORT = 62, // mapID,
SMART_ACTION_STORE_VARIABLE_DECIMAL = 63, // varID, number
SMART_ACTION_STORE_TARGET_LIST = 64, // varID,
SMART_ACTION_WP_RESUME = 65, // none
SMART_ACTION_SET_ORIENTATION = 66, //
SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
SMART_ACTION_PLAYMOVIE = 68, // entry
SMART_ACTION_MOVE_TO_POS = 69, // PointId, xyz
SMART_ACTION_RESPAWN_TARGET = 70, //
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
SMART_ACTION_CLOSE_GOSSIP = 72, // none
SMART_ACTION_TRIGGER_TIMED_EVENT = 73, // id(>1)
SMART_ACTION_REMOVE_TIMED_EVENT = 74, // id(>1)
SMART_ACTION_ADD_AURA = 75, // spellid, targets
SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // WARNING: CAN CRASH CORE, do not use if you dont know what you are doing
SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // none
SMART_ACTION_CALL_SCRIPT_RESET = 78, // none
SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle
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)
SMART_ACTION_SET_NPC_FLAG = 81, // Flags
SMART_ACTION_ADD_NPC_FLAG = 82, // Flags
SMART_ACTION_REMOVE_NPC_FLAG = 83, // Flags
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)
SMART_ACTION_INVOKER_CAST = 85, // spellID, castFlags, if avaliable, last used invoker will cast spellId with castFlags on targets
SMART_ACTION_CROSS_CAST = 86, // spellID, castFlags, CasterTargetType, CasterTarget param1, CasterTarget param2, CasterTarget param3, ( + the origonal target fields as Destination target), CasterTargets will cast spellID on all Targets (use with caution if targeting multiple * multiple units)
SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST = 87, // script9 ids 1-9
SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST = 88, // script9 id min, max
SMART_ACTION_RANDOM_MOVE = 89, // maxDist
SMART_ACTION_SET_UNIT_FIELD_ANIM_TIER = 90, // bytes, target
SMART_ACTION_REMOVE_UNIT_FIELD_ANIM_TIER = 91, // bytes, target
SMART_ACTION_INTERRUPT_SPELL = 92,
SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // anim id
SMART_ACTION_SET_DYNAMIC_FLAG = 94, // Flags
SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags
SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags
SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
SMART_ACTION_GO_SET_LOOT_STATE = 99, // state
SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id
SMART_ACTION_SET_HOME_POS = 101, // none
SMART_ACTION_SET_HEALTH_REGEN = 102, // 0/1
SMART_ACTION_SET_ROOT = 103, // off/on
SMART_ACTION_SET_GO_FLAG = 104, // Flags
SMART_ACTION_ADD_GO_FLAG = 105, // Flags
SMART_ACTION_REMOVE_GO_FLAG = 106, // Flags
SMART_ACTION_SUMMON_CREATURE_GROUP = 107, // Group, attackInvoker
SMART_ACTION_SET_POWER = 108, // PowerType, newPower
SMART_ACTION_ADD_POWER = 109, // PowerType, newPower
SMART_ACTION_REMOVE_POWER = 110, // PowerType, newPower
SMART_ACTION_GAME_EVENT_STOP = 111, // GameEventId
SMART_ACTION_GAME_EVENT_START = 112, // GameEventId
SMART_ACTION_SET_HEALTH = 113, // HealthMode, value.
SMART_ACTION_END = 114
};
struct SmartAction
{
SMART_ACTION type;
union
{
struct
{
uint32 textGroupID;
uint32 duration;
} talk;
struct
{
uint32 factionID;
} faction;
struct
{
uint32 creature;
uint32 model;
} morphOrMount;
struct
{
uint32 sound;
uint32 onlySelf;
} sound;
struct
{
uint32 emote;
} emote;
struct
{
uint32 quest;
} quest;
struct
{
uint32 state;
} react;
struct
{
uint32 emote1;
uint32 emote2;
uint32 emote3;
uint32 emote4;
uint32 emote5;
uint32 emote6;
} randomEmote;
struct
{
uint32 spell;
uint32 flags;
uint32 targetType;
uint32 targetParam1;
uint32 targetParam2;
uint32 targetParam3;
} cast;
struct
{
uint32 creature;
uint32 type;
uint32 duration;
uint32 attackInvoker;
} summonCreature;
struct
{
uint32 threatINC;
uint32 threatDEC;
} threatPCT;
struct
{
uint32 flag1;
uint32 flag2;
uint32 flag3;
uint32 flag4;
uint32 flag5;
uint32 flag6;
} addUnitFlag;
struct
{
uint32 flag1;
uint32 flag2;
uint32 flag3;
uint32 flag4;
uint32 flag5;
uint32 flag6;
} removeUnitFlag;
struct
{
uint32 attack;
} autoAttack;
struct
{
uint32 move;
} combatMove;
struct
{
uint32 phase;
} setEventPhase;
struct
{
uint32 inc;
uint32 dec;
} incEventPhase;
struct
{
uint32 spell;
} removeAura;
struct
{
uint32 dist;
uint32 angle;
uint32 entry;
uint32 credit;
uint32 creditType;
} follow;
struct
{
uint32 phase1;
uint32 phase2;
uint32 phase3;
uint32 phase4;
uint32 phase5;
uint32 phase6;
} randomPhase;
struct
{
uint32 phaseMin;
uint32 phaseMax;
} randomPhaseRange;
struct
{
uint32 creature;
} killedMonster;
struct
{
uint32 field;
uint32 data;
} setInstanceData;
struct
{
uint32 field;
} setInstanceData64;
struct
{
uint32 creature;
uint32 team;
} updateTemplate;
struct
{
uint32 range;
uint32 withEmote;
} callHelp;
struct
{
uint32 sheath;
} setSheath;
struct
{
uint32 delay;
} forceDespawn;
struct
{
uint32 minHP;
uint32 percent;
} invincHP;
struct
{
uint32 mask;
} ingamePhaseMask;
struct
{
uint32 field;
uint32 data;
} setData;
struct
{
uint32 distance;
} moveRandom;
struct
{
uint32 state;
} visibility;
struct
{
uint32 entry;
uint32 despawnTime;
} summonGO;
struct
{
uint32 state;
} active;
struct
{
uint32 id;
} taxi;
struct
{
uint32 run;
uint32 pathID;
uint32 repeat;
uint32 quest;
uint32 despawnTime;
uint32 reactState;
} wpStart;
struct
{
uint32 delay;
} wpPause;
struct
{
uint32 despawnTime;
uint32 quest;
uint32 fail;
} wpStop;
struct
{
uint32 entry;
uint32 count;
} item;
struct
{
uint32 id;
uint32 param1;
uint32 param2;
uint32 param3;
uint32 param4;
uint32 param5;
} installTtemplate;
struct
{
uint32 run;
} setRun;
struct
{
uint32 fly;
} setFly;
struct
{
uint32 swim;
} setSwim;
struct
{
uint32 mapID;
} teleport;
struct
{
uint32 id;
uint32 number;
} storeVar;
struct
{
uint32 id;
} storeTargets;
struct
{
uint32 id;
uint32 min;
uint32 max;
uint32 repeatMin;
uint32 repeatMax;
uint32 chance;
} timeEvent;
struct
{
uint32 entry;
} movie;
struct
{
uint32 entry;
uint32 mask;
uint32 slot1;
uint32 slot2;
uint32 slot3;
} equip;
struct
{
uint32 flag;
uint32 type;
} unitFlag;
struct
{
uint32 byte1;
uint32 type;
} setunitByte;
struct
{
uint32 byte1;
uint32 type;
} delunitByte;
struct
{
uint32 seat;
} enterVehicle;
struct
{
uint32 id;
uint32 timerType;
} timedActionList;
struct
{
uint32 entry1;
uint32 entry2;
uint32 entry3;
uint32 entry4;
uint32 entry5;
uint32 entry6;
} randTimedActionList;
struct
{
uint32 withDelayed;
uint32 spell_id;
uint32 withInstant;
} interruptSpellCasting;
struct
{
uint32 anim;
} sendGoCustomAnim;
struct
{
uint32 speedxy;
uint32 speedz;
} jump;
struct
{
uint32 withEmote;
} flee;
struct
{
uint32 goRespawnTime;
} RespawnTarget;
struct
{
uint32 pointId;
uint32 transport;
} MoveToPos;
struct
{
uint32 gossipMenuId;
uint32 gossipNpcTextId;
} sendGossipMenu;
struct
{
uint32 state;
} setGoLootState;
struct
{
uint32 id;
} sendTargetToTarget;
struct
{
uint32 distance;
uint32 angle;
} setRangedMovement;
struct
{
uint32 regenHealth;
} setHealthRegen;
struct
{
uint32 root;
} setRoot;
struct
{
uint32 flag;
} goFlag;
struct
{
uint32 group;
uint32 attackInvoker;
} creatureGroup;
struct
{
uint32 powerType;
uint32 newPower;
} power;
struct
{
uint32 id;
} gameEventStop;
struct
{
uint32 id;
} gameEventStart;
struct
{
uint32 healthpoint;
uint32 healthpointmod;
int32 healthpointpercent;
} sethealthpointorpercent;
//! Note for any new future actions
//! All parameters must have type uint32
struct
{
uint32 param1;
uint32 param2;
uint32 param3;
uint32 param4;
uint32 param5;
uint32 param6;
} raw;
};
};
enum SMARTAI_TEMPLATE
{
SMARTAI_TEMPLATE_BASIC = 0, //nothing is preset
SMARTAI_TEMPLATE_CASTER = 1, //spellid, repeatMin, repeatMax, range, manaPCT +JOIN: target_param1 as castFlag
SMARTAI_TEMPLATE_TURRET = 2, //spellid, repeatMin, repeatMax +JOIN: target_param1 as castFlag
SMARTAI_TEMPLATE_PASSIVE = 3,