2026-03-20 11:12:07 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "addons/lua_engine.hpp"
|
|
|
|
|
#include "addons/toc_parser.hpp"
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace wowee::addons {
|
|
|
|
|
|
|
|
|
|
class AddonManager {
|
|
|
|
|
public:
|
|
|
|
|
AddonManager();
|
|
|
|
|
~AddonManager();
|
|
|
|
|
|
`chore(lua): refactor addon Lua engine API + progress docs`
- Refactor Lua addon integration:
- Update CMakeLists.txt for addon build paths
- Enhance addons API headers and Lua engine interface
- Add new Lua API addon modules (`lua_api_helpers`, `lua_api_registrations`, `lua_services`, `lua_action_api`, `lua_inventory_api`, `lua_quest_api`, `lua_social_api`, `lua_spell_api`, `lua_system_api`, `lua_unit_api`)
- Update implementation in addon_manager.cpp, lua_engine.cpp, application.cpp, game_handler.cpp
2026-04-03 07:31:06 +03:00
|
|
|
bool initialize(game::GameHandler* gameHandler, const LuaServices& services = {});
|
2026-03-20 11:12:07 -07:00
|
|
|
void scanAddons(const std::string& addonsPath);
|
|
|
|
|
void loadAllAddons();
|
|
|
|
|
bool runScript(const std::string& code);
|
2026-03-20 11:23:38 -07:00
|
|
|
void fireEvent(const std::string& event, const std::vector<std::string>& args = {});
|
2026-03-20 12:07:22 -07:00
|
|
|
void update(float deltaTime);
|
2026-03-20 11:12:07 -07:00
|
|
|
void shutdown();
|
|
|
|
|
|
|
|
|
|
const std::vector<TocFile>& getAddons() const { return addons_; }
|
|
|
|
|
LuaEngine* getLuaEngine() { return &luaEngine_; }
|
|
|
|
|
bool isInitialized() const { return luaEngine_.isInitialized(); }
|
|
|
|
|
|
2026-03-20 12:22:50 -07:00
|
|
|
void saveAllSavedVariables();
|
2026-03-21 02:46:21 -07:00
|
|
|
void setCharacterName(const std::string& name) { characterName_ = name; }
|
2026-03-20 12:22:50 -07:00
|
|
|
|
2026-03-20 16:17:04 -07:00
|
|
|
/// Re-initialize the Lua VM and reload all addons (used by /reload).
|
|
|
|
|
bool reload();
|
|
|
|
|
|
2026-03-20 11:12:07 -07:00
|
|
|
private:
|
|
|
|
|
LuaEngine luaEngine_;
|
|
|
|
|
std::vector<TocFile> addons_;
|
2026-03-20 16:17:04 -07:00
|
|
|
game::GameHandler* gameHandler_ = nullptr;
|
`chore(lua): refactor addon Lua engine API + progress docs`
- Refactor Lua addon integration:
- Update CMakeLists.txt for addon build paths
- Enhance addons API headers and Lua engine interface
- Add new Lua API addon modules (`lua_api_helpers`, `lua_api_registrations`, `lua_services`, `lua_action_api`, `lua_inventory_api`, `lua_quest_api`, `lua_social_api`, `lua_spell_api`, `lua_system_api`, `lua_unit_api`)
- Update implementation in addon_manager.cpp, lua_engine.cpp, application.cpp, game_handler.cpp
2026-04-03 07:31:06 +03:00
|
|
|
LuaServices luaServices_;
|
2026-03-20 16:17:04 -07:00
|
|
|
std::string addonsPath_;
|
2026-03-20 11:12:07 -07:00
|
|
|
|
|
|
|
|
bool loadAddon(const TocFile& addon);
|
2026-03-20 12:22:50 -07:00
|
|
|
std::string getSavedVariablesPath(const TocFile& addon) const;
|
2026-03-21 02:46:21 -07:00
|
|
|
std::string getSavedVariablesPerCharacterPath(const TocFile& addon) const;
|
|
|
|
|
std::string characterName_;
|
2026-03-20 11:12:07 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace wowee::addons
|