Skip to content

Commit b59c832

Browse files
committed
Add RunCommand for player objects
1 parent a36d886 commit b59c832

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

methods/CMangos/PlayerMethods.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4062,7 +4062,8 @@ namespace LuaPlayer
40624062
{ "ResetHonor", METHOD_REG_NONE }, // classic only
40634063
{ "ClearHonorInfo", METHOD_REG_NONE }, // classic only
40644064
{ "GetXP", METHOD_REG_NONE }, // not implemented
4065-
{ "GetXPForNextLevel", METHOD_REG_NONE } // not implemented
4065+
{ "GetXPForNextLevel", METHOD_REG_NONE }, // not implemented
4066+
{ "RunCommand", METHOD_REG_NONE } // not implemented
40664067
};
40674068
};
40684069
#endif

methods/Mangos/PlayerMethods.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3976,7 +3976,8 @@ namespace LuaPlayer
39763976
{ "GetXP", METHOD_REG_NONE }, // not implemented
39773977
{ "GetXPForNextLevel", METHOD_REG_NONE }, // not implemented
39783978
{ "CanCompleteRepeatableQuest", METHOD_REG_NONE }, // not implemented
3979-
{ "CanRewardQuest", METHOD_REG_NONE } // not implemented
3979+
{ "CanRewardQuest", METHOD_REG_NONE }, // not implemented
3980+
{ "RunCommand", METHOD_REG_NONE } // not implemented
39803981
};
39813982
};
39823983
#endif

methods/TrinityCore/PlayerMethods.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,6 +3726,19 @@ namespace LuaPlayer
37263726
return 0;
37273727
}
37283728

3729+
/**
3730+
* Runs a command as the [Player].
3731+
*
3732+
* @param string command : the command to run
3733+
*/
3734+
int RunCommand(Eluna* E, Player* player)
3735+
{
3736+
const char* command = E->CHECKVAL<const char*>(2);
3737+
if (std::string(command).length() > 0)
3738+
ChatHandler(player->GetSession())._ParseCommands(command);
3739+
return 0;
3740+
}
3741+
37293742
ElunaRegister<Player> PlayerMethods[] =
37303743
{
37313744
// Getters
@@ -3989,6 +4002,7 @@ namespace LuaPlayer
39894002
{ "GroupCreate", &LuaPlayer::GroupCreate, METHOD_REG_WORLD }, // World state method only in multistate
39904003
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
39914004
{ "SendMovieStart", &LuaPlayer::SendMovieStart },
4005+
{ "RunCommand", &LuaPlayer::RunCommand },
39924006

39934007
// Not implemented methods
39944008
{ "GetHonorStoredKills", METHOD_REG_NONE }, // classic only

methods/VMangos/PlayerMethods.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,8 @@ namespace LuaPlayer
36753675
{ "GetXP", METHOD_REG_NONE }, // not implemented
36763676
{ "GetXPForNextLevel", METHOD_REG_NONE }, // not implemented
36773677
{ "CanCompleteRepeatableQuest", METHOD_REG_NONE }, // not implemented
3678-
{ "CanRewardQuest", METHOD_REG_NONE } // not implemented
3678+
{ "CanRewardQuest", METHOD_REG_NONE }, // not implemented
3679+
{ "RunCommand", METHOD_REG_NONE } // not implemented
36793680
};
36803681
};
36813682
#endif

0 commit comments

Comments
 (0)