31 std::string pathStr{path};
34 const auto& cd = model->
cd;
35 ini.setValue(
"Display/ShowUnderwear", cd.showUnderwear);
36 ini.setValue(
"Display/ShowHair", cd.showHair);
37 ini.setValue(
"Display/ShowFacialHair", cd.showFacialHair);
38 ini.setValue(
"Display/ShowEars", cd.showEars);
39 ini.setValue(
"Display/ShowFeet", cd.showFeet);
40 ini.setValue(
"Display/AutoHideGeosets", cd.autoHideGeosetsForHeadItems);
41 ini.setValue(
"Display/Sheathe", model->
bSheathe);
42 ini.setValue(
"Display/EyeGlow",
static_cast<int>(cd.eyeGlowType));
47 std::string key =
"Customization/" + std::to_string(optIdx);
48 ini.setValue(key +
"_OptionID",
static_cast<int>(opt.optionID));
49 if (opt.selectedIndex >= 0 && opt.selectedIndex <
static_cast<int>(opt.choiceIDs.size()))
50 ini.setValue(key +
"_ChoiceID",
static_cast<int>(opt.choiceIDs[opt.selectedIndex]));
53 ini.setValue(
"Customization/Count", optIdx);
58 std::string key =
"Equipment/" + std::to_string(s);
59 ini.setValue(key +
"_ID", witem ?
static_cast<int>(witem->
id()) : 0);
65 LOG_INFO <<
"Character preset saved to " << path;
77 if (!std::filesystem::exists(path))
83 std::string pathStr{path};
87 cd.
showUnderwear = ini.getBool(
"Display/ShowUnderwear",
true);
88 cd.showHair = ini.getBool(
"Display/ShowHair",
true);
89 cd.showFacialHair = ini.getBool(
"Display/ShowFacialHair",
true);
90 cd.showEars = ini.getBool(
"Display/ShowEars",
true);
91 cd.showFeet = ini.getBool(
"Display/ShowFeet",
false);
92 cd.autoHideGeosetsForHeadItems = ini.getBool(
"Display/AutoHideGeosets",
true);
93 model->
bSheathe = ini.getBool(
"Display/Sheathe",
false);
96 int optCount = ini.getInt(
"Customization/Count", 0);
97 for (
int i = 0; i < optCount; ++i)
99 std::string key =
"Customization/" + std::to_string(i);
100 unsigned int optionID =
static_cast<unsigned int>(ini.getInt(key +
"_OptionID", 0));
101 unsigned int choiceID =
static_cast<unsigned int>(ini.getInt(key +
"_ChoiceID", 0));
102 if (optionID == 0)
continue;
104 cd.set(optionID, choiceID);
108 if (opt.optionID == optionID)
110 for (
int c = 0; c < static_cast<int>(opt.choiceIDs.size()); ++c)
112 if (opt.choiceIDs[c] == choiceID)
114 opt.selectedIndex = c;
125 std::string key =
"Equipment/" + std::to_string(s);
126 int itemId = ini.getInt(key +
"_ID", 0);
127 int level = ini.getInt(key +
"_Level", 0);
132 witem->
setId(itemId);
133 if (level > 0) witem->
setLevel(level);
140 LOG_INFO <<
"Character preset loaded from " << path;
Represents an equipped item on a character model.
Core WoW .m2 model: geometry, animation, textures, and character data.
WoWItem * getItem(CharSlots slot)
Simple INI file reader/writer with section/key support.
WoWModel * getLoadedModel(AppState &app)
Return the currently loaded WoWModel (first child of root), or nullptr.
void load(const char *path, AppState &app)
Load a previously saved character preset from an INI file.
void save(const char *path, AppState &app)
Top-level aggregate of all mutable application state.
std::vector< CustomizationOption > customizationOptions
int equipSlotLevels[NUM_CHAR_SLOTS]
CharSlots
Character equipment slot indices.