diff --git a/g2o/events.py b/g2o/events.py index 88e3b92..3ec28a9 100644 --- a/g2o/events.py +++ b/g2o/events.py @@ -165,4 +165,12 @@ addEvent('onPlayerEquipRing') addEvent('onPlayerEquipShield') addEvent('onPlayerEquipSpell') -addEvent('onPacket') \ No newline at end of file +addEvent('onPacket') + +addEvent('onPlayerUseCheat') + +addEvent('onNpcActionFinished') +addEvent('onNpcActionSent') +addEvent('onNpcChangeHostPlayer') +addEvent('onNpcCreated') +addEvent('onNpcDestroyed') \ No newline at end of file diff --git a/src/events/sqevents.cpp b/src/events/sqevents.cpp index 83a554f..df30bf3 100644 --- a/src/events/sqevents.cpp +++ b/src/events/sqevents.cpp @@ -89,4 +89,12 @@ void registerSquirrelEvents() addEventHandler("onPlayerEquipSpell", sq_onPlayerEquipSpell, 0); addEventHandler("onPacket", sq_onPacket, 0); + + addEventHandler("onPlayerUseCheat", sq_onPlayerUseCheat, 0); + + addEventHandler("onNpcActionFinished", sq_onNpcActionFinished, 0); + addEventHandler("onNpcActionSent", sq_onNpcActionSent, 0); + addEventHandler("onNpcChangeHostPlayer", sq_onNpcChangeHostPlayer, 0); + addEventHandler("onNpcCreated", sq_onNpcCreated, 0); + addEventHandler("onNpcDestroyed", sq_onNpcDestroyed, 0); } \ No newline at end of file diff --git a/src/events/sqevents.h b/src/events/sqevents.h index a9ff4b9..bd23f75 100644 --- a/src/events/sqevents.h +++ b/src/events/sqevents.h @@ -50,6 +50,14 @@ SQInteger sq_onPlayerToggleFaceAni(HSQUIRRELVM); SQInteger sq_onPacket(HSQUIRRELVM); +SQInteger sq_onPlayerUseCheat(HSQUIRRELVM); + +SQInteger sq_onNpcActionFinished(HSQUIRRELVM); +SQInteger sq_onNpcActionSent(HSQUIRRELVM); +SQInteger sq_onNpcChangeHostPlayer(HSQUIRRELVM); +SQInteger sq_onNpcCreated(HSQUIRRELVM); +SQInteger sq_onNpcDestroyed(HSQUIRRELVM); + void registerSquirrelEvents(); #endif \ No newline at end of file diff --git a/src/events/sqevents_anticheat.cpp b/src/events/sqevents_anticheat.cpp new file mode 100644 index 0000000..67b1c5a --- /dev/null +++ b/src/events/sqevents_anticheat.cpp @@ -0,0 +1,18 @@ +#include +#include +#include "NoNut/core/Utils.h" +#include "sqcontainers.h" +#include "sqevents.h" + +SQInteger sq_onPlayerUseCheat(HSQUIRRELVM vm) +{ + SQInteger playerid, type; + + nonut::sqGetValue(vm, 2, &playerid); + nonut::sqGetValue(vm, 3, &type); + + py::dict kwargs = py::dict("playerid"_a=playerid, "type"_a=type); + callEvent("onPlayerUseCheat", kwargs); + + return 0; +} \ No newline at end of file diff --git a/src/events/sqevents_npc.cpp b/src/events/sqevents_npc.cpp new file mode 100644 index 0000000..4ce28aa --- /dev/null +++ b/src/events/sqevents_npc.cpp @@ -0,0 +1,73 @@ +#include +#include +#include "NoNut/core/Utils.h" +#include "sqcontainers.h" +#include "sqevents.h" + +SQInteger sq_onNpcActionFinished(HSQUIRRELVM vm) +{ + SQInteger npc_id, action_type, action_id; + SQBool result; + + nonut::sqGetValue(vm, 2, &npc_id); + nonut::sqGetValue(vm, 3, &action_type); + nonut::sqGetValue(vm, 4, &action_id); + nonut::sqGetValue(vm, 5, &result); + + py::dict kwargs = py::dict("npc_id"_a=npc_id, "action_type"_a=action_type, "action_id"_a=action_id, "result"_a=result); + callEvent("onNpcActionFinished", kwargs); + + return 0; +} + +SQInteger sq_onNpcActionSent(HSQUIRRELVM vm) +{ + SQInteger npc_id, action_type, action_id; + + nonut::sqGetValue(vm, 2, &npc_id); + nonut::sqGetValue(vm, 3, &action_type); + nonut::sqGetValue(vm, 4, &action_id); + + py::dict kwargs = py::dict("npc_id"_a=npc_id, "action_type"_a=action_type, "action_id"_a=action_id); + callEvent("onNpcActionSent", kwargs); + + return 0; +} + +SQInteger sq_onNpcChangeHostPlayer(HSQUIRRELVM vm) +{ + SQInteger npc_id, current_id, previous_id; + + nonut::sqGetValue(vm, 2, &npc_id); + nonut::sqGetValue(vm, 3, ¤t_id); + nonut::sqGetValue(vm, 4, &previous_id); + + py::dict kwargs = py::dict("npc_id"_a=npc_id, "current_id"_a=current_id, "previous_id"_a=previous_id); + callEvent("onNpcChangeHostPlayer", kwargs); + + return 0; +} + +SQInteger sq_onNpcCreated(HSQUIRRELVM vm) +{ + SQInteger npc_id; + + nonut::sqGetValue(vm, 2, &npc_id); + + py::dict kwargs = py::dict("npc_id"_a=npc_id); + callEvent("onNpcCreated", kwargs); + + return 0; +} + +SQInteger sq_onNpcDestroyed(HSQUIRRELVM vm) +{ + SQInteger npc_id; + + nonut::sqGetValue(vm, 2, &npc_id); + + py::dict kwargs = py::dict("npc_id"_a=npc_id); + callEvent("onNpcDestroyed", kwargs); + + return 0; +} \ No newline at end of file