fix(Core): implement "SCRIPT_COMMAND_MOVEMENT" (35) to fix Defias Thug waypoint errors (#1721)

* fix(DB): fix Defias Thug waypoint errors

* implement SCRIPT_COMMAND_MOVEMENT (35); remove SQL script
This commit is contained in:
Stoabrogga
2019-04-21 16:56:32 +02:00
committed by Poszer
parent e4f5b34a19
commit 5cf01e02f6
2 changed files with 31 additions and 1 deletions

View File

@@ -916,6 +916,28 @@ void Map::ScriptsProcess()
player->SendMovieStart(step.script->PlayMovie.MovieID);
break;
case SCRIPT_COMMAND_MOVEMENT:
// Source must be Creature.
if (Creature* cSource = _GetScriptCreature(source, true, step.script))
{
if (!cSource->IsAlive())
return;
cSource->GetMotionMaster()->MovementExpired();
cSource->GetMotionMaster()->MoveIdle();
switch (step.script->Movement.MovementType)
{
case RANDOM_MOTION_TYPE:
cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance);
break;
case WAYPOINT_MOTION_TYPE:
cSource->GetMotionMaster()->MovePath(step.script->Movement.Path, false);
break;
}
}
break;
default:
sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str());
break;