diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8de589a..ee7b8c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,11 +48,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Download Plugin + - name: Download Mod uses: actions/download-artifact@v3 with: name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} - path: release/Plugin/ + path: release/Mod/ - name: Download PDB uses: actions/download-artifact@v3 @@ -62,11 +62,11 @@ jobs: - name: Copy additional files run: | - cp LICENSE README.md release/Plugin/ + cp LICENSE README.md release/Mod/ - name: Archive release run: | - cd release/Plugin + cd release/Mod zip -r ../${{ github.event.repository.name }}-windows-x64.zip * cd .. diff --git a/manifest.json b/manifest.json index 684413c..86f4f95 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { - "name": "${pluginName}", - "entry": "${pluginFile}", - "version": "0.13.0", + "name": "${modName}", + "entry": "${modFile}", + "version": "0.13.1", "author": "GroupMountain", "description": "Check Player's Inventory", "type": "native", diff --git a/scripts/after_build.lua b/scripts/after_build.lua index cb06906..c1eb917 100644 --- a/scripts/after_build.lua +++ b/scripts/after_build.lua @@ -82,7 +82,7 @@ function string_formatter(str, variables) end) end -function pack_plugin(target,plugin_define) +function pack_mod(target,mod_define) import("lib.detect.find_file") local manifest_path = find_file("manifest.json", os.projectdir()) @@ -90,9 +90,9 @@ function pack_plugin(target,plugin_define) local manifest = io.readfile(manifest_path) local bindir = path.join(os.projectdir(), "bin/DLL") local pdbdir = path.join(os.projectdir(), "bin/PDB") - local outputdir = path.join(bindir, plugin_define.pluginName) - local targetfile = path.join(outputdir, plugin_define.pluginFile) - local pdbfile = path.join(pdbdir, path.basename(plugin_define.pluginFile) .. ".pdb") + local outputdir = path.join(bindir, mod_define.modName) + local targetfile = path.join(outputdir, mod_define.modFile) + local pdbfile = path.join(pdbdir, path.basename(mod_define.modFile) .. ".pdb") local manifestfile = path.join(outputdir, "manifest.json") local oritargetfile = target:targetfile() local oripdbfile = path.join(path.directory(oritargetfile), path.basename(oritargetfile) .. ".pdb") @@ -103,9 +103,9 @@ function pack_plugin(target,plugin_define) os.cp(oripdbfile, pdbfile) end - formattedmanifest = string_formatter(manifest, plugin_define) + formattedmanifest = string_formatter(manifest, mod_define) io.writefile(manifestfile,formattedmanifest) - cprint("${bright green}[Plugin Packer]: ${reset}plugin already generated to " .. outputdir) + cprint("${bright green}[Mod Packer]: ${reset}mod already generated to " .. outputdir) else cprint("${bright yellow}warn: ${reset}not found manifest.json in root dir!") end @@ -113,7 +113,7 @@ end return { - pack_plugin = pack_plugin, + pack_mod = pack_mod, beautify_json = beautify_json, string_formatter = string_formatter } diff --git a/src/Entry.cpp b/src/Entry.cpp index 423ecb9..0f66cfc 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -2,7 +2,7 @@ #include "Global.h" #include "Language.h" -ll::Logger logger(PLUGIN_NAME); +ll::Logger logger(MOD_NAME); namespace InventoryCheck { @@ -26,7 +26,6 @@ bool Entry::load() { tr("error.protocolMismatch.version", {std::to_string(TARGET_PROTOCOL), std::to_string(GMLIB::Version::getProtocolVersion())}) ); - return false; } return true; } @@ -40,7 +39,7 @@ bool Entry::enable() { } bool Entry::disable() { - // Code for disabling the plugin goes here. + // Code for disabling the mod goes here. return true; } @@ -55,7 +54,7 @@ LangI18n& Entry::getI18n() { return mI18n.value(); } } // namespace InventoryCheck -LL_REGISTER_PLUGIN(InventoryCheck::Entry, InventoryCheck::Entry::getInstance()); +LL_REGISTER_MOD(InventoryCheck::Entry, InventoryCheck::Entry::getInstance()); std::string tr(std::string const& key, std::vector const& data) { return InventoryCheck::Entry::getInstance()->getI18n().get(key, data); diff --git a/src/Entry.h b/src/Entry.h index cc54ba7..f052298 100644 --- a/src/Entry.h +++ b/src/Entry.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "Config.h" #include "Global.h" @@ -11,20 +13,20 @@ class Entry { public: static std::unique_ptr& getInstance(); - Entry(ll::plugin::NativePlugin& self) : mSelf(self) {} + Entry(ll::mod::NativeMod& self) : mSelf(self) {} - [[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; } + [[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; } - /// @return True if the plugin is loaded successfully. + /// @return True if the mod is loaded successfully. bool load(); - /// @return True if the plugin is enabled successfully. + /// @return True if the mod is enabled successfully. bool enable(); - /// @return True if the plugin is disabled successfully. + /// @return True if the mod is disabled successfully. bool disable(); - /// @return True if the plugin is unloaded successfully. + /// @return True if the mod is unloaded successfully. bool unload(); Config& getConfig(); @@ -32,7 +34,7 @@ public: LangI18n& getI18n(); private: - ll::plugin::NativePlugin& mSelf; + ll::mod::NativeMod& mSelf; std::optional mConfig; std::optional mI18n; }; diff --git a/src/Global.h b/src/Global.h index 7821251..1c6efdc 100644 --- a/src/Global.h +++ b/src/Global.h @@ -1,8 +1,11 @@ #pragma once + +#include + #include -#define PLUGIN_NAME "InventoryCheck" -#define TARGET_PROTOCOL 685 +#define MOD_NAME "InventoryCheck" +#define TARGET_PROTOCOL 686 extern ll::Logger logger; diff --git a/src/MemoryOperators.cpp b/src/MemoryOperators.cpp index 7c657f7..102088f 100644 --- a/src/MemoryOperators.cpp +++ b/src/MemoryOperators.cpp @@ -1,5 +1,5 @@ -// This file will make your plugin use LeviLamina's memory operators by default. -// This improves the memory management of your plugin and is recommended to use. +// This file will make your mod use LeviLamina's memory operators by default. +// This improves the memory management of your mod and is recommended to use. #define LL_MEMORY_OPERATORS diff --git a/tooth.json b/tooth.json index a15eb3e..d1b0e3c 100644 --- a/tooth.json +++ b/tooth.json @@ -1,7 +1,7 @@ { "format_version": 2, "tooth": "github.com/GroupMountain/InventoryCheck", - "version": "0.13.0", + "version": "0.13.1", "info": { "name": "InventoryCheck", "description": "Check Player's Inventory", @@ -14,9 +14,9 @@ "gmlib" ] }, - "asset_url": "https://github.com/GroupMountain/InventoryCheck/releases/download/v0.13.0/InventoryCheck-windows-x64.zip", + "asset_url": "https://github.com/GroupMountain/InventoryCheck/releases/download/v0.13.1/InventoryCheck-windows-x64.zip", "dependencies": { - "github.com/GroupMountain/GMLIB": ">=0.13.0" + "github.com/GroupMountain/GMLIB": ">=0.13.7" }, "files": { "place": [ diff --git a/xmake.lua b/xmake.lua index e0764e2..93f32a4 100644 --- a/xmake.lua +++ b/xmake.lua @@ -42,7 +42,7 @@ add_requires("gmlib") -- import("package.tools.xmake").install(package) -- end) -target("InventoryCheck") -- Change this to your plugin name. +target("InventoryCheck") -- Change this to your mod name. add_cxflags( "/EHa", "/utf-8" @@ -70,12 +70,12 @@ target("InventoryCheck") -- Change this to your plugin name. set_symbols("debug") after_build(function (target) - local plugin_packer = import("scripts.after_build") + local mod_packer = import("scripts.after_build") - local plugin_define = { - pluginName = target:name(), - pluginFile = path.filename(target:targetfile()), + local mod_define = { + modName = target:name(), + modFile = path.filename(target:targetfile()), } - plugin_packer.pack_plugin(target,plugin_define) + mod_packer.pack_mod(target,mod_define) end)