diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index fec5ba1bfd2..a128273d185 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -112,6 +112,7 @@ std::string GetScriptCommandName(ScriptCommands command) case SCRIPT_COMMAND_CLOSE_GOSSIP: res = "SCRIPT_COMMAND_CLOSE_GOSSIP"; break; case SCRIPT_COMMAND_PLAYMOVIE: res = "SCRIPT_COMMAND_PLAYMOVIE"; break; case SCRIPT_COMMAND_MOVEMENT: res = "SCRIPT_COMMAND_MOVEMENT"; break; + case SCRIPT_COMMAND_PLAY_ANIMKIT: res = "SCRIPT_COMMAND_PLAY_ANIMKIT"; break; default: { char sz[32]; @@ -5109,6 +5110,16 @@ void ObjectMgr::LoadScripts(ScriptsType type) } break; } + case SCRIPT_COMMAND_PLAY_ANIMKIT: + { + if (!sAnimKitStore.LookupEntry(tmp.PlayAnimKit.AnimKitID)) + { + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid AnimKid id (datalong = %u) in SCRIPT_COMMAND_PLAY_ANIMKIT for script id %u", + tableName.c_str(), tmp.PlayAnimKit.AnimKitID, tmp.id); + continue; + } + break; + } default: break; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index e890d5ef8d0..16e4219bc7c 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -113,7 +113,8 @@ enum ScriptCommands SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player SCRIPT_COMMAND_PLAYMOVIE = 34, // source = Player, datalong = movie id - SCRIPT_COMMAND_MOVEMENT = 35 // source = Creature, datalong = MovementType, datalong2 = MovementDistance (spawndist f.ex.), dataint = pathid + SCRIPT_COMMAND_MOVEMENT = 35, // source = Creature, datalong = MovementType, datalong2 = MovementDistance (spawndist f.ex.), dataint = pathid + SCRIPT_COMMAND_PLAY_ANIMKIT = 36 // source = Creature, datalong = AnimKit id }; // Benchmarked: Faster than std::unordered_map (insert/find) @@ -369,6 +370,12 @@ struct ScriptInfo uint32 MovementDistance; // datalong2 int32 Path; // dataint } Movement; + + + struct // SCRIPT_COMMAND_PLAY_ANIMKIT (35) + { + uint32 AnimKitID; // datalong + } PlayAnimKit; }; std::string GetDebugInfo() const; diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp index 1191e752091..43eaf73f987 100644 --- a/src/server/game/Maps/MapScripts.cpp +++ b/src/server/game/Maps/MapScripts.cpp @@ -894,6 +894,12 @@ void Map::ScriptsProcess() } break; + case SCRIPT_COMMAND_PLAY_ANIMKIT: + // Source must be Creature. + if (Creature* cSource = _GetScriptCreature(source, true, step.script)) + cSource->PlayOneShotAnimKit(step.script->PlayAnimKit.AnimKitID); + break; + default: TC_LOG_ERROR("scripts", "Unknown script command %s.", step.script->GetDebugInfo().c_str()); break;