refactor: Refactorized whole project structure
This commit is contained in:
19
source/classes/python/Daedalus.h
Normal file
19
source/classes/python/Daedalus.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _PYDAEDALUS_H_
|
||||
#define _PYDAEDALUS_H_
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include "squirrel/Daedalus.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
class PyDaedalus
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static nonut::Int index(nonut::String value) { return nonut::Daedalus::get()->index(value); }
|
||||
static py::dict symbol(nonut::String value) { return nonut::Daedalus::get()->symbol(value).data; }
|
||||
static py::dict instance(nonut::String value) { return nonut::Daedalus::get()->instance(value).data; }
|
||||
};
|
||||
|
||||
#endif
|
||||
32
source/classes/python/DamageDescription.h
Normal file
32
source/classes/python/DamageDescription.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _PYDAMAGEDESCRIPTION_H
|
||||
#define _PYDAMAGEDESCRIPTION_H
|
||||
|
||||
#include "squirrel/DamageDescription.h"
|
||||
|
||||
class PyDamageDescription
|
||||
{
|
||||
private:
|
||||
nonut::DamageDescription *sqobj;
|
||||
|
||||
public:
|
||||
PyDamageDescription(SQObject obj) { if (obj._type == OT_NULL) throw py::type_error("Presented Squirrel Object doesn't exist (type: null)"); sqobj = new nonut::DamageDescription(obj); }
|
||||
|
||||
nonut::Int getFlags() { return sqobj->flags; }
|
||||
nonut::Int getDamage() { return sqobj->damage; }
|
||||
nonut::String getItemInstance() { return sqobj->item_instance; }
|
||||
nonut::Int getDistance() { return sqobj->distance; }
|
||||
nonut::Int getSpellId() { return sqobj->spell_id; }
|
||||
nonut::Int getSpellLevel() { return sqobj->spell_level; }
|
||||
nonut::String getNode() { return sqobj->node; }
|
||||
|
||||
void setFlags(nonut::Int value) { sqobj->flags = value; }
|
||||
void setDamage(nonut::Int value) { sqobj->damage = value; }
|
||||
void setDistance(nonut::Int value) { sqobj->distance = value; }
|
||||
void setSpellId(nonut::Int value) { sqobj->spell_id = value; }
|
||||
void setSpellLevel(nonut::Int value) { sqobj->spell_level = value; }
|
||||
void setNode(nonut::String value) { sqobj->node = value; }
|
||||
|
||||
void del() { delete sqobj; }
|
||||
};
|
||||
|
||||
#endif
|
||||
32
source/classes/python/ItemGround.h
Normal file
32
source/classes/python/ItemGround.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _PY_ITEMGROUND_H_
|
||||
#define _PY_ITEMGROUND_H_
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include "squirrel/ItemGround.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
class PyItemGround
|
||||
{
|
||||
private:
|
||||
nonut::ItemGround *sqobj;
|
||||
|
||||
public:
|
||||
PyItemGround(SQObject obj) { if (obj._type == OT_NULL) throw py::type_error("Presented Squirrel Object doesn't exist (type: null)"); sqobj = new nonut::ItemGround(obj); }
|
||||
PyItemGround(nonut::ItemGround obj) { if (obj.isNull()) throw py::type_error("Presented ItemGround doesn't exist (type: null)"); sqobj = &obj; }
|
||||
|
||||
py::tuple getPosition() { return py::make_tuple(sqobj->getPosition().toTuple()); }
|
||||
py::tuple getRotation() { return py::make_tuple(sqobj->getRotation().toTuple()); }
|
||||
|
||||
nonut::Int getId() { return sqobj->id; }
|
||||
nonut::String getInstance() { return sqobj->instance; }
|
||||
nonut::Int getAmount() { return sqobj->amount; }
|
||||
nonut::String getWorld() { return sqobj->world; }
|
||||
nonut::Int getVirtualWorld() { return sqobj->virtualWorld; }
|
||||
|
||||
void setVirtualWorld(nonut::Int value) { sqobj->virtualWorld = value; }
|
||||
|
||||
void del() { delete sqobj; }
|
||||
};
|
||||
|
||||
#endif
|
||||
24
source/classes/python/ItemsGround.h
Normal file
24
source/classes/python/ItemsGround.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _PYITEMSGROUND_H_
|
||||
#define _PYITEMSGROUND_H_
|
||||
|
||||
#include "squirrel/ItemsGround.h"
|
||||
#include "squirrel/ItemGround.h"
|
||||
#include "Dictionary.h"
|
||||
|
||||
class PyItemsGround
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static PyItemGround getById(nonut::Int value) { return PyItemGround(nonut::ItemsGround::get()->getById(value)); }
|
||||
static nonut::Int create(py::dict value)
|
||||
{
|
||||
Sqrat::Table* pTable = PyDictionary::toSqObject(value);
|
||||
nonut::Int result = nonut::ItemsGround::get()->create(pTable->GetObject());
|
||||
delete pTable;
|
||||
return result;
|
||||
}
|
||||
static void destroy(nonut::Int value) { nonut::ItemsGround::get()->destroy(value); }
|
||||
};
|
||||
|
||||
#endif
|
||||
17
source/classes/python/Mds.h
Normal file
17
source/classes/python/Mds.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _PYMDS_H
|
||||
#define _PYMDS_H
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include "squirrel/Mds.h"
|
||||
namespace py = pybind11;
|
||||
|
||||
class PyMds
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static int id(std::string mdsName) { return nonut::Mds::get()->id(mdsName); }
|
||||
static std::string name(int mdsId) { return nonut::Mds::get()->name(mdsId); }
|
||||
};
|
||||
|
||||
#endif
|
||||
47
source/classes/python/Packet.h
Normal file
47
source/classes/python/Packet.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef _PYPACKET_H_
|
||||
#define _PYPACKET_H_
|
||||
|
||||
#include "squirrel/Packet.h"
|
||||
|
||||
class PyPacket
|
||||
{
|
||||
private:
|
||||
nonut::Packet *sqpacket;
|
||||
|
||||
public:
|
||||
PyPacket() { sqpacket = new nonut::Packet(); };
|
||||
PyPacket(SQObject obj) { if (obj._type == OT_NULL) throw py::type_error("Presented Squirrel Object doesn't exist (type: null)"); sqpacket = new nonut::Packet(obj); }
|
||||
|
||||
void reset() { sqpacket->reset(); }
|
||||
void send(nonut::Int id, nonut::Int value) { sqpacket->send(id, value); }
|
||||
void sendToAll(nonut::Int value) { sqpacket->sendToAll(value); };
|
||||
|
||||
void writeInt8(nonut::Int value) { sqpacket->writeInt8(value); }
|
||||
void writeUInt8(nonut::Int value) { sqpacket->writeUInt8(value); }
|
||||
void writeInt16(nonut::Int value) { sqpacket->writeInt16(value); }
|
||||
void writeUInt16(nonut::Int value) { sqpacket->writeUInt16(value); }
|
||||
void writeInt32(nonut::Int value) { sqpacket->writeInt32(value); }
|
||||
void writeUInt32(nonut::Int value) { sqpacket->writeUInt32(value); }
|
||||
|
||||
void writeBool(nonut::Bool value) { sqpacket->writeBool(value); }
|
||||
void writeFloat(nonut::Float value) { sqpacket->writeFloat(value); }
|
||||
void writeString(nonut::String value) { sqpacket->writeString(value); }
|
||||
|
||||
nonut::Int readInt8() { return sqpacket->readInt8(); }
|
||||
nonut::Int readUInt8() { return sqpacket->readUInt8(); }
|
||||
nonut::Int readInt16() { return sqpacket->readInt16(); }
|
||||
nonut::Int readUInt16() { return sqpacket->readUInt16(); }
|
||||
nonut::Int readInt32() { return sqpacket->readInt32(); }
|
||||
nonut::Int readUInt32() { return sqpacket->readUInt32(); }
|
||||
|
||||
nonut::Bool readBool() { return sqpacket->readBool(); }
|
||||
nonut::Float readFloat() { return sqpacket->readFloat(); }
|
||||
nonut::String readString() { return sqpacket->readString(); }
|
||||
|
||||
nonut::Int getBitsUsed() { return sqpacket->bitsUsed; }
|
||||
nonut::Int getBytesUsed() { return sqpacket->bytesUsed; }
|
||||
|
||||
void del() { delete sqpacket; }
|
||||
};
|
||||
|
||||
#endif
|
||||
31
source/classes/python/Sky.h
Normal file
31
source/classes/python/Sky.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _PYSKY_H_
|
||||
#define _PYSKY_H_
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include "squirrel/Sky.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
class PySky
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static void setWeather(nonut::Int value) { nonut::Sky::get()->weather = value; }
|
||||
static nonut::Int getWeather() { return nonut::Sky::get()->weather; }
|
||||
static void setRaining(nonut::Bool value) { nonut::Sky::get()->raining = value; }
|
||||
static nonut::Bool getRaining() { return nonut::Sky::get()->raining; }
|
||||
static void setRenderLightning(nonut::Bool value) { nonut::Sky::get()->renderLightning = value; }
|
||||
static nonut::Bool getRenderLightning() { return nonut::Sky::get()->renderLightning; }
|
||||
static void setWindScale(nonut::Float value) { nonut::Sky::get()->windScale = value; }
|
||||
static nonut::Float getWindScale() { return nonut::Sky::get()->windScale; }
|
||||
static void setDontRain(nonut::Bool value) { nonut::Sky::get()->dontRain = value; }
|
||||
static nonut::Bool getDontRain() { return nonut::Sky::get()->dontRain; }
|
||||
|
||||
static void setRainStartTime(nonut::Int h, nonut::Int m) { nonut::Sky::get()->setRainStartTime(h, m); }
|
||||
static void setRainStopTime(nonut::Int h, nonut::Int m) { nonut::Sky::get()->setRainStopTime(h, m); }
|
||||
static py::dict getRainStartTime() { return nonut::Sky::get()->getRainStartTime().data; }
|
||||
static py::dict getRainStopTime() { return nonut::Sky::get()->getRainStopTime().data; }
|
||||
};
|
||||
|
||||
#endif
|
||||
24
source/classes/python/Way.h
Normal file
24
source/classes/python/Way.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _PYWAY_H_
|
||||
#define _PYWAY_H_
|
||||
|
||||
#include "squirrel/Way.h"
|
||||
|
||||
class PyWay
|
||||
{
|
||||
private:
|
||||
nonut::Way *sqway;
|
||||
|
||||
public:
|
||||
PyWay(std::string world, std::string start, std::string end) { sqway = new nonut::Way(world, start, end); };
|
||||
PyWay(SQObject obj) { if (obj._type == OT_NULL) throw py::type_error("Presented Squirrel Object doesn't exist (type: null)"); sqway = new nonut::Way(obj); }
|
||||
|
||||
py::list getWaypoints() { return sqway->getWaypoints().data; }
|
||||
int getCountWaypoints() { return sqway->getCountWaypoints(); }
|
||||
|
||||
std::string getStart() { return sqway->start; }
|
||||
std::string getEnd() { return sqway->end; }
|
||||
|
||||
void del() { delete sqway; }
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user