feat: Added Mds class
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
## Events
|
|
||||||
|
|
||||||
* `addEventHandler` replaced with decorator [event](events/event.md)
|
* `addEventHandler` replaced with decorator [event](events/event.md)
|
||||||
```python
|
```python
|
||||||
@@ -72,3 +71,25 @@ def evtDrop(**kwargs):
|
|||||||
* `eventValue`
|
* `eventValue`
|
||||||
* `getPlayerMagicLevel`
|
* `getPlayerMagicLevel`
|
||||||
* `setPlayerMagicLevel`
|
* `setPlayerMagicLevel`
|
||||||
|
|
||||||
|
---
|
||||||
|
* All functions and events that returned/passed a `null` in the Squirrel, now passes an empty string. Most notable in this list are all equipment related functions and events
|
||||||
|
* `onPlayerEquipAmulet`
|
||||||
|
* `onPlayerEquipArmor`
|
||||||
|
* `onPlayerEquipBelt`
|
||||||
|
* `onPlayerEquipHandItem`
|
||||||
|
* `onPlayerEquipHelmet`
|
||||||
|
* `onPlayerEquipMeleeWeapon`
|
||||||
|
* `onPlayerEquipRangedWeapon`
|
||||||
|
* `onPlayerEquipRing`
|
||||||
|
* `onPlayerEquipShield`
|
||||||
|
* `onPlayerEquipSpell`
|
||||||
|
* `getPlayerAmulet`
|
||||||
|
* `getPlayerArmor`
|
||||||
|
* `getPlayerBelt`
|
||||||
|
* `getPlayerHelmet`
|
||||||
|
* `getPlayerMeleeWeapon`
|
||||||
|
* `getPlayerRangedWeapon`
|
||||||
|
* `getPlayerRing`
|
||||||
|
* `getPlayerShield`
|
||||||
|
* `getPlayerSpell`
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
### Requirements
|
|
||||||
|
|
||||||
* **CMake** 21.0+
|
|
||||||
* **Python** 3.12+
|
|
||||||
|
|
||||||
After cloning this repository, you should init all the submodules and build CPython. You can do it via command line:
|
|
||||||
```console
|
|
||||||
cd {PROJECT FOLDER}/dependencies/cpython/PCBuild/
|
|
||||||
build.bat -c Debug
|
|
||||||
```
|
|
||||||
Now, you're able to build the module with CMake. If you're using VSCode, then just open project folder and press hotkey **F7**. You should also pick the right preset (if you have x64 Python installed, then you can't build x32 module).
|
|
||||||
@@ -12,5 +12,6 @@ from g2o.classes.items import ItemGround
|
|||||||
from g2o.classes.items import ItemsGround
|
from g2o.classes.items import ItemsGround
|
||||||
from g2o.classes.daedalus import Daedalus
|
from g2o.classes.daedalus import Daedalus
|
||||||
from g2o.classes.sky import Sky
|
from g2o.classes.sky import Sky
|
||||||
|
from g2o.classes.mds import Mds
|
||||||
|
|
||||||
from sqg2oconst import *
|
from sqg2oconst import *
|
||||||
11
g2o/classes/mds.py
Normal file
11
g2o/classes/mds.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import sqg2o
|
||||||
|
|
||||||
|
class Mds:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def id(mdsName : str) -> int:
|
||||||
|
return sqg2o.Mds.id(mdsName)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def name(mdsId : id) -> str:
|
||||||
|
return sqg2o.Mds.name(mdsId)
|
||||||
@@ -102,7 +102,6 @@ nav:
|
|||||||
- removeEvent: events/removeEvent.md
|
- removeEvent: events/removeEvent.md
|
||||||
- removeEventHandler: events/removeEventHandler.md
|
- removeEventHandler: events/removeEventHandler.md
|
||||||
- toggleEvent: events/toggleEvent.md
|
- toggleEvent: events/toggleEvent.md
|
||||||
- How to build: howtobuild.md
|
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
name: material
|
name: material
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "classes/py/Daedalus.h"
|
#include "classes/py/Daedalus.h"
|
||||||
#include "classes/py/Sky.h"
|
#include "classes/py/Sky.h"
|
||||||
#include "classes/py/ItemsGround.h"
|
#include "classes/py/ItemsGround.h"
|
||||||
|
#include "classes/py/Mds.h"
|
||||||
|
|
||||||
#include "functions/pyfunctions.h"
|
#include "functions/pyfunctions.h"
|
||||||
|
|
||||||
@@ -100,6 +101,13 @@ PYBIND11_EMBEDDED_MODULE(sqg2o, m) {
|
|||||||
.def_static("create", [](py::dict value){ return PyItemsGround::create(value); })
|
.def_static("create", [](py::dict value){ return PyItemsGround::create(value); })
|
||||||
.def_static("destroy", [](int value){ return PyItemsGround::destroy(value); });
|
.def_static("destroy", [](int value){ return PyItemsGround::destroy(value); });
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
py::class_<PyMds>(m, "Mds")
|
||||||
|
|
||||||
|
.def_static("id", [](std::string value){ return PyMds::id(value); })
|
||||||
|
.def_static("name", [](int value){ return PyMds::name(value); });
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
m.def("getHostname", &py_getHostname);
|
m.def("getHostname", &py_getHostname);
|
||||||
|
|||||||
17
src/classes/py/Mds.h
Normal file
17
src/classes/py/Mds.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef _PYMDS_H
|
||||||
|
#define _PYMDS_H
|
||||||
|
|
||||||
|
#include <classes/sq/Mds.h>
|
||||||
|
#include <pybind11/embed.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
|
||||||
22
src/classes/sq/Mds.cpp
Normal file
22
src/classes/sq/Mds.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include <NoNut/core/CommonHeader.h>
|
||||||
|
#include "Mds.h"
|
||||||
|
|
||||||
|
namespace nonut
|
||||||
|
{
|
||||||
|
Mds* Mds::get()
|
||||||
|
{
|
||||||
|
if (inst == nullptr)
|
||||||
|
{
|
||||||
|
inst = new Mds();
|
||||||
|
}
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mds::Mds() :
|
||||||
|
StaticClass("Mds"),
|
||||||
|
|
||||||
|
METHOD_CTOR(id),
|
||||||
|
METHOD_CTOR(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/classes/sq/Mds.h
Normal file
26
src/classes/sq/Mds.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef _MDS_H
|
||||||
|
#define _MDS_H
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <NoNut/core/StaticClass.h>
|
||||||
|
#include <NoNut/core/CustomTypes.h>
|
||||||
|
|
||||||
|
namespace nonut
|
||||||
|
{
|
||||||
|
class Mds : public StaticClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static Mds* get();
|
||||||
|
|
||||||
|
Function<Int, String> id;
|
||||||
|
Function<String, Int> name;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static inline Mds* inst = nullptr;
|
||||||
|
|
||||||
|
Mds();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user