feat: Added remaining server-side events
+ onPlayerUseCheat, all NPC related events
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
18
src/events/sqevents_anticheat.cpp
Normal file
18
src/events/sqevents_anticheat.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <sqapi.h>
|
||||
#include <pybind11/embed.h>
|
||||
#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;
|
||||
}
|
||||
73
src/events/sqevents_npc.cpp
Normal file
73
src/events/sqevents_npc.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
#include <sqapi.h>
|
||||
#include <pybind11/embed.h>
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user