Added Enderal SE support
This commit is contained in:
parent
2b38e77101
commit
6b4b19bbfa
@ -7,6 +7,8 @@ RE::TESEffectShader* EventListener::regularBookShader;
|
|||||||
RE::TESEffectShader* EventListener::spellBookShader;
|
RE::TESEffectShader* EventListener::spellBookShader;
|
||||||
RE::TESEffectShader* EventListener::skillBookShader;
|
RE::TESEffectShader* EventListener::skillBookShader;
|
||||||
|
|
||||||
|
bool EventListener::bEnderalMode = false;
|
||||||
|
|
||||||
auto EventListener::GetSingleton() -> EventListener*
|
auto EventListener::GetSingleton() -> EventListener*
|
||||||
{
|
{
|
||||||
static EventListener singleton{};
|
static EventListener singleton{};
|
||||||
@ -24,8 +26,8 @@ void EventListener::Install()
|
|||||||
|
|
||||||
std::map<std::string, std::any> settings{
|
std::map<std::string, std::any> settings{
|
||||||
{ "sRegularBookShader", "Skyrim.esm@C723A" },
|
{ "sRegularBookShader", "Skyrim.esm@C723A" },
|
||||||
{ "sSpellBookShader", "Skyrim.esm@B6BF9" },
|
{ "sSpellBookShader", "Skyrim.esm@B6BFA" },
|
||||||
{ "sSkillBookShader", "Skyrim.esm@B6BFA" },
|
{ "sSkillBookShader", "Skyrim.esm@B6BF9" },
|
||||||
};
|
};
|
||||||
|
|
||||||
LoadINI(&settings, std::format("Data/SKSE/Plugins/{}.ini", SKSE::PluginDeclaration::GetSingleton()->GetName()).c_str());
|
LoadINI(&settings, std::format("Data/SKSE/Plugins/{}.ini", SKSE::PluginDeclaration::GetSingleton()->GetName()).c_str());
|
||||||
@ -35,6 +37,10 @@ void EventListener::Install()
|
|||||||
EventListener::regularBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sRegularBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
EventListener::regularBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sRegularBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
||||||
EventListener::spellBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sSpellBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
EventListener::spellBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sSpellBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
||||||
EventListener::skillBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sSkillBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
EventListener::skillBookShader = retrieveFormByString(std::any_cast<std::string>(settings["sSkillBookShader"]), defaultShader)->As<RE::TESEffectShader>();
|
||||||
|
|
||||||
|
if (EventListener::bEnderalMode = RE::TESDataHandler::GetSingleton()->GetModIndex("Enderal - Forgotten Stories.esm") != std::nullopt) {
|
||||||
|
logger::info("Detected Enderal SE, learning books will be highlighted as well");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto EventListener::ProcessEvent(
|
auto EventListener::ProcessEvent(
|
||||||
|
@ -24,6 +24,8 @@ public:
|
|||||||
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
|
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
|
||||||
-> RE::BSEventNotifyControl override;
|
-> RE::BSEventNotifyControl override;
|
||||||
|
|
||||||
|
static bool bEnderalMode;
|
||||||
|
|
||||||
static RE::TESEffectShader* regularBookShader;
|
static RE::TESEffectShader* regularBookShader;
|
||||||
static RE::TESEffectShader* skillBookShader;
|
static RE::TESEffectShader* skillBookShader;
|
||||||
static RE::TESEffectShader* spellBookShader;
|
static RE::TESEffectShader* spellBookShader;
|
||||||
|
40
src/Util.h
40
src/Util.h
@ -8,22 +8,34 @@ inline void TryAddBookRefShader(RE::TESObjectREFR* a_ref)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto baseObj = a_ref->GetBaseObject(); baseObj->IsBook()) {
|
if (const auto baseObj = a_ref->GetBaseObject()) {
|
||||||
if (const auto bookObj = baseObj->As<RE::TESObjectBOOK>()) {
|
if (baseObj->IsBook()) {
|
||||||
if (!bookObj->IsRead()) {
|
if (const auto bookObj = baseObj->As<RE::TESObjectBOOK>()) {
|
||||||
auto shader = EventListener::regularBookShader;
|
if (!bookObj->IsRead()) {
|
||||||
|
auto shader = EventListener::regularBookShader;
|
||||||
|
|
||||||
if (bookObj->TeachesSpell()) {
|
if (bookObj->TeachesSpell()) {
|
||||||
shader = EventListener::spellBookShader;
|
shader = EventListener::spellBookShader;
|
||||||
} else if (bookObj->TeachesSkill()) {
|
} else if (bookObj->TeachesSkill()) {
|
||||||
shader = EventListener::skillBookShader;
|
shader = EventListener::skillBookShader;
|
||||||
}
|
|
||||||
|
|
||||||
SKSE::GetTaskInterface()->AddTask([a_ref, shader]() {
|
|
||||||
if (a_ref) {
|
|
||||||
a_ref->ApplyEffectShader(shader);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
SKSE::GetTaskInterface()->AddTask([a_ref, shader]() {
|
||||||
|
if (a_ref) {
|
||||||
|
a_ref->ApplyEffectShader(shader);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (EventListener::bEnderalMode && baseObj->Is(RE::FormType::AlchemyItem)) {
|
||||||
|
if (const auto alchObj = baseObj->As<RE::AlchemyItem>()) {
|
||||||
|
if (alchObj->data.consumptionSound && alchObj->data.consumptionSound->formID == 0x7ea3a) {
|
||||||
|
SKSE::GetTaskInterface()->AddTask([a_ref]() {
|
||||||
|
if (a_ref) {
|
||||||
|
a_ref->ApplyEffectShader(EventListener::skillBookShader);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user