diff --git a/docs/comparing.md b/docs/comparing.md index 9b0241a..8e10403 100644 --- a/docs/comparing.md +++ b/docs/comparing.md @@ -1,4 +1,3 @@ -## Events * `addEventHandler` replaced with decorator [event](events/event.md) ```python @@ -71,4 +70,26 @@ def evtDrop(**kwargs): * `getTickCount` * `eventValue` * `getPlayerMagicLevel` - * `setPlayerMagicLevel` \ No newline at end of file + * `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` \ No newline at end of file diff --git a/docs/howtobuild.md b/docs/howtobuild.md deleted file mode 100644 index 52de57f..0000000 --- a/docs/howtobuild.md +++ /dev/null @@ -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). \ No newline at end of file diff --git a/g2o/__init__.py b/g2o/__init__.py index 4d1a4ac..047e979 100644 --- a/g2o/__init__.py +++ b/g2o/__init__.py @@ -12,5 +12,6 @@ from g2o.classes.items import ItemGround from g2o.classes.items import ItemsGround from g2o.classes.daedalus import Daedalus from g2o.classes.sky import Sky +from g2o.classes.mds import Mds -from sqg2oconst import * \ No newline at end of file +from sqg2oconst import * \ No newline at end of file diff --git a/g2o/classes/mds.py b/g2o/classes/mds.py new file mode 100644 index 0000000..68a8a3d --- /dev/null +++ b/g2o/classes/mds.py @@ -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) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index fca5024..1f8462f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -102,7 +102,6 @@ nav: - removeEvent: events/removeEvent.md - removeEventHandler: events/removeEventHandler.md - toggleEvent: events/toggleEvent.md - - How to build: howtobuild.md theme: name: material diff --git a/src/bind.cpp b/src/bind.cpp index 7fde6a3..4500890 100644 --- a/src/bind.cpp +++ b/src/bind.cpp @@ -6,6 +6,7 @@ #include "classes/py/Daedalus.h" #include "classes/py/Sky.h" #include "classes/py/ItemsGround.h" +#include "classes/py/Mds.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("destroy", [](int value){ return PyItemsGround::destroy(value); }); +// ------------------------------------------------------------------------- + + py::class_(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); diff --git a/src/classes/py/Mds.h b/src/classes/py/Mds.h new file mode 100644 index 0000000..88060c5 --- /dev/null +++ b/src/classes/py/Mds.h @@ -0,0 +1,17 @@ +#ifndef _PYMDS_H +#define _PYMDS_H + +#include +#include +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 \ No newline at end of file diff --git a/src/classes/sq/Mds.cpp b/src/classes/sq/Mds.cpp new file mode 100644 index 0000000..c2fd464 --- /dev/null +++ b/src/classes/sq/Mds.cpp @@ -0,0 +1,22 @@ +#include +#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) + { + } +} diff --git a/src/classes/sq/Mds.h b/src/classes/sq/Mds.h new file mode 100644 index 0000000..c0a8e15 --- /dev/null +++ b/src/classes/sq/Mds.h @@ -0,0 +1,26 @@ +#ifndef _MDS_H +#define _MDS_H +#include + +#include +#include + +namespace nonut +{ + class Mds : public StaticClass + { + public: + static Mds* get(); + + Function id; + Function name; + + private: + + static inline Mds* inst = nullptr; + + Mds(); + }; +} +#endif +