Skip to content

Commit

Permalink
Added some new database command scripts from trinityTBC WIP (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
milestorme committed Oct 28, 2020
1 parent 009f315 commit f904f21
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ std::string GetScriptCommandName(ScriptCommands command)
case SCRIPT_COMMAND_CLOSE_GOSSIP:
res = "SCRIPT_COMMAND_CLOSE_GOSSIP";
break;
case SCRIPT_COMMAND_MOVEMENT:
res = "SCRIPT_COMMAND_MOVEMENT";
break;
default:
{
char sz[32];
Expand Down
10 changes: 9 additions & 1 deletion src/server/game/Globals/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,18 @@ struct ScriptInfo
uint32 ModelID; // datalong
} Model;

// SCRIPT_COMMAND_CLOSE_GOSSIP (33)
// SCRIPT_COMMAND_CLOSE_GOSSIP (33)

struct // SCRIPT_COMMAND_MOVEMENT (35)
{
uint32 MovementType; // datalong
uint32 MovementDistance;// datalong2
int32 Path; // dataint
} Movement;
};

std::string GetDebugInfo() const;

};

typedef std::multimap<uint32, ScriptInfo> ScriptMap;
Expand Down
23 changes: 23 additions & 0 deletions src/server/game/Maps/MapScripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,29 @@ void Map::ScriptsProcess()
pSource->PlayerTalkClass->CloseGossip();
break;

case SCRIPT_COMMAND_MOVEMENT:
// Source must be Creature.
if (Creature* cSource = _GetScriptCreature(source, true, step.script))
{
if (!cSource->IsAlive())
return;

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;

break;

default:
sLog.outError("Unknown script command %s.", step.script->GetDebugInfo().c_str());
break;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/World/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ enum ScriptCommands
SCRIPT_COMMAND_EQUIP = 31, // soucre = Creature, datalong = equipment id
SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id
SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player
SCRIPT_COMMAND_MOVEMENT = 35, // source = Creature, datalong = MovementType, datalong2 = MovementDistance (spawndist f.ex.), dataint = pathid
};

// Storage class for commands issued for delayed execution
Expand Down

1 comment on commit f904f21

@PadreWoW
Copy link

@PadreWoW PadreWoW commented on f904f21 Oct 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
break;

	 break;

Seriously?

And where is "cSource->GetMotionMaster()->MovementExpired();"?
This is original commit:
https://github.com/TrinityCore/TrinityCore/pull/18891/files

Please sign in to comment.