refactor: Refactorized whole project structure
This commit is contained in:
11
source/functions/CMakeLists.txt
Normal file
11
source/functions/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
target_sources(${PYG2O_MODULE_NAME}
|
||||
PRIVATE
|
||||
python/functions.cpp
|
||||
squirrel/functions.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PYG2O_MODULE_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/
|
||||
)
|
||||
198
source/functions/python/functions.cpp
Normal file
198
source/functions/python/functions.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
#include <sqapi.h>
|
||||
#include <pybind11/embed.h>
|
||||
#include <CustomTypes.h>
|
||||
|
||||
#include "python/functions.h"
|
||||
#include "squirrel/functions.h"
|
||||
#include "Dictionary.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
#define SERVERFUNC nonut::ServerFunctions::getInstance()
|
||||
|
||||
std::string py_getHostname() { return SERVERFUNC->getHostname(); }
|
||||
int py_getMaxSlots() { return SERVERFUNC->getMaxSlots(); }
|
||||
int py_getPlayersCount() { return SERVERFUNC->getPlayersCount(); }
|
||||
|
||||
float py_getDistance2d(float x1, float y1, float x2, float y2) { return SERVERFUNC->getDistance2d(x1, y1, x2, y2); }
|
||||
float py_getDistance3d(float x1, float y1, float z1, float x2, float y2, float z2) { return SERVERFUNC->getDistance3d(x1, y1, z1, x2, y2, z2); }
|
||||
float py_getVectorAngle(float x1, float y1, float x2, float y2) { return SERVERFUNC->getVectorAngle(x1, y1, x2, y2); }
|
||||
|
||||
void py_sendMessageToAll(int r, int g, int b, std::string text) { return SERVERFUNC->sendMessageToAll(r, g, b, text); }
|
||||
void py_sendMessageToPlayer(int id, int r, int g, int b, std::string text) { return SERVERFUNC->sendMessageToPlayer(id, r, g, b, text); }
|
||||
void py_sendPlayerMessageToAll(int id, int r, int g, int b, std::string text) { return SERVERFUNC->sendPlayerMessageToAll(id, r, g, b, text); }
|
||||
void py_sendPlayerMessageToPlayer(int id, int to, int r, int g, int b, std::string text) { return SERVERFUNC->sendPlayerMessageToPlayer(id, to, r, g, b, text); }
|
||||
|
||||
void py_exit(int code) { return SERVERFUNC->exit(code); }
|
||||
float py_getDayLength() { return SERVERFUNC->getDayLength(); }
|
||||
std::string py_getServerDescription() { return SERVERFUNC->getServerDescription(); }
|
||||
std::string py_getServerWorld() { return SERVERFUNC->getServerWorld(); }
|
||||
py::dict py_getTime() { return SERVERFUNC->getTime().data; }
|
||||
void py_serverLog(std::string text) { return SERVERFUNC->serverLog(text); }
|
||||
void py_setDayLength(float ms) { return SERVERFUNC->setDayLength(ms); }
|
||||
bool py_setServerDescription(std::string text) { return SERVERFUNC->setServerDescription(text); }
|
||||
void py_setServerWorld(std::string text) { return SERVERFUNC->setServerWorld(text); }
|
||||
void py_setTime(int h, int m, int d) { return SERVERFUNC->setTime(h, m, d); }
|
||||
|
||||
void py_clearNpcActions(int npc_id) { return SERVERFUNC->clearNpcActions(npc_id); }
|
||||
int py_createNpc(std::string name, std::string instance) { return SERVERFUNC->createNpc(name, instance); }
|
||||
bool py_destroyNpc(int npc_id) { return SERVERFUNC->destroyNpc(npc_id); }
|
||||
py::dict py_getNpcAction(int npc_id, int index) { return SERVERFUNC->getNpcAction(npc_id, index).data; }
|
||||
// ??? py_getNpcActionType
|
||||
py::list py_getNpcActions(int npc_id) { return SERVERFUNC->getNpcActions(npc_id).data; }
|
||||
int py_getNpcActionsCount(int npc_id) { return SERVERFUNC->getNpcActionsCount(npc_id); }
|
||||
int py_getNpcHostPlayer(int npc_id) { return SERVERFUNC->getNpcHostPlayer(npc_id); }
|
||||
int py_getNpcLastActionId(int npc_id) { return SERVERFUNC->getNpcLastActionId(npc_id); }
|
||||
bool py_isNpc(int npc_id) { return SERVERFUNC->isNpc(npc_id); }
|
||||
bool py_isNpcActionFinished(int npc_id, int action_id) { return SERVERFUNC->isNpcActionFinished(npc_id, action_id); }
|
||||
void py_npcAttackMelee(int a_id, int e_id, int a_type, int combo) { return SERVERFUNC->npcAttackMelee(a_id, e_id, a_type, combo); }
|
||||
void py_npcAttackRanged(int a_id, int e_id) { return SERVERFUNC->npcAttackRanged(a_id, e_id); }
|
||||
void py_npcSpellCast(int a_id, int e_id) { return SERVERFUNC->npcSpellCast(a_id, e_id); }
|
||||
void py_npcUseClosestMob(int npc_id, std::string sceme, int target_state) { return SERVERFUNC->npcUseClosestMob(npc_id, sceme, target_state); }
|
||||
//??? py_pushNpcAction
|
||||
bool py_setNpcHostPlayer(int npc_id, int host_id) { return SERVERFUNC->setNpcHostPlayer(npc_id, host_id); }
|
||||
|
||||
bool py_addBan(py::dict info)
|
||||
{
|
||||
Sqrat::Table* pTable = PyDictionary::toSqObject(info);
|
||||
nonut::Int result = SERVERFUNC->addBan(pTable->GetObject());
|
||||
delete pTable;
|
||||
return result;
|
||||
}
|
||||
bool py_applyPlayerOverlay(int id, int overlayId) { return SERVERFUNC->applyPlayerOverlay(id, overlayId); }
|
||||
void py_ban(int id, int minutes, std::string reason) { return SERVERFUNC->ban(id, minutes, reason); }
|
||||
void py_drawWeapon(int id, int weaponMode) { return SERVERFUNC->drawWeapon(id, weaponMode); }
|
||||
void py_equipItem(int id, std::string instance, int slotId) { return SERVERFUNC->equipItem(id, instance, slotId); }
|
||||
std::string py_getPlayerAmulet(int id) { return SERVERFUNC->getPlayerAmulet(id); }
|
||||
float py_getPlayerAngle(int id) { return SERVERFUNC->getPlayerAngle(id); }
|
||||
std::string py_getPlayerAni(int id) { return SERVERFUNC->getPlayerAni(id); }
|
||||
std::string py_getPlayerArmor(int id) { return SERVERFUNC->getPlayerArmor(id); }
|
||||
py::dict py_getPlayerAtVector(int id)
|
||||
{
|
||||
py::dict result;
|
||||
nonut::Position3d pos = SERVERFUNC->getPlayerAtVector(id);
|
||||
|
||||
result["x"] = pos.x;
|
||||
result["y"] = pos.y;
|
||||
result["z"] = pos.z;
|
||||
return result;
|
||||
}
|
||||
std::string py_getPlayerBelt(int id) { return SERVERFUNC->getPlayerBelt(id); }
|
||||
py::dict py_getPlayerCameraPosition(int id)
|
||||
{
|
||||
py::dict result;
|
||||
nonut::Position3d pos = SERVERFUNC->getPlayerCameraPosition(id);
|
||||
|
||||
result["x"] = pos.x;
|
||||
result["y"] = pos.y;
|
||||
result["z"] = pos.z;
|
||||
return result;
|
||||
}
|
||||
bool py_getPlayerCollision(int id) { return SERVERFUNC->getPlayerCollision(id); }
|
||||
py::dict py_getPlayerColor(int id)
|
||||
{
|
||||
py::dict result;
|
||||
nonut::Color color = SERVERFUNC->getPlayerColor(id);
|
||||
|
||||
result["r"] = color.r;
|
||||
result["g"] = color.g;
|
||||
result["b"] = color.b;
|
||||
return result;
|
||||
}
|
||||
int py_getPlayerContext(int id, int type) { return SERVERFUNC->getPlayerContext(id, type); }
|
||||
int py_getPlayerDexterity(int id) { return SERVERFUNC->getPlayerDexterity(id); }
|
||||
py::list py_getPlayerFaceAnis(int id) { return SERVERFUNC->getPlayerFaceAnis(id).data; }
|
||||
float py_getPlayerFatness(int id) { return SERVERFUNC->getPlayerFatness(id); }
|
||||
int py_getPlayerFocus(int id) { return SERVERFUNC->getPlayerFocus(id); }
|
||||
int py_getPlayerHealth(int id) { return SERVERFUNC->getPlayerHealth(id); }
|
||||
std::string py_getPlayerHelmet(int id) { return SERVERFUNC->getPlayerHelmet(id); }
|
||||
std::string py_getPlayerIP(int id) { return SERVERFUNC->getPlayerIP(id); }
|
||||
std::string py_getPlayerInstance(int id) { return SERVERFUNC->getPlayerInstance(id); }
|
||||
std::string py_getPlayerMacAddr(int id) { return SERVERFUNC->getPlayerMacAddr(id); }
|
||||
int py_getPlayerMana(int id) { return SERVERFUNC->getPlayerMana(id); }
|
||||
int py_getPlayerMaxHealth(int id) { return SERVERFUNC->getPlayerMaxHealth(id); }
|
||||
int py_getPlayerMaxMana(int id) { return SERVERFUNC->getPlayerMaxMana(id); }
|
||||
std::string py_getPlayerMeleeWeapon(int id) { return SERVERFUNC->getPlayerMeleeWeapon(id); }
|
||||
std::string py_getPlayerName(int id) { return SERVERFUNC->getPlayerName(id); }
|
||||
int py_getPlayerPing(int id) { return SERVERFUNC->getPlayerPing(id); }
|
||||
py::dict py_getPlayerPosition(int id)
|
||||
{
|
||||
py::dict result;
|
||||
|
||||
nonut::Position3d pos = SERVERFUNC->getPlayerPosition(id);
|
||||
|
||||
result["x"] = pos.x;
|
||||
result["y"] = pos.y;
|
||||
result["z"] = pos.z;
|
||||
return result;
|
||||
}
|
||||
std::string py_getPlayerRangedWeapon(int id) { return SERVERFUNC->getPlayerRangedWeapon(id); }
|
||||
int py_getPlayerRespawnTime(int id) { return SERVERFUNC->getPlayerRespawnTime(id); }
|
||||
std::string py_getPlayerRing(int id, int handId) { return SERVERFUNC->getPlayerRing(id, handId); }
|
||||
py::dict py_getPlayerScale(int id) { return SERVERFUNC->getPlayerScale(id).data; }
|
||||
std::string py_getPlayerSerial(int id) { return SERVERFUNC->getPlayerSerial(id); }
|
||||
std::string py_getPlayerShield(int id) { return SERVERFUNC->getPlayerShield(id); }
|
||||
int py_getPlayerSkillWeapon(int id, int skillId) { return SERVERFUNC->getPlayerSkillWeapon(id, skillId); }
|
||||
std::string py_getPlayerSpell(int id, int slotId) { return SERVERFUNC->getPlayerSpell(id, slotId); }
|
||||
int py_getPlayerStrength(int id) { return SERVERFUNC->getPlayerStrength(id); }
|
||||
int py_getPlayerTalent(int id, int talentId) { return SERVERFUNC->getPlayerTalent(id, talentId); }
|
||||
std::string py_getPlayerUID(int id) { return SERVERFUNC->getPlayerUID(id); }
|
||||
int py_getPlayerVirtualWorld(int id) { return SERVERFUNC->getPlayerVirtualWorld(id); }
|
||||
py::dict py_getPlayerVisual(int id) { return SERVERFUNC->getPlayerVisual(id).data; }
|
||||
int py_getPlayerWeaponMode(int id) { return SERVERFUNC->getPlayerWeaponMode(id); }
|
||||
std::string py_getPlayerWorld(int id) { return SERVERFUNC->getPlayerWorld(id); }
|
||||
void py_giveItem(int id, std::string instance, int amount) { return SERVERFUNC->giveItem(id, instance, amount); }
|
||||
bool py_hitPlayer(int id, int targetid) { return SERVERFUNC->hitPlayer(id, targetid); }
|
||||
bool py_isPlayerConnected(int id) { return SERVERFUNC->isPlayerConnected(id); }
|
||||
bool py_isPlayerDead(int id) { return SERVERFUNC->isPlayerDead(id); }
|
||||
bool py_isPlayerUnconscious(int id) { return SERVERFUNC->isPlayerUnconscious(id); }
|
||||
void py_kick(int id, std::string reason) { return SERVERFUNC->kick(id, reason); }
|
||||
void py_playAni(int id, std::string aniName) { return SERVERFUNC->playAni(id, aniName); }
|
||||
void py_playFaceAni(int id, std::string aniName) { return SERVERFUNC->playFaceAni(id, aniName); }
|
||||
void py_readySpell(int id, int slotId, int manaInvested) { return SERVERFUNC->readySpell(id, slotId, manaInvested); }
|
||||
void py_removeItem(int id, std::string instance, int amount) { return SERVERFUNC->removeItem(id, instance, amount); }
|
||||
bool py_removePlayerOverlay(int id, int overlayId) { return SERVERFUNC->removePlayerOverlay(id, overlayId); }
|
||||
void py_removeWeapon(int id) { return SERVERFUNC->removeWeapon(id); }
|
||||
void py_respawnPlayer(int id) { return SERVERFUNC->respawnPlayer(id); }
|
||||
void py_setPlayerAngle(int id, float angle) { return SERVERFUNC->setPlayerAngle(id, angle); }
|
||||
void py_setPlayerCollision(int id, bool collision) { return SERVERFUNC->setPlayerCollision(id, collision); }
|
||||
void py_setPlayerColor(int id, int r, int g, int b) { return SERVERFUNC->setPlayerColor(id, r, g, b); }
|
||||
void py_setPlayerContext(int id, int type, int value) { return SERVERFUNC->setPlayerContext(id, type, value); }
|
||||
void py_setPlayerDexterity(int id, int dexterity) { return SERVERFUNC->setPlayerDexterity(id, dexterity); }
|
||||
void py_setPlayerFatness(int id, float fatness) { return SERVERFUNC->setPlayerFatness(id, fatness); }
|
||||
void py_setPlayerHealth(int id, int health) { return SERVERFUNC->setPlayerHealth(id, health); }
|
||||
void py_setPlayerInstance(int id, std::string instance) { return SERVERFUNC->setPlayerInstance(id, instance); }
|
||||
void py_setPlayerInvisible(int id, bool toggle) { return SERVERFUNC->setPlayerInvisible(id, toggle); }
|
||||
void py_setPlayerMana(int id, int mana) { return SERVERFUNC->setPlayerMana(id, mana); }
|
||||
void py_setPlayerMaxHealth(int id, int maxHealth) { return SERVERFUNC->setPlayerMaxHealth(id, maxHealth); }
|
||||
void py_setPlayerMaxMana(int id, int maxMana) { return SERVERFUNC->setPlayerMaxMana(id, maxMana); }
|
||||
void py_setPlayerName(int id, std::string name) { return SERVERFUNC->setPlayerName(id, name); }
|
||||
void py_setPlayerPosition(int id, float x, float y, float z) { return SERVERFUNC->setPlayerPosition(id, x, y, z); }
|
||||
void py_setPlayerRespawnTime(int id, int respawnTime) { return SERVERFUNC->setPlayerRespawnTime(id, respawnTime); }
|
||||
void py_setPlayerScale(int id, float x, float y, float z) { return SERVERFUNC->setPlayerScale(id, x, y, z); }
|
||||
void py_setPlayerSkillWeapon(int id, int skillId, int percentage) { return SERVERFUNC->setPlayerSkillWeapon(id, skillId, percentage); }
|
||||
void py_setPlayerStrength(int id, int strength) { return SERVERFUNC->setPlayerStrength(id, strength); }
|
||||
void py_setPlayerTalent(int id, int talentId, int talentValue) { return SERVERFUNC->setPlayerTalent(id, talentId, talentValue); }
|
||||
void py_setPlayerVirtualWorld(int id, int virtualWorld) { return SERVERFUNC->setPlayerVirtualWorld(id, virtualWorld); }
|
||||
void py_setPlayerVisual(int id, std::string bMdl, int bTxt, std::string hMdl, int hTxt) { return SERVERFUNC->setPlayerVisual(id, bMdl, bTxt, hMdl, hTxt); }
|
||||
void py_setPlayerWeaponMode(int id, int weaponMode) { return SERVERFUNC->setPlayerWeaponMode(id, weaponMode); }
|
||||
void py_setPlayerWorld(int id, std::string world, std::string startPointName) { return SERVERFUNC->setPlayerWorld(id, world, startPointName); }
|
||||
void py_spawnPlayer(int id) { return SERVERFUNC->spawnPlayer(id); }
|
||||
void py_stopAni(int id, std::string aniName) { return SERVERFUNC->stopAni(id, aniName); }
|
||||
void py_stopFaceAni(int id, std::string aniName) { return SERVERFUNC->stopFaceAni(id, aniName); }
|
||||
void py_unequipItem(int id, std::string instance) { return SERVERFUNC->unequipItem(id, instance); }
|
||||
void py_unreadySpell(int id) { return SERVERFUNC->unreadySpell(id); }
|
||||
void py_unspawnPlayer(int id) { return SERVERFUNC->unspawnPlayer(id); }
|
||||
void py_useItem(int id, std::string instance) { return SERVERFUNC->useItem(id, instance); }
|
||||
void py_useItemToState(int id, std::string instance, int state) { return SERVERFUNC->useItemToState(id, instance, state); }
|
||||
|
||||
py::list py_findNearbyPlayers(py::dict position, int radius, std::string world, int vWorld)
|
||||
{
|
||||
Sqrat::Table* pTable = PyDictionary::toSqObject(position);
|
||||
py::list result = SERVERFUNC->findNearbyPlayers(pTable->GetObject(), radius, world, vWorld).data;
|
||||
delete pTable;
|
||||
return result;
|
||||
}
|
||||
py::list py_getSpawnedPlayersForPlayer(int id) { return SERVERFUNC->getSpawnedPlayersForPlayer(id).data; }
|
||||
py::list py_getStreamedPlayersByPlayer(int id) { return SERVERFUNC->getStreamedPlayersByPlayer(id).data; }
|
||||
py::dict py_getNearestWaypoint(std::string world, int x, int y, int z) { return SERVERFUNC->getNearestWaypoint(world, x, y, z).data; }
|
||||
py::dict py_getWaypoint(std::string world, std::string name) { return SERVERFUNC->getWaypoint(world, name).data; }
|
||||
147
source/functions/python/functions.h
Normal file
147
source/functions/python/functions.h
Normal file
@@ -0,0 +1,147 @@
|
||||
#ifndef _PYFUNCTIONS_
|
||||
#define _PYFUNCTIONS_
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
namespace py = pybind11;
|
||||
|
||||
// Shared functions
|
||||
std::string py_getHostname();
|
||||
int py_getMaxSlots();
|
||||
int py_getPlayersCount();
|
||||
|
||||
float py_getDistance2d(float, float, float, float);
|
||||
float py_getDistance3d(float, float, float, float, float, float);
|
||||
float py_getVectorAngle(float, float, float, float);
|
||||
|
||||
void py_sendMessageToAll(int, int, int, std::string);
|
||||
void py_sendMessageToPlayer(int, int, int, int, std::string);
|
||||
void py_sendPlayerMessageToAll(int, int, int, int, std::string);
|
||||
void py_sendPlayerMessageToPlayer(int, int, int, int, int, std::string);
|
||||
|
||||
void py_exit(int);
|
||||
float py_getDayLength();
|
||||
std::string py_getServerDescription();
|
||||
std::string py_getServerWorld();
|
||||
py::dict py_getTime();
|
||||
void py_serverLog(std::string);
|
||||
void py_setDayLength(float);
|
||||
bool py_setServerDescription(std::string);
|
||||
void py_setServerWorld(std::string);
|
||||
void py_setTime(int, int, int);
|
||||
|
||||
void py_clearNpcActions(int);
|
||||
int py_createNpc(std::string, std::string);
|
||||
bool py_destroyNpc(int);
|
||||
py::dict py_getNpcAction(int, int);
|
||||
// ??? py_getNpcActionType
|
||||
py::list py_getNpcActions(int);
|
||||
int py_getNpcActionsCount(int);
|
||||
int py_getNpcHostPlayer(int);
|
||||
int py_getNpcLastActionId(int);
|
||||
bool py_isNpc(int);
|
||||
bool py_isNpcActionFinished(int, int);
|
||||
void py_npcAttackMelee(int, int, int, int);
|
||||
void py_npcAttackRanged(int, int);
|
||||
void py_npcSpellCast(int, int);
|
||||
void py_npcUseClosestMob(int, std::string, int);
|
||||
//??? py_pushNpcAction
|
||||
bool py_setNpcHostPlayer(int, int);
|
||||
|
||||
bool py_addBan(py::dict);
|
||||
bool py_applyPlayerOverlay(int, int);
|
||||
void py_ban(int, int, std::string);
|
||||
void py_drawWeapon(int, int);
|
||||
void py_equipItem(int, std::string, int);
|
||||
std::string py_getPlayerAmulet(int);
|
||||
float py_getPlayerAngle(int);
|
||||
std::string py_getPlayerAni(int);
|
||||
std::string py_getPlayerArmor(int);
|
||||
py::dict py_getPlayerAtVector(int);
|
||||
std::string py_getPlayerBelt(int);
|
||||
py::dict py_getPlayerCameraPosition(int);
|
||||
bool py_getPlayerCollision(int);
|
||||
py::dict py_getPlayerColor(int);
|
||||
int py_getPlayerContext(int, int);
|
||||
int py_getPlayerDexterity(int);
|
||||
py::list py_getPlayerFaceAnis(int);
|
||||
float py_getPlayerFatness(int);
|
||||
int py_getPlayerFocus(int);
|
||||
int py_getPlayerHealth(int);
|
||||
std::string py_getPlayerHelmet(int);
|
||||
std::string py_getPlayerIP(int);
|
||||
std::string py_getPlayerInstance(int);
|
||||
std::string py_getPlayerMacAddr(int);
|
||||
int py_getPlayerMana(int);
|
||||
int py_getPlayerMaxHealth(int);
|
||||
int py_getPlayerMaxMana(int);
|
||||
std::string py_getPlayerMeleeWeapon(int);
|
||||
std::string py_getPlayerName(int);
|
||||
int py_getPlayerPing(int);
|
||||
py::dict py_getPlayerPosition(int);
|
||||
std::string py_getPlayerRangedWeapon(int);
|
||||
int py_getPlayerRespawnTime(int);
|
||||
std::string py_getPlayerRing(int, int);
|
||||
py::dict py_getPlayerScale(int);
|
||||
std::string py_getPlayerSerial(int);
|
||||
std::string py_getPlayerShield(int);
|
||||
int py_getPlayerSkillWeapon(int, int);
|
||||
std::string py_getPlayerSpell(int, int);
|
||||
int py_getPlayerStrength(int);
|
||||
int py_getPlayerTalent(int, int);
|
||||
std::string py_getPlayerUID(int);
|
||||
int py_getPlayerVirtualWorld(int);
|
||||
py::dict py_getPlayerVisual(int);
|
||||
int py_getPlayerWeaponMode(int);
|
||||
std::string py_getPlayerWorld(int);
|
||||
void py_giveItem(int, std::string, int);
|
||||
bool py_hitPlayer(int, int);
|
||||
bool py_isPlayerConnected(int);
|
||||
bool py_isPlayerDead(int);
|
||||
bool py_isPlayerUnconscious(int);
|
||||
void py_kick(int, std::string);
|
||||
void py_playAni(int, std::string);
|
||||
void py_playFaceAni(int, std::string);
|
||||
void py_readySpell(int, int, int);
|
||||
void py_removeItem(int, std::string, int);
|
||||
bool py_removePlayerOverlay(int, int);
|
||||
void py_removeWeapon(int);
|
||||
void py_respawnPlayer(int);
|
||||
void py_setPlayerAngle(int, float);
|
||||
void py_setPlayerCollision(int, bool);
|
||||
void py_setPlayerColor(int, int, int, int);
|
||||
void py_setPlayerContext(int, int, int);
|
||||
void py_setPlayerDexterity(int, int);
|
||||
void py_setPlayerFatness(int, float);
|
||||
void py_setPlayerHealth(int, int);
|
||||
void py_setPlayerInstance(int, std::string);
|
||||
void py_setPlayerInvisible(int, bool);
|
||||
void py_setPlayerMana(int, int);
|
||||
void py_setPlayerMaxHealth(int, int);
|
||||
void py_setPlayerMaxMana(int, int);
|
||||
void py_setPlayerName(int, std::string);
|
||||
void py_setPlayerPosition(int, float, float, float);
|
||||
void py_setPlayerRespawnTime(int, int);
|
||||
void py_setPlayerScale(int, float, float, float);
|
||||
void py_setPlayerSkillWeapon(int, int, int);
|
||||
void py_setPlayerStrength(int, int);
|
||||
void py_setPlayerTalent(int, int, int);
|
||||
void py_setPlayerVirtualWorld(int, int);
|
||||
void py_setPlayerVisual(int, std::string, int, std::string, int);
|
||||
void py_setPlayerWeaponMode(int, int);
|
||||
void py_setPlayerWorld(int, std::string, std::string);
|
||||
void py_spawnPlayer(int);
|
||||
void py_stopAni(int, std::string);
|
||||
void py_stopFaceAni(int, std::string);
|
||||
void py_unequipItem(int, std::string);
|
||||
void py_unreadySpell(int);
|
||||
void py_unspawnPlayer(int);
|
||||
void py_useItem(int, std::string);
|
||||
void py_useItemToState(int, std::string, int);
|
||||
|
||||
py::list py_findNearbyPlayers(py::dict, int, std::string, int);
|
||||
py::list py_getSpawnedPlayersForPlayer(int);
|
||||
py::list py_getStreamedPlayersByPlayer(int);
|
||||
py::dict py_getNearestWaypoint(std::string, int, int, int);
|
||||
py::dict py_getWaypoint(std::string, std::string);
|
||||
|
||||
#endif
|
||||
155
source/functions/squirrel/functions.cpp
Normal file
155
source/functions/squirrel/functions.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
#include <sqapi.h>
|
||||
#include "squirrel/functions.h"
|
||||
|
||||
namespace nonut
|
||||
{
|
||||
ServerFunctions::ServerFunctions() :
|
||||
FUNCTION_CTOR(getMaxSlots),
|
||||
FUNCTION_CTOR(getHostname),
|
||||
FUNCTION_CTOR(getPlayersCount),
|
||||
|
||||
FUNCTION_CTOR(getDistance2d),
|
||||
FUNCTION_CTOR(getDistance3d),
|
||||
FUNCTION_CTOR(getVectorAngle),
|
||||
|
||||
FUNCTION_CTOR(sendMessageToAll),
|
||||
FUNCTION_CTOR(sendMessageToPlayer),
|
||||
FUNCTION_CTOR(sendPlayerMessageToAll),
|
||||
FUNCTION_CTOR(sendPlayerMessageToPlayer),
|
||||
|
||||
FUNCTION_CTOR(exit),
|
||||
FUNCTION_CTOR(getDayLength),
|
||||
FUNCTION_CTOR(getServerDescription),
|
||||
FUNCTION_CTOR(getServerWorld),
|
||||
FUNCTION_CTOR(getTime),
|
||||
FUNCTION_CTOR(serverLog),
|
||||
FUNCTION_CTOR(setDayLength),
|
||||
FUNCTION_CTOR(setServerDescription),
|
||||
FUNCTION_CTOR(setServerWorld),
|
||||
FUNCTION_CTOR(setTime),
|
||||
|
||||
FUNCTION_CTOR(clearNpcActions),
|
||||
FUNCTION_CTOR(createNpc),
|
||||
FUNCTION_CTOR(destroyNpc),
|
||||
FUNCTION_CTOR(getNpcAction),
|
||||
//FUNCTION_CTOR(getNpcActionType),
|
||||
FUNCTION_CTOR(getNpcActions),
|
||||
FUNCTION_CTOR(getNpcActionsCount),
|
||||
FUNCTION_CTOR(getNpcHostPlayer),
|
||||
FUNCTION_CTOR(getNpcLastActionId),
|
||||
FUNCTION_CTOR(isNpc),
|
||||
FUNCTION_CTOR(isNpcActionFinished),
|
||||
FUNCTION_CTOR(npcAttackMelee),
|
||||
FUNCTION_CTOR(npcAttackRanged),
|
||||
FUNCTION_CTOR(npcSpellCast),
|
||||
FUNCTION_CTOR(npcUseClosestMob),
|
||||
//FUNCTION_CTOR(pushNpcAction),
|
||||
FUNCTION_CTOR(setNpcHostPlayer),
|
||||
FUNCTION_CTOR(addBan),
|
||||
FUNCTION_CTOR(applyPlayerOverlay),
|
||||
FUNCTION_CTOR(ban),
|
||||
FUNCTION_CTOR(drawWeapon),
|
||||
FUNCTION_CTOR(equipItem),
|
||||
FUNCTION_CTOR(getPlayerAmulet),
|
||||
FUNCTION_CTOR(getPlayerAngle),
|
||||
FUNCTION_CTOR(getPlayerAni),
|
||||
FUNCTION_CTOR(getPlayerArmor),
|
||||
FUNCTION_CTOR(getPlayerAtVector),
|
||||
FUNCTION_CTOR(getPlayerBelt),
|
||||
FUNCTION_CTOR(getPlayerCameraPosition),
|
||||
FUNCTION_CTOR(getPlayerCollision),
|
||||
FUNCTION_CTOR(getPlayerColor),
|
||||
FUNCTION_CTOR(getPlayerContext),
|
||||
FUNCTION_CTOR(getPlayerDexterity),
|
||||
FUNCTION_CTOR(getPlayerFaceAnis),
|
||||
FUNCTION_CTOR(getPlayerFatness),
|
||||
FUNCTION_CTOR(getPlayerFocus),
|
||||
FUNCTION_CTOR(getPlayerHealth),
|
||||
FUNCTION_CTOR(getPlayerHelmet),
|
||||
FUNCTION_CTOR(getPlayerIP),
|
||||
FUNCTION_CTOR(getPlayerInstance),
|
||||
FUNCTION_CTOR(getPlayerMacAddr),
|
||||
FUNCTION_CTOR(getPlayerMana),
|
||||
FUNCTION_CTOR(getPlayerMaxHealth),
|
||||
FUNCTION_CTOR(getPlayerMaxMana),
|
||||
FUNCTION_CTOR(getPlayerMeleeWeapon),
|
||||
FUNCTION_CTOR(getPlayerName),
|
||||
FUNCTION_CTOR(getPlayerPing),
|
||||
FUNCTION_CTOR(getPlayerPosition),
|
||||
FUNCTION_CTOR(getPlayerRangedWeapon),
|
||||
FUNCTION_CTOR(getPlayerRespawnTime),
|
||||
FUNCTION_CTOR(getPlayerRing),
|
||||
FUNCTION_CTOR(getPlayerScale),
|
||||
FUNCTION_CTOR(getPlayerSerial),
|
||||
FUNCTION_CTOR(getPlayerShield),
|
||||
FUNCTION_CTOR(getPlayerSkillWeapon),
|
||||
FUNCTION_CTOR(getPlayerSpell),
|
||||
FUNCTION_CTOR(getPlayerStrength),
|
||||
FUNCTION_CTOR(getPlayerTalent),
|
||||
FUNCTION_CTOR(getPlayerUID),
|
||||
FUNCTION_CTOR(getPlayerVirtualWorld),
|
||||
FUNCTION_CTOR(getPlayerVisual),
|
||||
FUNCTION_CTOR(getPlayerWeaponMode),
|
||||
FUNCTION_CTOR(getPlayerWorld),
|
||||
FUNCTION_CTOR(giveItem),
|
||||
FUNCTION_CTOR(hitPlayer),
|
||||
FUNCTION_CTOR(isPlayerConnected),
|
||||
FUNCTION_CTOR(isPlayerDead),
|
||||
FUNCTION_CTOR(isPlayerUnconscious),
|
||||
FUNCTION_CTOR(kick),
|
||||
FUNCTION_CTOR(playAni),
|
||||
FUNCTION_CTOR(playFaceAni),
|
||||
FUNCTION_CTOR(readySpell),
|
||||
FUNCTION_CTOR(removeItem),
|
||||
FUNCTION_CTOR(removePlayerOverlay),
|
||||
FUNCTION_CTOR(removeWeapon),
|
||||
FUNCTION_CTOR(respawnPlayer),
|
||||
FUNCTION_CTOR(setPlayerAngle),
|
||||
FUNCTION_CTOR(setPlayerCollision),
|
||||
FUNCTION_CTOR(setPlayerColor),
|
||||
FUNCTION_CTOR(setPlayerContext),
|
||||
FUNCTION_CTOR(setPlayerDexterity),
|
||||
FUNCTION_CTOR(setPlayerFatness),
|
||||
FUNCTION_CTOR(setPlayerHealth),
|
||||
FUNCTION_CTOR(setPlayerInstance),
|
||||
FUNCTION_CTOR(setPlayerInvisible),
|
||||
FUNCTION_CTOR(setPlayerMana),
|
||||
FUNCTION_CTOR(setPlayerMaxHealth),
|
||||
FUNCTION_CTOR(setPlayerMaxMana),
|
||||
FUNCTION_CTOR(setPlayerName),
|
||||
FUNCTION_CTOR(setPlayerPosition),
|
||||
FUNCTION_CTOR(setPlayerRespawnTime),
|
||||
FUNCTION_CTOR(setPlayerScale),
|
||||
FUNCTION_CTOR(setPlayerSkillWeapon),
|
||||
FUNCTION_CTOR(setPlayerStrength),
|
||||
FUNCTION_CTOR(setPlayerTalent),
|
||||
FUNCTION_CTOR(setPlayerVirtualWorld),
|
||||
FUNCTION_CTOR(setPlayerVisual),
|
||||
FUNCTION_CTOR(setPlayerWeaponMode),
|
||||
FUNCTION_CTOR(setPlayerWorld),
|
||||
FUNCTION_CTOR(spawnPlayer),
|
||||
FUNCTION_CTOR(stopAni),
|
||||
FUNCTION_CTOR(stopFaceAni),
|
||||
FUNCTION_CTOR(unequipItem),
|
||||
FUNCTION_CTOR(unreadySpell),
|
||||
FUNCTION_CTOR(unspawnPlayer),
|
||||
FUNCTION_CTOR(useItem),
|
||||
FUNCTION_CTOR(useItemToState),
|
||||
|
||||
FUNCTION_CTOR(findNearbyPlayers),
|
||||
FUNCTION_CTOR(getSpawnedPlayersForPlayer),
|
||||
FUNCTION_CTOR(getStreamedPlayersByPlayer),
|
||||
FUNCTION_CTOR(getNearestWaypoint),
|
||||
FUNCTION_CTOR(getWaypoint)
|
||||
{}
|
||||
|
||||
ServerFunctions* ServerFunctions::getInstance()
|
||||
{
|
||||
if (instance == nullptr)
|
||||
{
|
||||
instance = new ServerFunctions();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
161
source/functions/squirrel/functions.h
Normal file
161
source/functions/squirrel/functions.h
Normal file
@@ -0,0 +1,161 @@
|
||||
#ifndef _SQFUNCTIONS_
|
||||
#define _SQFUNCTIONS_
|
||||
|
||||
#include <Function.h>
|
||||
#include <CustomTypes.h>
|
||||
|
||||
namespace nonut
|
||||
{
|
||||
class ServerFunctions
|
||||
{
|
||||
protected:
|
||||
ServerFunctions();
|
||||
static inline ServerFunctions* instance = nullptr;
|
||||
public:
|
||||
ServerFunctions(ServerFunctions& other) = delete;
|
||||
void operator=(const ServerFunctions&) = delete;
|
||||
static ServerFunctions* getInstance();
|
||||
|
||||
Function<String> getHostname;
|
||||
Function<Int> getMaxSlots;
|
||||
Function<Int> getPlayersCount;
|
||||
|
||||
Function<Float, Float, Float, Float, Float> getDistance2d;
|
||||
Function<Float, Float, Float, Float, Float, Float, Float> getDistance3d;
|
||||
Function<Float, Float, Float, Float, Float> getVectorAngle;
|
||||
|
||||
Function<void, Int, Int, Int, String> sendMessageToAll;
|
||||
Function<void, Int, Int, Int, Int, String> sendMessageToPlayer;
|
||||
Function<void, Int, Int, Int, Int, String> sendPlayerMessageToAll;
|
||||
Function<void, Int, Int, Int, Int, Int, String> sendPlayerMessageToPlayer;
|
||||
|
||||
Function<void, Int> exit;
|
||||
Function<Float> getDayLength;
|
||||
Function<String> getServerDescription;
|
||||
Function<String> getServerWorld;
|
||||
Function<SqDict> getTime;
|
||||
Function<void, String> serverLog;
|
||||
Function<void, Float> setDayLength;
|
||||
Function<Bool, String> setServerDescription;
|
||||
Function<void, String> setServerWorld;
|
||||
Function<void, Int, Int, Int> setTime;
|
||||
|
||||
Function<void, Int> clearNpcActions;
|
||||
Function<Int, String, String> createNpc;
|
||||
Function<Bool, Int> destroyNpc;
|
||||
Function<SqDict, Int, Int> getNpcAction;
|
||||
//Function<???> getNpcActionType;
|
||||
Function<SqList, Int> getNpcActions;
|
||||
Function<Int, Int> getNpcActionsCount;
|
||||
Function<Int, Int> getNpcHostPlayer;
|
||||
Function<Int, Int> getNpcLastActionId;
|
||||
Function<Bool, Int> isNpc;
|
||||
Function<Bool, Int, Int> isNpcActionFinished;
|
||||
Function<void, Int, Int, Int, Int> npcAttackMelee;
|
||||
Function<void, Int, Int> npcAttackRanged;
|
||||
Function<void, Int, Int> npcSpellCast;
|
||||
Function<void, Int, String, Int> npcUseClosestMob;
|
||||
//Function<???> pushNpcAction;
|
||||
Function<Bool, Int, Int> setNpcHostPlayer;
|
||||
|
||||
Function<Bool, SQObject> addBan;
|
||||
Function<Bool, Int, Int> applyPlayerOverlay;
|
||||
Function<void, Int, Int, String> ban;
|
||||
Function<void, Int, Int> drawWeapon;
|
||||
Function<void, Int, String, Int> equipItem;
|
||||
Function<String, Int> getPlayerAmulet;
|
||||
Function<Float, Int> getPlayerAngle;
|
||||
Function<String, Int> getPlayerAni;
|
||||
Function<String, Int> getPlayerArmor;
|
||||
Function<Position3d, Int> getPlayerAtVector;
|
||||
Function<String, Int> getPlayerBelt;
|
||||
Function<Position3d, Int> getPlayerCameraPosition;
|
||||
Function<Bool, Int> getPlayerCollision;
|
||||
Function<Color, Int> getPlayerColor;
|
||||
Function<Int, Int, Int> getPlayerContext;
|
||||
Function<Int, Int> getPlayerDexterity;
|
||||
Function<SqList, Int> getPlayerFaceAnis;
|
||||
Function<Float, Int> getPlayerFatness;
|
||||
Function<Int, Int> getPlayerFocus;
|
||||
Function<Int, Int> getPlayerHealth;
|
||||
Function<String, Int> getPlayerHelmet;
|
||||
Function<String, Int> getPlayerIP;
|
||||
Function<String, Int> getPlayerInstance;
|
||||
Function<String, Int> getPlayerMacAddr;
|
||||
Function<Int, Int> getPlayerMana;
|
||||
Function<Int, Int> getPlayerMaxHealth;
|
||||
Function<Int, Int> getPlayerMaxMana;
|
||||
Function<String, Int> getPlayerMeleeWeapon;
|
||||
Function<String, Int> getPlayerName;
|
||||
Function<Int, Int> getPlayerPing;
|
||||
Function<Position3d, Int> getPlayerPosition;
|
||||
Function<String, Int> getPlayerRangedWeapon;
|
||||
Function<Int, Int> getPlayerRespawnTime;
|
||||
Function<String, Int, Int> getPlayerRing;
|
||||
Function<SqDict, Int> getPlayerScale;
|
||||
Function<String, Int> getPlayerSerial;
|
||||
Function<String, Int> getPlayerShield;
|
||||
Function<Int, Int, Int> getPlayerSkillWeapon;
|
||||
Function<String, Int, Int> getPlayerSpell;
|
||||
Function<Int, Int> getPlayerStrength;
|
||||
Function<Int, Int, Int> getPlayerTalent;
|
||||
Function<String, Int> getPlayerUID;
|
||||
Function<Int, Int> getPlayerVirtualWorld;
|
||||
Function<SqDict, Int> getPlayerVisual;
|
||||
Function<Int, Int> getPlayerWeaponMode;
|
||||
Function<String, Int> getPlayerWorld;
|
||||
Function<void, Int, String, Int> giveItem;
|
||||
Function<Bool, Int, Int> hitPlayer;
|
||||
Function<Bool, Int> isPlayerConnected;
|
||||
Function<Bool, Int> isPlayerDead;
|
||||
Function<Bool, Int> isPlayerUnconscious;
|
||||
Function<void, Int, String> kick;
|
||||
Function<void, Int, String> playAni;
|
||||
Function<void, Int, String> playFaceAni;
|
||||
Function<void, Int, Int, Int> readySpell;
|
||||
Function<void, Int, String, Int> removeItem;
|
||||
Function<Bool, Int, Int> removePlayerOverlay;
|
||||
Function<void, Int> removeWeapon;
|
||||
Function<void, Int> respawnPlayer;
|
||||
Function<void, Int, Float> setPlayerAngle;
|
||||
Function<void, Int, Bool> setPlayerCollision;
|
||||
Function<void, Int, Int, Int, Int> setPlayerColor;
|
||||
Function<void, Int, Int, Int> setPlayerContext;
|
||||
Function<void, Int, Int> setPlayerDexterity;
|
||||
Function<void, Int, Float> setPlayerFatness;
|
||||
Function<void, Int, Int> setPlayerHealth;
|
||||
Function<void, Int, String> setPlayerInstance;
|
||||
Function<void, Int, Bool> setPlayerInvisible;
|
||||
Function<void, Int, Int> setPlayerMana;
|
||||
Function<void, Int, Int> setPlayerMaxHealth;
|
||||
Function<void, Int, Int> setPlayerMaxMana;
|
||||
Function<void, Int, String> setPlayerName;
|
||||
Function<void, Int, Float, Float, Float> setPlayerPosition;
|
||||
Function<void, Int, Int> setPlayerRespawnTime;
|
||||
Function<void, Int, Float, Float, Float> setPlayerScale;
|
||||
Function<void, Int, Int, Int> setPlayerSkillWeapon;
|
||||
Function<void, Int, Int> setPlayerStrength;
|
||||
Function<void, Int, Int, Int> setPlayerTalent;
|
||||
Function<void, Int, Int> setPlayerVirtualWorld;
|
||||
Function<void, Int, String, Int, String, Int> setPlayerVisual;
|
||||
Function<void, Int, Int> setPlayerWeaponMode;
|
||||
Function<void, Int, String, String> setPlayerWorld;
|
||||
Function<void, Int> spawnPlayer;
|
||||
Function<void, Int, String> stopAni;
|
||||
Function<void, Int, String> stopFaceAni;
|
||||
Function<void, Int, String> unequipItem;
|
||||
Function<void, Int> unreadySpell;
|
||||
Function<void, Int> unspawnPlayer;
|
||||
Function<void, Int, String> useItem;
|
||||
Function<void, Int, String, Int> useItemToState;
|
||||
|
||||
Function<SqList, SQObject, Int, String, Int> findNearbyPlayers;
|
||||
Function<SqList, Int> getSpawnedPlayersForPlayer;
|
||||
Function<SqList, Int> getStreamedPlayersByPlayer;
|
||||
|
||||
Function<SqDict, String, Int, Int, Int> getNearestWaypoint;
|
||||
Function<SqDict, String, String> getWaypoint;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user