AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SmartAIMgr Class Reference

#include "SmartScriptMgr.h"

Public Member Functions

 ~SmartAIMgr ()
 
void LoadSmartAIFromDB ()
 
SmartAIEventList GetScript (int32 entry, SmartScriptType type)
 

Static Public Member Functions

static SmartAIMgrinstance ()
 

Private Member Functions

 SmartAIMgr ()
 
bool IsEventValid (SmartScriptHolder &e)
 
bool IsTargetValid (SmartScriptHolder const &e)
 
bool IsMinMaxValid (SmartScriptHolder const &e, uint32 min, uint32 max)
 
bool NotNULL (SmartScriptHolder const &e, uint32 data)
 
bool IsCreatureValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsQuestValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsGameObjectValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsSpellValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsItemValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsTextEmoteValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsEmoteValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsAreaTriggerValid (SmartScriptHolder const &e, uint32 entry)
 
bool IsSoundValid (SmartScriptHolder const &e, uint32 entry)
 

Static Private Member Functions

static bool EventHasInvoker (SMART_EVENT event)
 
static bool IsTextValid (SmartScriptHolder const &e, uint32 id)
 
static bool CheckUnusedEventParams (SmartScriptHolder const &e)
 
static bool CheckUnusedActionParams (SmartScriptHolder const &e)
 
static bool CheckUnusedTargetParams (SmartScriptHolder const &e)
 

Private Attributes

SmartAIEventMap mEventMap [SMART_SCRIPT_TYPE_MAX]
 

Detailed Description

Constructor & Destructor Documentation

◆ SmartAIMgr()

SmartAIMgr::SmartAIMgr ( )
inlineprivate
1983{};

◆ ~SmartAIMgr()

SmartAIMgr::~SmartAIMgr ( )
inline
1985{};

Member Function Documentation

◆ CheckUnusedActionParams()

bool SmartAIMgr::CheckUnusedActionParams ( SmartScriptHolder const &  e)
staticprivate
617{
618 size_t paramsStructSize = [&]() -> size_t
619 {
620 constexpr size_t NO_PARAMS = size_t(0);
621 switch (e.action.type)
622 {
623 case SMART_ACTION_NONE: return NO_PARAMS;
624 case SMART_ACTION_TALK: return sizeof(SmartAction::talk);
627 case SMART_ACTION_SOUND: return sizeof(SmartAction::sound);
628 case SMART_ACTION_PLAY_EMOTE: return sizeof(SmartAction::emote);
629 case SMART_ACTION_FAIL_QUEST: return sizeof(SmartAction::quest);
632 case SMART_ACTION_ACTIVATE_GOBJECT: return NO_PARAMS;
634 case SMART_ACTION_CAST: return sizeof(SmartAction::cast);
639 case SMART_ACTION_RESERVED_16: return sizeof(SmartAction::raw);
647 case SMART_ACTION_EVADE: return NO_PARAMS;
650 case SMART_ACTION_COMBAT_STOP: return NO_PARAMS;
652 case SMART_ACTION_FOLLOW: return sizeof(SmartAction::follow);
655 case SMART_ACTION_RESET_GOBJECT: return NO_PARAMS;
660 case SMART_ACTION_DIE: return sizeof(SmartAction::die);
661 case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: return NO_PARAMS;
668 case SMART_ACTION_SET_DATA: return sizeof(SmartAction::setData);
670 case SMART_ACTION_ATTACK_STOP: return NO_PARAMS;
673 case SMART_ACTION_ATTACK_START: return NO_PARAMS;
675 case SMART_ACTION_KILL_UNIT: return NO_PARAMS;
677 case SMART_ACTION_WP_START: return sizeof(SmartAction::wpStart);
678 case SMART_ACTION_WP_PAUSE: return sizeof(SmartAction::wpPause);
679 case SMART_ACTION_WP_STOP: return sizeof(SmartAction::wpStop);
680 case SMART_ACTION_ADD_ITEM: return sizeof(SmartAction::item);
681 case SMART_ACTION_REMOVE_ITEM: return sizeof(SmartAction::item);
683 case SMART_ACTION_SET_RUN: return sizeof(SmartAction::setRun);
684 case SMART_ACTION_SET_FLY: return sizeof(SmartAction::setFly);
685 case SMART_ACTION_SET_SWIM: return sizeof(SmartAction::setSwim);
686 case SMART_ACTION_TELEPORT: return sizeof(SmartAction::teleport);
689 case SMART_ACTION_WP_RESUME: return NO_PARAMS;
692 case SMART_ACTION_PLAYMOVIE: return sizeof(SmartAction::movie);
695 case SMART_ACTION_EQUIP: return sizeof(SmartAction::equip);
696 case SMART_ACTION_CLOSE_GOSSIP: return NO_PARAMS;
699 case SMART_ACTION_ADD_AURA: return sizeof(SmartAction::addAura);
700 case SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT: return NO_PARAMS;
701 case SMART_ACTION_RESET_SCRIPT_BASE_OBJECT: return NO_PARAMS;
702 case SMART_ACTION_CALL_SCRIPT_RESET: return NO_PARAMS;
705 case SMART_ACTION_SET_NPC_FLAG: return sizeof(SmartAction::flag);
706 case SMART_ACTION_ADD_NPC_FLAG: return sizeof(SmartAction::flag);
709 case SMART_ACTION_SELF_CAST: return sizeof(SmartAction::cast);
710 case SMART_ACTION_INVOKER_CAST: return sizeof(SmartAction::cast);
722 case SMART_ACTION_JUMP_TO_POS: return sizeof(SmartAction::jump);
728 case SMART_ACTION_SET_ROOT: return sizeof(SmartAction::setRoot);
733 case SMART_ACTION_SET_POWER: return sizeof(SmartAction::power);
734 case SMART_ACTION_ADD_POWER: return sizeof(SmartAction::power);
744 // case SMART_ACTION_SET_CAN_FLY: return sizeof(SmartAction::setFly);
745 // case SMART_ACTION_REMOVE_AURAS_BY_TYPE: return sizeof(SmartAction::auraType);
747 case SMART_ACTION_FLEE: return sizeof(SmartAction::flee);
748 case SMART_ACTION_ADD_THREAT: return sizeof(SmartAction::threat);
751 case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: return NO_PARAMS;
752 // case SMART_ACTION_PAUSE_MOVEMENT: return sizeof(SmartAction::pauseMovement);
753 case SMART_ACTION_PLAY_ANIMKIT: return sizeof(SmartAction::raw);
754 case SMART_ACTION_SCENE_PLAY: return sizeof(SmartAction::raw);
755 case SMART_ACTION_SCENE_CANCEL: return sizeof(SmartAction::raw);
756 // case SMART_ACTION_SPAWN_SPAWNGROUP: return sizeof(SmartAction::groupSpawn);
757 // case SMART_ACTION_DESPAWN_SPAWNGROUP: return sizeof(SmartAction::groupSpawn);
758 // case SMART_ACTION_RESPAWN_BY_SPAWNID: return sizeof(SmartAction::respawnData);
761 // case SMART_ACTION_PLAY_SPELL_VISUAL_KIT: return sizeof(SmartAction::raw);
762 // case SMART_ACTION_OVERRIDE_LIGHT: return sizeof(SmartAction::overrideLight);
763 // case SMART_ACTION_OVERRIDE_WEATHER: return sizeof(SmartAction::overrideWeather);
764 // case SMART_ACTION_SET_AI_ANIM_KIT: return sizeof(SmartAction::raw);
767 // case SMART_ACTION_CREATE_CONVERSATION: return sizeof(SmartAction::raw);
769 case SMART_ACTION_EXIT_VEHICLE: return NO_PARAMS;
773 case SMART_ACTION_FALL: return NO_PARAMS;
776 case SMART_ACTION_NO_ENVIRONMENT_UPDATE: return NO_PARAMS;
777 case SMART_ACTION_ZONE_UNDER_ATTACK: return NO_PARAMS;
778 case SMART_ACTION_LOAD_GRID: return NO_PARAMS;
779 case SMART_ACTION_MUSIC: return sizeof(SmartAction::music);
780 case SMART_ACTION_SET_GUID: return sizeof(SmartAction::setGuid);
781 case SMART_ACTION_DISABLE: return sizeof(SmartAction::disable);
785 default:
786 LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.",
787 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
788 return sizeof(SmartAction::raw);
789 }
790 }();
791
792 static size_t rawCount = sizeof(SmartAction::raw) / sizeof(uint32);
793 size_t paramsCount = paramsStructSize / sizeof(uint32);
794
795 bool valid = true;
796 for (size_t index = paramsCount; index < rawCount; index++)
797 {
798 uint32 value = ((uint32*)&e.action.raw)[index];
799 if (value != 0)
800 {
801 LOG_ERROR("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} has unused action_param{} with value {}, it must be 0, skipped.",
802 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), index + 1, value);
803 valid = false;
804 }
805 }
806
807 return valid;
808}
std::uint32_t uint32
Definition: Define.h:108
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
@ SMART_ACTION_REMOVE_TIMED_EVENT
Definition: SmartScriptMgr.h:644
@ SMART_ACTION_NONE
Definition: SmartScriptMgr.h:570
@ SMART_ACTION_SET_GO_FLAG
Definition: SmartScriptMgr.h:674
@ SMART_ACTION_WP_RESUME
Definition: SmartScriptMgr.h:635
@ SMART_ACTION_UPDATE_TEMPLATE
Definition: SmartScriptMgr.h:606
@ SMART_ACTION_STORE_TARGET_LIST
Definition: SmartScriptMgr.h:634
@ SMART_ACTION_SET_HEALTH_REGEN
Definition: SmartScriptMgr.h:672
@ SMART_ACTION_ACTIVATE_GOBJECT
Definition: SmartScriptMgr.h:579
@ SMART_ACTION_FORCE_DESPAWN
Definition: SmartScriptMgr.h:611
@ SMART_ACTION_GAME_EVENT_START
Definition: SmartScriptMgr.h:682
@ SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST
Definition: SmartScriptMgr.h:658
@ SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1
Definition: SmartScriptMgr.h:661
@ SMART_ACTION_SET_INST_DATA64
Definition: SmartScriptMgr.h:605
@ SMART_ACTION_SET_FACTION
Definition: SmartScriptMgr.h:572
@ SMART_ACTION_THREAT_SINGLE_PCT
Definition: SmartScriptMgr.h:583
@ SMART_ACTION_OFFER_QUEST
Definition: SmartScriptMgr.h:577
@ SMART_ACTION_REMOVE_ALL_GAMEOBJECTS
Definition: SmartScriptMgr.h:696
@ SMART_ACTION_RISE_UP
Definition: SmartScriptMgr.h:684
@ SMART_ACTION_SET_INGAME_PHASE_MASK
Definition: SmartScriptMgr.h:614
@ SMART_ACTION_SET_UNIT_FIELD_BYTES_1
Definition: SmartScriptMgr.h:660
@ SMART_ACTION_CLOSE_GOSSIP
Definition: SmartScriptMgr.h:642
@ SMART_ACTION_RESERVED_16
Definition: SmartScriptMgr.h:586
@ SMART_ACTION_DISABLE_EVADE
Definition: SmartScriptMgr.h:687
@ SMART_ACTION_ADD_GO_FLAG
Definition: SmartScriptMgr.h:675
@ SMART_ACTION_ADD_DYNAMIC_FLAG
Definition: SmartScriptMgr.h:665
@ SMART_ACTION_KILL_UNIT
Definition: SmartScriptMgr.h:621
@ SMART_ACTION_LOAD_EQUIPMENT
Definition: SmartScriptMgr.h:694
@ SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS
Definition: SmartScriptMgr.h:585
@ SMART_ACTION_ATTACK_START
Definition: SmartScriptMgr.h:619
@ SMART_ACTION_SET_UNIT_FLAG
Definition: SmartScriptMgr.h:588
@ SMART_ACTION_NO_ENVIRONMENT_UPDATE
Definition: SmartScriptMgr.h:727
@ SMART_ACTION_CALL_GROUPEVENTHAPPENS
Definition: SmartScriptMgr.h:596
@ SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL
Definition: SmartScriptMgr.h:613
@ SMART_ACTION_INVOKER_CAST
Definition: SmartScriptMgr.h:704
@ SMART_ACTION_SCENE_PLAY
Definition: SmartScriptMgr.h:699
@ SMART_ACTION_SET_SCALE
Definition: SmartScriptMgr.h:742
@ SMART_ACTION_JUMP_TO_POS
Definition: SmartScriptMgr.h:667
@ SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST
Definition: SmartScriptMgr.h:657
@ SMART_ACTION_SEND_GOSSIP_MENU
Definition: SmartScriptMgr.h:668
@ SMART_ACTION_SET_COUNTER
Definition: SmartScriptMgr.h:633
@ SMART_ACTION_FLEE_FOR_ASSIST
Definition: SmartScriptMgr.h:595
@ SMART_ACTION_EQUIP
Definition: SmartScriptMgr.h:641
@ SMART_ACTION_SET_ROOT
Definition: SmartScriptMgr.h:673
@ SMART_ACTION_ATTACK_STOP
Definition: SmartScriptMgr.h:739
@ SMART_ACTION_SUMMON_GO
Definition: SmartScriptMgr.h:620
@ SMART_ACTION_SET_HOVER
Definition: SmartScriptMgr.h:721
@ SMART_ACTION_WP_PAUSE
Definition: SmartScriptMgr.h:624
@ SMART_ACTION_SIMPLE_TALK
Definition: SmartScriptMgr.h:654
@ SMART_ACTION_STOP_MOTION
Definition: SmartScriptMgr.h:726
@ SMART_ACTION_CAST
Definition: SmartScriptMgr.h:581
@ SMART_ACTION_MUSIC
Definition: SmartScriptMgr.h:730
@ SMART_ACTION_ALLOW_COMBAT_MOVEMENT
Definition: SmartScriptMgr.h:591
@ SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS
Definition: SmartScriptMgr.h:718
@ SMART_ACTION_ADD_AURA
Definition: SmartScriptMgr.h:645
@ SMART_ACTION_THREAT_ALL_PCT
Definition: SmartScriptMgr.h:584
@ SMART_ACTION_RESPAWN_TARGET
Definition: SmartScriptMgr.h:640
@ SMART_ACTION_SOUND
Definition: SmartScriptMgr.h:574
@ SMART_ACTION_MOVE_TO_POS_TARGET
Definition: SmartScriptMgr.h:715
@ SMART_ACTION_SET_MOVEMENT_SPEED
Definition: SmartScriptMgr.h:706
@ SMART_ACTION_PLAY_CINEMATIC
Definition: SmartScriptMgr.h:705
@ SMART_ACTION_ADD_NPC_FLAG
Definition: SmartScriptMgr.h:652
@ SMART_ACTION_EVADE
Definition: SmartScriptMgr.h:594
@ SMART_ACTION_FAIL_QUEST
Definition: SmartScriptMgr.h:576
@ SMART_ACTION_INTERRUPT_SPELL
Definition: SmartScriptMgr.h:662
@ SMART_ACTION_ADD_POWER
Definition: SmartScriptMgr.h:679
@ SMART_ACTION_REMOVE_DYNAMIC_FLAG
Definition: SmartScriptMgr.h:666
@ SMART_ACTION_RANDOM_SOUND
Definition: SmartScriptMgr.h:685
@ SMART_ACTION_SET_COMBAT_DISTANCE
Definition: SmartScriptMgr.h:719
@ SMART_ACTION_SCENE_CANCEL
Definition: SmartScriptMgr.h:700
@ SMART_ACTION_SET_POWER
Definition: SmartScriptMgr.h:678
@ SMART_ACTION_MOVE_FORWARD
Definition: SmartScriptMgr.h:616
@ SMART_ACTION_SEND_TARGET_TO_TARGET
Definition: SmartScriptMgr.h:670
@ SMART_ACTION_REMOVE_POWER
Definition: SmartScriptMgr.h:680
@ SMART_ACTION_SET_DYNAMIC_FLAG
Definition: SmartScriptMgr.h:664
@ SMART_ACTION_FALL
Definition: SmartScriptMgr.h:724
@ SMART_ACTION_GO_SET_GO_STATE
Definition: SmartScriptMgr.h:688
@ SMART_ACTION_REMOVE_ITEM
Definition: SmartScriptMgr.h:627
@ SMART_ACTION_SEND_GO_CUSTOM_ANIM
Definition: SmartScriptMgr.h:663
@ SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL
Definition: SmartScriptMgr.h:573
@ SMART_ACTION_REMOVE_UNIT_FLAG
Definition: SmartScriptMgr.h:589
@ SMART_ACTION_RANDOM_PHASE
Definition: SmartScriptMgr.h:600
@ SMART_ACTION_SET_EMOTE_STATE
Definition: SmartScriptMgr.h:587
@ SMART_ACTION_CROSS_CAST
Definition: SmartScriptMgr.h:656
@ SMART_ACTION_WP_STOP
Definition: SmartScriptMgr.h:625
@ SMART_ACTION_GAME_EVENT_STOP
Definition: SmartScriptMgr.h:681
@ SMART_ACTION_CALL_KILLEDMONSTER
Definition: SmartScriptMgr.h:603
@ SMART_ACTION_TALK
Definition: SmartScriptMgr.h:571
@ SMART_ACTION_CALL_SCRIPT_RESET
Definition: SmartScriptMgr.h:648
@ SMART_ACTION_SET_DATA
Definition: SmartScriptMgr.h:615
@ SMART_ACTION_WP_START
Definition: SmartScriptMgr.h:623
@ SMART_ACTION_COMBAT_STOP
Definition: SmartScriptMgr.h:597
@ SMART_ACTION_EXIT_VEHICLE
Definition: SmartScriptMgr.h:717
@ SMART_ACTION_SET_RUN
Definition: SmartScriptMgr.h:629
@ SMART_ACTION_SET_HEALTH_PCT
Definition: SmartScriptMgr.h:708
@ SMART_ACTION_AUTO_ATTACK
Definition: SmartScriptMgr.h:590
@ SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL
Definition: SmartScriptMgr.h:612
@ SMART_ACTION_SET_VISIBILITY
Definition: SmartScriptMgr.h:617
@ SMART_ACTION_RANDOM_PHASE_RANGE
Definition: SmartScriptMgr.h:601
@ SMART_ACTION_GO_SET_LOOT_STATE
Definition: SmartScriptMgr.h:669
@ SMART_ACTION_SELF_CAST
Definition: SmartScriptMgr.h:655
@ SMART_ACTION_SET_SWIM
Definition: SmartScriptMgr.h:631
@ SMART_ACTION_SET_SIGHT_DIST
Definition: SmartScriptMgr.h:691
@ SMART_ACTION_SET_INST_DATA
Definition: SmartScriptMgr.h:604
@ SMART_ACTION_PLAY_ANIMKIT
Definition: SmartScriptMgr.h:698
@ SMART_ACTION_REMOVE_GO_FLAG
Definition: SmartScriptMgr.h:676
@ SMART_ACTION_LOAD_GRID
Definition: SmartScriptMgr.h:729
@ SMART_ACTION_CALL_FOR_HELP
Definition: SmartScriptMgr.h:609
@ SMART_ACTION_SUMMON_RADIAL
Definition: SmartScriptMgr.h:743
@ SMART_ACTION_ADD_THREAT
Definition: SmartScriptMgr.h:693
@ SMART_ACTION_TELEPORT
Definition: SmartScriptMgr.h:632
@ SMART_ACTION_PLAYMOVIE
Definition: SmartScriptMgr.h:638
@ SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT
Definition: SmartScriptMgr.h:695
@ SMART_ACTION_FOLLOW
Definition: SmartScriptMgr.h:599
@ SMART_ACTION_PLAY_EMOTE
Definition: SmartScriptMgr.h:575
@ SMART_ACTION_SET_EVENT_PHASE
Definition: SmartScriptMgr.h:592
@ SMART_ACTION_SET_CORPSE_DELAY
Definition: SmartScriptMgr.h:686
@ SMART_ACTION_SET_GUID
Definition: SmartScriptMgr.h:740
@ SMART_ACTION_SET_SHEATH
Definition: SmartScriptMgr.h:610
@ SMART_ACTION_SET_ORIENTATION
Definition: SmartScriptMgr.h:636
@ SMART_ACTION_SET_NPC_FLAG
Definition: SmartScriptMgr.h:651
@ SMART_ACTION_MOVE_TO_POS
Definition: SmartScriptMgr.h:639
@ SMART_ACTION_RANDOM_EMOTE
Definition: SmartScriptMgr.h:580
@ SMART_ACTION_INC_EVENT_PHASE
Definition: SmartScriptMgr.h:593
@ SMART_ACTION_CREATE_TIMED_EVENT
Definition: SmartScriptMgr.h:637
@ SMART_ACTION_SET_EVENT_FLAG_RESET
Definition: SmartScriptMgr.h:725
@ SMART_ACTION_DIE
Definition: SmartScriptMgr.h:607
@ SMART_ACTION_RESET_SCRIPT_BASE_OBJECT
Definition: SmartScriptMgr.h:647
@ SMART_ACTION_REMOVE_NPC_FLAG
Definition: SmartScriptMgr.h:653
@ SMART_ACTION_SET_FLY
Definition: SmartScriptMgr.h:630
@ SMART_ACTION_INSTALL_AI_TEMPLATE
Definition: SmartScriptMgr.h:628
@ SMART_ACTION_SUMMON_CREATURE
Definition: SmartScriptMgr.h:582
@ SMART_ACTION_RESET_GOBJECT
Definition: SmartScriptMgr.h:602
@ SMART_ACTION_CALL_TIMED_ACTIONLIST
Definition: SmartScriptMgr.h:650
@ SMART_ACTION_SET_IN_COMBAT_WITH_ZONE
Definition: SmartScriptMgr.h:608
@ SMART_ACTION_SET_HOME_POS
Definition: SmartScriptMgr.h:671
@ SMART_ACTION_ADD_ITEM
Definition: SmartScriptMgr.h:626
@ SMART_ACTION_SET_ACTIVE
Definition: SmartScriptMgr.h:618
@ SMART_ACTION_SET_RANGED_MOVEMENT
Definition: SmartScriptMgr.h:649
@ SMART_ACTION_ACTIVATE_TAXI
Definition: SmartScriptMgr.h:622
@ SMART_ACTION_DISABLE
Definition: SmartScriptMgr.h:741
@ SMART_ACTION_START_CLOSEST_WAYPOINT
Definition: SmartScriptMgr.h:683
@ SMART_ACTION_SET_CASTER_COMBAT_DIST
Definition: SmartScriptMgr.h:720
@ SMART_ACTION_SUMMON_CREATURE_GROUP
Definition: SmartScriptMgr.h:677
@ SMART_ACTION_PLAY_SPELL_VISUAL
Definition: SmartScriptMgr.h:744
@ SMART_ACTION_SET_REACT_STATE
Definition: SmartScriptMgr.h:578
@ SMART_ACTION_RANDOM_MOVE
Definition: SmartScriptMgr.h:659
@ SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT
Definition: SmartScriptMgr.h:646
@ SMART_ACTION_TRIGGER_TIMED_EVENT
Definition: SmartScriptMgr.h:643
@ SMART_ACTION_REMOVEAURASFROMSPELL
Definition: SmartScriptMgr.h:598
@ SMART_ACTION_FLEE
Definition: SmartScriptMgr.h:692
@ SMART_ACTION_ZONE_UNDER_ATTACK
Definition: SmartScriptMgr.h:728
struct SmartAction::@77::@181 corpseDelay
struct SmartAction::@77::@150 RespawnTarget
struct SmartAction::@77::@116 invincHP
struct SmartAction::@77::@164 closestWaypointFromList
struct SmartAction::@77::@91 randomEmote
struct SmartAction::@77::@165 combatDistance
struct SmartAction::@77::@112 die
SAIBool disable
Definition: SmartScriptMgr.h:1393
struct SmartAction::@77::@159 goState
struct SmartAction::@77::@92 cast
struct SmartAction::@77::@98 threat
struct SmartAction::@77::@97 threatPCT
struct SmartAction::@77::@115 forceDespawn
struct SmartAction::@77::@188 radialSummon
struct SmartAction::@77::@147 jump
struct SmartAction::@77::@101 setEventPhase
uint32 quest
Definition: SmartScriptMgr.h:831
struct SmartAction::@77::@134 storeTargets
struct SmartAction::@77::@118 setData
struct SmartAction::@77::@167 casterDistance
struct SmartAction::@77::@138 unitFlag
struct SmartAction::@77::@121 setActive
struct SmartAction::@77::@122 summonGO
struct SmartAction::@77::@173 orientation
struct SmartAction::@77::@152 sendGossipMenu
struct SmartAction::@77::@113 callHelp
struct SmartAction::@77::@142 timedActionList
struct SmartAction::@77::@79 talk
struct SmartAction::@77::@136 movie
struct SmartAction::@77::@106 randomPhase
struct SmartAction::@77::@107 randomPhaseRange
struct SmartAction::@77::@141 delunitByte
struct SmartAction::@77::@146 sendGoCustomAnim
struct SmartAction::@77::@161 power
struct SmartAction::@77::@84 randomSound
struct SmartAction::@77::@143 randTimedActionList
struct SmartAction::@77::@96 summonCreature
struct SmartAction::@77::@130 setFly
struct SmartAction::@77::@99 autoAttack
struct SmartAction::@77::@135 timeEvent
struct SmartAction::@77::@123 taxi
struct SmartAction::@77::@140 setunitByte
struct SmartAction::@77::@170 randomTimedEvent
struct SmartAction::@77::@117 ingamePhaseMask
struct SmartAction::@77::@155 setRangedMovement
struct SmartAction::@77::@162 gameEventStop
struct SmartAction::@77::@184 cinematic
struct SmartAction::@77::@93 crossCast
struct SmartAction::@77::@108 killedMonster
struct SmartAction::@77::@109 setInstanceData
uint32 flag
Definition: SmartScriptMgr.h:1140
struct SmartAction::@77::@189 spellVisual
struct SmartAction::@77::@127 item
struct SmartAction::@77::@160 creatureGroup
struct SmartAction::@77::@149 flee
struct SmartAction::@77::@148 movementFlag
struct SmartAction::@77::@110 setInstanceData64
struct SmartAction::@77::@111 updateTemplate
struct SmartAction::@77::@151 moveToPos
struct SmartAction::@77::@169 loadEquipment
struct SmartAction::@77::@120 visibility
struct SmartAction::@77::@104 removeAura
struct SmartAction::@77::@182 movementSpeed
struct SmartAction::@77::@180 disableEvade
struct SmartAction::@77::@105 follow
struct SmartAction::@77::@89 questOffer
struct SmartAction::@77::@166 sightDistance
struct SmartAction::@77::@124 wpStart
struct SmartAction::@77::@102 incEventPhase
struct SmartAction::@77::@126 wpStop
struct SmartAction::@77::@163 gameEventStart
struct SmartAction::@77::@144 randRangeTimedActionList
struct SmartAction::@77::@128 installTtemplate
struct SmartAction::@77::@129 setRun
struct SmartAction::@77::@114 setSheath
struct SmartAction::@77::@185 setGuid
struct SmartAction::@77::@80 simpleTalk
struct SmartAction::@77::@168 setHomePos
struct SmartAction::@77::@154 sendTargetToTarget
struct SmartAction::@77::@82 morphOrMount
struct SmartAction::@77::@157 setRoot
struct SmartAction::@77::@190 raw
struct SmartAction::@77::@174 stopMotion
struct SmartAction::@77::@145 interruptSpellCasting
struct SmartAction::@77::@119 moveRandom
struct SmartAction::@77::@153 setGoLootState
struct SmartAction::@77::@183 setHealthPct
uint32 sound
Definition: SmartScriptMgr.h:792
struct SmartAction::@77::@158 goFlag
struct SmartAction::@77::@171 setHover
struct SmartAction::@77::@103 addAura
struct SmartAction::@77::@100 combatMove
struct SmartAction::@77::@131 setSwim
struct SmartAction::@77::@156 setHealthRegen
struct SmartAction::@77::@137 equip
struct SmartAction::@77::@125 wpPause
struct SmartAction::@77::@81 faction
struct SmartAction::@77::@132 teleport
struct SmartAction::@77::@90 react
struct SmartAction::@77::@187 setScale
uint32 emote
Definition: SmartScriptMgr.h:826
struct SmartAction::@77::@133 setCounter
struct SmartAction::@77::@85 music

References SmartScriptHolder::action, SmartAction::addAura, SmartAction::autoAttack, SmartAction::callHelp, SmartAction::cast, SmartAction::casterDistance, SmartAction::cinematic, SmartAction::closestWaypointFromList, SmartAction::combatDistance, SmartAction::combatMove, SmartAction::corpseDelay, SmartAction::creatureGroup, SmartAction::crossCast, SmartAction::delunitByte, SmartAction::die, SmartAction::disable, SmartAction::disableEvade, SmartAction::emote, SmartScriptHolder::entryOrGuid, SmartAction::equip, SmartScriptHolder::event_id, SmartAction::faction, SmartAction::flag, SmartAction::flee, SmartAction::follow, SmartAction::forceDespawn, SmartAction::gameEventStart, SmartAction::gameEventStop, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), SmartAction::goFlag, SmartAction::goState, SmartAction::incEventPhase, SmartAction::ingamePhaseMask, SmartAction::installTtemplate, SmartAction::interruptSpellCasting, SmartAction::invincHP, SmartAction::item, SmartAction::jump, SmartAction::killedMonster, SmartAction::loadEquipment, LOG_ERROR, LOG_WARN, SmartAction::morphOrMount, SmartAction::movementFlag, SmartAction::movementSpeed, SmartAction::moveRandom, SmartAction::moveToPos, SmartAction::movie, SmartAction::music, SmartAction::orientation, SmartAction::power, SmartAction::quest, SmartAction::questOffer, SmartAction::radialSummon, SmartAction::randomEmote, SmartAction::randomPhase, SmartAction::randomPhaseRange, SmartAction::randomSound, SmartAction::randomTimedEvent, SmartAction::randRangeTimedActionList, SmartAction::randTimedActionList, SmartAction::raw, SmartAction::react, SmartAction::removeAura, SmartAction::RespawnTarget, SmartAction::sendGoCustomAnim, SmartAction::sendGossipMenu, SmartAction::sendTargetToTarget, SmartAction::setActive, SmartAction::setCounter, SmartAction::setData, SmartAction::setEventPhase, SmartAction::setFly, SmartAction::setGoLootState, SmartAction::setGuid, SmartAction::setHealthPct, SmartAction::setHealthRegen, SmartAction::setHomePos, SmartAction::setHover, SmartAction::setInstanceData, SmartAction::setInstanceData64, SmartAction::setRangedMovement, SmartAction::setRoot, SmartAction::setRun, SmartAction::setScale, SmartAction::setSheath, SmartAction::setSwim, SmartAction::setunitByte, SmartAction::sightDistance, SmartAction::simpleTalk, SMART_ACTION_ACTIVATE_GOBJECT, SMART_ACTION_ACTIVATE_TAXI, SMART_ACTION_ADD_AURA, SMART_ACTION_ADD_DYNAMIC_FLAG, SMART_ACTION_ADD_GO_FLAG, SMART_ACTION_ADD_ITEM, SMART_ACTION_ADD_NPC_FLAG, SMART_ACTION_ADD_POWER, SMART_ACTION_ADD_THREAT, SMART_ACTION_ALLOW_COMBAT_MOVEMENT, SMART_ACTION_ATTACK_START, SMART_ACTION_ATTACK_STOP, SMART_ACTION_AUTO_ATTACK, SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS, SMART_ACTION_CALL_FOR_HELP, SMART_ACTION_CALL_GROUPEVENTHAPPENS, SMART_ACTION_CALL_KILLEDMONSTER, SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST, SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST, SMART_ACTION_CALL_SCRIPT_RESET, SMART_ACTION_CALL_TIMED_ACTIONLIST, SMART_ACTION_CAST, SMART_ACTION_CLOSE_GOSSIP, SMART_ACTION_COMBAT_STOP, SMART_ACTION_CREATE_TIMED_EVENT, SMART_ACTION_CROSS_CAST, SMART_ACTION_DIE, SMART_ACTION_DISABLE, SMART_ACTION_DISABLE_EVADE, SMART_ACTION_EQUIP, SMART_ACTION_EVADE, SMART_ACTION_EXIT_VEHICLE, SMART_ACTION_FAIL_QUEST, SMART_ACTION_FALL, SMART_ACTION_FLEE, SMART_ACTION_FLEE_FOR_ASSIST, SMART_ACTION_FOLLOW, SMART_ACTION_FORCE_DESPAWN, SMART_ACTION_GAME_EVENT_START, SMART_ACTION_GAME_EVENT_STOP, SMART_ACTION_GO_SET_GO_STATE, SMART_ACTION_GO_SET_LOOT_STATE, SMART_ACTION_INC_EVENT_PHASE, SMART_ACTION_INSTALL_AI_TEMPLATE, SMART_ACTION_INTERRUPT_SPELL, SMART_ACTION_INVOKER_CAST, SMART_ACTION_JUMP_TO_POS, SMART_ACTION_KILL_UNIT, SMART_ACTION_LOAD_EQUIPMENT, SMART_ACTION_LOAD_GRID, SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL, SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL, SMART_ACTION_MOVE_FORWARD, SMART_ACTION_MOVE_TO_POS, SMART_ACTION_MOVE_TO_POS_TARGET, SMART_ACTION_MUSIC, SMART_ACTION_NO_ENVIRONMENT_UPDATE, SMART_ACTION_NONE, SMART_ACTION_OFFER_QUEST, SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT, SMART_ACTION_PLAY_ANIMKIT, SMART_ACTION_PLAY_CINEMATIC, SMART_ACTION_PLAY_EMOTE, SMART_ACTION_PLAY_SPELL_VISUAL, SMART_ACTION_PLAYMOVIE, SMART_ACTION_RANDOM_EMOTE, SMART_ACTION_RANDOM_MOVE, SMART_ACTION_RANDOM_PHASE, SMART_ACTION_RANDOM_PHASE_RANGE, SMART_ACTION_RANDOM_SOUND, SMART_ACTION_REMOVE_ALL_GAMEOBJECTS, SMART_ACTION_REMOVE_DYNAMIC_FLAG, SMART_ACTION_REMOVE_GO_FLAG, SMART_ACTION_REMOVE_ITEM, SMART_ACTION_REMOVE_NPC_FLAG, SMART_ACTION_REMOVE_POWER, SMART_ACTION_REMOVE_TIMED_EVENT, SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1, SMART_ACTION_REMOVE_UNIT_FLAG, SMART_ACTION_REMOVEAURASFROMSPELL, SMART_ACTION_RESERVED_16, SMART_ACTION_RESET_GOBJECT, SMART_ACTION_RESET_SCRIPT_BASE_OBJECT, SMART_ACTION_RESPAWN_TARGET, SMART_ACTION_RISE_UP, SMART_ACTION_SCENE_CANCEL, SMART_ACTION_SCENE_PLAY, SMART_ACTION_SELF_CAST, SMART_ACTION_SEND_GO_CUSTOM_ANIM, SMART_ACTION_SEND_GOSSIP_MENU, SMART_ACTION_SEND_TARGET_TO_TARGET, SMART_ACTION_SET_ACTIVE, SMART_ACTION_SET_CASTER_COMBAT_DIST, SMART_ACTION_SET_COMBAT_DISTANCE, SMART_ACTION_SET_CORPSE_DELAY, SMART_ACTION_SET_COUNTER, SMART_ACTION_SET_DATA, SMART_ACTION_SET_DYNAMIC_FLAG, SMART_ACTION_SET_EMOTE_STATE, SMART_ACTION_SET_EVENT_FLAG_RESET, SMART_ACTION_SET_EVENT_PHASE, SMART_ACTION_SET_FACTION, SMART_ACTION_SET_FLY, SMART_ACTION_SET_GO_FLAG, SMART_ACTION_SET_GUID, SMART_ACTION_SET_HEALTH_PCT, SMART_ACTION_SET_HEALTH_REGEN, SMART_ACTION_SET_HOME_POS, SMART_ACTION_SET_HOVER, SMART_ACTION_SET_IN_COMBAT_WITH_ZONE, SMART_ACTION_SET_INGAME_PHASE_MASK, SMART_ACTION_SET_INST_DATA, SMART_ACTION_SET_INST_DATA64, SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL, SMART_ACTION_SET_MOVEMENT_SPEED, SMART_ACTION_SET_NPC_FLAG, SMART_ACTION_SET_ORIENTATION, SMART_ACTION_SET_POWER, SMART_ACTION_SET_RANGED_MOVEMENT, SMART_ACTION_SET_REACT_STATE, SMART_ACTION_SET_ROOT, SMART_ACTION_SET_RUN, SMART_ACTION_SET_SCALE, SMART_ACTION_SET_SHEATH, SMART_ACTION_SET_SIGHT_DIST, SMART_ACTION_SET_SWIM, SMART_ACTION_SET_UNIT_FIELD_BYTES_1, SMART_ACTION_SET_UNIT_FLAG, SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS, SMART_ACTION_SET_VISIBILITY, SMART_ACTION_SIMPLE_TALK, SMART_ACTION_SOUND, SMART_ACTION_START_CLOSEST_WAYPOINT, SMART_ACTION_STOP_MOTION, SMART_ACTION_STORE_TARGET_LIST, SMART_ACTION_SUMMON_CREATURE, SMART_ACTION_SUMMON_CREATURE_GROUP, SMART_ACTION_SUMMON_GO, SMART_ACTION_SUMMON_RADIAL, SMART_ACTION_TALK, SMART_ACTION_TELEPORT, SMART_ACTION_THREAT_ALL_PCT, SMART_ACTION_THREAT_SINGLE_PCT, SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT, SMART_ACTION_TRIGGER_TIMED_EVENT, SMART_ACTION_UPDATE_TEMPLATE, SMART_ACTION_WP_PAUSE, SMART_ACTION_WP_RESUME, SMART_ACTION_WP_START, SMART_ACTION_WP_STOP, SMART_ACTION_ZONE_UNDER_ATTACK, SmartAction::sound, SmartAction::spellVisual, SmartAction::stopMotion, SmartAction::storeTargets, SmartAction::summonCreature, SmartAction::summonGO, SmartAction::talk, SmartAction::taxi, SmartAction::teleport, SmartAction::threat, SmartAction::threatPCT, SmartAction::timedActionList, SmartAction::timeEvent, SmartAction::type, SmartAction::unitFlag, SmartAction::updateTemplate, SmartAction::visibility, SmartAction::wpPause, SmartAction::wpStart, and SmartAction::wpStop.

Referenced by IsEventValid().

◆ CheckUnusedEventParams()

bool SmartAIMgr::CheckUnusedEventParams ( SmartScriptHolder const &  e)
staticprivate
496{
497 size_t paramsStructSize = [&]() -> size_t
498 {
499 constexpr size_t NO_PARAMS = size_t(0);
500 switch (e.event.type)
501 {
506 case SMART_EVENT_AGGRO: return NO_PARAMS;
507 case SMART_EVENT_KILL: return sizeof(SmartEvent::kill);
508 case SMART_EVENT_DEATH: return NO_PARAMS;
509 case SMART_EVENT_EVADE: return NO_PARAMS;
510 case SMART_EVENT_SPELLHIT: return sizeof(SmartEvent::spellHit);
511 case SMART_EVENT_RANGE: return sizeof(SmartEvent::rangeRepeat);
512 case SMART_EVENT_OOC_LOS: return sizeof(SmartEvent::los);
513 case SMART_EVENT_RESPAWN: return sizeof(SmartEvent::respawn);
522 case SMART_EVENT_REWARD_QUEST: return sizeof(SmartEvent::quest);
523 case SMART_EVENT_REACHED_HOME: return NO_PARAMS;
524 case SMART_EVENT_RECEIVE_EMOTE: return sizeof(SmartEvent::emote);
525 case SMART_EVENT_HAS_AURA: return sizeof(SmartEvent::aura);
526 case SMART_EVENT_TARGET_BUFFED: return sizeof(SmartEvent::aura);
527 case SMART_EVENT_RESET: return NO_PARAMS;
528 case SMART_EVENT_IC_LOS: return sizeof(SmartEvent::los);
531 case SMART_EVENT_CHARMED: return sizeof(SmartEvent::charm);
532 case SMART_EVENT_CHARMED_TARGET: return NO_PARAMS;
538 case SMART_EVENT_CORPSE_REMOVED: return NO_PARAMS;
539 case SMART_EVENT_AI_INIT: return NO_PARAMS;
540 case SMART_EVENT_DATA_SET: return sizeof(SmartEvent::dataSet);
543 case SMART_EVENT_TRANSPORT_ADDPLAYER: return NO_PARAMS;
545 case SMART_EVENT_TRANSPORT_REMOVE_PLAYER: return NO_PARAMS;
549 case SMART_EVENT_QUEST_ACCEPTED: return NO_PARAMS;
550 case SMART_EVENT_QUEST_OBJ_COMPLETION: return NO_PARAMS;
551 case SMART_EVENT_QUEST_COMPLETION: return NO_PARAMS;
552 case SMART_EVENT_QUEST_REWARDED: return NO_PARAMS;
553 case SMART_EVENT_QUEST_FAIL: return NO_PARAMS;
554 case SMART_EVENT_TEXT_OVER: return sizeof(SmartEvent::textOver);
556 case SMART_EVENT_JUST_SUMMONED: return NO_PARAMS;
562 case SMART_EVENT_UPDATE: return sizeof(SmartEvent::minMaxRepeat);
563 case SMART_EVENT_LINK: return NO_PARAMS;
565 case SMART_EVENT_JUST_CREATED: return NO_PARAMS;
567 case SMART_EVENT_FOLLOW_COMPLETED: return NO_PARAMS;
575 case SMART_EVENT_ON_SPELLCLICK: return NO_PARAMS;
579 case SMART_EVENT_COUNTER_SET: return sizeof(SmartEvent::counter);
580 //case SMART_EVENT_SCENE_START: return sizeof(SmartEvent::raw);
581 //case SMART_EVENT_SCENE_TRIGGER: return sizeof(SmartEvent::raw);
582 //case SMART_EVENT_SCENE_CANCEL: return sizeof(SmartEvent::raw);
583 //case SMART_EVENT_SCENE_COMPLETE: return sizeof(SmartEvent::raw);
587 case SMART_EVENT_NEAR_UNIT: return sizeof(SmartEvent::nearUnit);
591 default:
592 LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an event {} with no unused params specified in SmartAIMgr::CheckUnusedEventParams(), please report this.",
593 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetEventType());
594 return sizeof(SmartEvent::raw);
595 }
596 }();
597
598 static size_t rawCount = sizeof(SmartEvent::raw) / sizeof(uint32);
599 size_t paramsCount = paramsStructSize / sizeof(uint32);
600
601 bool valid = true;
602 for (size_t index = paramsCount; index < rawCount; index++)
603 {
604 uint32 value = ((uint32*)&e.event.raw)[index];
605 if (value != 0)
606 {
607 LOG_ERROR("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} has unused event_param{} with value {}, it must be 0, skipped.",
608 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), index + 1, value);
609 valid = false;
610 }
611 }
612
613 return valid;
614}
@ SMART_EVENT_IC_LOS
Definition: SmartScriptMgr.h:144
@ SMART_EVENT_EVADE
Definition: SmartScriptMgr.h:125
@ SMART_EVENT_ACTION_DONE
Definition: SmartScriptMgr.h:190
@ SMART_EVENT_SUMMON_DESPAWNED
Definition: SmartScriptMgr.h:153
@ SMART_EVENT_SPELLHIT
Definition: SmartScriptMgr.h:126
@ SMART_EVENT_RECEIVE_EMOTE
Definition: SmartScriptMgr.h:140
@ SMART_EVENT_FRIENDLY_HEALTH_PCT
Definition: SmartScriptMgr.h:192
@ SMART_EVENT_QUEST_FAIL
Definition: SmartScriptMgr.h:169
@ SMART_EVENT_DATA_SET
Definition: SmartScriptMgr.h:156
@ SMART_EVENT_RECEIVE_HEAL
Definition: SmartScriptMgr.h:171
@ SMART_EVENT_TIMED_EVENT_TRIGGERED
Definition: SmartScriptMgr.h:177
@ SMART_EVENT_CHARMED_TARGET
Definition: SmartScriptMgr.h:148
@ SMART_EVENT_NEAR_PLAYERS_NEGATION
Definition: SmartScriptMgr.h:210
@ SMART_EVENT_TARGET_MANA_PCT
Definition: SmartScriptMgr.h:136
@ SMART_EVENT_QUEST_COMPLETION
Definition: SmartScriptMgr.h:167
@ SMART_EVENT_JUST_CREATED
Definition: SmartScriptMgr.h:181
@ SMART_EVENT_HEALTH_PCT
Definition: SmartScriptMgr.h:120
@ SMART_EVENT_EVENT_PHASE_CHANGE
Definition: SmartScriptMgr.h:184
@ SMART_EVENT_AREA_CASTING
Definition: SmartScriptMgr.h:213
@ SMART_EVENT_AREATRIGGER_ONTRIGGER
Definition: SmartScriptMgr.h:164
@ SMART_EVENT_DISTANCE_GAMEOBJECT
Definition: SmartScriptMgr.h:194
@ SMART_EVENT_ON_SPELLCLICK
Definition: SmartScriptMgr.h:191
@ SMART_EVENT_MOVEMENTINFORM
Definition: SmartScriptMgr.h:152
@ SMART_EVENT_RANGE
Definition: SmartScriptMgr.h:127
@ SMART_EVENT_MANA_PCT
Definition: SmartScriptMgr.h:121
@ SMART_EVENT_NEAR_UNIT_NEGATION
Definition: SmartScriptMgr.h:212
@ SMART_EVENT_PASSENGER_REMOVED
Definition: SmartScriptMgr.h:146
@ SMART_EVENT_INSTANCE_PLAYER_ENTER
Definition: SmartScriptMgr.h:163
@ SMART_EVENT_LINK
Definition: SmartScriptMgr.h:179
@ SMART_EVENT_WAYPOINT_PAUSED
Definition: SmartScriptMgr.h:173
@ SMART_EVENT_REACHED_HOME
Definition: SmartScriptMgr.h:139
@ SMART_EVENT_TRANSPORT_ADDCREATURE
Definition: SmartScriptMgr.h:160
@ SMART_EVENT_REWARD_QUEST
Definition: SmartScriptMgr.h:138
@ SMART_EVENT_GO_EVENT_INFORM
Definition: SmartScriptMgr.h:189
@ SMART_EVENT_UPDATE_IC
Definition: SmartScriptMgr.h:118
@ SMART_EVENT_RESET
Definition: SmartScriptMgr.h:143
@ SMART_EVENT_JUST_SUMMONED
Definition: SmartScriptMgr.h:172
@ SMART_EVENT_CHARMED
Definition: SmartScriptMgr.h:147
@ SMART_EVENT_AI_INIT
Definition: SmartScriptMgr.h:155
@ SMART_EVENT_WAYPOINT_START
Definition: SmartScriptMgr.h:157
@ SMART_EVENT_AREA_RANGE
Definition: SmartScriptMgr.h:214
@ SMART_EVENT_SPELLHIT_TARGET
Definition: SmartScriptMgr.h:149
@ SMART_EVENT_GAME_EVENT_START
Definition: SmartScriptMgr.h:186
@ SMART_EVENT_KILL
Definition: SmartScriptMgr.h:123
@ SMART_EVENT_TRANSPORT_REMOVE_PLAYER
Definition: SmartScriptMgr.h:161
@ SMART_EVENT_GOSSIP_HELLO
Definition: SmartScriptMgr.h:182
@ SMART_EVENT_GOSSIP_SELECT
Definition: SmartScriptMgr.h:180
@ SMART_EVENT_CORPSE_REMOVED
Definition: SmartScriptMgr.h:154
@ SMART_EVENT_PASSENGER_BOARDED
Definition: SmartScriptMgr.h:145
@ SMART_EVENT_UPDATE
Definition: SmartScriptMgr.h:178
@ SMART_EVENT_TRANSPORT_ADDPLAYER
Definition: SmartScriptMgr.h:159
@ SMART_EVENT_WAYPOINT_ENDED
Definition: SmartScriptMgr.h:176
@ SMART_EVENT_IS_BEHIND_TARGET
Definition: SmartScriptMgr.h:185
@ SMART_EVENT_UPDATE_OOC
Definition: SmartScriptMgr.h:119
@ SMART_EVENT_ACCEPTED_QUEST
Definition: SmartScriptMgr.h:137
@ SMART_EVENT_COUNTER_SET
Definition: SmartScriptMgr.h:195
@ SMART_EVENT_FRIENDLY_MISSING_BUFF
Definition: SmartScriptMgr.h:134
@ SMART_EVENT_WAYPOINT_RESUMED
Definition: SmartScriptMgr.h:174
@ SMART_EVENT_WAYPOINT_REACHED
Definition: SmartScriptMgr.h:158
@ SMART_EVENT_TARGET_BUFFED
Definition: SmartScriptMgr.h:142
@ SMART_EVENT_RESPAWN
Definition: SmartScriptMgr.h:129
@ SMART_EVENT_QUEST_ACCEPTED
Definition: SmartScriptMgr.h:165
@ SMART_EVENT_FRIENDLY_HEALTH
Definition: SmartScriptMgr.h:132
@ SMART_EVENT_NEAR_UNIT
Definition: SmartScriptMgr.h:211
@ SMART_EVENT_QUEST_REWARDED
Definition: SmartScriptMgr.h:168
@ SMART_EVENT_TEXT_OVER
Definition: SmartScriptMgr.h:170
@ SMART_EVENT_DEATH
Definition: SmartScriptMgr.h:124
@ SMART_EVENT_TRANSPORT_RELOCATE
Definition: SmartScriptMgr.h:162
@ SMART_EVENT_GAME_EVENT_END
Definition: SmartScriptMgr.h:187
@ SMART_EVENT_DAMAGED
Definition: SmartScriptMgr.h:150
@ SMART_EVENT_FOLLOW_COMPLETED
Definition: SmartScriptMgr.h:183
@ SMART_EVENT_QUEST_OBJ_COMPLETION
Definition: SmartScriptMgr.h:166
@ SMART_EVENT_DISTANCE_CREATURE
Definition: SmartScriptMgr.h:193
@ SMART_EVENT_WAYPOINT_STOPPED
Definition: SmartScriptMgr.h:175
@ SMART_EVENT_SUMMONED_UNIT_DIES
Definition: SmartScriptMgr.h:202
@ SMART_EVENT_FRIENDLY_IS_CC
Definition: SmartScriptMgr.h:133
@ SMART_EVENT_GO_STATE_CHANGED
Definition: SmartScriptMgr.h:188
@ SMART_EVENT_OOC_LOS
Definition: SmartScriptMgr.h:128
@ SMART_EVENT_AGGRO
Definition: SmartScriptMgr.h:122
@ SMART_EVENT_NEAR_PLAYERS
Definition: SmartScriptMgr.h:209
@ SMART_EVENT_TARGET_HEALTH_PCT
Definition: SmartScriptMgr.h:130
@ SMART_EVENT_VICTIM_CASTING
Definition: SmartScriptMgr.h:131
@ SMART_EVENT_DAMAGED_TARGET
Definition: SmartScriptMgr.h:151
@ SMART_EVENT_HAS_AURA
Definition: SmartScriptMgr.h:141
@ SMART_EVENT_SUMMONED_UNIT
Definition: SmartScriptMgr.h:135
struct SmartEvent::@30::@59 gossip
struct SmartEvent::@30::@34 kill
struct SmartEvent::@30::@57 timedEvent
struct SmartEvent::@30::@32 minMaxRepeat
struct SmartEvent::@30::@56 textOver
struct SmartEvent::@30::@40 friendlyHealth
struct SmartEvent::@30::@67 friendlyHealthPct
struct SmartEvent::@30::@33 rangeRepeat
struct SmartEvent::@30::@52 transportAddCreature
struct SmartEvent::@30::@47 charm
struct SmartEvent::@30::@54 instancePlayerEnter
struct SmartEvent::@30::@75 areaRange
struct SmartEvent::@30::@36 los
struct SmartEvent::@30::@72 nearUnit
struct SmartEvent::@30::@42 missingBuff
struct SmartEvent::@30::@63 gameEvent
struct SmartEvent::@30::@55 areatrigger
struct SmartEvent::@30::@64 goStateChanged
uint32 emote
Definition: SmartScriptMgr.h:332
struct SmartEvent::@30::@39 targetCasting
struct SmartEvent::@30::@43 summoned
struct SmartEvent::@30::@41 friendlyCC
struct SmartEvent::@30::@73 nearUnitNegation
struct SmartEvent::@30::@76 raw
struct SmartEvent::@30::@49 movementInform
struct SmartEvent::@30::@53 transportRelocate
struct SmartEvent::@30::@66 doAction
struct SmartEvent::@30::@37 respawn
struct SmartEvent::@30::@70 nearPlayer
struct SmartEvent::@30::@71 nearPlayerNegation
struct SmartEvent::@30::@50 dataSet
struct SmartEvent::@30::@58 gossipHello
struct SmartEvent::@30::@74 areaCasting
struct SmartEvent::@30::@61 eventPhaseChange
struct SmartEvent::@30::@35 spellHit
uint32 quest
Definition: SmartScriptMgr.h:325
struct SmartEvent::@30::@46 aura
struct SmartEvent::@30::@38 minMax
struct SmartEvent::@30::@69 counter
struct SmartEvent::@30::@62 behindTarget
struct SmartEvent::@30::@51 waypoint
struct SmartEvent::@30::@68 distance
struct SmartEvent::@30::@65 eventInform

References SmartEvent::areaCasting, SmartEvent::areaRange, SmartEvent::areatrigger, SmartEvent::aura, SmartEvent::behindTarget, SmartEvent::charm, SmartEvent::counter, SmartEvent::dataSet, SmartEvent::distance, SmartEvent::doAction, SmartEvent::emote, SmartScriptHolder::entryOrGuid, SmartScriptHolder::event, SmartScriptHolder::event_id, SmartEvent::eventInform, SmartEvent::eventPhaseChange, SmartEvent::friendlyCC, SmartEvent::friendlyHealth, SmartEvent::friendlyHealthPct, SmartEvent::gameEvent, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetEventType(), SmartScriptHolder::GetScriptType(), SmartEvent::gossip, SmartEvent::gossipHello, SmartEvent::goStateChanged, SmartEvent::instancePlayerEnter, SmartEvent::kill, LOG_ERROR, LOG_WARN, SmartEvent::los, SmartEvent::minMax, SmartEvent::minMaxRepeat, SmartEvent::missingBuff, SmartEvent::movementInform, SmartEvent::nearPlayer, SmartEvent::nearPlayerNegation, SmartEvent::nearUnit, SmartEvent::nearUnitNegation, SmartEvent::quest, SmartEvent::rangeRepeat, SmartEvent::raw, SmartEvent::respawn, SMART_EVENT_ACCEPTED_QUEST, SMART_EVENT_ACTION_DONE, SMART_EVENT_AGGRO, SMART_EVENT_AI_INIT, SMART_EVENT_AREA_CASTING, SMART_EVENT_AREA_RANGE, SMART_EVENT_AREATRIGGER_ONTRIGGER, SMART_EVENT_CHARMED, SMART_EVENT_CHARMED_TARGET, SMART_EVENT_CORPSE_REMOVED, SMART_EVENT_COUNTER_SET, SMART_EVENT_DAMAGED, SMART_EVENT_DAMAGED_TARGET, SMART_EVENT_DATA_SET, SMART_EVENT_DEATH, SMART_EVENT_DISTANCE_CREATURE, SMART_EVENT_DISTANCE_GAMEOBJECT, SMART_EVENT_EVADE, SMART_EVENT_EVENT_PHASE_CHANGE, SMART_EVENT_FOLLOW_COMPLETED, SMART_EVENT_FRIENDLY_HEALTH, SMART_EVENT_FRIENDLY_HEALTH_PCT, SMART_EVENT_FRIENDLY_IS_CC, SMART_EVENT_FRIENDLY_MISSING_BUFF, SMART_EVENT_GAME_EVENT_END, SMART_EVENT_GAME_EVENT_START, SMART_EVENT_GO_EVENT_INFORM, SMART_EVENT_GO_STATE_CHANGED, SMART_EVENT_GOSSIP_HELLO, SMART_EVENT_GOSSIP_SELECT, SMART_EVENT_HAS_AURA, SMART_EVENT_HEALTH_PCT, SMART_EVENT_IC_LOS, SMART_EVENT_INSTANCE_PLAYER_ENTER, SMART_EVENT_IS_BEHIND_TARGET, SMART_EVENT_JUST_CREATED, SMART_EVENT_JUST_SUMMONED, SMART_EVENT_KILL, SMART_EVENT_LINK, SMART_EVENT_MANA_PCT, SMART_EVENT_MOVEMENTINFORM, SMART_EVENT_NEAR_PLAYERS, SMART_EVENT_NEAR_PLAYERS_NEGATION, SMART_EVENT_NEAR_UNIT, SMART_EVENT_NEAR_UNIT_NEGATION, SMART_EVENT_ON_SPELLCLICK, SMART_EVENT_OOC_LOS, SMART_EVENT_PASSENGER_BOARDED, SMART_EVENT_PASSENGER_REMOVED, SMART_EVENT_QUEST_ACCEPTED, SMART_EVENT_QUEST_COMPLETION, SMART_EVENT_QUEST_FAIL, SMART_EVENT_QUEST_OBJ_COMPLETION, SMART_EVENT_QUEST_REWARDED, SMART_EVENT_RANGE, SMART_EVENT_REACHED_HOME, SMART_EVENT_RECEIVE_EMOTE, SMART_EVENT_RECEIVE_HEAL, SMART_EVENT_RESET, SMART_EVENT_RESPAWN, SMART_EVENT_REWARD_QUEST, SMART_EVENT_SPELLHIT, SMART_EVENT_SPELLHIT_TARGET, SMART_EVENT_SUMMON_DESPAWNED, SMART_EVENT_SUMMONED_UNIT, SMART_EVENT_SUMMONED_UNIT_DIES, SMART_EVENT_TARGET_BUFFED, SMART_EVENT_TARGET_HEALTH_PCT, SMART_EVENT_TARGET_MANA_PCT, SMART_EVENT_TEXT_OVER, SMART_EVENT_TIMED_EVENT_TRIGGERED, SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_EVENT_TRANSPORT_ADDPLAYER, SMART_EVENT_TRANSPORT_RELOCATE, SMART_EVENT_TRANSPORT_REMOVE_PLAYER, SMART_EVENT_UPDATE, SMART_EVENT_UPDATE_IC, SMART_EVENT_UPDATE_OOC, SMART_EVENT_VICTIM_CASTING, SMART_EVENT_WAYPOINT_ENDED, SMART_EVENT_WAYPOINT_PAUSED, SMART_EVENT_WAYPOINT_REACHED, SMART_EVENT_WAYPOINT_RESUMED, SMART_EVENT_WAYPOINT_START, SMART_EVENT_WAYPOINT_STOPPED, SmartEvent::spellHit, SmartEvent::summoned, SmartEvent::targetCasting, SmartEvent::textOver, SmartEvent::timedEvent, SmartEvent::transportAddCreature, SmartEvent::transportRelocate, SmartEvent::type, and SmartEvent::waypoint.

Referenced by IsEventValid().

◆ CheckUnusedTargetParams()

bool SmartAIMgr::CheckUnusedTargetParams ( SmartScriptHolder const &  e)
staticprivate
811{
812 size_t paramsStructSize = [&]() -> size_t
813 {
814 constexpr size_t NO_PARAMS = size_t(0);
815 switch (e.target.type)
816 {
817 case SMART_TARGET_NONE: return NO_PARAMS;
818 case SMART_TARGET_SELF: return NO_PARAMS;
819 case SMART_TARGET_VICTIM: return NO_PARAMS;
824 case SMART_TARGET_ACTION_INVOKER: return NO_PARAMS;
825 case SMART_TARGET_POSITION: return NO_PARAMS; //uses x,y,z,o
829 case SMART_TARGET_STORED: return sizeof(SmartTarget::stored);
833 case SMART_TARGET_INVOKER_PARTY: return NO_PARAMS;
839 case SMART_TARGET_ACTION_INVOKER_VEHICLE: return NO_PARAMS;
844 case SMART_TARGET_LOOT_RECIPIENTS: return NO_PARAMS;
845 case SMART_TARGET_FARTHEST: return sizeof(SmartTarget::farthest);
847 // case SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT: return sizeof(SmartTarget::goClosest);
849 default:
850 LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using a target {} with no unused params specified in SmartAIMgr::CheckUnusedTargetParams(), please report this.",
851 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
852 return sizeof(SmartTarget::raw);
853 }
854 }();
855
856 static size_t rawCount = sizeof(SmartTarget::raw) / sizeof(uint32);
857 size_t paramsCount = paramsStructSize / sizeof(uint32);
858
859 bool valid = true;
860 for (size_t index = paramsCount; index < rawCount; index++)
861 {
862 uint32 value = ((uint32*)&e.target.raw)[index];
863 if (value != 0)
864 {
865 LOG_ERROR("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} has unused target_param{} with value {}, it must be 0, skipped.",
866 e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), index + 1, value);
867 valid = false;
868 }
869 }
870
871 return valid;
872}
@ SMART_TARGET_LOOT_RECIPIENTS
Definition: SmartScriptMgr.h:1503
@ SMART_TARGET_CLOSEST_CREATURE
Definition: SmartScriptMgr.h:1495
@ SMART_TARGET_CREATURE_DISTANCE
Definition: SmartScriptMgr.h:1487
@ SMART_TARGET_HOSTILE_RANDOM_NOT_TOP
Definition: SmartScriptMgr.h:1482
@ SMART_TARGET_INVOKER_PARTY
Definition: SmartScriptMgr.h:1492
@ SMART_TARGET_CLOSEST_FRIENDLY
Definition: SmartScriptMgr.h:1502
@ SMART_TARGET_CLOSEST_GAMEOBJECT
Definition: SmartScriptMgr.h:1496
@ SMART_TARGET_VEHICLE_PASSENGER
Definition: SmartScriptMgr.h:1505
@ SMART_TARGET_GAMEOBJECT_RANGE
Definition: SmartScriptMgr.h:1489
@ SMART_TARGET_CREATURE_GUID
Definition: SmartScriptMgr.h:1486
@ SMART_TARGET_PLAYER_RANGE
Definition: SmartScriptMgr.h:1493
@ SMART_TARGET_VICTIM
Definition: SmartScriptMgr.h:1478
@ SMART_TARGET_GAMEOBJECT_DISTANCE
Definition: SmartScriptMgr.h:1491
@ SMART_TARGET_CREATURE_RANGE
Definition: SmartScriptMgr.h:1485
@ SMART_TARGET_CLOSEST_PLAYER
Definition: SmartScriptMgr.h:1497
@ SMART_TARGET_HOSTILE_RANDOM
Definition: SmartScriptMgr.h:1481
@ SMART_TARGET_GAMEOBJECT_GUID
Definition: SmartScriptMgr.h:1490
@ SMART_TARGET_HOSTILE_SECOND_AGGRO
Definition: SmartScriptMgr.h:1479
@ SMART_TARGET_OWNER_OR_SUMMONER
Definition: SmartScriptMgr.h:1499
@ SMART_TARGET_SELF
Definition: SmartScriptMgr.h:1477
@ SMART_TARGET_PLAYER_WITH_AURA
Definition: SmartScriptMgr.h:1513
@ SMART_TARGET_ACTION_INVOKER
Definition: SmartScriptMgr.h:1483
@ SMART_TARGET_POSITION
Definition: SmartScriptMgr.h:1484
@ SMART_TARGET_HOSTILE_LAST_AGGRO
Definition: SmartScriptMgr.h:1480
@ SMART_TARGET_ACTION_INVOKER_VEHICLE
Definition: SmartScriptMgr.h:1498
@ SMART_TARGET_FARTHEST
Definition: SmartScriptMgr.h:1504
@ SMART_TARGET_THREAT_LIST
Definition: SmartScriptMgr.h:1500
@ SMART_TARGET_CLOSEST_ENEMY
Definition: SmartScriptMgr.h:1501
@ SMART_TARGET_NONE
Definition: SmartScriptMgr.h:1476
@ SMART_TARGET_PLAYER_DISTANCE
Definition: SmartScriptMgr.h:1494
@ SMART_TARGET_STORED
Definition: SmartScriptMgr.h:1488
struct SmartTarget::@191::@210 closestAttackable
struct SmartTarget::@191::@198 unitDistance
struct SmartTarget::@191::@209 goClosest
struct SmartTarget::@191::@194 farthest
struct SmartTarget::@191::@199 playerDistance
struct SmartTarget::@191::@196 unitGUID
struct SmartTarget::@191::@193 hostileRandom
struct SmartTarget::@191::@202 goRange
struct SmartTarget::@191::@206 owner
struct SmartTarget::@191::@195 unitRange
struct SmartTarget::@191::@207 vehicle
struct SmartTarget::@191::@211 closestFriendly
struct SmartTarget::@191::@205 unitClosest
struct SmartTarget::@191::@208 threatList
struct SmartTarget::@191::@203 goGUID
struct SmartTarget::@191::@213 playerWithAura
struct SmartTarget::@191::@200 playerRange
struct SmartTarget::@191::@204 goDistance
struct SmartTarget::@191::@215 raw
struct SmartTarget::@191::@201 stored

References SmartTarget::closestAttackable, SmartTarget::closestFriendly, SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartTarget::farthest, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), SmartScriptHolder::GetTargetType(), SmartTarget::goClosest, SmartTarget::goDistance, SmartTarget::goGUID, SmartTarget::goRange, SmartTarget::hostileRandom, LOG_ERROR, LOG_WARN, SmartTarget::owner, SmartTarget::playerDistance, SmartTarget::playerRange, SmartTarget::playerWithAura, SmartTarget::raw, SMART_TARGET_ACTION_INVOKER, SMART_TARGET_ACTION_INVOKER_VEHICLE, SMART_TARGET_CLOSEST_CREATURE, SMART_TARGET_CLOSEST_ENEMY, SMART_TARGET_CLOSEST_FRIENDLY, SMART_TARGET_CLOSEST_GAMEOBJECT, SMART_TARGET_CLOSEST_PLAYER, SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_CREATURE_GUID, SMART_TARGET_CREATURE_RANGE, SMART_TARGET_FARTHEST, SMART_TARGET_GAMEOBJECT_DISTANCE, SMART_TARGET_GAMEOBJECT_GUID, SMART_TARGET_GAMEOBJECT_RANGE, SMART_TARGET_HOSTILE_LAST_AGGRO, SMART_TARGET_HOSTILE_RANDOM, SMART_TARGET_HOSTILE_RANDOM_NOT_TOP, SMART_TARGET_HOSTILE_SECOND_AGGRO, SMART_TARGET_INVOKER_PARTY, SMART_TARGET_LOOT_RECIPIENTS, SMART_TARGET_NONE, SMART_TARGET_OWNER_OR_SUMMONER, SMART_TARGET_PLAYER_DISTANCE, SMART_TARGET_PLAYER_RANGE, SMART_TARGET_PLAYER_WITH_AURA, SMART_TARGET_POSITION, SMART_TARGET_SELF, SMART_TARGET_STORED, SMART_TARGET_THREAT_LIST, SMART_TARGET_VEHICLE_PASSENGER, SMART_TARGET_VICTIM, SmartTarget::stored, SmartScriptHolder::target, SmartTarget::threatList, SmartTarget::type, SmartTarget::unitClosest, SmartTarget::unitDistance, SmartTarget::unitGUID, SmartTarget::unitRange, and SmartTarget::vehicle.

Referenced by IsTargetValid().

◆ EventHasInvoker()

bool SmartAIMgr::EventHasInvoker ( SMART_EVENT  event)
staticprivate
320{
321 switch (event)
322 { // white list of events that actually have an invoker passed to them
325 case SMART_EVENT_KILL:
365 return true;
366 default:
367 return false;
368 }
369}

References SMART_EVENT_ACCEPTED_QUEST, SMART_EVENT_ACTION_DONE, SMART_EVENT_AGGRO, SMART_EVENT_AREA_CASTING, SMART_EVENT_AREA_RANGE, SMART_EVENT_AREATRIGGER_ONTRIGGER, SMART_EVENT_DAMAGED, SMART_EVENT_DAMAGED_TARGET, SMART_EVENT_DEATH, SMART_EVENT_DISTANCE_CREATURE, SMART_EVENT_FOLLOW_COMPLETED, SMART_EVENT_FRIENDLY_HEALTH, SMART_EVENT_FRIENDLY_HEALTH_PCT, SMART_EVENT_FRIENDLY_IS_CC, SMART_EVENT_FRIENDLY_MISSING_BUFF, SMART_EVENT_GO_STATE_CHANGED, SMART_EVENT_GOSSIP_HELLO, SMART_EVENT_GOSSIP_SELECT, SMART_EVENT_IC_LOS, SMART_EVENT_INSTANCE_PLAYER_ENTER, SMART_EVENT_IS_BEHIND_TARGET, SMART_EVENT_JUST_SUMMONED, SMART_EVENT_KILL, SMART_EVENT_NEAR_PLAYERS, SMART_EVENT_ON_SPELLCLICK, SMART_EVENT_OOC_LOS, SMART_EVENT_PASSENGER_BOARDED, SMART_EVENT_PASSENGER_REMOVED, SMART_EVENT_RANGE, SMART_EVENT_RECEIVE_EMOTE, SMART_EVENT_RECEIVE_HEAL, SMART_EVENT_REWARD_QUEST, SMART_EVENT_SPELLHIT, SMART_EVENT_SPELLHIT_TARGET, SMART_EVENT_SUMMON_DESPAWNED, SMART_EVENT_SUMMONED_UNIT, SMART_EVENT_SUMMONED_UNIT_DIES, SMART_EVENT_TARGET_BUFFED, SMART_EVENT_TARGET_HEALTH_PCT, SMART_EVENT_TARGET_MANA_PCT, SMART_EVENT_TRANSPORT_ADDCREATURE, and SMART_EVENT_VICTIM_CASTING.

Referenced by IsEventValid(), and IsTargetValid().

◆ GetScript()

SmartAIEventList SmartAIMgr::GetScript ( int32  entry,
SmartScriptType  type 
)
inline
1992 {
1993 SmartAIEventList temp;
1994 if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
1995 return mEventMap[uint32(type)][entry];
1996 else
1997 {
1998 if (entry > 0) //first search is for guid (negative), do not drop error if not found
1999 LOG_DEBUG("sql.sql", "SmartAIMgr::GetScript: Could not load Script for Entry {} ScriptType {}.", entry, uint32(type));
2000 return temp;
2001 }
2002 }
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
std::vector< SmartScriptHolder > SmartAIEventList
Definition: SmartScriptMgr.h:1975
SmartAIEventMap mEventMap[SMART_SCRIPT_TYPE_MAX]
Definition: SmartScriptMgr.h:2006

References LOG_DEBUG, and mEventMap.

◆ instance()

SmartAIMgr * SmartAIMgr::instance ( )
static
123{
124 static SmartAIMgr instance;
125 return &instance;
126}
Definition: SmartScriptMgr.h:1982
static SmartAIMgr * instance()
Definition: SmartScriptMgr.cpp:122

References instance().

Referenced by instance().

◆ IsAreaTriggerValid()

bool SmartAIMgr::IsAreaTriggerValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2124 {
2125 if (!sObjectMgr->GetAreaTrigger(entry))
2126 {
2127 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent AreaTrigger entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2128 return false;
2129 }
2130 return true;
2131 }
#define sObjectMgr
Definition: ObjectMgr.h:1640

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sObjectMgr.

Referenced by IsEventValid().

◆ IsCreatureValid()

