mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: support SavedVariablesPerCharacter for per-character addon data
Implement the SavedVariablesPerCharacter TOC directive that many addons use to store different settings per character (Bartender, Dominos, MoveAnything, WeakAuras, etc.). Without this, all characters share the same addon data file. Per-character files are stored as <AddonName>.<CharacterName>.lua.saved alongside the existing account-wide <AddonName>.lua.saved files. The character name is resolved from the player GUID at world entry time. Changes: - TocFile::getSavedVariablesPerCharacter() parses the TOC directive - AddonManager loads/saves per-character vars alongside account-wide vars - Character name set from game handler before addon loading
This commit is contained in:
parent
0d2fd02dca
commit
e21f808714
5 changed files with 51 additions and 6 deletions
|
|
@ -26,6 +26,7 @@ public:
|
|||
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();
|
||||
|
|
@ -38,6 +39,8 @@ private:
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ struct TocFile {
|
|||
std::string getInterface() const;
|
||||
bool isLoadOnDemand() const;
|
||||
std::vector<std::string> getSavedVariables() const;
|
||||
std::vector<std::string> getSavedVariablesPerCharacter() const;
|
||||
};
|
||||
|
||||
std::optional<TocFile> parseTocFile(const std::string& tocPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue