Skip to content

Commit 45da3a2

Browse files
committed
Add RunCommand for player objects
1 parent 51da91e commit 45da3a2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

methods/CMangos/PlayerMethods.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,6 +3733,19 @@ namespace LuaPlayer
37333733
return 0;
37343734
}
37353735
#endif
3736+
3737+
/**
3738+
* Runs a command as the [Player].
3739+
*
3740+
* @param string command : the command to run
3741+
*/
3742+
int RunCommand(Eluna* E, Player* player)
3743+
{
3744+
const char* command = E->CHECKVAL<const char*>(2);
3745+
if (std::string(command).length() > 0)
3746+
ChatHandler(player->GetSession()).ExecuteCommand(command);
3747+
return 0;
3748+
}
37363749

37373750
ElunaRegister<Player> PlayerMethods[] =
37383751
{
@@ -4028,6 +4041,8 @@ namespace LuaPlayer
40284041
{ "ResetAchievements", METHOD_REG_NONE },
40294042
{ "SendMovieStart", METHOD_REG_NONE },
40304043
#endif
4044+
{ "RunCommand", &LuaPlayer::RunCommand },
4045+
40314046
// Not implemented methods
40324047
{ "GetChampioningFaction", METHOD_REG_NONE }, // ACore & TC only
40334048
{ "GetRecruiterId", METHOD_REG_NONE }, // not implemented
@@ -4062,8 +4077,7 @@ namespace LuaPlayer
40624077
{ "ResetHonor", METHOD_REG_NONE }, // classic only
40634078
{ "ClearHonorInfo", METHOD_REG_NONE }, // classic only
40644079
{ "GetXP", METHOD_REG_NONE }, // not implemented
4065-
{ "GetXPForNextLevel", METHOD_REG_NONE }, // not implemented
4066-
{ "RunCommand", METHOD_REG_NONE } // not implemented
4080+
{ "GetXPForNextLevel", METHOD_REG_NONE } // not implemented
40674081
};
40684082
};
40694083
#endif

0 commit comments

Comments
 (0)