mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Quest API] Add EVENT_GM_COMMAND to Perl/Lua. (#2634)
# Perl - Add `EVENT_GM_COMMAND`, exports `$message`. # Lua - Add `event_gm_command`, exports `e.message`. # Notes - Only parses with real GM commands such as `#reload quest`.
This commit is contained in:
parent
20efa83f73
commit
46f993ef71
@ -602,6 +602,8 @@ int command_realdispatch(Client *c, std::string message, bool ignore_status)
|
||||
return -1;
|
||||
}
|
||||
|
||||
parse->EventPlayer(EVENT_GM_COMMAND, c, message, 0);
|
||||
|
||||
cur->function(c, &sep); // Dispatch C++ Command
|
||||
|
||||
return 0;
|
||||
|
||||
@ -165,6 +165,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_AA_GAIN",
|
||||
"EVENT_PAYLOAD",
|
||||
"EVENT_LEVEL_DOWN",
|
||||
"EVENT_GM_COMMAND",
|
||||
#ifdef BOTS
|
||||
"EVENT_SPELL_EFFECT_BOT",
|
||||
"EVENT_SPELL_EFFECT_BUFF_TIC_BOT",
|
||||
@ -1998,6 +1999,11 @@ void PerlembParser::ExportEventVariables(
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_GM_COMMAND: {
|
||||
ExportVar(package_name.c_str(), "message", data);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ typedef enum {
|
||||
EVENT_AA_GAIN,
|
||||
EVENT_PAYLOAD,
|
||||
EVENT_LEVEL_DOWN,
|
||||
EVENT_GM_COMMAND,
|
||||
#ifdef BOTS
|
||||
EVENT_SPELL_EFFECT_BOT,
|
||||
EVENT_SPELL_EFFECT_BUFF_TIC_BOT,
|
||||
|
||||
@ -4554,7 +4554,8 @@ luabind::scope lua_register_events() {
|
||||
luabind::value("aa_buy", static_cast<int>(EVENT_AA_BUY)),
|
||||
luabind::value("aa_gain", static_cast<int>(EVENT_AA_GAIN)),
|
||||
luabind::value("payload", static_cast<int>(EVENT_PAYLOAD)),
|
||||
luabind::value("level_down", static_cast<int>(EVENT_LEVEL_DOWN))
|
||||
luabind::value("level_down", static_cast<int>(EVENT_LEVEL_DOWN)),
|
||||
luabind::value("gm_command", static_cast<int>(EVENT_GM_COMMAND))
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,8 @@ const char *LuaEvents[_LargestEventID] = {
|
||||
"event_aa_buy",
|
||||
"event_aa_gain",
|
||||
"event_payload",
|
||||
"event_level_down"
|
||||
"event_level_down",
|
||||
"event_gm_command"
|
||||
};
|
||||
|
||||
extern Zone *zone;
|
||||
@ -265,6 +266,7 @@ LuaParser::LuaParser() {
|
||||
PlayerArgumentDispatch[EVENT_PAYLOAD] = handle_player_payload;
|
||||
PlayerArgumentDispatch[EVENT_LEVEL_UP] = handle_player_level_up;
|
||||
PlayerArgumentDispatch[EVENT_LEVEL_DOWN] = handle_player_level_down;
|
||||
PlayerArgumentDispatch[EVENT_GM_COMMAND] = handle_player_gm_command;
|
||||
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||
|
||||
@ -1116,6 +1116,18 @@ void handle_player_level_down(
|
||||
lua_setfield(L, -2, "levels_lost");
|
||||
}
|
||||
|
||||
void handle_player_gm_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "message");
|
||||
}
|
||||
|
||||
// Item
|
||||
void handle_item_click(
|
||||
QuestInterface *parse,
|
||||
|
||||
@ -609,6 +609,15 @@ void handle_player_level_down(
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_player_gm_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
|
||||
// Item
|
||||
void handle_item_click(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user