Add basic entrypoint logging
This commit is contained in:
parent
3f7af718ba
commit
1e9822d554
3 changed files with 138 additions and 6 deletions
|
|
@ -29,15 +29,17 @@ namespace OutfitSystem {
|
|||
std::int32_t GetOutfitNameMaxLength(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "GetOutfitNameMaxLength");
|
||||
LOG(trace, "Enter GetOutfitNameMaxLength");
|
||||
LogExit exitPrint("GetOutfitNameMaxLength"sv);
|
||||
return ArmorAddonOverrideService::ce_outfitNameMaxLength;
|
||||
}
|
||||
std::vector<RE::TESObjectARMO*> GetCarriedArmor(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* target_skse) {
|
||||
RE::Actor* target) {
|
||||
LOG(trace, "Enter GetCarriedArmor {}", (void*) target);
|
||||
LogExit exitPrint("GetCarriedArmor"sv);
|
||||
std::vector<RE::TESObjectARMO*> result;
|
||||
auto target = (RE::Actor*) (target_skse);
|
||||
if (target == nullptr) {
|
||||
registry->TraceStack("Cannot retrieve data for a None RE::Actor.",
|
||||
stackId,
|
||||
|
|
@ -82,9 +84,10 @@ namespace OutfitSystem {
|
|||
RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* target_skse) {
|
||||
RE::Actor* target) {
|
||||
LOG(trace, "Enter GetWornItems {}", (void*) target);
|
||||
LogExit exitPrint("GetWornItems"sv);
|
||||
std::vector<RE::TESObjectARMO*> result;
|
||||
auto target = (RE::Actor*) (target_skse);
|
||||
if (target == nullptr) {
|
||||
registry->TraceStack("Cannot retrieve data for a None RE::Actor.", stackId, RE::BSScript::IVirtualMachine::Severity::kError);
|
||||
std::vector<RE::TESObjectARMO*> empty;
|
||||
|
|
@ -126,6 +129,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* target) {
|
||||
LOG(trace, "Enter RefreshArmorFor {}", (void*) target);
|
||||
LogExit exitPrint("RefreshArmorFor"sv);
|
||||
ERROR_AND_RETURN_IF(target == nullptr, "Cannot refresh armor on a None RE::Actor.", registry, stackId);
|
||||
auto pm = target->GetActorRuntimeData().currentProcess;
|
||||
if (pm) {
|
||||
|
|
@ -144,6 +149,8 @@ namespace OutfitSystem {
|
|||
void RefreshArmorForAllConfiguredActors(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter RefreshArmorForAllConfiguredActors");
|
||||
LogExit exitPrint("RefreshArmorForAllConfiguredActors"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
auto actors = service.listActors();
|
||||
for (auto& actorRef : actors) {
|
||||
|
|
@ -169,6 +176,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::Actor*> ActorsNearPC(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter RefreshArmorForAllConfiguredActors");
|
||||
LogExit exitPrint("RefreshArmorForAllConfiguredActors"sv);
|
||||
std::vector<RE::Actor*> result;
|
||||
auto pc = RE::PlayerCharacter::GetSingleton();
|
||||
ERROR_AND_RETURN_EXPR_IF(pc == nullptr, "Could not get PC Singleton.", result, registry, stackId);
|
||||
|
|
@ -192,6 +201,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::TESObjectARMO*> armors;
|
||||
//
|
||||
void setup(std::string nameFilter, bool mustBePlayable) {
|
||||
LOG(trace, "Enter ArmorFormSearchUtils.setup");
|
||||
LogExit exitPrint("ArmorFormSearchUtils.setup"sv);
|
||||
auto data = RE::TESDataHandler::GetSingleton();
|
||||
auto& list = data->GetFormArray(RE::FormType::Armor);
|
||||
const auto size = list.size();
|
||||
|
|
@ -239,11 +250,15 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString filter,
|
||||
bool mustBePlayable) {
|
||||
LOG(trace, "Enter ArmorFormSearchUtils.Prep");
|
||||
LogExit exitPrint("ArmorFormSearchUtils.Prep"sv);
|
||||
data.setup(filter.data(), mustBePlayable);
|
||||
}
|
||||
std::vector<RE::TESObjectARMO*> GetForms(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ArmorFormSearchUtils.GetForms");
|
||||
LogExit exitPrint("ArmorFormSearchUtils.GetForms"sv);
|
||||
std::vector<RE::TESObjectARMO*> result;
|
||||
auto& list = data.armors;
|
||||
for (auto it = list.begin(); it != list.end(); it++)
|
||||
|
|
@ -258,6 +273,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::BSFixedString> GetNames(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ArmorFormSearchUtils.GetNames");
|
||||
LogExit exitPrint("ArmorFormSearchUtils.GetNames"sv);
|
||||
std::vector<RE::BSFixedString> result;
|
||||
auto& list = data.names;
|
||||
for (auto it = list.begin(); it != list.end(); it++)
|
||||
|
|
@ -265,6 +282,8 @@ namespace OutfitSystem {
|
|||
return result;
|
||||
}
|
||||
void Clear(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ArmorFormSearchUtils.Clear");
|
||||
LogExit exitPrint("ArmorFormSearchUtils.Clear"sv);
|
||||
data.clear();
|
||||
}
|
||||
}// namespace ArmorFormSearchUtils
|
||||
|
|
@ -280,6 +299,8 @@ namespace OutfitSystem {
|
|||
} data;
|
||||
//
|
||||
void Clear(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter BodySlotListing.Clear");
|
||||
LogExit exitPrint("BodySlotListing.Clear"sv);
|
||||
data.bodySlots.clear();
|
||||
data.armorNames.clear();
|
||||
data.armors.clear();
|
||||
|
|
@ -288,6 +309,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter BodySlotListing.Prep");
|
||||
LogExit exitPrint("BodySlotListing.Prep"sv);
|
||||
data.bodySlots.clear();
|
||||
data.armorNames.clear();
|
||||
data.armors.clear();
|
||||
|
|
@ -321,6 +344,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::TESObjectARMO*> GetArmorForms(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter BodySlotListing.GetArmorForms");
|
||||
LogExit exitPrint("BodySlotListing.GetArmorForms"sv);
|
||||
std::vector<RE::TESObjectARMO*> result;
|
||||
auto& list = data.armors;
|
||||
for (auto it = list.begin(); it != list.end(); it++)
|
||||
|
|
@ -335,6 +360,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::BSFixedString> GetArmorNames(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter BodySlotListing.GetArmorNames");
|
||||
LogExit exitPrint("BodySlotListing.GetArmorNames"sv);
|
||||
std::vector<RE::BSFixedString> result;
|
||||
auto& list = data.armorNames;
|
||||
for (auto it = list.begin(); it != list.end(); it++)
|
||||
|
|
@ -344,6 +371,8 @@ namespace OutfitSystem {
|
|||
std::vector<std::int32_t> GetSlotIndices(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter BodySlotListing.GetSlotIndices");
|
||||
LogExit exitPrint("BodySlotListing.GetSlotIndices"sv);
|
||||
std::vector<std::int32_t> result;
|
||||
auto& list = data.bodySlots;
|
||||
for (auto it = list.begin(); it != list.end(); it++)
|
||||
|
|
@ -357,6 +386,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
std::vector<RE::BSFixedString> arr,
|
||||
bool descending) {
|
||||
LOG(trace, "Enter StringSorts.NaturalSort_ASCII");
|
||||
LogExit exitPrint("StringSorts.NaturalSort_ASCII"sv);
|
||||
std::vector<RE::BSFixedString> result = arr;
|
||||
std::sort(
|
||||
result.begin(),
|
||||
|
|
@ -371,7 +402,6 @@ namespace OutfitSystem {
|
|||
return result;
|
||||
}
|
||||
|
||||
// TODO: You need to change all the papyrus scripts that were assuming behavior here.
|
||||
template<typename T>
|
||||
std::vector<T*> NaturalSortPair_ASCII(
|
||||
RE::BSScript::IVirtualMachine* registry,
|
||||
|
|
@ -380,6 +410,8 @@ namespace OutfitSystem {
|
|||
std::vector<RE::BSFixedString> arr,// Array of string
|
||||
std::vector<T*> second, // Array of forms (T)
|
||||
bool descending) {
|
||||
LOG(trace, "Enter StringSorts.NaturalSortPair_ASCII");
|
||||
LogExit exitPrint("StringSorts.NaturalSortPair_ASCII"sv);
|
||||
std::size_t size = arr.size();
|
||||
if (size != second.size()) {
|
||||
registry->TraceStack("The two arrays must be the same length.", stackId, RE::BSScript::IVirtualMachine::Severity::kError);
|
||||
|
|
@ -418,6 +450,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString str) {
|
||||
LOG(trace, "Enter Utility.HexToInt32");
|
||||
LogExit exitPrint("Utility.HexToInt32"sv);
|
||||
const char* s = str.data();
|
||||
char* discard;
|
||||
return strtoul(s, &discard, 16);
|
||||
|
|
@ -426,6 +460,8 @@ namespace OutfitSystem {
|
|||
|
||||
std::uint32_t value,
|
||||
std::int32_t length) {
|
||||
LOG(trace, "Enter Utility.ToHex");
|
||||
LogExit exitPrint("Utility.ToHex"sv);
|
||||
if (length < 1) {
|
||||
registry->TraceStack(
|
||||
"Cannot format a hexadecimal valueinteger to a negative number of digits. Defaulting to eight.",
|
||||
|
|
@ -455,6 +491,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
RE::TESObjectARMO* armor_skse) {
|
||||
LOG(trace, "Enter AddArmorToOutfit");
|
||||
LogExit exitPrint("AddArmorToOutfit"sv);
|
||||
auto armor = (RE::TESObjectARMO*) (armor_skse);
|
||||
ERROR_AND_RETURN_IF(armor == nullptr, "Cannot add a None armor to an outfit.", registry, stackId);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
|
|
@ -471,6 +509,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::TESObjectARMO* armor_skse,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter ArmorConflictsWithOutfit");
|
||||
LogExit exitPrint("ArmorConflictsWithOutfit"sv);
|
||||
auto armor = (RE::TESObjectARMO*) (armor_skse);
|
||||
if (armor == nullptr) {
|
||||
registry->TraceStack("A None armor can't conflict with anything in an outfit.", stackId, RE::BSScript::IVirtualMachine::Severity::kWarning);
|
||||
|
|
@ -489,6 +529,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter CreateOutfit");
|
||||
LogExit exitPrint("CreateOutfit"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
try {
|
||||
service.addOutfit(name.data());
|
||||
|
|
@ -501,6 +543,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter DeleteOutfit");
|
||||
LogExit exitPrint("DeleteOutfit"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.deleteOutfit(name.data());
|
||||
}
|
||||
|
|
@ -509,6 +553,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter GetOutfitContents");
|
||||
LogExit exitPrint("GetOutfitContents"sv);
|
||||
std::vector<RE::TESObjectARMO*> result;
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
try {
|
||||
|
|
@ -531,6 +577,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter GetOutfitFavoriteStatus");
|
||||
LogExit exitPrint("GetOutfitFavoriteStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
bool result = false;
|
||||
try {
|
||||
|
|
@ -546,6 +594,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter GetOutfitPassthroughStatus");
|
||||
LogExit exitPrint("GetOutfitPassthroughStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
bool result = false;
|
||||
try {
|
||||
|
|
@ -561,6 +611,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter GetOutfitEquipRequiredStatus");
|
||||
LogExit exitPrint("GetOutfitEquipRequiredStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
bool result = false;
|
||||
try {
|
||||
|
|
@ -575,12 +627,16 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* actor) {
|
||||
LOG(trace, "Enter GetSelectedOutfit");
|
||||
LogExit exitPrint("GetSelectedOutfit"sv);
|
||||
if (!actor)
|
||||
return RE::BSFixedString("");
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
return service.currentOutfit(actor->GetHandle().native_handle()).name.c_str();
|
||||
}
|
||||
bool IsEnabled(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter IsEnabled");
|
||||
LogExit exitPrint("IsEnabled"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
return service.enabled;
|
||||
}
|
||||
|
|
@ -589,6 +645,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
bool favoritesOnly) {
|
||||
LOG(trace, "Enter ListOutfits");
|
||||
LogExit exitPrint("ListOutfits"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
std::vector<RE::BSFixedString> result;
|
||||
std::vector<std::string> intermediate;
|
||||
|
|
@ -602,6 +660,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
RE::TESObjectARMO* armor_skse) {
|
||||
LOG(trace, "Enter RemoveArmorFromOutfit");
|
||||
LogExit exitPrint("RemoveArmorFromOutfit"sv);
|
||||
auto armor = (RE::TESObjectARMO*) (armor_skse);
|
||||
ERROR_AND_RETURN_IF(armor == nullptr, "Cannot remove a None armor from an outfit.", registry, stackId);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
|
|
@ -618,6 +678,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::TESObjectARMO* armor_skse,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter RemoveConflictingArmorsFrom");
|
||||
LogExit exitPrint("RemoveConflictingArmorsFrom"sv);
|
||||
auto armor = (RE::TESObjectARMO*) (armor_skse);
|
||||
ERROR_AND_RETURN_IF(armor == nullptr,
|
||||
"A None armor can't conflict with anything in an outfit.",
|
||||
|
|
@ -649,6 +711,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
RE::BSFixedString changeTo) {
|
||||
LOG(trace, "Enter RenameOutfit");
|
||||
LogExit exitPrint("RenameOutfit"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
try {
|
||||
service.renameOutfit(name.data(), changeTo.data());
|
||||
|
|
@ -670,6 +734,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
bool favorite) {
|
||||
LOG(trace, "Enter SetOutfitFavoriteStatus");
|
||||
LogExit exitPrint("SetOutfitFavoriteStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.setFavorite(name.data(), favorite);
|
||||
}
|
||||
|
|
@ -679,6 +745,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
bool allowsPassthrough) {
|
||||
LOG(trace, "Enter SetOutfitPassthroughStatus");
|
||||
LogExit exitPrint("SetOutfitPassthroughStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.setOutfitPassthrough(name.data(), allowsPassthrough);
|
||||
}
|
||||
|
|
@ -688,12 +756,16 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BSFixedString name,
|
||||
bool equipRequired) {
|
||||
LOG(trace, "Enter SetOutfitEquipRequiredStatus");
|
||||
LogExit exitPrint("SetOutfitEquipRequiredStatus"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.setOutfitEquipRequired(name.data(), equipRequired);
|
||||
}
|
||||
bool OutfitExists(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*,
|
||||
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter OutfitExists");
|
||||
LogExit exitPrint("OutfitExists"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
return service.hasOutfit(name.data());
|
||||
}
|
||||
|
|
@ -702,6 +774,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
RE::BSFixedString name,
|
||||
std::vector<RE::TESObjectARMO*> armors) {
|
||||
LOG(trace, "Enter OverwriteOutfit");
|
||||
LogExit exitPrint("OverwriteOutfit"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
try {
|
||||
auto& outfit = service.getOrCreateOutfit(name.data());
|
||||
|
|
@ -722,6 +796,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
bool state) {
|
||||
LOG(trace, "Enter SetEnabled");
|
||||
LogExit exitPrint("SetEnabled"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.setEnabled(state);
|
||||
}
|
||||
|
|
@ -730,6 +806,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
RE::Actor* actor,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter SetSelectedOutfit");
|
||||
LogExit exitPrint("SetSelectedOutfit"sv);
|
||||
if (!actor)
|
||||
return;
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
|
|
@ -739,6 +817,8 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* target) {
|
||||
LOG(trace, "Enter AddActor");
|
||||
LogExit exitPrint("AddActor"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.addActor(target->GetHandle().native_handle());
|
||||
}
|
||||
|
|
@ -746,12 +826,16 @@ namespace OutfitSystem {
|
|||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*,
|
||||
RE::Actor* target) {
|
||||
LOG(trace, "Enter RemoveActor");
|
||||
LogExit exitPrint("RemoveActor"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
service.removeActor(target->GetHandle().native_handle());
|
||||
}
|
||||
std::vector<RE::Actor*> ListActors(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ListActors");
|
||||
LogExit exitPrint("ListActors"sv);
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
auto actors = service.listActors();
|
||||
std::vector<RE::Actor*> actorVec;
|
||||
|
|
@ -784,16 +868,22 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
|
||||
bool value) {
|
||||
LOG(trace, "Enter SetLocationBasedAutoSwitchEnabled");
|
||||
LogExit exitPrint("SetLocationBasedAutoSwitchEnabled"sv);
|
||||
ArmorAddonOverrideService::GetInstance().setLocationBasedAutoSwitchEnabled(value);
|
||||
}
|
||||
bool GetLocationBasedAutoSwitchEnabled(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter GetLocationBasedAutoSwitchEnabled");
|
||||
LogExit exitPrint("GetLocationBasedAutoSwitchEnabled"sv);
|
||||
return ArmorAddonOverrideService::GetInstance().locationBasedAutoSwitchEnabled;
|
||||
}
|
||||
std::vector<std::uint32_t> GetAutoSwitchLocationArray(RE::BSScript::IVirtualMachine* registry,
|
||||
std::uint32_t stackId,
|
||||
RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter GetAutoSwitchLocationArray");
|
||||
LogExit exitPrint("GetAutoSwitchLocationArray"sv);
|
||||
std::vector<std::uint32_t> result;
|
||||
for (LocationType i : {
|
||||
LocationType::World,
|
||||
|
|
@ -813,6 +903,8 @@ namespace OutfitSystem {
|
|||
return result;
|
||||
}
|
||||
std::optional<LocationType> identifyLocation(RE::BGSLocation* location, RE::TESWeather* weather) {
|
||||
LOG(trace, "Enter identifyLocation");
|
||||
LogExit exitPrint("identifyLocation"sv);
|
||||
// Just a helper function to classify a location.
|
||||
// TODO: Think of a better place than this since we're not exposing it to Papyrus.
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
|
|
@ -849,6 +941,8 @@ namespace OutfitSystem {
|
|||
|
||||
RE::BGSLocation* location_skse,
|
||||
RE::TESWeather* weather_skse) {
|
||||
LOG(trace, "Enter IdentifyLocationType");
|
||||
LogExit exitPrint("IdentifyLocationType"sv);
|
||||
// NOTE: Identify the location for Papyrus. In the event no location is identified, we lie to Papyrus and say "World".
|
||||
// Therefore, Papyrus cannot assume that locations returned have an outfit assigned, at least not for "World".
|
||||
return static_cast<std::uint32_t>(identifyLocation((RE::BGSLocation*) location_skse,
|
||||
|
|
@ -859,6 +953,8 @@ namespace OutfitSystem {
|
|||
RE::Actor* actor,
|
||||
RE::BGSLocation* location_skse,
|
||||
RE::TESWeather* weather_skse) {
|
||||
LOG(trace, "Enter SetOutfitUsingLocation");
|
||||
LogExit exitPrint("SetOutfitUsingLocation"sv);
|
||||
// NOTE: Location can be NULL.
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
if (!actor)
|
||||
|
|
@ -881,6 +977,8 @@ namespace OutfitSystem {
|
|||
RE::Actor* actor,
|
||||
std::uint32_t location,
|
||||
RE::BSFixedString name) {
|
||||
LOG(trace, "Enter SetLocationOutfit");
|
||||
LogExit exitPrint("SetLocationOutfit"sv);
|
||||
if (!actor)
|
||||
return;
|
||||
if (strcmp(name.data(), "") == 0) {
|
||||
|
|
@ -893,6 +991,8 @@ namespace OutfitSystem {
|
|||
void UnsetLocationOutfit(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*,
|
||||
RE::Actor* actor,
|
||||
std::uint32_t location) {
|
||||
LOG(trace, "Enter UnsetLocationOutfit");
|
||||
LogExit exitPrint("UnsetLocationOutfit"sv);
|
||||
if (!actor)
|
||||
return;
|
||||
return ArmorAddonOverrideService::GetInstance()
|
||||
|
|
@ -903,6 +1003,8 @@ namespace OutfitSystem {
|
|||
RE::StaticFunctionTag*,
|
||||
RE::Actor* actor,
|
||||
std::uint32_t location) {
|
||||
LOG(trace, "Enter GetLocationOutfit");
|
||||
LogExit exitPrint("GetLocationOutfit"sv);
|
||||
if (!actor)
|
||||
return RE::BSFixedString("");
|
||||
auto outfit = ArmorAddonOverrideService::GetInstance()
|
||||
|
|
@ -915,6 +1017,8 @@ namespace OutfitSystem {
|
|||
}
|
||||
}
|
||||
bool ExportSettings(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ExportSettings");
|
||||
LogExit exitPrint("ExportSettings"sv);
|
||||
std::string outputFile = GetRuntimeDirectory() + "Data\\SKSE\\Plugins\\OutfitSystemData.json";
|
||||
auto& service = ArmorAddonOverrideService::GetInstance();
|
||||
proto::OutfitSystem data = service.save();
|
||||
|
|
@ -939,6 +1043,8 @@ namespace OutfitSystem {
|
|||
}
|
||||
}
|
||||
bool ImportSettings(RE::BSScript::IVirtualMachine* registry, std::uint32_t stackId, RE::StaticFunctionTag*) {
|
||||
LOG(trace, "Enter ImportSettings");
|
||||
LogExit exitPrint("ImportSettings"sv);
|
||||
std::string inputFile = GetRuntimeDirectory() + "Data\\SKSE\\Plugins\\OutfitSystemData.json";
|
||||
std::ifstream file(inputFile);
|
||||
if (!file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue