37 ScriptMapMap::const_iterator s = scripts.find(
id);
38 if (s == scripts.end())
48 bool immedScript =
false;
49 for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter)
61 sMapMgr->IncreaseScheduledScriptsCount();
89 sMapMgr->IncreaseScheduledScriptsCount();
104 if (!source && !target)
111 if (!player && source)
115 TC_LOG_ERROR(
"scripts",
"{} neither source nor target object is player (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
126 if (!source && !target)
135 if (!creature && source)
143 if (!creature && target)
148 TC_LOG_ERROR(
"scripts",
"{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
159 if (!source && !target)
168 if (!gameobject && source)
176 if (!gameobject && target)
181 TC_LOG_ERROR(
"scripts",
"{} neither source nor target are gameobjects (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
191 Unit* unit =
nullptr;
195 TC_LOG_ERROR(
"scripts",
"{} {} object is not unit {}, skipping.",
201 TC_LOG_ERROR(
"scripts",
"{} {} object could not be cast to unit.",
202 scriptInfo->
GetDebugInfo(), isSource ?
"source" :
"target");
216 TC_LOG_ERROR(
"scripts",
"{} {} object is not a player {}.",
242 scriptInfo->
GetDebugInfo(), isSource ?
"source" :
"target");
247 TC_LOG_ERROR(
"scripts",
"{} {} object is not a world object {}.",
270 else if (!source->
IsUnit())
277 TC_LOG_ERROR(
"scripts",
"{} source object could not be cast to world object {}, skipping.",
285 TC_LOG_ERROR(
"scripts",
"{} gameobject is not a door (GoType: {}, {}).",
294 goTarget->UseDoorOrButton(nTimeToToggle);
304 if (bounds.first == bounds.second)
307 return bounds.first->second;
330 source = player->GetItemByGuid(step.
sourceGUID);
350 TC_LOG_ERROR(
"scripts",
"{} source with unsupported high guid {}.",
379 TC_LOG_ERROR(
"scripts",
"{} target with unsupported high guid {}.",
499 TC_LOG_ERROR(
"scripts",
"{} source is not unit, gameobject or player {}, skipping.",
512 TC_LOG_ERROR(
"scripts",
"{} target is not unit, gameobject or player {}, skipping.",
520 TC_LOG_ERROR(
"scripts",
"{} neither source nor target is player (source: {}; target: {}), skipping.",
572 TC_LOG_ERROR(
"scripts",
"{} can not be used with gameobject of type {} (guid: {}).",
628 TC_LOG_ERROR(
"scripts",
"{} target object is not gameobject {}, skipping.",
649 if (!source && !target)
773 if (creatureBounds.first != creatureBounds.second)
776 auto creatureItr = std::find_if(creatureBounds.first, creatureBounds.second, [](Map::CreatureBySpawnIdContainer::value_type
const& pair)
778 return pair.second->IsAlive();
781 cTarget = creatureItr != creatureBounds.second ? creatureItr->second : creatureBounds.first->second;
808 if (cSource->isDead())
809 TC_LOG_ERROR(
"scripts",
"{} creature is already dead {}",
815 cSource->RemoveCorpse();
831 sourceUnit->SetFacingToObject(targetUnit);
853 player->PlayerTalkClass->SendCloseGossip();
866 if (!cSource->IsAlive())
869 cSource->GetMotionMaster()->MoveIdle();
896 sMapMgr->DecreaseScheduledScriptCount();
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define TC_LOG_ERROR(filterType__,...)
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
ScriptMapMap * GetScriptsMapByType(ScriptsType type)
@ SF_CASTSPELL_SOURCE_TO_SOURCE
@ SF_CASTSPELL_SOURCE_TO_TARGET
@ SF_CASTSPELL_TARGET_TO_SOURCE
@ SF_PLAYSOUND_DISTANCE_SOUND
@ SF_TELEPORT_USE_CREATURE
@ SF_KILLCREDIT_REWARD_GROUP
@ SF_PLAYSOUND_TARGET_PLAYER
@ SF_CASTSPELL_TARGET_TO_TARGET
@ SF_CASTSPELL_SEARCH_CREATURE
@ SF_ORIENTATION_FACE_TARGET
std::multimap< uint32, ScriptInfo > ScriptMap
@ SCRIPT_COMMAND_CREATE_ITEM
@ SCRIPT_COMMAND_DESPAWN_SELF
@ SCRIPT_COMMAND_CLOSE_DOOR
@ SCRIPT_COMMAND_CAST_SPELL
@ SCRIPT_COMMAND_RESPAWN_GAMEOBJECT
@ SCRIPT_COMMAND_QUEST_EXPLORED
@ SCRIPT_COMMAND_ACTIVATE_OBJECT
@ SCRIPT_COMMAND_OPEN_DOOR
@ SCRIPT_COMMAND_PLAYMOVIE
@ SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT
@ SCRIPT_COMMAND_PLAY_ANIMKIT
@ SCRIPT_COMMAND_TELEPORT_TO
@ SCRIPT_COMMAND_TEMP_SUMMON_CREATURE
@ SCRIPT_COMMAND_MOVEMENT
@ SCRIPT_COMMAND_KILL_CREDIT
@ SCRIPT_COMMAND_LOAD_PATH
@ SCRIPT_COMMAND_ORIENTATION
@ SCRIPT_COMMAND_PLAY_SOUND
@ SCRIPT_COMMAND_CLOSE_GOSSIP
@ SCRIPT_COMMAND_REMOVE_AURA
std::map< uint32, ScriptMap > ScriptMapMap
std::vector< ItemPosCount > ItemPosCountVec
@ GAMEOBJECT_TYPE_FISHINGNODE
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
GOState GetGoState() const
void SetLootState(LootState s, Unit *unit=nullptr)
void SetRespawnTime(int32 respawn)
GameobjectTypes GetGoType() const
Player * _GetScriptPlayer(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
Pet * GetPet(ObjectGuid const &guid)
GameObject * _FindGameObject(WorldObject *pWorldObject, ObjectGuid::LowType guid) const
Player * GetPlayer(ObjectGuid const &guid)
Creature * _GetScriptCreature(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
GameObject * _GetScriptGameObjectSourceOrTarget(Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
void ScriptsProcess()
Process queued scripts.
ScriptScheduleMap m_scriptSchedule
void ScriptCommandStart(ScriptInfo const &script, uint32 delay, Object *source, Object *target)
void _ScriptProcessDoor(Object *source, Object *target, ScriptInfo const *scriptInfo) const
GameObject * GetGameObject(ObjectGuid const &guid)
WorldObject * _GetScriptWorldObject(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
Corpse * GetCorpse(ObjectGuid const &guid)
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Player * _GetScriptPlayerSourceOrTarget(Object *source, Object *target, ScriptInfo const *scriptInfo) const
Unit * _GetScriptUnit(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
CreatureBySpawnIdContainer _creatureBySpawnIdStore
Creature * GetCreature(ObjectGuid const &guid)
Creature * _GetScriptCreatureSourceOrTarget(Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
static ObjectGuid const Empty
std::string ToString() const
static Creature * ToCreature(Object *o)
static Unit * ToUnit(Object *o)
static GameObject * ToGameObject(Object *o)
GameObject * ToGameObject()
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
void AreaExploredOrEventHappens(uint32 questId)
void FailQuest(uint32 quest_id)
virtual void Say(std::string_view text, Language language, WorldObject const *target=nullptr)
virtual void Yell(std::string_view text, Language language, WorldObject const *target=nullptr)
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
void NearTeleportTo(Position const &pos, bool casting=false)
virtual void Whisper(std::string_view text, Language language, Player *target, bool isBossWhisper=false)
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
float GetDistance(WorldObject const *obj) const
constexpr float GetOrientation() const
ScriptInfo const * script
owner of source if source is item
struct ScriptInfo::@284::@303 LoadPath
struct ScriptInfo::@284::@296 TempSummonCreature
struct ScriptInfo::@284::@290 MoveTo
struct ScriptInfo::@284::@311 PlayAnimKit
struct ScriptInfo::@284::@295 RespawnGameobject
struct ScriptInfo::@284::@300 PlaySound
struct ScriptInfo::@284::@310 Movement
struct ScriptInfo::@284::@292 TeleportTo
struct ScriptInfo::@284::@305 Kill
struct ScriptInfo::@284::@307 Equip
struct ScriptInfo::@284::@308 Model
struct ScriptInfo::@284::@297 ToggleDoor
struct ScriptInfo::@284::@301 CreateItem
struct ScriptInfo::@284::@288 Emote
struct ScriptInfo::@284::@294 KillCredit
struct ScriptInfo::@284::@299 CastSpell
std::string GetDebugInfo() const
struct ScriptInfo::@284::@304 CallScript
struct ScriptInfo::@284::@287 Talk
struct ScriptInfo::@284::@293 QuestExplored
struct ScriptInfo::@284::@298 RemoveAura
struct ScriptInfo::@284::@309 PlayMovie
struct ScriptInfo::@284::@302 DespawnSelf