mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Quest API] Add EVENT_CONSIDER to Perl and Lua. (#1531)
* [Quest API] Add EVENT_CONSIDER to Perl and Lua. - Exports $entity_id in Perl. - Exports e.entity_id in Lua. Allows you to perform events on consider for server operators. * Missing comma. * Formatting. * Add return capability to EVENT_CONSIDER and EVENT_CONSIDER_CORPSE so operators can break out of consider functions.
This commit is contained in:
parent
9589bf6bf8
commit
6e76f89ca2
@ -4854,6 +4854,10 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
|
||||
if (tmob == 0)
|
||||
return;
|
||||
|
||||
if (parse->EventPlayer(EVENT_CONSIDER, this, fmt::format("{}", conin->targetid), 0) == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tmob->GetClass() == LDON_TREASURE)
|
||||
{
|
||||
Message(Chat::Yellow, "%s", tmob->GetCleanName());
|
||||
@ -4977,7 +4981,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
|
||||
Consider_Struct* conin = (Consider_Struct*)app->pBuffer;
|
||||
Corpse* tcorpse = entity_list.GetCorpseByID(conin->targetid);
|
||||
if (tcorpse && tcorpse->IsNPCCorpse()) {
|
||||
parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0);
|
||||
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 min; uint32 sec; uint32 ttime;
|
||||
if ((ttime = tcorpse->GetDecayTime()) != 0) {
|
||||
sec = (ttime / 1000) % 60; // Total seconds
|
||||
@ -4991,7 +4998,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
else if (tcorpse && tcorpse->IsPlayerCorpse()) {
|
||||
parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0);
|
||||
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 day, hour, min, sec, ttime;
|
||||
if ((ttime = tcorpse->GetDecayTime()) != 0) {
|
||||
sec = (ttime / 1000) % 60; // Total seconds
|
||||
|
||||
@ -122,6 +122,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_BOT_COMMAND",
|
||||
"EVENT_WARP",
|
||||
"EVENT_TEST_BUFF",
|
||||
"EVENT_CONSIDER",
|
||||
"EVENT_CONSIDER_CORPSE"
|
||||
};
|
||||
|
||||
@ -1645,6 +1646,12 @@ void PerlembParser::ExportEventVariables(
|
||||
ExportVar(package_name.c_str(), "from_z", sep.arg[2]);
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_CONSIDER: {
|
||||
ExportVar(package_name.c_str(), "entity_id", std::stoi(data));
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_CONSIDER_CORPSE: {
|
||||
ExportVar(package_name.c_str(), "corpse_entity_id", std::stoi(data));
|
||||
break;
|
||||
|
||||
@ -90,6 +90,7 @@ typedef enum {
|
||||
EVENT_BOT_COMMAND,
|
||||
EVENT_WARP,
|
||||
EVENT_TEST_BUFF,
|
||||
EVENT_CONSIDER,
|
||||
EVENT_CONSIDER_CORPSE,
|
||||
_LargestEventID
|
||||
} QuestEventID;
|
||||
|
||||
@ -3242,6 +3242,7 @@ luabind::scope lua_register_events() {
|
||||
luabind::value("use_skill", static_cast<int>(EVENT_USE_SKILL)),
|
||||
luabind::value("warp", static_cast<int>(EVENT_WARP)),
|
||||
luabind::value("test_buff", static_cast<int>(EVENT_TEST_BUFF)),
|
||||
luabind::value("consider", static_cast<int>(EVENT_CONSIDER)),
|
||||
luabind::value("consider_corpse", static_cast<int>(EVENT_CONSIDER_CORPSE))
|
||||
];
|
||||
}
|
||||
|
||||
@ -133,6 +133,7 @@ const char *LuaEvents[_LargestEventID] = {
|
||||
"event_bot_command",
|
||||
"event_warp",
|
||||
"event_test_buff",
|
||||
"event_consider",
|
||||
"event_consider_corpse"
|
||||
};
|
||||
|
||||
@ -221,6 +222,7 @@ LuaParser::LuaParser() {
|
||||
PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate;
|
||||
PlayerArgumentDispatch[EVENT_BOT_COMMAND] = handle_player_bot_command;
|
||||
PlayerArgumentDispatch[EVENT_WARP] = handle_player_warp;
|
||||
PlayerArgumentDispatch[EVENT_CONSIDER] = handle_player_consider;
|
||||
PlayerArgumentDispatch[EVENT_CONSIDER_CORPSE] = handle_player_consider_corpse;
|
||||
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
|
||||
@ -573,6 +573,11 @@ void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std
|
||||
lua_setfield(L, -2, "from_z");
|
||||
}
|
||||
|
||||
void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<EQ::Any>* extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "entity_id");
|
||||
}
|
||||
|
||||
void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<EQ::Any>* extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "corpse_entity_id");
|
||||
|
||||
@ -105,6 +105,8 @@ void handle_player_bot_command(QuestInterface *parse, lua_State* L, Client* clie
|
||||
std::vector<EQ::Any> *extra_pointers);
|
||||
void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<EQ::Any>* extra_pointers);
|
||||
void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<EQ::Any>* extra_pointers);
|
||||
void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<EQ::Any>* extra_pointers);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user