From 9a35cacf27588b2f0b93256423ac9ddb6a590113 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 4 Dec 2022 17:47:49 -0500 Subject: [PATCH] [Quest API] Add EVENT_PAYLOAD to Perl/Lua. (#2611) * [Quest API] Add EVENT_PAYLOAD to Perl/Lua. # Perl - Add `$bot->SendPayload(payload_id)`. - Add `$bot->SendPayload(payload_id, payload_value)`. - Add `$client->SendPayload(payload_id)`. - Add `$client->SendPayload(payload_id, payload_value)`. - Add `$mob->SendPayload(payload_id)`. - Add `$mob->SendPayload(payload_id, payload_value)`. - Add `$npc->SendPayload(payload_id)`. - Add `$npc->SendPayload(payload_id, payload_value)`. # Lua - Add `bot:SendPayload(payload_id)`. - Add `bot:SendPayload(payload_id, payload_value)`. - Add `client:SendPayload(payload_id)`. - Add `client:SendPayload(payload_id, payload_value)`. - Add `mob:SendPayload(payload_id)`. - Add `mob:SendPayload(payload_id, payload_value)`. - Add `npc:SendPayload(payload_id)`. - Add `npc:SendPayload(payload_id, payload_value)`. # Notes - Allows operators to send payload IDs with a payload value, the value can be a comma separated value, JSON, etc. - The idea is to allow a more configurable event for operators to send information to/from entities. * Cleanup parser events. --- zone/bot.cpp | 8 +- zone/bot.h | 5 +- zone/client.cpp | 6 + zone/client.h | 1 + zone/embparser.cpp | 10 +- zone/entity.cpp | 6 +- zone/event_codes.h | 1 + zone/lua_bot.cpp | 18 +- zone/lua_bot.h | 4 +- zone/lua_client.cpp | 12 + zone/lua_client.h | 2 + zone/lua_general.cpp | 3 +- zone/lua_mob.cpp | 32 +- zone/lua_mob.h | 2 + zone/lua_npc.cpp | 12 + zone/lua_npc.h | 2 + zone/lua_parser.cpp | 6 +- zone/lua_parser_events.cpp | 849 ++++++++++++++++++++++++++++------ zone/lua_parser_events.h | 913 ++++++++++++++++++++++++++++++------- zone/mob_ai.cpp | 28 +- zone/npc.cpp | 6 + zone/npc.h | 4 +- zone/perl_bot.cpp | 18 +- zone/perl_client.cpp | 12 + zone/perl_npc.cpp | 12 + 25 files changed, 1630 insertions(+), 342 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 3865360b6..026260134 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10476,12 +10476,18 @@ void Bot::SpawnBotGroupByName(Client* c, std::string botgroup_name, uint32 leade ); } -void Bot::SignalBot(int signal_id) +void Bot::Signal(int signal_id) { const auto export_string = fmt::format("{}", signal_id); parse->EventBot(EVENT_SIGNAL, this, nullptr, export_string, 0); } +void Bot::SendPayload(int payload_id, std::string payload_value) +{ + const auto export_string = fmt::format("{} {}", payload_id, payload_value); + parse->EventBot(EVENT_PAYLOAD, this, nullptr, export_string, 0); +} + void Bot::OwnerMessage(std::string message) { if (!GetBotOwner() || !GetBotOwner()->IsClient()) { diff --git a/zone/bot.h b/zone/bot.h index fd6a3f3d9..6789423e8 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -323,7 +323,7 @@ public: std::string bucket_value, uint8 bucket_comparison ); - + void AddSpellToBotEnforceList( int16 iPriority, uint16 iSpellID, @@ -719,7 +719,8 @@ public: int32 GetBaseDR() { return _baseDR; } int32 GetBaseCorrup() { return _baseCorrup; } - void SignalBot(int signal_id); + void Signal(int signal_id); + void SendPayload(int payload_id, std::string payload_value = std::string()); void OwnerMessage(std::string message); protected: diff --git a/zone/client.cpp b/zone/client.cpp index 1406675fa..17e730008 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5496,6 +5496,12 @@ void Client::Signal(int signal_id) parse->EventPlayer(EVENT_SIGNAL, this, export_string, 0); } +void Client::SendPayload(int payload_id, std::string payload_value) +{ + const auto export_string = fmt::format("{} {}", payload_id, payload_value); + parse->EventPlayer(EVENT_PAYLOAD, this, export_string, 0); +} + void Client::SendRewards() { std::vector rewards; diff --git a/zone/client.h b/zone/client.h index 6e9e37cef..b82af9bfd 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1438,6 +1438,7 @@ public: void Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration); void NotifyNewTitlesAvailable(); void Signal(int signal_id); + void SendPayload(int payload_id, std::string payload_value = std::string()); Mob *GetBindSightTarget() { return bind_sight_target; } void SetBindSightTarget(Mob *n) { bind_sight_target = n; } const uint16 GetBoatID() const { return controlling_boat_id; } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 71d83b775..9fc72dd8b 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -162,7 +162,8 @@ const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_INSPECT", "EVENT_TASK_BEFORE_UPDATE", "EVENT_AA_BUY", - "EVENT_AA_GAIN" + "EVENT_AA_GAIN", + "EVENT_PAYLOAD" #ifdef BOTS , "EVENT_SPELL_EFFECT_BOT", @@ -1603,6 +1604,13 @@ void PerlembParser::ExportEventVariables( break; } + case EVENT_PAYLOAD: { + Seperator sep(data); + ExportVar(package_name.c_str(), "payload_id", sep.arg[0]); + ExportVar(package_name.c_str(), "payload_value", sep.arg[1]); + break; + } + case EVENT_NPC_SLAY: { ExportVar(package_name.c_str(), "killed", mob->GetNPCTypeID()); break; diff --git a/zone/entity.cpp b/zone/entity.cpp index f79e04838..4a701df6b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -5214,7 +5214,7 @@ void EntityList::SignalAllBotsByOwnerCharacterID(uint32 character_id, int signal } for (const auto& b : client_bot_list) { - b->SignalBot(signal_id); + b->Signal(signal_id); } } @@ -5222,7 +5222,7 @@ void EntityList::SignalBotByBotID(uint32 bot_id, int signal_id) { auto b = GetBotByBotID(bot_id); if (b) { - b->SignalBot(signal_id); + b->Signal(signal_id); } } @@ -5230,7 +5230,7 @@ void EntityList::SignalBotByBotName(std::string bot_name, int signal_id) { auto b = GetBotByBotName(bot_name); if (b) { - b->SignalBot(signal_id); + b->Signal(signal_id); } } #endif diff --git a/zone/event_codes.h b/zone/event_codes.h index 922dcd505..802f735b7 100644 --- a/zone/event_codes.h +++ b/zone/event_codes.h @@ -106,6 +106,7 @@ typedef enum { EVENT_TASK_BEFORE_UPDATE, EVENT_AA_BUY, EVENT_AA_GAIN, + EVENT_PAYLOAD, #ifdef BOTS EVENT_SPELL_EFFECT_BOT, EVENT_SPELL_EFFECT_BUFF_TIC_BOT, diff --git a/zone/lua_bot.cpp b/zone/lua_bot.cpp index 9175732dc..442a2058f 100644 --- a/zone/lua_bot.cpp +++ b/zone/lua_bot.cpp @@ -84,9 +84,9 @@ uint32 Lua_Bot::GetBotItemIDBySlot(uint16 slot_id) { return self->GetBotItemBySlot(slot_id); } -void Lua_Bot::SignalBot(int signal_id) { +void Lua_Bot::Signal(int signal_id) { Lua_Safe_Call_Void(); - self->SignalBot(signal_id); + self->Signal(signal_id); } void Lua_Bot::OwnerMessage(std::string message) { @@ -134,6 +134,16 @@ bool Lua_Bot::HasBotSpellEntry(uint16 spellid) { return self->HasBotSpellEntry(spellid); } +void Lua_Bot::SendPayload(int payload_id) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id); +} + +void Lua_Bot::SendPayload(int payload_id, std::string payload_value) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id, payload_value); +} + luabind::scope lua_register_bot() { return luabind::class_("Bot") .def(luabind::constructor<>()) @@ -161,7 +171,9 @@ luabind::scope lua_register_bot() { .def("RemoveBotItem", (void(Lua_Bot::*)(uint32))&Lua_Bot::RemoveBotItem) .def("SetExpansionBitmask", (void(Lua_Bot::*)(int))&Lua_Bot::SetExpansionBitmask) .def("SetExpansionBitmask", (void(Lua_Bot::*)(int,bool))&Lua_Bot::SetExpansionBitmask) - .def("SignalBot", (void(Lua_Bot::*)(int))&Lua_Bot::SignalBot); + .def("SendPayload", (void(Lua_Bot::*)(int))&Lua_Bot::SendPayload) + .def("SendPayload", (void(Lua_Bot::*)(int,std::string))&Lua_Bot::SendPayload) + .def("Signal", (void(Lua_Bot::*)(int))&Lua_Bot::Signal); } #endif diff --git a/zone/lua_bot.h b/zone/lua_bot.h index f05e7f58f..4776e0193 100644 --- a/zone/lua_bot.h +++ b/zone/lua_bot.h @@ -50,8 +50,10 @@ public: void RemoveBotItem(uint32 item_id); void SetExpansionBitmask(int expansion_bitmask); void SetExpansionBitmask(int expansion_bitmask, bool save); - void SignalBot(int signal_id); + void Signal(int signal_id); bool HasBotSpellEntry(uint16 spellid); + void SendPayload(int payload_id); + void SendPayload(int payload_id, std::string payload_value); }; #endif diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 8d1a3ab75..5e525cabd 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -2855,6 +2855,16 @@ luabind::object Lua_Client::GetZoneFlags(lua_State* L) { return t; } +void Lua_Client::SendPayload(int payload_id) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id); +} + +void Lua_Client::SendPayload(int payload_id, std::string payload_value) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id, payload_value); +} + std::string Lua_Client::GetGuildPublicNote() { Lua_Safe_Call_String(); @@ -3316,6 +3326,8 @@ luabind::scope lua_register_client() { .def("SendSound", (void(Lua_Client::*)(void))&Lua_Client::SendSound) .def("SendToGuildHall", (void(Lua_Client::*)(void))&Lua_Client::SendToGuildHall) .def("SendToInstance", (void(Lua_Client::*)(std::string,std::string,uint32,float,float,float,float,std::string,uint32))&Lua_Client::SendToInstance) + .def("SendPayload", (void(Lua_Client::*)(int))&Lua_Client::SendPayload) + .def("SendPayload", (void(Lua_Client::*)(int,std::string))&Lua_Client::SendPayload) .def("SendWebLink", (void(Lua_Client::*)(const char *))&Lua_Client::SendWebLink) .def("SendZoneFlagInfo", (void(Lua_Client::*)(Lua_Client))&Lua_Client::SendZoneFlagInfo) .def("SetAAEXPModifier", (void(Lua_Client::*)(uint32,double))&Lua_Client::SetAAEXPModifier) diff --git a/zone/lua_client.h b/zone/lua_client.h index 3ebedbf14..d34213a2d 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -450,6 +450,8 @@ public: void UpdateAdmin(bool from_database); luabind::object GetPEQZoneFlags(lua_State* L); luabind::object GetZoneFlags(lua_State* L); + void SendPayload(int payload_id); + void SendPayload(int payload_id, std::string payload_value); std::string GetGuildPublicNote(); void ApplySpell(int spell_id); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index e72227239..623f90890 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -4529,7 +4529,8 @@ luabind::scope lua_register_events() { luabind::value("inspect", static_cast(EVENT_INSPECT)), luabind::value("task_before_update", static_cast(EVENT_TASK_BEFORE_UPDATE)), luabind::value("aa_buy", static_cast(EVENT_AA_BUY)), - luabind::value("aa_gain", static_cast(EVENT_AA_GAIN)) + luabind::value("aa_gain", static_cast(EVENT_AA_GAIN)), + luabind::value("payload", static_cast(EVENT_PAYLOAD)) ]; } diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 8648b6ba6..75f61b1b3 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -1366,7 +1366,7 @@ void Lua_Mob::Signal(int signal_id) { self->CastToNPC()->SignalNPC(signal_id); #ifdef BOTS } else if (self->IsBot()) { - self->CastToBot()->SignalBot(signal_id); + self->CastToBot()->Signal(signal_id); #endif } } @@ -2719,6 +2719,34 @@ bool Lua_Mob::EntityVariableExists(std::string variable_name) { return self->EntityVariableExists(variable_name); } +void Lua_Mob::SendPayload(int payload_id) { + Lua_Safe_Call_Void(); + + if (self->IsClient()) { + self->CastToClient()->SendPayload(payload_id); + } else if (self->IsNPC()) { + self->CastToNPC()->SendPayload(payload_id); +#ifdef BOTS + } else if (self->IsBot()) { + self->CastToBot()->SendPayload(payload_id); +#endif + } +} + +void Lua_Mob::SendPayload(int payload_id, std::string payload_value) { + Lua_Safe_Call_Void(); + + if (self->IsClient()) { + self->CastToClient()->SendPayload(payload_id, payload_value); + } else if (self->IsNPC()) { + self->CastToNPC()->SendPayload(payload_id, payload_value); +#ifdef BOTS + } else if (self->IsBot()) { + self->CastToBot()->SendPayload(payload_id, payload_value); +#endif + } +} + #ifdef BOTS void Lua_Mob::DamageAreaBots(int64 damage) { Lua_Safe_Call_Void(); @@ -3193,6 +3221,8 @@ luabind::scope lua_register_mob() { .def("SendWearChange", (void(Lua_Mob::*)(uint8))&Lua_Mob::SendWearChange) .def("SendBeginCast", &Lua_Mob::SendBeginCast) .def("SendIllusionPacket", (void(Lua_Mob::*)(luabind::adl::object))&Lua_Mob::SendIllusionPacket) + .def("SendPayload", (void(Lua_Mob::*)(int))&Lua_Mob::SendPayload) + .def("SendPayload", (void(Lua_Mob::*)(int,std::string))&Lua_Mob::SendPayload) .def("SendSpellEffect", (void(Lua_Mob::*)(uint32,uint32,uint32,bool,uint32))&Lua_Mob::SendSpellEffect) .def("SendSpellEffect", (void(Lua_Mob::*)(uint32,uint32,uint32,bool,uint32,bool))&Lua_Mob::SendSpellEffect) .def("SendSpellEffect", (void(Lua_Mob::*)(uint32,uint32,uint32,bool,uint32,bool,Lua_Client))&Lua_Mob::SendSpellEffect) diff --git a/zone/lua_mob.h b/zone/lua_mob.h index 7a3109772..cb13c591d 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -308,6 +308,8 @@ public: void SetEntityVariable(std::string variable_name, std::string variable_value); bool EntityVariableExists(std::string variable_name); void Signal(int signal_id); + void SendPayload(int payload_id); + void SendPayload(int payload_id, std::string payload_value); bool CombatRange(Lua_Mob other); void DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage); void DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage); diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index 456b60556..2dc28013f 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -681,6 +681,16 @@ void Lua_NPC::ReloadSpells() self->ReloadSpells(); } +void Lua_NPC::SendPayload(int payload_id) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id); +} + +void Lua_NPC::SendPayload(int payload_id, std::string payload_value) { + Lua_Safe_Call_Void(); + self->SendPayload(payload_id, payload_value); +} + luabind::scope lua_register_npc() { return luabind::class_("NPC") .def(luabind::constructor<>()) @@ -787,6 +797,8 @@ luabind::scope lua_register_npc() { .def("SaveGuardSpot", (void(Lua_NPC::*)(bool))&Lua_NPC::SaveGuardSpot) .def("SaveGuardSpot", (void(Lua_NPC::*)(float,float,float,float))&Lua_NPC::SaveGuardSpot) .def("ScaleNPC", (void(Lua_NPC::*)(uint8))&Lua_NPC::ScaleNPC) + .def("SendPayload", (void(Lua_NPC::*)(int))&Lua_NPC::SendPayload) + .def("SendPayload", (void(Lua_NPC::*)(int,std::string))&Lua_NPC::SendPayload) .def("SetCopper", (void(Lua_NPC::*)(uint32))&Lua_NPC::SetCopper) .def("SetFollowCanRun", (void(Lua_NPC::*)(bool))&Lua_NPC::SetFollowCanRun) .def("SetFollowDistance", (void(Lua_NPC::*)(int))&Lua_NPC::SetFollowDistance) diff --git a/zone/lua_npc.h b/zone/lua_npc.h index 5eec64d3b..7b7eda13c 100644 --- a/zone/lua_npc.h +++ b/zone/lua_npc.h @@ -157,6 +157,8 @@ public: void RemoveAISpellEffect(int spell_effect_id); bool HasAISpellEffect(int spell_effect_id); float GetNPCStat(std::string stat); + void SendPayload(int payload_id); + void SendPayload(int payload_id, std::string payload_value); }; #endif diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index b8ff97fbe..9659c0e44 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -149,7 +149,8 @@ const char *LuaEvents[_LargestEventID] = { "event_inspect", "event_task_before_update", "event_aa_buy", - "event_aa_gain" + "event_aa_gain", + "event_payload" }; extern Zone *zone; @@ -206,6 +207,7 @@ LuaParser::LuaParser() { NPCArgumentDispatch[EVENT_LEAVE_AREA] = handle_npc_area; NPCArgumentDispatch[EVENT_LOOT_ZONE] = handle_npc_loot_zone; NPCArgumentDispatch[EVENT_SPAWN_ZONE] = handle_npc_spawn_zone; + NPCArgumentDispatch[EVENT_PAYLOAD] = handle_npc_payload; PlayerArgumentDispatch[EVENT_SAY] = handle_player_say; PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage; @@ -259,6 +261,7 @@ LuaParser::LuaParser() { PlayerArgumentDispatch[EVENT_INSPECT] = handle_player_inspect; PlayerArgumentDispatch[EVENT_AA_BUY] = handle_player_aa_buy; PlayerArgumentDispatch[EVENT_AA_GAIN] = handle_player_aa_gain; + PlayerArgumentDispatch[EVENT_PAYLOAD] = handle_player_payload; ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click; ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click; @@ -296,6 +299,7 @@ LuaParser::LuaParser() { BotArgumentDispatch[EVENT_TIMER] = handle_bot_timer; BotArgumentDispatch[EVENT_TRADE] = handle_bot_trade; BotArgumentDispatch[EVENT_USE_SKILL] = handle_bot_use_skill; + BotArgumentDispatch[EVENT_PAYLOAD] = handle_bot_payload; #endif L = nullptr; diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 0735ef3b5..c1438e37a 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -27,8 +27,15 @@ #include "lua_parser_events.h" //NPC -void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_event_say( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { npc->DoQuestPause(init); Lua_Client l_client(reinterpret_cast(init)); @@ -43,8 +50,15 @@ void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *in lua_setfield(L, -2, "language"); } -void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_event_trade( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(reinterpret_cast(init)); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); @@ -94,8 +108,15 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob * lua_setfield(L, -2, "trade"); } -void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_event_hp( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if(extra_data == 1) { lua_pushinteger(L, -1); lua_setfield(L, -2, "hp_event"); @@ -111,32 +132,60 @@ void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *ini } } -void handle_npc_single_mob(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_single_mob( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); lua_setfield(L, -2, "other"); } -void handle_npc_single_client(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_single_client( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(reinterpret_cast(init)); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); lua_setfield(L, -2, "other"); } -void handle_npc_single_npc(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_single_npc( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_NPC l_npc(reinterpret_cast(init)); luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc); l_npc_o.push(L); lua_setfield(L, -2, "other"); } -void handle_npc_task_accepted(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_task_accepted( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(reinterpret_cast(init)); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); @@ -146,8 +195,15 @@ void handle_npc_task_accepted(QuestInterface *parse, lua_State* L, NPC* npc, Mob lua_setfield(L, -2, "task_id"); } -void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_popup( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); @@ -157,8 +213,15 @@ void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, lua_setfield(L, -2, "popup_id"); } -void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_waypoint( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); @@ -168,8 +231,15 @@ void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *ini lua_setfield(L, -2, "wp"); } -void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_hate( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); @@ -180,20 +250,59 @@ void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s } -void handle_npc_signal(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_signal( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "signal"); } -void handle_npc_timer(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_payload( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { + Seperator sep(data.c_str()); + + lua_pushinteger(L, std::stoi(sep.arg[0])); + lua_setfield(L, -2, "payload_id"); + + lua_pushstring(L, sep.argplus[1]); + lua_setfield(L, -2, "payload_value"); +} + +void handle_npc_timer( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "timer"); } -void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_death( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); @@ -239,8 +348,15 @@ void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, } } -void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_cast( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { int spell_id = std::stoi(data); if(IsValidSpell(spell_id)) { Lua_Spell l_spell(&spells[spell_id]); @@ -255,8 +371,15 @@ void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s } } -void handle_npc_area(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_area( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, *std::any_cast(extra_pointers->at(0))); lua_setfield(L, -2, "area_id"); @@ -264,12 +387,26 @@ void handle_npc_area(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s lua_setfield(L, -2, "area_type"); } -void handle_npc_null(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_null( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { } -void handle_npc_loot_zone(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_loot_zone( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(reinterpret_cast(init)); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); @@ -286,17 +423,30 @@ void handle_npc_loot_zone(QuestInterface *parse, lua_State* L, NPC* npc, Mob *in lua_setfield(L, -2, "corpse"); } -void handle_npc_spawn_zone(QuestInterface* parse, lua_State* L, NPC* npc, Mob* init, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_npc_spawn_zone( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_NPC l_npc(std::any_cast(init->CastToNPC())); luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc); l_npc_o.push(L); lua_setfield(L, -2, "other"); } -//Player -void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +// Player +void handle_player_say( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "message"); @@ -304,8 +454,14 @@ void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std: lua_setfield(L, -2, "language"); } -void handle_player_environmental_damage(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers){ +void handle_player_environmental_damage( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "env_damage"); @@ -317,8 +473,14 @@ void handle_player_environmental_damage(QuestInterface *parse, lua_State* L, Cli lua_setfield(L, -2, "env_final_damage"); } -void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_death( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); Mob *o = entity_list.GetMobID(std::stoi(sep.arg[0])); @@ -350,14 +512,26 @@ void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, st lua_setfield(L, -2, "skill"); } -void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_timer( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "timer"); } -void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_discover_item( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { const EQ::ItemData *item = database.GetItem(extra_data); if(item) { Lua_Item l_item(item); @@ -372,52 +546,111 @@ void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* cl } } -void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_fish_forage_success( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); } -void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_click_object( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Object l_object(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_object_o = luabind::adl::object(L, l_object); l_object_o.push(L); lua_setfield(L, -2, "object"); } -void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_click_door( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Door l_door(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_door_o = luabind::adl::object(L, l_door); l_door_o.push(L); lua_setfield(L, -2, "door"); } -void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_signal( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "signal"); } -void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_payload( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { + Seperator sep(data.c_str()); + + lua_pushinteger(L, std::stoi(sep.arg[0])); + lua_setfield(L, -2, "payload_id"); + + lua_pushstring(L, sep.argplus[1]); + lua_setfield(L, -2, "payload_value"); +} + +void handle_player_popup_response( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "popup_id"); } -void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_pick_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); } -void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_cast( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); int spell_id = std::stoi(sep.arg[0]); @@ -440,14 +673,26 @@ void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std lua_setfield(L, -2, "caster_level"); } -void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_task_fail( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "task_id"); } -void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_zone( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); @@ -469,24 +714,42 @@ void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std lua_setfield(L, -2, "instance_version"); } -void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_duel_win( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(std::any_cast(extra_pointers->at(1))); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); lua_setfield(L, -2, "other"); } -void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_duel_loss( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Client l_client(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_client_o = luabind::adl::object(L, l_client); l_client_o.push(L); lua_setfield(L, -2, "other"); } -void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_loot( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); @@ -498,8 +761,14 @@ void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std lua_setfield(L, -2, "corpse"); } -void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_task_stage_complete( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "task_id"); @@ -508,8 +777,14 @@ void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Clie lua_setfield(L, -2, "activity_id"); } -void handle_player_task_update(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_task_update( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "count"); @@ -521,8 +796,14 @@ void handle_player_task_update(QuestInterface *parse, lua_State* L, Client* clie lua_setfield(L, -2, "task_id"); } -void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_command( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str(), ' ', 10, 100, true); std::string command(sep.arg[0] + 1); lua_pushstring(L, command.c_str()); @@ -540,8 +821,14 @@ void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, lua_setfield(L, -2, "args"); } -void handle_player_combine(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_combine( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, extra_data); lua_setfield(L, -2, "recipe_id"); @@ -549,16 +836,28 @@ void handle_player_combine(QuestInterface *parse, lua_State* L, Client* client, lua_setfield(L, -2, "recipe_name"); } -void handle_player_feign(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_feign( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_NPC l_npc(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc); l_npc_o.push(L); lua_setfield(L, -2, "other"); } -void handle_player_area(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_area( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, *std::any_cast(extra_pointers->at(0))); lua_setfield(L, -2, "area_id"); @@ -566,8 +865,14 @@ void handle_player_area(QuestInterface *parse, lua_State* L, Client* client, std lua_setfield(L, -2, "area_type"); } -void handle_player_respawn(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_respawn( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "option"); @@ -575,8 +880,14 @@ void handle_player_respawn(QuestInterface *parse, lua_State* L, Client* client, lua_setfield(L, -2, "resurrect"); } -void handle_player_packet(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_packet( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Packet l_packet(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_packet_o = luabind::adl::object(L, l_packet); l_packet_o.push(L); @@ -586,11 +897,24 @@ void handle_player_packet(QuestInterface *parse, lua_State* L, Client* client, s lua_setfield(L, -2, "connecting"); } -void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_player_null( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { } -void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { +void handle_player_use_skill( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "skill_id"); @@ -599,11 +923,24 @@ void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client lua_setfield(L, -2, "skill_level"); } -void handle_test_buff(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_test_buff( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { } -void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers) { +void handle_player_combine_validate( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, extra_data); lua_setfield(L, -2, "recipe_id"); @@ -627,8 +964,14 @@ void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* lua_setfield(L, -2, "tradeskill_id"); } -void handle_player_bot_command(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers) { +void handle_player_bot_command( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str(), ' ', 10, 100, true); std::string bot_command(sep.arg[0] + 1); lua_pushstring(L, bot_command.c_str()); @@ -646,7 +989,14 @@ void handle_player_bot_command(QuestInterface* parse, lua_State* L, Client* clie lua_setfield(L, -2, "args"); } -void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_warp( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushnumber(L, std::stof(sep.arg[0])); lua_setfield(L, -2, "from_x"); @@ -658,29 +1008,64 @@ void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std lua_setfield(L, -2, "from_z"); } -void handle_player_quest_combine(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_quest_combine( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "container_slot"); } -void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_consider( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *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* extra_pointers) { +void handle_player_consider_corpse( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "corpse_entity_id"); } -void handle_player_inspect(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_inspect( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); lua_setfield(L, -2, "other"); } -void handle_player_aa_buy(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_aa_buy( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "aa_cost"); @@ -695,27 +1080,57 @@ void handle_player_aa_buy(QuestInterface* parse, lua_State* L, Client* client, s lua_setfield(L, -2, "aa_next_id"); } -void handle_player_aa_gain(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_aa_gain( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "aa_gained"); } -//Item -void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +// Item +void handle_item_click( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, extra_data); lua_setfield(L, -2, "slot_id"); } -void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_timer( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "timer"); } -void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { - +void handle_item_proc( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_Mob l_mob(mob); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); @@ -734,8 +1149,16 @@ void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, EQ::I } } -void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_loot( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if(mob && mob->IsCorpse()) { Lua_Corpse l_corpse(mob->CastToCorpse()); luabind::adl::object l_corpse_o = luabind::adl::object(L, l_corpse); @@ -749,14 +1172,30 @@ void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, EQ::I } } -void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_equip( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushinteger(L, extra_data); lua_setfield(L, -2, "slot_id"); } -void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_augment( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); @@ -766,8 +1205,16 @@ void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, EQ lua_setfield(L, -2, "slot_id"); } -void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_augment_insert( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); @@ -777,8 +1224,16 @@ void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* cli lua_setfield(L, -2, "slot_id"); } -void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_augment_remove( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Lua_ItemInst l_item(std::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); @@ -791,12 +1246,29 @@ void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* cli lua_setfield(L, -2, "destroyed"); } -void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_item_null( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { } -//Spell -void handle_spell_event(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector *extra_pointers) { +// Spell +void handle_spell_event( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if (mob) { Lua_Mob l_mob(mob); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); @@ -836,7 +1308,16 @@ void handle_spell_event(QuestInterface *parse, lua_State* L, Mob* mob, Client* c lua_setfield(L, -2, "spell"); } -void handle_translocate_finish(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector *extra_pointers) { +void handle_translocate_finish( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if (mob) { Lua_Mob l_mob(mob); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); @@ -854,7 +1335,14 @@ void handle_translocate_finish(QuestInterface *parse, lua_State* L, Mob* mob, Cl lua_setfield(L, -2, "target"); } -void handle_player_equip_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { +void handle_player_equip_item( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushnumber(L, extra_data); lua_setfield(L, -2, "item_id"); @@ -872,16 +1360,38 @@ void handle_player_equip_item(QuestInterface *parse, lua_State* L, Client* clien lua_setfield(L, -2, "item"); } -void handle_spell_null(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector *extra_pointers) { } +void handle_spell_null( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { +} -void handle_encounter_timer(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_encounter_timer( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "timer"); } -void handle_encounter_load(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_encounter_load( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if (encounter) { Lua_Encounter l_enc(encounter); luabind::adl::object l_enc_o = luabind::adl::object(L, l_enc); @@ -895,8 +1405,14 @@ void handle_encounter_load(QuestInterface *parse, lua_State* L, Encounter* encou } } -void handle_encounter_unload(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers) { +void handle_encounter_unload( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { if (extra_pointers) { std::string *str = std::any_cast(extra_pointers->at(0)); lua_pushstring(L, str->c_str()); @@ -904,12 +1420,24 @@ void handle_encounter_unload(QuestInterface *parse, lua_State* L, Encounter* enc } } -void handle_encounter_null(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers) { - +void handle_encounter_null( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { } -void handle_player_skill_up(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_skill_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "skill_id"); @@ -924,7 +1452,14 @@ void handle_player_skill_up(QuestInterface* parse, lua_State* L, Client* client, lua_setfield(L, -2, "is_tradeskill"); } -void handle_player_language_skill_up(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_language_skill_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "skill_id"); @@ -936,7 +1471,14 @@ void handle_player_language_skill_up(QuestInterface* parse, lua_State* L, Client lua_setfield(L, -2, "skill_max"); } -void handle_player_alt_currency_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_alt_currency_merchant( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "currency_id"); @@ -954,7 +1496,14 @@ void handle_player_alt_currency_merchant(QuestInterface* parse, lua_State* L, Cl lua_setfield(L, -2, "item_cost"); } -void handle_player_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +void handle_player_merchant( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "npc_id"); @@ -972,6 +1521,8 @@ void handle_player_merchant(QuestInterface* parse, lua_State* L, Client* client, lua_setfield(L, -2, "item_cost"); } +// Bot + #ifdef BOTS void handle_bot_null( QuestInterface *parse, @@ -1122,6 +1673,24 @@ void handle_bot_signal( lua_setfield(L, -2, "signal"); } +void handle_bot_payload( + QuestInterface *parse, + lua_State* L, + Bot* bot, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +) { + Seperator sep(data.c_str()); + + lua_pushinteger(L, std::stoi(sep.arg[0])); + lua_setfield(L, -2, "payload_id"); + + lua_pushstring(L, sep.argplus[1]); + lua_setfield(L, -2, "payload_value"); +} + void handle_bot_slay( QuestInterface *parse, lua_State* L, diff --git a/zone/lua_parser_events.h b/zone/lua_parser_events.h index 0732359be..49d05ec82 100644 --- a/zone/lua_parser_events.h +++ b/zone/lua_parser_events.h @@ -12,169 +12,758 @@ typedef void(*EncounterArgumentHandler)(QuestInterface*, lua_State*, Encounter* typedef void(*BotArgumentHandler)(QuestInterface*, lua_State*, Bot*, Mob*, std::string, uint32, std::vector*); #endif -//NPC -void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_single_mob(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_single_client(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_single_npc(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_task_accepted(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_signal(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_timer(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_area(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_null(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_loot_zone(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_npc_spawn_zone(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, - std::vector *extra_pointers); +// NPC +void handle_npc_event_say( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); -//Player -void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_environmental_damage(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_task_update(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_combine(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_feign(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_area(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_respawn(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_packet(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_test_buff(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_bot_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_quest_combine(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_equip_item(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_skill_up(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_language_skill_up(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_alt_currency_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_inspect(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_player_aa_buy(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); -void handle_player_aa_gain(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, - std::vector* extra_pointers); +void handle_npc_event_trade( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); -//Item -void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, - std::vector *extra_pointers); +void handle_npc_event_hp( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); -//Spell -void handle_spell_event(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_translocate_finish(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_spell_null(QuestInterface *parse, lua_State* L, Mob* mob, Client* client, uint32 spell_id, std::string data, uint32 extra_data, - std::vector *extra_pointers); +void handle_npc_single_mob( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_single_client( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_single_npc( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_task_accepted( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_popup( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_waypoint( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_hate( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_signal( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_timer( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_death( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_cast( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_area( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_null( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_loot_zone( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_spawn_zone( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_npc_payload( + QuestInterface *parse, + lua_State* L, + NPC* npc, + Mob *init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +// Player +void handle_player_say( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_environmental_damage( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_death( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_timer( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_discover_item( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_fish_forage_success( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_click_object( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_click_door( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_signal( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_popup_response( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_pick_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_cast( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_task_fail( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_zone( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_duel_win( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_duel_loss( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_loot( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_task_stage_complete( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_task_update( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_command( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_combine( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_feign( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_area( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_respawn( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_packet( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_null( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_use_skill( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_test_buff( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_combine_validate( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_bot_command( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_warp( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_quest_combine( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_consider( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_consider_corpse( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_equip_item( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_skill_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_language_skill_up( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_alt_currency_merchant( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_merchant( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_inspect( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_aa_buy( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_aa_gain( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_player_payload( + QuestInterface *parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); -//Encounter -void handle_encounter_timer(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_encounter_load(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_encounter_unload(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers); -void handle_encounter_null(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data, - std::vector *extra_pointers); +// Item +void handle_item_click( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); +void handle_item_timer( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_proc( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_loot( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_equip( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_augment( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_augment_insert( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_augment_remove( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_item_null( + QuestInterface *parse, + lua_State* L, + Client* client, + EQ::ItemInstance* item, + Mob *mob, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +// Spell +void handle_spell_event( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_translocate_finish( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_spell_null( + QuestInterface *parse, + lua_State* L, + Mob* mob, + Client* client, + uint32 spell_id, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +// Encounter +void handle_encounter_timer( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_encounter_load( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_encounter_unload( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +void handle_encounter_null( + QuestInterface *parse, + lua_State* L, + Encounter* encounter, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + +// Bot #ifdef BOTS void handle_bot_null( QuestInterface *parse, @@ -296,6 +885,16 @@ void handle_bot_use_skill( std::vector *extra_pointers ); +void handle_bot_payload( + QuestInterface *parse, + lua_State* L, + Bot* bot, + Mob* init, + std::string data, + uint32 extra_data, + std::vector *extra_pointers +); + #endif #endif diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 9101cb04f..5ae1b1b98 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2477,37 +2477,11 @@ void NPC::CheckSignal() { if (!signal_q.empty()) { int signal_id = signal_q.front(); signal_q.pop_front(); - std::string export_string = fmt::format("{}", signal_id); + const auto export_string = fmt::format("{}", signal_id); parse->EventNPC(EVENT_SIGNAL, this, nullptr, export_string, 0); } } - - -/* -alter table npc_types drop column usedspells; -alter table npc_types add column npc_spells_id int(11) unsigned not null default 0 after merchant_id; -Create Table npc_spells ( - id int(11) unsigned not null auto_increment primary key, - name tinytext, - parent_list int(11) unsigned not null default 0, - attack_proc smallint(5) not null default -1, - proc_chance tinyint(3) not null default 3 - ); -create table npc_spells_entries ( - id int(11) unsigned not null auto_increment primary key, - npc_spells_id int(11) not null, - spellid smallint(5) not null default 0, - type smallint(5) unsigned not null default 0, - minlevel tinyint(3) unsigned not null default 0, - maxlevel tinyint(3) unsigned not null default 255, - manacost smallint(5) not null default '-1', - recast_delay int(11) not null default '-1', - priority smallint(5) not null default 0, - index npc_spells_id (npc_spells_id) - ); -*/ - bool IsSpellInList(DBnpcspells_Struct* spell_list, uint16 iSpellID); bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSpellEffectID, int32 base_value, int32 limit, int32 max_value); diff --git a/zone/npc.cpp b/zone/npc.cpp index 9dbeb20ef..cd25eaaeb 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -3040,6 +3040,12 @@ void NPC::SignalNPC(int _signal_id) signal_q.push_back(_signal_id); } +void NPC::SendPayload(int payload_id, std::string payload_value) +{ + const auto export_string = fmt::format("{} {}", payload_id, payload_value); + parse->EventNPC(EVENT_PAYLOAD, this, nullptr, export_string, 0); +} + NPC_Emote_Struct* NPC::GetNPCEmote(uint32 emoteid, uint8 event_) { LinkedListIterator iterator(zone->NPCEmoteList); iterator.Reset(); diff --git a/zone/npc.h b/zone/npc.h index 43eaec2f4..34a5a1038 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -262,6 +262,7 @@ public: void PetOnSpawn(NewSpawn_Struct* ns); void SignalNPC(int _signal_id); + void SendPayload(int payload_id, std::string payload_value = std::string()); inline int32 GetNPCFactionID() const { return npc_faction_id; } @@ -321,8 +322,9 @@ public: bool MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop, bool verbose=false); + void CheckSignal(); + virtual void DoClassAttacks(Mob *target); - void CheckSignal(); inline bool IsNotTargetableWithHotkey() const { return no_target_hotkey; } int64 GetNPCHPRegen() const { return hp_regen + itembonuses.HPRegen + spellbonuses.HPRegen; } inline const char* GetAmmoIDfile() const { return ammo_idfile; } diff --git a/zone/perl_bot.cpp b/zone/perl_bot.cpp index 8b513cea4..0e01e42a0 100644 --- a/zone/perl_bot.cpp +++ b/zone/perl_bot.cpp @@ -81,9 +81,9 @@ uint32 Perl_Bot_GetBotItemIDBySlot(Bot* self, uint16 slot_id) return self->GetBotItemBySlot(slot_id); } -void Perl_Bot_SignalBot(Bot* self, int signal_id) +void Perl_Bot_Signal(Bot* self, int signal_id) { - self->SignalBot(signal_id); + self->Signal(signal_id); } void Perl_Bot_OwnerMessage(Bot* self, std::string message) @@ -131,6 +131,16 @@ bool Perl_Bot_HasBotSpellEntry(Bot* self, uint16 spellid) return self->HasBotSpellEntry(spellid); } +void Perl_Bot_SendPayload(Bot* self, int payload_id) // @categories Script Utility +{ + self->SendPayload(payload_id); +} + +void Perl_Bot_SendPayload(Bot* self, int payload_id, std::string payload_value) // @categories Script Utility +{ + self->SendPayload(payload_id, payload_value); +} + void perl_register_bot() { perl::interpreter state(PERL_GET_THX); @@ -159,9 +169,11 @@ void perl_register_bot() package.add("ReloadBotSpells", &Perl_Bot_ReloadBotSpells); package.add("ReloadBotSpellSettings", &Perl_Bot_ReloadBotSpellSettings); package.add("RemoveBotItem", &Perl_Bot_RemoveBotItem); + package.add("SendPayload", (void(*)(Bot*, int))&Perl_Bot_SendPayload); + package.add("SendPayload", (void(*)(Bot*, int, std::string))&Perl_Bot_SendPayload); package.add("SetExpansionBitmask", (void(*)(Bot*, int))&Perl_Bot_SetExpansionBitmask); package.add("SetExpansionBitmask", (void(*)(Bot*, int, bool))&Perl_Bot_SetExpansionBitmask); - package.add("SignalBot", &Perl_Bot_SignalBot); + package.add("Signal", &Perl_Bot_Signal); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 142d88646..c518f4cbb 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -2732,6 +2732,16 @@ perl::array Perl_Client_GetZoneFlags(Client* self) return a; } +void Perl_Client_SendPayload(Client* self, int payload_id) // @categories Script Utility +{ + self->SendPayload(payload_id); +} + +void Perl_Client_SendPayload(Client* self, int payload_id, std::string payload_value) // @categories Script Utility +{ + self->SendPayload(payload_id, payload_value); +} + void Perl_Client_Signal(Client* self, int signal_id) { self->Signal(signal_id); @@ -3179,6 +3189,8 @@ void perl_register_client() package.add("SendMarqueeMessage", (void(*)(Client*, uint32, std::string, uint32))&Perl_Client_SendMarqueeMessage); package.add("SendMarqueeMessage", (void(*)(Client*, uint32, uint32, uint32, uint32, uint32, std::string))&Perl_Client_SendMarqueeMessage); package.add("SendOPTranslocateConfirm", &Perl_Client_SendOPTranslocateConfirm); + package.add("SendPayload", (void(*)(Client*, int))&Perl_Client_SendPayload); + package.add("SendPayload", (void(*)(Client*, int, std::string))&Perl_Client_SendPayload); package.add("SendPEQZoneFlagInfo", &Perl_Client_SendPEQZoneFlagInfo); package.add("SendSound", &Perl_Client_SendSound); package.add("SendSpellAnim", &Perl_Client_SendSpellAnim); diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 62a8b0d33..efccaa173 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -670,6 +670,16 @@ void Perl_NPC_ReloadSpells(NPC* self) self->ReloadSpells(); } +void Perl_NPC_SendPayload(NPC* self, int payload_id) // @categories Script Utility +{ + self->SendPayload(payload_id); +} + +void Perl_NPC_SendPayload(NPC* self, int payload_id, std::string payload_value) // @categories Script Utility +{ + self->SendPayload(payload_id, payload_value); +} + void perl_register_npc() { perl::interpreter perl(PERL_GET_THX); @@ -786,6 +796,8 @@ void perl_register_npc() package.add("SaveGuardSpot", (void(*)(NPC*, bool))&Perl_NPC_SaveGuardSpot); package.add("SaveGuardSpot", (void(*)(NPC*, float, float, float, float))&Perl_NPC_SaveGuardSpot); package.add("ScaleNPC", &Perl_NPC_ScaleNPC); + package.add("SendPayload", (void(*)(NPC*, int))&Perl_NPC_SendPayload); + package.add("SendPayload", (void(*)(NPC*, int, std::string))&Perl_NPC_SendPayload); package.add("SetCopper", &Perl_NPC_SetCopper); package.add("SetGold", &Perl_NPC_SetGold); package.add("SetGrid", &Perl_NPC_SetGrid);