bool SmartAIMgr::IsCreatureValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2054 {
2055 if (!sObjectMgr->GetCreatureTemplate(entry))
2056 {
2057 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Creature entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2058 return false;
2059 }
2060 return true;
2061 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sObjectMgr.

Referenced by IsEventValid(), and IsTargetValid().

◆ IsEmoteValid()

bool SmartAIMgr::IsEmoteValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2114 {
2115 if (!sEmotesStore.LookupEntry(entry))
2116 {
2117 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Emote entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2118 return false;
2119 }
2120 return true;
2121 }
DBCStorage< EmotesEntry > sEmotesStore(EmotesEntryfmt)

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sEmotesStore.

Referenced by IsEventValid().

◆ IsEventValid()

bool SmartAIMgr::IsEventValid ( SmartScriptHolder e)
private
875{
877 {
878 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has invalid event type ({}), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
879 return false;
880 }
881 // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
883 {
884 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {}, event type {} can not be used for Script type {}", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
885 return false;
886 }
887 if (e.action.type <= 0
890 {
891 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has an invalid action type ({}), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
892 return false;
893 }
894 switch (e.action.type)
895 {
900 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has an action type that is not supported on 3.3.5a ({}), skipped.",
902 return false;
909 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has an action type that is not yet supported on AzerothCore ({}), skipped.",
911 return false;
912 default:
913 break;
914 }
916 {
917 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has an invalid target type ({}), skipped.",
919 return false;
920 }
922 {
923 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has a target type that is not yet supported on AzerothCore ({}), skipped.",
925 return false;
926 }
928 {
929 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has invalid phase mask ({}), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
930 return false;
931 }
933 {
934 LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid {} using event({}) has invalid event flags ({}), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
935 return false;
936 }
938 {
939 e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!
941 return false;
942
944 return false;
945 }
946 else
947 {
948 uint32 type = e.event.type;
949 switch (type)
950 {
962 return false;
963
965 return false;
966 break;
969 return false;
970
972 return false;
973 break;
976 return false;
977
979 return false;
980
982 return false;
983
984 break;
987 if (e.event.spellHit.spell)
988 {
989 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
990 if (!spellInfo)
991 {
992 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Spell entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
993 return false;
994 }
995 if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
996 {
997 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses Spell entry {} with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
998 return false;
999 }
1000 }
1002 return false;
1003 break;
1005 case SMART_EVENT_IC_LOS:
1007 {
1008 return false;
1009 }
1010
1012 {
1013 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses hostilityMode with invalid value {} (max allowed value {}), skipped.",
1015 return false;
1016 }
1017
1019 break;
1022 {
1023 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Map entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
1024 return false;
1025 }
1027 {
1028 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Area entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
1029 return false;
1030 }
1031 break;
1034 return false;
1035
1037 return false;
1038 break;
1041 return false;
1042 break;
1044 {
1046 return false;
1047
1048 if (!NotNULL(e, e.event.missingBuff.radius))
1049 return false;
1050
1052 return false;
1053 break;
1054 }
1055 case SMART_EVENT_KILL:
1057 return false;
1058
1060 return false;
1061
1063 break;
1065 if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId))
1066 {
1067 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Spell entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
1068 return false;
1069 }
1070
1072 return false;
1073 break;
1076 return false;
1077
1079 return false;
1080
1082 return false;
1083 break;
1087 return false;
1088 break;
1093 return false;
1094
1096 return false;
1097 break;
1100 if (e.event.quest.quest && !IsQuestValid(e, e.event.quest.quest))
1101 {
1102 return false;
1103 }
1104
1105 if (!IsMinMaxValid(e, e.event.quest.cooldownMin, e.event.quest.cooldownMax))
1106 {
1107 return false;
1108 }
1109 break;
1111 {
1112 if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
1113 return false;
1114
1115 if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
1116 return false;
1117 break;
1118 }
1121 {
1122 if (!IsSpellValid(e, e.event.aura.spell))
1123 return false;
1124
1126 return false;
1127 break;
1128 }
1130 {
1132 return false;
1133 break;
1134 }
1136 {
1138 {
1139 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid Motion type {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
1140 return false;
1141 }
1142 break;
1143 }
1145 {
1147 return false;
1148 break;
1149 }
1151 {
1153 return false;
1154 break;
1155 }
1157 //if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group!
1158 break;
1159 case SMART_EVENT_LINK:
1160 {
1161 if (e.link && e.link == e.event_id)
1162 {
1163 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {}, Event {}, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
1164 return false;
1165 }
1166 break;
1167 }
1169 {
1171 {
1172 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has no param set, event won't be executed!.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1173 return false;
1174 }
1175
1177 {
1178 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid phasemask {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.eventPhaseChange.phasemask);
1179 return false;
1180 }
1181
1183 {
1184 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses event phasemask {} and incompatible event_param1 {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.event_phase_mask, e.event.eventPhaseChange.phasemask);
1185 return false;
1186 }
1187 break;
1188 }
1191 return false;
1192 break;
1195 {
1196 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
1197 if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
1198 return false;
1199 break;
1200 }
1202 {
1204 {
1205 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid event id {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
1206 return false;
1207 }
1208 break;
1209 }
1212 return false;
1213
1215 {
1216 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1217 return false;
1218 }
1219
1220 switch (e.GetTargetType())
1221 {
1229 break;
1230 case SMART_TARGET_SELF:
1233 {
1234 return false;
1235 }
1236 break;
1237 default:
1238 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid target_type {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
1239 return false;
1240 }
1241 break;
1243 if (e.event.distance.guid == 0 && e.event.distance.entry == 0)
1244 {
1245 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE did not provide creature guid or entry, skipped.");
1246 return false;
1247 }
1248
1249 if (e.event.distance.guid != 0 && e.event.distance.entry != 0)
1250 {
1251 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE provided both an entry and guid, skipped.");
1252 return false;
1253 }
1254
1255 if (e.event.distance.guid != 0 && !sObjectMgr->GetCreatureData(e.event.distance.guid))
1256 {
1257 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature guid {}, skipped.", e.event.distance.guid);
1258 return false;
1259 }
1260
1261 if (e.event.distance.entry != 0 && !sObjectMgr->GetCreatureTemplate(e.event.distance.entry))
1262 {
1263 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature entry {}, skipped.", e.event.distance.entry);
1264 return false;
1265 }
1266 break;
1268 if (e.event.distance.guid == 0 && e.event.distance.entry == 0)
1269 {
1270 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT did not provide gameobject guid or entry, skipped.");
1271 return false;
1272 }
1273
1274 if (e.event.distance.guid != 0 && e.event.distance.entry != 0)
1275 {
1276 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT provided both an entry and guid, skipped.");
1277 return false;
1278 }
1279
1280 if (e.event.distance.guid != 0 && !sObjectMgr->GetGameObjectData(e.event.distance.guid))
1281 {
1282 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject guid {}, skipped.", e.event.distance.guid);
1283 return false;
1284 }
1285
1286 if (e.event.distance.entry != 0 && !sObjectMgr->GetGameObjectTemplate(e.event.distance.entry))
1287 {
1288 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject entry {}, skipped.", e.event.distance.entry);
1289 return false;
1290 }
1291 break;
1294 return false;
1295
1296 if (e.event.counter.id == 0)
1297 {
1298 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid counter id {}, skipped.", e.event.counter.id);
1299 return false;
1300 }
1301
1302 if (e.event.counter.value == 0)
1303 {
1304 LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid value {}, skipped.", e.event.counter.value);
1305 return false;
1306 }
1307 break;
1310 return false;
1311 break;
1314 return false;
1315 break;
1329 case SMART_EVENT_AGGRO:
1330 case SMART_EVENT_DEATH:
1331 case SMART_EVENT_EVADE:
1333 case SMART_EVENT_RESET:
1351 break;
1352 default:
1353 LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type({}), Entry {} SourceType {} Event {} Action {}, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1354 return false;
1355 }
1356 }
1357
1358 if (!CheckUnusedEventParams(e))
1359 {
1360 return false;
1361 }
1362
1363 switch (e.GetActionType())
1364 {
1367 {
1368 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Faction {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
1369 return false;
1370 }
1371 break;
1375 {
1376 if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
1377 {
1378 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Creature entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
1379 return false;
1380 }
1381
1383 {
1385 {
1386 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1387 return false;
1388 }
1389 else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
1390 {
1391 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Model id {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
1392 return false;
1393 }
1394 }
1395 }
1396 break;
1397 case SMART_ACTION_SOUND:
1398 if (!IsSoundValid(e, e.action.sound.sound))
1399 return false;
1400 AC_SAI_IS_BOOLEAN_VALID(e, e.action.sound.onlySelf);
1401 break;
1404 return false;
1405
1407 return false;
1408
1410 return false;
1411
1413 return false;
1414 break;
1415 case SMART_ACTION_MUSIC:
1416 if (!IsSoundValid(e, e.action.music.sound))
1417 return false;
1418 break;
1421 return false;
1422
1424 return false;
1425
1427 return false;
1428
1430 return false;
1431 break;
1434 if (!IsEmoteValid(e, e.action.emote.emote))
1435 return false;
1436 break;
1439 return false;
1440
1442 break;
1444 if (!IsQuestValid(e, e.action.quest.quest))
1445 return false;
1446 break;
1448 {
1449 if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
1450 {
1451 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid Taxi path ID {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
1452 return false;
1453 }
1454 break;
1455 }
1457 {
1458 if (std::all_of(e.action.randomEmote.emotes.begin(), e.action.randomEmote.emotes.end(), [](uint32 emote) { return emote == 0; }))
1459 {
1460 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} does not have any non-zero emote",
1462 return false;
1463 }
1464
1465 for (uint32 emote : e.action.randomEmote.emotes)
1466 if (emote && !IsEmoteValid(e, emote))
1467 return false;
1468 break;
1469 }
1471 {
1472 if (std::all_of(e.action.randTimedActionList.actionLists.begin(), e.action.randTimedActionList.actionLists.end(), [](uint32 actionList) { return actionList == 0; }))
1473 {
1474 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} does not have any non-zero action list",
1476 return false;
1477 }
1478 break;
1479 }
1481 {
1482 if (std::all_of(e.action.closestWaypointFromList.wps.begin(), e.action.closestWaypointFromList.wps.end(), [](uint32 wp) { return wp == 0; }))
1483 {
1484 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} does not have any non-zero waypoint id",
1486 return false;
1487 }
1488 break;
1489 }
1492 {
1493 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invoker cast action, but event does not provide any invoker!", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
1494 return false;
1495 }
1496 break;
1497 case SMART_ACTION_CAST:
1500 return false;
1501 break;
1504 return false;
1505 break;
1507 if (!IsSpellValid(e, e.action.addAura.spell))
1508 return false;
1509 break;
1512 if (Quest const* qid = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
1513 {
1514 if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
1515 {
1516 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} SpecialFlags for Quest entry {} does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
1517 return false;
1518 }
1519 }
1520 else
1521 {
1522 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Quest entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
1523 return false;
1524 }
1525 break;
1528 {
1529 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} attempts to set phase {}. Phase mask cannot be used past phase {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
1530 return false;
1531 }
1532 break;
1535 {
1536 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1537 return false;
1538 }
1540 {
1541 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1542 return false;
1543 }
1544 break;
1547 return false;
1548 break;
1550 {
1551 if (std::all_of(e.action.randomPhase.phases.begin(), e.action.randomPhase.phases.end(), [](uint32 phase) { return phase == 0; }))
1552 {
1553 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} does not have any non-zero phase",
1555 return false;
1556 }
1557
1558 if (std::any_of(e.action.randomPhase.phases.begin(), e.action.randomPhase.phases.end(), [](uint32 phase) { return phase >= SMART_EVENT_PHASE_MAX; }))
1559 {
1560 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1561 return false;
1562 }
1563 break;
1564 }
1565 case SMART_ACTION_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
1566 {
1569 {
1570 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1571 return false;
1572 }
1573
1575 return false;
1576 break;
1577 }
1580 return false;
1582 {
1583 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses incorrect TempSummonType {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
1584 return false;
1585 }
1586
1588 break;
1591 return false;
1592 break;
1595 return false;
1597 break;
1600 {
1601 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses incorrect Sheath state {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
1602 return false;
1603 }
1604 break;
1606 {
1608 {
1609 LOG_ERROR("sql.sql", "SmartAIMgr: Creature {} Event {} Action {} uses invalid React State {}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
1610 return false;
1611 }
1612 break;
1613 }
1616 return false;
1617 break;
1620 if (!IsItemValid(e, e.action.item.entry))
1621 return false;
1622
1623 if (!NotNULL(e, e.action.item.count))
1624 return false;
1625 break;
1627 if (!sMapStore.LookupEntry(e.action.teleport.mapID))
1628 {
1629 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Map entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
1630 return false;
1631 }
1632 break;
1635 {
1636 LOG_ERROR("sql.sql", "SmartAIMgr: Creature {} Event {} Action {} uses non-existent AI template id {}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
1637 return false;
1638 }
1639 break;
1642 return false;
1644 break;
1646 {
1647 if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
1648 {
1649 LOG_ERROR("sql.sql", "SmartAIMgr: Creature {} Event {} Action {} uses non-existent WaypointPath id {}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
1650 return false;
1651 }
1653 return false;
1654
1655 // Allow "invalid" value 3 for a while to allow cleanup the values stored in the db for SMART_ACTION_WP_START.
1656 // Remember to remove this once the clean is complete.
1657 constexpr uint32 TEMPORARY_EXTRA_VALUE_FOR_DB_CLEANUP = 1;
1658
1659 if (e.action.wpStart.reactState > (REACT_AGGRESSIVE + TEMPORARY_EXTRA_VALUE_FOR_DB_CLEANUP))
1660 {
1661 LOG_ERROR("sql.sql", "SmartAIMgr: Creature {} Event {} Action {} uses invalid React State {}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
1662 return false;
1663 }
1664
1667 break;
1668 }
1670 {
1672 return false;
1673
1675 return false;
1676 break;
1677 }
1679 {
1681 return false;
1682 break;
1683 }
1688 {
1689 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Power {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
1690 return false;
1691 }
1692 break;
1694 {
1695 uint32 eventId = e.action.gameEventStop.id;
1696
1697 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
1698 if (eventId < 1 || eventId >= events.size())
1699 {
1700 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent event, eventId {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
1701 return false;
1702 }
1703
1704 GameEventData const& eventData = events[eventId];
1705 if (!eventData.isValid())
1706 {
1707 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent event, eventId {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
1708 return false;
1709 }
1710 break;
1711 }
1713 {
1714 uint32 eventId = e.action.gameEventStart.id;
1715
1716 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
1717 if (eventId < 1 || eventId >= events.size())
1718 {
1719 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent event, eventId {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
1720 return false;
1721 }
1722
1723 GameEventData const& eventData = events[eventId];
1724 if (!eventData.isValid())
1725 {
1726 LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent event, eventId {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
1727 return false;
1728 }
1729 break;
1730 }
1731 case SMART_ACTION_EQUIP:
1732 {
1734 {
1735 if (int8 equipId = static_cast<int8>(e.action.equip.entry))
1736 {
1737 EquipmentInfo const* eInfo = sObjectMgr->GetEquipmentInfo(e.entryOrGuid, equipId);
1738 if (!eInfo)
1739 {
1740 LOG_ERROR("scripts.ai.sai", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id {} for creature {}, skipped.", equipId, e.entryOrGuid);
1741 return false;
1742 }
1743 }
1744 }
1745 break;
1746 }
1748 {
1750 {
1751 LOG_ERROR("scripts.ai.sai", "SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: {}, skipped.", e.entryOrGuid);
1752 return false;
1753 }
1754 break;
1755 }
1757 {
1759 {
1760 LOG_ERROR("sql.sql", "SmartScript: action_type {} is not allowed with source_type {}. Entry {}, skipped.", e.GetActionType(), e.GetScriptType(), e.entryOrGuid);
1761 return false;
1762 }
1763 break;
1764 }
1766 {
1767 if (e.action.setInstanceData.type == 1)
1768 {
1769 if (e.action.setInstanceData.data >= EncounterState::TO_BE_DECIDED)
1770 {
1771 LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INST_DATA with type 1 (bossState) uses invalid encounter state {}. Source entry {}, type {}", e.action.setInstanceData.data, e.entryOrGuid, e.GetScriptType());
1772 return false;
1773 }
1774 }
1775 else if (e.action.setInstanceData.type > 1)
1776 {
1777 LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INST_DATA uses unsupported data type {}. Source entry {}, type {}", e.action.setInstanceData.type, e.entryOrGuid, e.GetScriptType());
1778 return false;
1779 }
1780 break;
1781 }
1783 {
1785 {
1786 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} is trying to set invalid HP percent {}, skipped.",
1788 return false;
1789 }
1790 break;
1791 }
1793 {
1795 {
1796 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses invalid movementType {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.movementSpeed.movementType);
1797 return false;
1798 }
1799
1801 {
1802 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses speed 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
1803 return false;
1804 }
1805 break;
1806 }
1808 {
1810 break;
1811 }
1813 {
1815 break;
1816 }
1818 {
1820 break;
1821 }
1823 {
1825 break;
1826 }
1828 {
1830 break;
1831 }
1833 {
1835 break;
1836 }
1838 {
1840 break;
1841 }
1843 {
1845 break;
1846 }
1848 {
1851 break;
1852 }
1854 {
1856 break;
1857 }
1859 {
1861 break;
1862 }
1864 {
1866 break;
1867 }
1868 case SMART_ACTION_TALK:
1871 return false;
1872 break;
1875 return false;
1876 break;
1878 {
1880 break;
1881 }
1883 {
1885 break;
1886 }
1889 case SMART_ACTION_EVADE:
1895 case SMART_ACTION_DIE:
1949 case SMART_ACTION_FLEE:
1955 case SMART_ACTION_FALL:
1974 break;
1975 default:
1976 LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
1977 return false;
1978 }
1979
1981 return false;
1982
1983 return true;
1984}
std::int8_t int8
Definition: Define.h:106
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition: Util.h:619
#define AC_SAI_IS_BOOLEAN_VALID(e, value)
Definition: SmartScriptMgr.cpp:32
@ SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
Definition: SmartScriptMgr.h:1714
@ SMART_SCRIPT_TYPE_CREATURE
Definition: SmartScriptMgr.h:1705
@ SMART_SCRIPT_TYPE_GAMEOBJECT
Definition: SmartScriptMgr.h:1706
@ SMARTAI_TEMPLATE_END
Definition: SmartScriptMgr.h:1471
@ SMART_EVENT_FLAGS_ALL
Definition: SmartScriptMgr.h:1871
@ SMART_TARGET_AC_END
Definition: SmartScriptMgr.h:1519
@ SMART_TARGET_AC_START
Definition: SmartScriptMgr.h:1511
@ SMART_TARGET_TC_END
Definition: SmartScriptMgr.h:1507
const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2]
Definition: SmartScriptMgr.h:1746
#define sSmartWaypointMgr
Definition: SmartScriptMgr.h:2150
@ SMART_SCRIPT_RESPAWN_CONDITION_AREA
Definition: SmartScriptMgr.h:564
@ SMART_SCRIPT_RESPAWN_CONDITION_MAP
Definition: SmartScriptMgr.h:563
@ SMART_ACTION_TC_END
Definition: SmartScriptMgr.h:710
@ SMART_ACTION_AC_START
Definition: SmartScriptMgr.h:713
@ SMART_ACTION_CONE_SUMMON
Definition: SmartScriptMgr.h:734
@ SMART_ACTION_REMOVE_AURAS_BY_TYPE
Definition: SmartScriptMgr.h:690
@ SMART_ACTION_VORTEX_SUMMON
Definition: SmartScriptMgr.h:736
@ SMART_ACTION_SPAWN_SPAWNGROUP
Definition: SmartScriptMgr.h:701
@ SMART_ACTION_RANDOM_MUSIC
Definition: SmartScriptMgr.h:731
@ SMART_ACTION_ADD_IMMUNITY
Definition: SmartScriptMgr.h:722
@ SMART_ACTION_CUSTOM_CAST
Definition: SmartScriptMgr.h:733
@ SMART_ACTION_CU_ENCOUNTER_START
Definition: SmartScriptMgr.h:737
@ SMART_ACTION_AC_END
Definition: SmartScriptMgr.h:746
@ SMART_ACTION_PLAYER_TALK
Definition: SmartScriptMgr.h:735
@ SMART_ACTION_DESPAWN_SPAWNGROUP
Definition: SmartScriptMgr.h:702
@ SMART_ACTION_RESPAWN_BY_SPAWNID
Definition: SmartScriptMgr.h:703
@ SMART_ACTION_REMOVE_MOVEMENT
Definition: SmartScriptMgr.h:697
@ SMART_ACTION_DO_ACTION
Definition: SmartScriptMgr.h:738
@ SMART_ACTION_SET_CAN_FLY
Definition: SmartScriptMgr.h:689
@ SMART_ACTION_REMOVE_IMMUNITY
Definition: SmartScriptMgr.h:723
@ SMART_EVENT_AC_START
Definition: SmartScriptMgr.h:207
@ SMART_EVENT_TC_END
Definition: SmartScriptMgr.h:204
@ SMART_EVENT_AC_END
Definition: SmartScriptMgr.h:216
@ SMART_EVENT_PHASE_ALL
Definition: SmartScriptMgr.h:97
@ SMART_EVENT_PHASE_MAX
Definition: SmartScriptMgr.h:77
const uint32 SmartAITypeMask[SMART_SCRIPT_TYPE_MAX][2]
Definition: SmartScriptMgr.h:1732
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< TaxiPathEntry > sTaxiPathStore(TaxiPathEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:49
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: Object.h:42
@ REACT_AGGRESSIVE
Definition: Unit.h:1037
#define MAX_MOVE_TYPE
Definition: Unit.h:389
#define MAX_SHEATH_STATE
Definition: Unit.h:131
#define sGameEventMgr
Definition: GameEventMgr.h:186
@ NULL_MOTION_TYPE
Definition: MotionMaster.h:56
@ QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT
Definition: QuestDef.h:161
#define sSpellMgr
Definition: SpellMgr.h:825
events
Definition: boss_sartura.cpp:43
phase
Definition: boss_skadi.cpp:102
@ MAX_POWERS
Definition: SharedDefines.h:248
@ EVENT_CHARGE
Definition: SharedDefines.h:3283
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
uint32 map
Definition: SmartScriptMgr.h:275
uint32 event_flags
Definition: SmartScriptMgr.h:224
uint32 event_phase_mask
Definition: SmartScriptMgr.h:222
uint32 entry
Definition: SmartScriptMgr.h:471
uint32 id
Definition: SmartScriptMgr.h:361
uint32 cooldownMax
Definition: SmartScriptMgr.h:247
uint32 min
Definition: SmartScriptMgr.h:229
uint32 radius
Definition: SmartScriptMgr.h:295
uint32 school
Definition: SmartScriptMgr.h:255
uint32 rangeMin
Definition: SmartScriptMgr.h:526
uint32 eventId
Definition: SmartScriptMgr.h:451
uint32 guid
Definition: SmartScriptMgr.h:470
uint32 spellId
Definition: SmartScriptMgr.h:289
uint32 hostilityMode
Hostility mode of the event. 0: hostile, 1: not hostile, 2: any.
Definition: SmartScriptMgr.h:265
uint32 repeatMin
Definition: SmartScriptMgr.h:231
uint32 area
Definition: SmartScriptMgr.h:276
uint32 value
Definition: SmartScriptMgr.h:367
SAIBool playerOnly
Definition: SmartScriptMgr.h:248
uint32 spell
Definition: SmartScriptMgr.h:254
uint32 repeatMax
Definition: SmartScriptMgr.h:232
uint32 max
Definition: SmartScriptMgr.h:230
uint32 gameEventId
Definition: SmartScriptMgr.h:441
uint32 cooldownMin
Definition: SmartScriptMgr.h:246
uint32 minHpPct
Definition: SmartScriptMgr.h:461
uint32 maxRange
Definition: SmartScriptMgr.h:238
uint32 rangeMax
Definition: SmartScriptMgr.h:527
uint32 maxHpPct
Definition: SmartScriptMgr.h:462
uint32 minRange
Definition: SmartScriptMgr.h:237
SMART_EVENT type
Definition: SmartScriptMgr.h:221
uint32 creature
Definition: SmartScriptMgr.h:249
uint32 phasemask
Definition: SmartScriptMgr.h:430
std::array< uint32, SMART_ACTION_PARAM_COUNT > emotes
Definition: SmartScriptMgr.h:847
uint32 repeatMax
Definition: SmartScriptMgr.h:1122
uint32 phaseMin
Definition: SmartScriptMgr.h:949
SAIBool reset
Definition: SmartScriptMgr.h:1107
std::array< uint32, SMART_ACTION_PARAM_COUNT > actionLists
Definition: SmartScriptMgr.h:1170
SAIBool root
Definition: SmartScriptMgr.h:1250
uint32 spell
Definition: SmartScriptMgr.h:852
std::array< uint32, SMART_ACTION_PARAM_COUNT > wps
Definition: SmartScriptMgr.h:1288
SAIBool force
Definition: SmartScriptMgr.h:1315
uint32 data
Definition: SmartScriptMgr.h:961
uint32 powerType
Definition: SmartScriptMgr.h:1272
SAIBool regenHealth
Definition: SmartScriptMgr.h:1245
uint32 entry
Definition: SmartScriptMgr.h:936
SAIBool allowOverride
Definition: SmartScriptMgr.h:1165
uint32 min
Definition: SmartScriptMgr.h:1119
SAIBool withDelayed
Definition: SmartScriptMgr.h:1181
SAIBool withInstant
Definition: SmartScriptMgr.h:1183
uint32 percent
Definition: SmartScriptMgr.h:1001
uint32 dec
Definition: SmartScriptMgr.h:918
struct SmartAction::@77::@177 castCustom
struct SmartAction::@77::@86 randomMusic
uint32 mapID
Definition: SmartScriptMgr.h:1100
uint32 model
Definition: SmartScriptMgr.h:787
SAIBool attackInvoker
Definition: SmartScriptMgr.h:883
SAIBool useTalkTarget
Definition: SmartScriptMgr.h:770
SAIBool run
Definition: SmartScriptMgr.h:1045
SAIBool swim
Definition: SmartScriptMgr.h:1095
uint32 sound2
Definition: SmartScriptMgr.h:800
uint32 creature
Definition: SmartScriptMgr.h:786
uint32 sound3
Definition: SmartScriptMgr.h:801
uint32 state
Definition: SmartScriptMgr.h:842
uint32 sound1
Definition: SmartScriptMgr.h:799
SAIBool updateLevel
Definition: SmartScriptMgr.h:973
SMART_ACTION type
Definition: SmartScriptMgr.h:762
uint32 sound4
Definition: SmartScriptMgr.h:802
SAIBool attack
Definition: SmartScriptMgr.h:902
uint32 repeatMin
Definition: SmartScriptMgr.h:1121
SAIBool fly
Definition: SmartScriptMgr.h:1088
uint32 textGroupID
Definition: SmartScriptMgr.h:768
std::array< uint32, SMART_ACTION_PARAM_COUNT > phases
Definition: SmartScriptMgr.h:944
SAIBool repeat
Definition: SmartScriptMgr.h:1047
uint32 count
Definition: SmartScriptMgr.h:1068
uint32 inc
Definition: SmartScriptMgr.h:917
uint32 phaseMax
Definition: SmartScriptMgr.h:950
SAIBool withEmote
Definition: SmartScriptMgr.h:984
uint32 max
Definition: SmartScriptMgr.h:1120
uint32 speedFraction
Definition: SmartScriptMgr.h:1405
SAIBool fail
Definition: SmartScriptMgr.h:1062
SAIBool directAdd
Definition: SmartScriptMgr.h:837
uint32 reactState
Definition: SmartScriptMgr.h:1050
uint32 speedInteger
Definition: SmartScriptMgr.h:1404
uint32 factionID
Definition: SmartScriptMgr.h:781
SAIBool move
Definition: SmartScriptMgr.h:907
uint32 movementType
Definition: SmartScriptMgr.h:1403
uint32 questID
Definition: SmartScriptMgr.h:836
uint32 pathID
Definition: SmartScriptMgr.h:1046
uint32 id
Definition: SmartScriptMgr.h:1040
uint32 phase
Definition: SmartScriptMgr.h:912
uint32 sheath
Definition: SmartScriptMgr.h:989
float x
Definition: SmartScriptMgr.h:1537
float y
Definition: SmartScriptMgr.h:1537
SMARTAI_TARGETS type
Definition: SmartScriptMgr.h:1536
uint32 link
Definition: SmartScriptMgr.h:1896
uint32 event_id
Definition: SmartScriptMgr.h:1895
int32 entryOrGuid
Definition: SmartScriptMgr.h:1893
uint32 GetScriptType() const
Definition: SmartScriptMgr.h:1903
uint32 GetEventType() const
Definition: SmartScriptMgr.h:1904
uint32 GetTargetType() const
Definition: SmartScriptMgr.h:1906
SmartAction action
Definition: SmartScriptMgr.h:1899
SmartEvent event
Definition: SmartScriptMgr.h:1898
uint32 GetActionType() const
Definition: SmartScriptMgr.h:1905
SmartTarget target
Definition: SmartScriptMgr.h:1900
bool IsTextEmoteValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2103
bool NotNULL(SmartScriptHolder const &e, uint32 data)
Definition: SmartScriptMgr.h:2043
bool IsSoundValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2133
bool IsGameObjectValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2073
bool IsMinMaxValid(SmartScriptHolder const &e, uint32 min, uint32 max)
Definition: SmartScriptMgr.h:2023
static bool EventHasInvoker(SMART_EVENT event)
Definition: SmartScriptMgr.cpp:319
bool IsQuestValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2063
bool IsCreatureValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2053
bool IsAreaTriggerValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2123
static bool IsTextValid(SmartScriptHolder const &e, uint32 id)
Definition: SmartScriptMgr.cpp:1986
static bool CheckUnusedEventParams(SmartScriptHolder const &e)
Definition: SmartScriptMgr.cpp:495
static bool CheckUnusedActionParams(SmartScriptHolder const &e)
Definition: SmartScriptMgr.cpp:616
bool IsItemValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2093
bool IsEmoteValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2113
bool IsSpellValid(SmartScriptHolder const &e, uint32 entry)
Definition: SmartScriptMgr.h:2083
Definition: CreatureData.h:349
Definition: GameEventMgr.h:57
bool isValid() const
Definition: GameEventMgr.h:73
std::vector< GameEventData > GameEventDataMap
Definition: GameEventMgr.h:107
Definition: QuestDef.h:207
Definition: SpellInfo.h:314
uint32 SchoolMask
Definition: SpellInfo.h:390

References AC_SAI_IS_BOOLEAN_VALID, SmartScriptHolder::action, SmartAction::actionLists, SmartAction::addAura, SmartAction::allowOverride, SmartEvent::area, SmartEvent::areaCasting, SmartEvent::areaRange, SmartEvent::areatrigger, AsUnderlyingType(), SmartAction::attack, SmartAction::attackInvoker, SmartEvent::aura, SmartAction::autoAttack, SmartEvent::behindTarget, SmartAction::callHelp, SmartAction::castCustom, CheckUnusedActionParams(), CheckUnusedEventParams(), SmartAction::closestWaypointFromList, SmartAction::combatMove, SmartEvent::cooldownMax, SmartEvent::cooldownMin, SmartAction::count, SmartEvent::counter, SmartEvent::creature, SmartAction::creature, SmartAction::crossCast, SmartAction::data, SmartEvent::dataSet, SmartAction::dec, SmartAction::directAdd, SmartAction::disable, SmartAction::disableEvade, SmartEvent::distance, SmartEvent::doAction, SmartEvent::emote, SmartAction::emote, SmartAction::emotes, SmartEvent::End, SmartEvent::entry, SmartAction::entry, SmartScriptHolder::entryOrGuid, SmartAction::equip, SmartScriptHolder::event, EVENT_CHARGE, SmartEvent::event_flags, SmartScriptHolder::event_id, SmartEvent::event_phase_mask, EventHasInvoker(), SmartEvent::eventId, SmartEvent::eventPhaseChange, SmartAction::faction, SmartAction::factionID, SmartAction::fail, SmartAction::fly, SmartAction::force, SmartEvent::friendlyCC, SmartEvent::friendlyHealth, SmartEvent::friendlyHealthPct, SmartEvent::gameEvent, SmartEvent::gameEventId, SmartAction::gameEventStart, SmartAction::gameEventStop, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetEventType(), SmartScriptHolder::GetScriptType(), SmartScriptHolder::GetTargetType(), SmartEvent::guid, SmartEvent::hostilityMode, SmartEvent::id, SmartAction::id, SmartAction::inc, SmartAction::incEventPhase, SmartAction::installTtemplate, SmartAction::interruptSpellCasting, IsAreaTriggerValid(), IsCreatureValid(), IsEmoteValid(), IsGameObjectValid(), IsItemValid(), IsMinMaxValid(), IsQuestValid(), IsSoundValid(), IsSpellValid(), IsTextEmoteValid(), IsTextValid(), GameEventData::isValid(), Acore::IsValidMapCoord(), SmartAction::item, SmartEvent::kill, SmartAction::killedMonster, SmartScriptHolder::link, SmartAction::loadEquipment, LOG_ERROR, SmartEvent::los, SmartEvent::map, SmartAction::mapID, SmartEvent::max, SmartAction::max, MAX_MOVE_TYPE, MAX_POWERS, MAX_SHEATH_STATE, SmartEvent::maxHpPct, SmartEvent::maxRange, SmartEvent::min, SmartAction::min, SmartEvent::minHpPct, SmartEvent::minMax, SmartEvent::minMaxRepeat, SmartEvent::minRange, SmartEvent::missingBuff, SmartAction::model, SmartAction::morphOrMount, SmartAction::move, SmartEvent::movementInform, SmartAction::movementSpeed, SmartAction::movementType, SmartAction::music, SmartEvent::nearPlayer, SmartEvent::nearPlayerNegation, NotNULL(), NULL_MOTION_TYPE, SmartAction::pathID, SmartAction::percent, SmartAction::phase, SmartEvent::phasemask, SmartAction::phaseMax, SmartAction::phaseMin, SmartAction::phases, SmartEvent::playerOnly, SmartAction::power, SmartAction::powerType, SmartEvent::quest, SmartAction::quest, QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT, SmartAction::questID, SmartAction::questOffer, SmartEvent::radius, SmartAction::randomEmote, SmartAction::randomMusic, SmartAction::randomPhase, SmartAction::randomPhaseRange, SmartAction::randomSound, SmartAction::randTimedActionList, SmartEvent::rangeMax, SmartEvent::rangeMin, SmartEvent::rangeRepeat, SmartAction::react, REACT_AGGRESSIVE, SmartAction::reactState, SmartAction::regenHealth, SmartAction::removeAura, SmartAction::repeat, SmartEvent::repeatMax, SmartAction::repeatMax, SmartEvent::repeatMin, SmartAction::repeatMin, SmartAction::reset, SmartEvent::respawn, SmartAction::root, SmartAction::run, sAreaTableStore, SmartEvent::school, SpellInfo::SchoolMask, sCreatureDisplayInfoStore, SmartAction::setCounter, SmartAction::setEventPhase, SmartAction::setFly, SmartAction::setHealthPct, SmartAction::setHealthRegen, SmartAction::setInstanceData, SmartAction::setRoot, SmartAction::setRun, SmartAction::setSheath, SmartAction::setSwim, sFactionTemplateStore, sGameEventMgr, SmartAction::sheath, SmartAction::simpleTalk, sMapStore, SMART_ACTION_AC_END, SMART_ACTION_AC_START, SMART_ACTION_ACTIVATE_GOBJECT, SMART_ACTION_ACTIVATE_TAXI, SMART_ACTION_ADD_AURA, SMART_ACTION_ADD_DYNAMIC_FLAG, SMART_ACTION_ADD_GO_FLAG, SMART_ACTION_ADD_IMMUNITY, SMART_ACTION_ADD_ITEM, SMART_ACTION_ADD_NPC_FLAG, SMART_ACTION_ADD_POWER, SMART_ACTION_ADD_THREAT, SMART_ACTION_ALLOW_COMBAT_MOVEMENT, SMART_ACTION_ATTACK_START, SMART_ACTION_ATTACK_STOP, SMART_ACTION_AUTO_ATTACK, SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS, SMART_ACTION_CALL_FOR_HELP, SMART_ACTION_CALL_GROUPEVENTHAPPENS, SMART_ACTION_CALL_KILLEDMONSTER, SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST, SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST, SMART_ACTION_CALL_SCRIPT_RESET, SMART_ACTION_CALL_TIMED_ACTIONLIST, SMART_ACTION_CAST, SMART_ACTION_CLOSE_GOSSIP, SMART_ACTION_COMBAT_STOP, SMART_ACTION_CONE_SUMMON, SMART_ACTION_CREATE_TIMED_EVENT, SMART_ACTION_CROSS_CAST, SMART_ACTION_CU_ENCOUNTER_START, SMART_ACTION_CUSTOM_CAST, SMART_ACTION_DESPAWN_SPAWNGROUP, SMART_ACTION_DIE, SMART_ACTION_DISABLE, SMART_ACTION_DISABLE_EVADE, SMART_ACTION_DO_ACTION, SMART_ACTION_EQUIP, SMART_ACTION_EVADE, SMART_ACTION_EXIT_VEHICLE, SMART_ACTION_FAIL_QUEST, SMART_ACTION_FALL, SMART_ACTION_FLEE, SMART_ACTION_FLEE_FOR_ASSIST, SMART_ACTION_FOLLOW, SMART_ACTION_FORCE_DESPAWN, SMART_ACTION_GAME_EVENT_START, SMART_ACTION_GAME_EVENT_STOP, SMART_ACTION_GO_SET_GO_STATE, SMART_ACTION_GO_SET_LOOT_STATE, SMART_ACTION_INC_EVENT_PHASE, SMART_ACTION_INSTALL_AI_TEMPLATE, SMART_ACTION_INTERRUPT_SPELL, SMART_ACTION_INVOKER_CAST, SMART_ACTION_JUMP_TO_POS, SMART_ACTION_KILL_UNIT, SMART_ACTION_LOAD_EQUIPMENT, SMART_ACTION_LOAD_GRID, SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL, SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL, SMART_ACTION_MOVE_FORWARD, SMART_ACTION_MOVE_TO_POS, SMART_ACTION_MOVE_TO_POS_TARGET, SMART_ACTION_MUSIC, SMART_ACTION_NO_ENVIRONMENT_UPDATE, SMART_ACTION_OFFER_QUEST, SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT, SMART_ACTION_PLAY_ANIMKIT, SMART_ACTION_PLAY_CINEMATIC, SMART_ACTION_PLAY_EMOTE, SMART_ACTION_PLAY_SPELL_VISUAL, SMART_ACTION_PLAYER_TALK, SMART_ACTION_PLAYMOVIE, SMART_ACTION_RANDOM_EMOTE, SMART_ACTION_RANDOM_MOVE, SMART_ACTION_RANDOM_MUSIC, SMART_ACTION_RANDOM_PHASE, SMART_ACTION_RANDOM_PHASE_RANGE, SMART_ACTION_RANDOM_SOUND, SMART_ACTION_REMOVE_ALL_GAMEOBJECTS, SMART_ACTION_REMOVE_AURAS_BY_TYPE, SMART_ACTION_REMOVE_DYNAMIC_FLAG, SMART_ACTION_REMOVE_GO_FLAG, SMART_ACTION_REMOVE_IMMUNITY, SMART_ACTION_REMOVE_ITEM, SMART_ACTION_REMOVE_MOVEMENT, SMART_ACTION_REMOVE_NPC_FLAG, SMART_ACTION_REMOVE_POWER, SMART_ACTION_REMOVE_TIMED_EVENT, SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1, SMART_ACTION_REMOVE_UNIT_FLAG, SMART_ACTION_REMOVEAURASFROMSPELL, SMART_ACTION_RESERVED_16, SMART_ACTION_RESET_GOBJECT, SMART_ACTION_RESET_SCRIPT_BASE_OBJECT, SMART_ACTION_RESPAWN_BY_SPAWNID, SMART_ACTION_RESPAWN_TARGET, SMART_ACTION_RISE_UP, SMART_ACTION_SCENE_CANCEL, SMART_ACTION_SCENE_PLAY, SMART_ACTION_SEND_GO_CUSTOM_ANIM, SMART_ACTION_SEND_GOSSIP_MENU, SMART_ACTION_SEND_TARGET_TO_TARGET, SMART_ACTION_SET_ACTIVE, SMART_ACTION_SET_CAN_FLY, SMART_ACTION_SET_CASTER_COMBAT_DIST, SMART_ACTION_SET_COMBAT_DISTANCE, SMART_ACTION_SET_CORPSE_DELAY, SMART_ACTION_SET_COUNTER, SMART_ACTION_SET_DATA, SMART_ACTION_SET_DYNAMIC_FLAG, SMART_ACTION_SET_EMOTE_STATE, SMART_ACTION_SET_EVENT_FLAG_RESET, SMART_ACTION_SET_EVENT_PHASE, SMART_ACTION_SET_FACTION, SMART_ACTION_SET_FLY, SMART_ACTION_SET_GO_FLAG, SMART_ACTION_SET_GUID, SMART_ACTION_SET_HEALTH_PCT, SMART_ACTION_SET_HEALTH_REGEN, SMART_ACTION_SET_HOME_POS, SMART_ACTION_SET_HOVER, SMART_ACTION_SET_IN_COMBAT_WITH_ZONE, SMART_ACTION_SET_INGAME_PHASE_MASK, SMART_ACTION_SET_INST_DATA, SMART_ACTION_SET_INST_DATA64, SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL, SMART_ACTION_SET_MOVEMENT_SPEED, SMART_ACTION_SET_NPC_FLAG, SMART_ACTION_SET_ORIENTATION, SMART_ACTION_SET_POWER, SMART_ACTION_SET_RANGED_MOVEMENT, SMART_ACTION_SET_REACT_STATE, SMART_ACTION_SET_ROOT, SMART_ACTION_SET_RUN, SMART_ACTION_SET_SCALE, SMART_ACTION_SET_SHEATH, SMART_ACTION_SET_SIGHT_DIST, SMART_ACTION_SET_SWIM, SMART_ACTION_SET_UNIT_FIELD_BYTES_1, SMART_ACTION_SET_UNIT_FLAG, SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS, SMART_ACTION_SET_VISIBILITY, SMART_ACTION_SIMPLE_TALK, SMART_ACTION_SOUND, SMART_ACTION_SPAWN_SPAWNGROUP, SMART_ACTION_START_CLOSEST_WAYPOINT, SMART_ACTION_STOP_MOTION, SMART_ACTION_STORE_TARGET_LIST, SMART_ACTION_SUMMON_CREATURE, SMART_ACTION_SUMMON_CREATURE_GROUP, SMART_ACTION_SUMMON_GO, SMART_ACTION_SUMMON_RADIAL, SMART_ACTION_TALK, SMART_ACTION_TC_END, SMART_ACTION_TELEPORT, SMART_ACTION_THREAT_ALL_PCT, SMART_ACTION_THREAT_SINGLE_PCT, SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT, SMART_ACTION_TRIGGER_TIMED_EVENT, SMART_ACTION_UPDATE_TEMPLATE, SMART_ACTION_VORTEX_SUMMON, SMART_ACTION_WP_PAUSE, SMART_ACTION_WP_RESUME, SMART_ACTION_WP_START, SMART_ACTION_WP_STOP, SMART_ACTION_ZONE_UNDER_ATTACK, SMART_EVENT_AC_END, SMART_EVENT_AC_START, SMART_EVENT_ACCEPTED_QUEST, SMART_EVENT_ACTION_DONE, SMART_EVENT_AGGRO, SMART_EVENT_AI_INIT, SMART_EVENT_AREA_CASTING, SMART_EVENT_AREA_RANGE, SMART_EVENT_AREATRIGGER_ONTRIGGER, SMART_EVENT_CHARMED, SMART_EVENT_CHARMED_TARGET, SMART_EVENT_CORPSE_REMOVED, SMART_EVENT_COUNTER_SET, SMART_EVENT_DAMAGED, SMART_EVENT_DAMAGED_TARGET, SMART_EVENT_DATA_SET, SMART_EVENT_DEATH, SMART_EVENT_DISTANCE_CREATURE, SMART_EVENT_DISTANCE_GAMEOBJECT, SMART_EVENT_EVADE, SMART_EVENT_EVENT_PHASE_CHANGE, SMART_EVENT_FLAGS_ALL, SMART_EVENT_FOLLOW_COMPLETED, SMART_EVENT_FRIENDLY_HEALTH, SMART_EVENT_FRIENDLY_HEALTH_PCT, SMART_EVENT_FRIENDLY_IS_CC, SMART_EVENT_FRIENDLY_MISSING_BUFF, SMART_EVENT_GAME_EVENT_END, SMART_EVENT_GAME_EVENT_START, SMART_EVENT_GO_EVENT_INFORM, SMART_EVENT_GO_STATE_CHANGED, SMART_EVENT_GOSSIP_HELLO, SMART_EVENT_GOSSIP_SELECT, SMART_EVENT_HAS_AURA, SMART_EVENT_HEALTH_PCT, SMART_EVENT_IC_LOS, SMART_EVENT_INSTANCE_PLAYER_ENTER, SMART_EVENT_IS_BEHIND_TARGET, SMART_EVENT_JUST_CREATED, SMART_EVENT_JUST_SUMMONED, SMART_EVENT_KILL, SMART_EVENT_LINK, SMART_EVENT_MANA_PCT, SMART_EVENT_MOVEMENTINFORM, SMART_EVENT_NEAR_PLAYERS, SMART_EVENT_NEAR_PLAYERS_NEGATION, SMART_EVENT_NEAR_UNIT, SMART_EVENT_NEAR_UNIT_NEGATION, SMART_EVENT_ON_SPELLCLICK, SMART_EVENT_OOC_LOS, SMART_EVENT_PASSENGER_BOARDED, SMART_EVENT_PASSENGER_REMOVED, SMART_EVENT_PHASE_ALL, SMART_EVENT_PHASE_MAX, SMART_EVENT_QUEST_ACCEPTED, SMART_EVENT_QUEST_COMPLETION, SMART_EVENT_QUEST_FAIL, SMART_EVENT_QUEST_OBJ_COMPLETION, SMART_EVENT_QUEST_REWARDED, SMART_EVENT_RANGE, SMART_EVENT_REACHED_HOME, SMART_EVENT_RECEIVE_EMOTE, SMART_EVENT_RECEIVE_HEAL, SMART_EVENT_RESET, SMART_EVENT_RESPAWN, SMART_EVENT_REWARD_QUEST, SMART_EVENT_SPELLHIT, SMART_EVENT_SPELLHIT_TARGET, SMART_EVENT_SUMMON_DESPAWNED, SMART_EVENT_SUMMONED_UNIT, SMART_EVENT_SUMMONED_UNIT_DIES, SMART_EVENT_TARGET_BUFFED, SMART_EVENT_TARGET_HEALTH_PCT, SMART_EVENT_TARGET_MANA_PCT, SMART_EVENT_TC_END, SMART_EVENT_TEXT_OVER, SMART_EVENT_TIMED_EVENT_TRIGGERED, SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_EVENT_TRANSPORT_ADDPLAYER, SMART_EVENT_TRANSPORT_RELOCATE, SMART_EVENT_TRANSPORT_REMOVE_PLAYER, SMART_EVENT_UPDATE, SMART_EVENT_UPDATE_IC, SMART_EVENT_UPDATE_OOC, SMART_EVENT_VICTIM_CASTING, SMART_EVENT_WAYPOINT_ENDED, SMART_EVENT_WAYPOINT_PAUSED, SMART_EVENT_WAYPOINT_REACHED, SMART_EVENT_WAYPOINT_RESUMED, SMART_EVENT_WAYPOINT_START, SMART_EVENT_WAYPOINT_STOPPED, SMART_SCRIPT_RESPAWN_CONDITION_AREA, SMART_SCRIPT_RESPAWN_CONDITION_MAP, SMART_SCRIPT_TYPE_CREATURE, SMART_SCRIPT_TYPE_GAMEOBJECT, SMART_SCRIPT_TYPE_TIMED_ACTIONLIST, SMART_TARGET_AC_END, SMART_TARGET_AC_START, SMART_TARGET_ACTION_INVOKER, SMART_TARGET_CLOSEST_CREATURE, SMART_TARGET_CLOSEST_PLAYER, SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_CREATURE_GUID, SMART_TARGET_CREATURE_RANGE, SMART_TARGET_LOOT_RECIPIENTS, SMART_TARGET_PLAYER_DISTANCE, SMART_TARGET_PLAYER_RANGE, SMART_TARGET_SELF, SMART_TARGET_TC_END, SMARTAI_TEMPLATE_END, SmartAIEventMask, SmartAITypeMask, sObjectMgr, SmartAction::sound, SmartAction::sound1, SmartAction::sound2, SmartAction::sound3, SmartAction::sound4, SmartAction::speedFraction, SmartAction::speedInteger, SmartEvent::spell, SmartAction::spell, SmartEvent::spellHit, SmartEvent::spellId, sSmartWaypointMgr, sSpellMgr, SmartAction::state, sTaxiPathStore, SmartAction::summonCreature, SmartEvent::summoned, SmartAction::summonGO, SmartAction::swim, SmartAction::talk, SmartScriptHolder::target, SmartEvent::targetCasting, SmartAction::taxi, SmartAction::teleport, TEMPSUMMON_MANUAL_DESPAWN, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, SmartAction::textGroupID, SmartAction::timedActionList, SmartAction::timeEvent, SmartEvent::transportAddCreature, SmartEvent::type, SmartAction::type, SmartTarget::type, SmartAction::updateLevel, SmartAction::updateTemplate, SmartAction::useTalkTarget, SmartEvent::value, SmartAction::visibility, SmartAction::withDelayed, SmartAction::withEmote, SmartAction::withInstant, SmartAction::wps, SmartAction::wpStart, SmartAction::wpStop, SmartTarget::x, and SmartTarget::y.

Referenced by LoadSmartAIFromDB().

◆ IsGameObjectValid()

bool SmartAIMgr::IsGameObjectValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2074 {
2075 if (!sObjectMgr->GetGameObjectTemplate(entry))
2076 {
2077 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent GameObject entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2078 return false;
2079 }
2080 return true;
2081 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sObjectMgr.

Referenced by IsEventValid(), and IsTargetValid().

◆ IsItemValid()

bool SmartAIMgr::IsItemValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2094 {
2095 if (!sItemStore.LookupEntry(entry))
2096 {
2097 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Item entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2098 return false;
2099 }
2100 return true;
2101 }
DBCStorage< ItemEntry > sItemStore(Itemfmt)

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sItemStore.

Referenced by IsEventValid().

◆ IsMinMaxValid()

bool SmartAIMgr::IsMinMaxValid ( SmartScriptHolder const &  e,
uint32  min,
uint32  max 
)
inlineprivate
2024 {
2025 if (max < min)
2026 {
2027 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses min/max params wrong ({}/{}), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
2028 return false;
2029 }
2030 return true;
2031 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), and LOG_ERROR.

Referenced by IsEventValid().

◆ IsQuestValid()

bool SmartAIMgr::IsQuestValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2064 {
2065 if (!sObjectMgr->GetQuestTemplate(entry))
2066 {
2067 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Quest entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2068 return false;
2069 }
2070 return true;
2071 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sObjectMgr.

Referenced by IsEventValid().

◆ IsSoundValid()

bool SmartAIMgr::IsSoundValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2134 {
2135 if (!sSoundEntriesStore.LookupEntry(entry))
2136 {
2137 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Sound entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2138 return false;
2139 }
2140 return true;
2141 }
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sSoundEntriesStore.

Referenced by IsEventValid().

◆ IsSpellValid()

bool SmartAIMgr::IsSpellValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2084 {
2085 if (!sSpellMgr->GetSpellInfo(entry))
2086 {
2087 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Spell entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2088 return false;
2089 }
2090 return true;
2091 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sSpellMgr.

Referenced by IsEventValid().

◆ IsTargetValid()

bool SmartAIMgr::IsTargetValid ( SmartScriptHolder const &  e)
private
372{
373 if (e.GetActionType() == SMART_ACTION_INSTALL_AI_TEMPLATE)
374 return true; // AI template has special handling
375 switch (e.GetTargetType())
376 {
379 {
380 if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
381 {
382 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Creature entry {} as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
383 return false;
384 }
385 break;
386 }
389 {
390 if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
391 {
392 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent GameObject entry {} as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
393 return false;
394 }
395 break;
396 }
398 {
399 if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry))
400 return false;
401 break;
402 }
404 {
405 if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry))
406 return false;
407 break;
408 }
411 {
412 if (e.target.playerDistance.dist == 0)
413 {
414 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
415 return false;
416 }
417 break;
418 }
422 if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && e.GetEventType() != SMART_EVENT_LINK && !EventHasInvoker(e.event.type))
423 {
424 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invoker target, but event does not provide any invoker!", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
425 return false;
426 }
427 break;
429 {
430 if (e.target.summonedCreatures.entry && !IsCreatureValid(e, e.target.summonedCreatures.entry))
431 {
432 return false;
433 }
434 break;
435 }
437 {
438 if (e.target.instanceStorage.type != 1 && e.target.instanceStorage.type != 2)
439 {
440 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invalid instance storage type as target ({}).",
441 e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType(), e.target.instanceStorage.type);
442 return false;
443 }
444 break;
445 }
450 AC_SAI_IS_BOOLEAN_VALID(e, e.target.hostileRandom.playerOnly);
451 break;
453 AC_SAI_IS_BOOLEAN_VALID(e, e.target.farthest.playerOnly);
454 AC_SAI_IS_BOOLEAN_VALID(e, e.target.farthest.isInLos);
455 break;
457 AC_SAI_IS_BOOLEAN_VALID(e, e.target.unitClosest.dead);
458 break;
460 AC_SAI_IS_BOOLEAN_VALID(e, e.target.closestAttackable.playerOnly);
461 break;
463 AC_SAI_IS_BOOLEAN_VALID(e, e.target.closestFriendly.playerOnly);
464 break;
466 AC_SAI_IS_BOOLEAN_VALID(e, e.target.owner.useCharmerOrOwner);
467 break;
481 break;
482 default:
483 LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type({}), Entry {} SourceType {} Event {} Action {}, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
484 return false;
485 }
486
488 {
489 return false;
490 }
491
492 return true;
493}
@ SMART_TARGET_SUMMONED_CREATURES
Definition: SmartScriptMgr.h:1516
@ SMART_TARGET_ROLE_SELECTION
Definition: SmartScriptMgr.h:1515
@ SMART_TARGET_INSTANCE_STORAGE
Definition: SmartScriptMgr.h:1517
@ SMART_TARGET_RANDOM_POINT
Definition: SmartScriptMgr.h:1514
static bool CheckUnusedTargetParams(SmartScriptHolder const &e)
Definition: SmartScriptMgr.cpp:810

References AC_SAI_IS_BOOLEAN_VALID, CheckUnusedTargetParams(), SmartTarget::closestAttackable, SmartTarget::closestFriendly, SmartTarget::creature, SmartTarget::dead, SmartTarget::dist, SmartTarget::entry, SmartScriptHolder::entryOrGuid, SmartScriptHolder::event, SmartScriptHolder::event_id, EventHasInvoker(), SmartTarget::farthest, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetEventType(), SmartScriptHolder::GetScriptType(), SmartScriptHolder::GetTargetType(), SmartTarget::goDistance, SmartTarget::goGUID, SmartTarget::hostileRandom, SmartTarget::instanceStorage, IsCreatureValid(), IsGameObjectValid(), SmartTarget::isInLos, LOG_ERROR, SmartTarget::owner, SmartTarget::playerDistance, SmartTarget::playerOnly, SMART_ACTION_INSTALL_AI_TEMPLATE, SMART_EVENT_LINK, SMART_EVENT_SUMMONED_UNIT_DIES, SMART_SCRIPT_TYPE_TIMED_ACTIONLIST, SMART_TARGET_ACTION_INVOKER, SMART_TARGET_ACTION_INVOKER_VEHICLE, SMART_TARGET_CLOSEST_CREATURE, SMART_TARGET_CLOSEST_ENEMY, SMART_TARGET_CLOSEST_FRIENDLY, SMART_TARGET_CLOSEST_GAMEOBJECT, SMART_TARGET_CLOSEST_PLAYER, SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_CREATURE_GUID, SMART_TARGET_CREATURE_RANGE, SMART_TARGET_FARTHEST, SMART_TARGET_GAMEOBJECT_DISTANCE, SMART_TARGET_GAMEOBJECT_GUID, SMART_TARGET_GAMEOBJECT_RANGE, SMART_TARGET_HOSTILE_LAST_AGGRO, SMART_TARGET_HOSTILE_RANDOM, SMART_TARGET_HOSTILE_RANDOM_NOT_TOP, SMART_TARGET_HOSTILE_SECOND_AGGRO, SMART_TARGET_INSTANCE_STORAGE, SMART_TARGET_INVOKER_PARTY, SMART_TARGET_LOOT_RECIPIENTS, SMART_TARGET_NONE, SMART_TARGET_OWNER_OR_SUMMONER, SMART_TARGET_PLAYER_DISTANCE, SMART_TARGET_PLAYER_RANGE, SMART_TARGET_PLAYER_WITH_AURA, SMART_TARGET_POSITION, SMART_TARGET_RANDOM_POINT, SMART_TARGET_ROLE_SELECTION, SMART_TARGET_SELF, SMART_TARGET_STORED, SMART_TARGET_SUMMONED_CREATURES, SMART_TARGET_THREAT_LIST, SMART_TARGET_VICTIM, sObjectMgr, SmartTarget::summonedCreatures, SmartScriptHolder::target, SmartEvent::type, SmartTarget::type, SmartTarget::unitClosest, SmartTarget::unitDistance, SmartTarget::unitGUID, and SmartTarget::useCharmerOrOwner.

Referenced by LoadSmartAIFromDB().

◆ IsTextEmoteValid()

bool SmartAIMgr::IsTextEmoteValid ( SmartScriptHolder const &  e,
uint32  entry 
)
inlineprivate
2104 {
2105 if (!sEmotesTextStore.LookupEntry(entry))
2106 {
2107 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Text Emote entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
2108 return false;
2109 }
2110 return true;
2111 }
DBCStorage< EmotesTextEntry > sEmotesTextStore(EmotesTextEntryfmt)

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), LOG_ERROR, and sEmotesTextStore.

Referenced by IsEventValid().

◆ IsTextValid()

bool SmartAIMgr::IsTextValid ( SmartScriptHolder const &  e,
uint32  id 
)
staticprivate
1987{
1988 if (e.GetScriptType() != SMART_SCRIPT_TYPE_CREATURE)
1989 return true;
1990
1991 uint32 entry = 0;
1992
1993 if (e.GetEventType() == SMART_EVENT_TEXT_OVER)
1994 {
1995 entry = e.event.textOver.creatureEntry;
1996 }
1997 else
1998 {
1999 switch (e.GetTargetType())
2000 {
2004 return true; // ignore
2005 default:
2006 if (e.entryOrGuid < 0)
2007 {
2008 ObjectGuid::LowType guid = ObjectGuid::LowType(-e.entryOrGuid);
2009 CreatureData const* data = sObjectMgr->GetCreatureData(guid);
2010 if (!data)
2011 {
2012 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} using non-existent Creature guid {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), guid);
2013 return false;
2014 }
2015 else
2016 entry = data->id1;
2017 }
2018 else
2019 entry = uint32(e.entryOrGuid);
2020 break;
2021 }
2022 }
2023
2024 if (!entry || !sCreatureTextMgr->TextExist(entry, uint8(id)))
2025 {
2026 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} using non-existent Text id {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), id);
2027 return false;
2028 }
2029
2030 return true;
2031}
std::uint8_t uint8
Definition: Define.h:110
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:119
Definition: CreatureData.h:359
uint32 id1
Definition: CreatureData.h:361
uint32 LowType
Definition: ObjectGuid.h:124

References SmartEvent::creatureEntry, SmartScriptHolder::entryOrGuid, SmartScriptHolder::event, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetEventType(), SmartScriptHolder::GetScriptType(), SmartScriptHolder::GetTargetType(), CreatureData::id1, LOG_ERROR, sCreatureTextMgr, SMART_EVENT_TEXT_OVER, SMART_SCRIPT_TYPE_CREATURE, SMART_TARGET_CLOSEST_CREATURE, SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_CREATURE_RANGE, sObjectMgr, and SmartEvent::textOver.

Referenced by IsEventValid().

◆ LoadSmartAIFromDB()

void SmartAIMgr::LoadSmartAIFromDB ( )
129{
130 uint32 oldMSTime = getMSTime();
131
132 for (uint8 i = 0; i < SMART_SCRIPT_TYPE_MAX; i++)
133 mEventMap[i].clear(); //Drop Existing SmartAI List
134
136 PreparedQueryResult result = WorldDatabase.Query(stmt);
137
138 if (!result)
139 {
140 LOG_WARN("server.loading", ">> Loaded 0 SmartAI scripts. DB table `smart_scripts` is empty.");
141 LOG_INFO("server.loading", " ");
142 return;
143 }
144
145 uint32 count = 0;
146
147 do
148 {
149 Field* fields = result->Fetch();
150
152
153 temp.entryOrGuid = fields[0].Get<int32>();
154 if (!temp.entryOrGuid)
155 {
156 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: invalid entryorguid (0), skipped loading.");
157 continue;
158 }
159
160 SmartScriptType source_type = (SmartScriptType)fields[1].Get<uint8>();
161 if (source_type >= SMART_SCRIPT_TYPE_MAX)
162 {
163 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: invalid source_type ({}), skipped loading.", uint32(source_type));
164 continue;
165 }
166 if (temp.entryOrGuid >= 0)
167 {
168 switch (source_type)
169 {
171 {
172 if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
173 {
174 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry ({}) does not exist, skipped loading.", uint32(temp.entryOrGuid));
175 continue;
176 }
177 break;
178 }
180 {
181 if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
182 {
183 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry ({}) does not exist, skipped loading.", uint32(temp.entryOrGuid));
184 continue;
185 }
186 break;
187 }
189 {
190 if (!sObjectMgr->GetAreaTrigger((uint32)temp.entryOrGuid))
191 {
192 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry ({}) does not exist, skipped loading.", uint32(temp.entryOrGuid));
193 continue;
194 }
195 break;
196 }
198 break;//nothing to check, really
199 default:
200 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type {}", (uint32)source_type);
201 continue;
202 }
203 }
204 else
205 {
206 if (!sObjectMgr->GetCreatureData(uint32(std::abs(temp.entryOrGuid))))
207 {
208 LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid ({}) does not exist, skipped loading.", uint32(std::abs(temp.entryOrGuid)));
209 continue;
210 }
211 }
212
213 temp.source_type = source_type;
214 temp.event_id = fields[2].Get<uint16>();
215 temp.link = fields[3].Get<uint16>();
216 temp.event.type = (SMART_EVENT)fields[4].Get<uint8>();
217 temp.event.event_phase_mask = fields[5].Get<uint16>();
218 temp.event.event_chance = fields[6].Get<uint8>();
219 temp.event.event_flags = fields[7].Get<uint16>();
220
221 temp.event.raw.param1 = fields[8].Get<uint32>();
222 temp.event.raw.param2 = fields[9].Get<uint32>();
223 temp.event.raw.param3 = fields[10].Get<uint32>();
224 temp.event.raw.param4 = fields[11].Get<uint32>();
225 temp.event.raw.param5 = fields[12].Get<uint32>();
226 temp.event.raw.param6 = fields[13].Get<uint32>();
227
228 temp.action.type = (SMART_ACTION)fields[14].Get<uint8>();
229 temp.action.raw.param1 = fields[15].Get<uint32>();
230 temp.action.raw.param2 = fields[16].Get<uint32>();
231 temp.action.raw.param3 = fields[17].Get<uint32>();
232 temp.action.raw.param4 = fields[18].Get<uint32>();
233 temp.action.raw.param5 = fields[19].Get<uint32>();
234 temp.action.raw.param6 = fields[20].Get<uint32>();
235
236 temp.target.type = (SMARTAI_TARGETS)fields[21].Get<uint8>();
237 temp.target.raw.param1 = fields[22].Get<uint32>();
238 temp.target.raw.param2 = fields[23].Get<uint32>();
239 temp.target.raw.param3 = fields[24].Get<uint32>();
240 temp.target.raw.param4 = fields[25].Get<uint32>();
241 temp.target.x = fields[26].Get<float>();
242 temp.target.y = fields[27].Get<float>();
243 temp.target.z = fields[28].Get<float>();
244 temp.target.o = fields[29].Get<float>();
245
246 //check target
247 if (!IsTargetValid(temp))
248 continue;
249
250 // check all event and action params
251 if (!IsEventValid(temp))
252 continue;
253
254 // xinef: specific check for timed events, fix db makers
255 switch (temp.event.type)
256 {
269 if (temp.event.minMaxRepeat.repeatMin == 0 && temp.event.minMaxRepeat.repeatMax == 0)
271 break;
273 if (temp.event.rangeRepeat.repeatMin == 0 && temp.event.rangeRepeat.repeatMax == 0)
275 // Will only work properly if value is 0 or 1
278 break;
280 if (temp.event.areaRange.repeatMin == 0 && temp.event.areaRange.repeatMax == 0)
282 break;
285 if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
287 break;
289 if (temp.event.areaCasting.repeatMin == 0 && temp.event.areaCasting.repeatMax == 0)
291 break;
293 if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
295 break;
296 default:
297 break;
298 }
299
301 if (temp.target.type == SMART_TARGET_SELF && (std::fabs(temp.target.x) > 200.0f || std::fabs(temp.target.y) > 200.0f || std::fabs(temp.target.z) > 200.0f))
303
304 // creature entry / guid not found in storage, create empty event list for it and increase counters
305 if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())
306 {
307 ++count;
308 SmartAIEventList eventList;
309 mEventMap[source_type][temp.entryOrGuid] = eventList;
310 }
311 // store the new event
312 mEventMap[source_type][temp.entryOrGuid].push_back(temp);
313 } while (result->NextRow());
314
315 LOG_INFO("server.loading", ">> Loaded {} SmartAI scripts in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
316 LOG_INFO("server.loading", " ");
317}
std::int32_t int32
Definition: Define.h:104
std::uint16_t uint16
Definition: Define.h:109
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:50
@ WORLD_SEL_SMART_SCRIPTS
Definition: WorldDatabase.h:35
SmartScriptType
Definition: SmartScriptMgr.h:1704
@ SMART_SCRIPT_TYPE_MAX
Definition: SmartScriptMgr.h:1715
@ SMART_SCRIPT_TYPE_AREATRIGGER
Definition: SmartScriptMgr.h:1707
@ SMART_EVENT_FLAG_NOT_REPEATABLE
Definition: SmartScriptMgr.h:1859
SMARTAI_TARGETS
Definition: SmartScriptMgr.h:1475
SMART_ACTION
Definition: SmartScriptMgr.h:569
SMART_EVENT
Definition: SmartScriptMgr.h:117
Definition: PreparedStatement.h:158
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
uint32 param1
Definition: SmartScriptMgr.h:542
uint32 param2
Definition: SmartScriptMgr.h:543
uint32 param4
Definition: SmartScriptMgr.h:545
uint32 param3
Definition: SmartScriptMgr.h:544
uint32 param6
Definition: SmartScriptMgr.h:547
uint32 event_chance
Definition: SmartScriptMgr.h:223
uint32 onlyFireOnRepeat
Definition: SmartScriptMgr.h:241
uint32 param5
Definition: SmartScriptMgr.h:546
uint32 param3
Definition: SmartScriptMgr.h:1076
uint32 param5
Definition: SmartScriptMgr.h:1078
uint32 param1
Definition: SmartScriptMgr.h:1074
uint32 param4
Definition: SmartScriptMgr.h:1077
uint32 param6
Definition: SmartScriptMgr.h:1458
uint32 param2
Definition: SmartScriptMgr.h:1075
uint32 param4
Definition: SmartScriptMgr.h:1685
float o
Definition: SmartScriptMgr.h:1537
uint32 param1
Definition: SmartScriptMgr.h:1682
uint32 param3
Definition: SmartScriptMgr.h:1684
float z
Definition: SmartScriptMgr.h:1537
uint32 param2
Definition: SmartScriptMgr.h:1683
Definition: SmartScriptMgr.h:1888
SmartScriptType source_type
Definition: SmartScriptMgr.h:1894
bool IsTargetValid(SmartScriptHolder const &e)
Definition: SmartScriptMgr.cpp:371
bool IsEventValid(SmartScriptHolder &e)
Definition: SmartScriptMgr.cpp:874

References SmartScriptHolder::action, SmartEvent::areaCasting, SmartEvent::areaRange, SmartScriptHolder::entryOrGuid, SmartScriptHolder::event, SmartEvent::event_chance, SmartEvent::event_flags, SmartScriptHolder::event_id, SmartEvent::event_phase_mask, SmartEvent::friendlyCC, Field::Get(), getMSTime(), GetMSTimeDiffToNow(), IsEventValid(), IsTargetValid(), SmartScriptHolder::link, LOG_ERROR, LOG_INFO, LOG_WARN, SmartEvent::max, mEventMap, SmartEvent::min, SmartEvent::minMaxRepeat, SmartTarget::o, SmartEvent::onlyFireOnRepeat, SmartEvent::param1, SmartAction::param1, SmartTarget::param1, SmartEvent::param2, SmartAction::param2, SmartTarget::param2, SmartEvent::param3, SmartAction::param3, SmartTarget::param3, SmartEvent::param4, SmartAction::param4, SmartTarget::param4, SmartEvent::param5, SmartAction::param5, SmartEvent::param6, SmartAction::param6, SmartEvent::rangeRepeat, SmartEvent::raw, SmartAction::raw, SmartTarget::raw, SmartEvent::repeatMax, SmartEvent::repeatMin, SMART_ACTION_MOVE_TO_POS, SMART_EVENT_AREA_CASTING, SMART_EVENT_AREA_RANGE, SMART_EVENT_FLAG_NOT_REPEATABLE, SMART_EVENT_FRIENDLY_HEALTH, SMART_EVENT_FRIENDLY_HEALTH_PCT, SMART_EVENT_FRIENDLY_IS_CC, SMART_EVENT_FRIENDLY_MISSING_BUFF, SMART_EVENT_HAS_AURA, SMART_EVENT_HEALTH_PCT, SMART_EVENT_IS_BEHIND_TARGET, SMART_EVENT_MANA_PCT, SMART_EVENT_RANGE, SMART_EVENT_TARGET_BUFFED, SMART_EVENT_TARGET_HEALTH_PCT, SMART_EVENT_TARGET_MANA_PCT, SMART_EVENT_UPDATE, SMART_EVENT_UPDATE_IC, SMART_EVENT_UPDATE_OOC, SMART_EVENT_VICTIM_CASTING, SMART_SCRIPT_TYPE_AREATRIGGER, SMART_SCRIPT_TYPE_CREATURE, SMART_SCRIPT_TYPE_GAMEOBJECT, SMART_SCRIPT_TYPE_MAX, SMART_SCRIPT_TYPE_TIMED_ACTIONLIST, SMART_TARGET_POSITION, SMART_TARGET_SELF, sObjectMgr, SmartScriptHolder::source_type, SmartScriptHolder::target, SmartEvent::type, SmartAction::type, SmartTarget::type, WORLD_SEL_SMART_SCRIPTS, WorldDatabase, SmartTarget::x, SmartTarget::y, and SmartTarget::z.

◆ NotNULL()

bool SmartAIMgr::NotNULL ( SmartScriptHolder const &  e,
uint32  data 
)
inlineprivate
2044 {
2045 if (!data)
2046 {
2047 LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} Parameter can not be nullptr, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
2048 return false;
2049 }
2050 return true;
2051 }

References SmartScriptHolder::entryOrGuid, SmartScriptHolder::event_id, SmartScriptHolder::GetActionType(), SmartScriptHolder::GetScriptType(), and LOG_ERROR.

Referenced by IsEventValid().

Member Data Documentation

◆ mEventMap

SmartAIEventMap SmartAIMgr::mEventMap[SMART_SCRIPT_TYPE_MAX]
private

Referenced by GetScript(), and LoadSmartAIFromDB().