1

Localizable notifications via Papyrus scripts

This commit is contained in:
Eddoursul 2022-07-14 14:30:14 +02:00
parent be249e6ab9
commit a20629cde9
7 changed files with 21 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -531,7 +531,9 @@ namespace ArtifactTracker
if (g_bTakeAll) { if (g_bTakeAll) {
g_bTakeAllCount++; g_bTakeAllCount++;
} else { } else {
RE::DebugNotification(fmt::format("New artifact acquired: {}", form->GetName()).c_str()); //RE::DebugNotification(fmt::format("New artifact acquired: {}", form->GetName()).c_str());
RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> stackCallback;
RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("ETR_NewArtifactNotification", "Show", RE::MakeFunctionArguments<RE::TESForm*>(std::move(form)), stackCallback);
} }
} }
} }

View File

@ -88,8 +88,10 @@ auto EventListener::ProcessEvent(
RE::BSInputDeviceManager::GetSingleton()->AddEventSink(EventListener::GetSingleton()); RE::BSInputDeviceManager::GetSingleton()->AddEventSink(EventListener::GetSingleton());
} else { } else {
RE::BSInputDeviceManager::GetSingleton()->RemoveEventSink(EventListener::GetSingleton()); RE::BSInputDeviceManager::GetSingleton()->RemoveEventSink(EventListener::GetSingleton());
if (ArtifactTracker::g_bTakeAll && ArtifactTracker::g_bTakeAllCount > 0) { if (ArtifactTracker::g_bTakeAll && ArtifactTracker::g_bNotifyNewArtifact && ArtifactTracker::g_bTakeAllCount > 0) {
RE::DebugNotification(fmt::format("{} new artifact(s) acquired", ArtifactTracker::g_bTakeAllCount).c_str()); //RE::DebugNotification(fmt::format("{} new artifact(s) acquired", ArtifactTracker::g_bTakeAllCount).c_str());
RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> stackCallback;
RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("ETR_NewArtifactsCombinedNotification", "Show", RE::MakeFunctionArguments<std::uint32_t>(std::move(ArtifactTracker::g_bTakeAllCount)), stackCallback);
} }
ArtifactTracker::g_bTakeAll = false; ArtifactTracker::g_bTakeAll = false;
ArtifactTracker::g_bTakeAllCount = 0; ArtifactTracker::g_bTakeAllCount = 0;

View File

@ -0,0 +1,5 @@
Scriptname ETR_NewArtifactNotification Hidden
function Show(Form a_form) global
Debug.Notification("New artifact acquired: " + a_form.GetName())
endfunction

View File

@ -0,0 +1,9 @@
Scriptname ETR_NewArtifactsCombinedNotification Hidden
function Show(int iCount) global
if iCount == 1
Debug.Notification(iCount + " new artifact acquired")
else
Debug.Notification(iCount + " new artifacts acquired")
endif
endfunction