Kelsidavis-WoWee/include/addons/addon_manager.hpp
Paul a916270a13 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

47 lines
1.4 KiB
C++

#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();
bool initialize(game::GameHandler* gameHandler, const LuaServices& services = {});
void scanAddons(const std::string& addonsPath);
void loadAllAddons();
bool runScript(const std::string& code);
void fireEvent(const std::string& event, const std::vector<std::string>& args = {});
void update(float deltaTime);
void shutdown();
const std::vector<TocFile>& getAddons() const { return addons_; }
LuaEngine* getLuaEngine() { return &luaEngine_; }
bool isInitialized() const { return luaEngine_.isInitialized(); }
void saveAllSavedVariables();
void setCharacterName(const std::string& name) { characterName_ = name; }
/// Re-initialize the Lua VM and reload all addons (used by /reload).
bool reload();
private:
LuaEngine luaEngine_;
std::vector<TocFile> addons_;
game::GameHandler* gameHandler_ = nullptr;
LuaServices luaServices_;
std::string addonsPath_;
bool loadAddon(const TocFile& addon);
std::string getSavedVariablesPath(const TocFile& addon) const;
std::string getSavedVariablesPerCharacterPath(const TocFile& addon) const;
std::string characterName_;
};
} // namespace wowee::addons