diff --git a/.vs/PortiaMods/v16/.suo b/.vs/PortiaMods/v16/.suo
index 2a27dc9..aea166c 100644
Binary files a/.vs/PortiaMods/v16/.suo and b/.vs/PortiaMods/v16/.suo differ
diff --git a/CustomQuests/CustomQuests.csproj b/CustomQuests/CustomQuests.csproj
new file mode 100644
index 0000000..17b4446
--- /dev/null
+++ b/CustomQuests/CustomQuests.csproj
@@ -0,0 +1,92 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {06F79FB4-D84F-4C73-B804-D3D4A4813BE3}
+ Library
+ Properties
+ CustomQuests
+ CustomQuests
+ v3.5
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityModManager\0Harmony12.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\Assembly-CSharp.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\Assembly-CSharp-firstpass.dll
+
+
+
+
+
+
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.AnimationModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.AudioModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.CoreModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.IMGUIModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.ParticleSystemModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UI.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UIModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll
+
+
+ H:\tmp\ga\MTAP\Portia_Data\Managed\UnityModManager\UnityModManager.dll
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CustomQuests/Main.cs b/CustomQuests/Main.cs
new file mode 100644
index 0000000..c629b4f
--- /dev/null
+++ b/CustomQuests/Main.cs
@@ -0,0 +1,90 @@
+using Harmony12;
+using SimpleJSON;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using UnityEngine;
+using UnityModManagerNet;
+
+namespace CustomQuests
+{
+ public partial class Main
+ {
+ private static bool isDebug = false;
+
+ public static void Dbgl(string str = "", bool pref = true)
+ {
+ if (isDebug)
+ Debug.Log((pref ? "CustomQuests " : "") + str);
+ }
+ public static bool enabled;
+ public static Settings settings { get; private set; }
+
+ public static Dictionary nameDesc = new Dictionary();
+ public static Dictionary sourceStrings = new Dictionary();
+
+ // Send a response to the mod manager about the launch status, success or not.
+ private static bool Load(UnityModManager.ModEntry modEntry)
+ {
+ settings = UnityModManager.ModSettings.Load(modEntry);
+ modEntry.OnToggle = OnToggle;
+ modEntry.OnGUI = OnGUI;
+ modEntry.OnSaveGUI = OnSaveGUI;
+
+ var harmony = HarmonyInstance.Create(modEntry.Info.Id);
+ harmony.PatchAll(Assembly.GetExecutingAssembly());
+
+ LoadItems();
+
+ //LoadItemFile();
+
+ return true;
+ }
+
+ private static void LoadItems()
+ {
+ // weapons items
+ string path = $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\\assets\\";
+ if (Directory.Exists(path))
+ {
+ string[] files = Directory.GetFiles(path, "*.json");
+ foreach (string file in files)
+ {
+ try
+ {
+ JSONNode jsonRoot = JSONNode.Parse(File.ReadAllText(file));
+ if (jsonRoot != null)
+ {
+ for (int i = 0; i < jsonRoot.Count; i++)
+ {
+ JSONNode jsonNode = jsonRoot[i];
+ storeItems.Add(new StoreItem(jsonNode["ID"].AsInt, productIds++, jsonNode["count"].AsInt, jsonNode["currency"].AsInt, jsonNode["requireMission"], jsonNode["storeId"].AsInt, jsonNode["chance"].AsFloat));
+ }
+ }
+ }
+ catch (Exception arg)
+ {
+ Debug.LogError("exception reading json file:" + arg);
+ }
+ }
+ }
+ }
+
+ private static void OnSaveGUI(UnityModManager.ModEntry modEntry)
+ {
+ settings.Save(modEntry);
+ }
+
+ private static void OnGUI(UnityModManager.ModEntry modEntry)
+ {
+ }
+
+ // Called when the mod is turned to on/off.
+ static bool OnToggle(UnityModManager.ModEntry modEntry, bool value /* active or inactive */)
+ {
+ enabled = value;
+ return true; // Permit or not.
+ }
+ }
+}
\ No newline at end of file
diff --git a/CustomQuests/Settings.cs b/CustomQuests/Settings.cs
new file mode 100644
index 0000000..662ecfe
--- /dev/null
+++ b/CustomQuests/Settings.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using UnityModManagerNet;
+
+namespace CustomQuests
+{
+ public class Settings : UnityModManager.ModSettings
+ {
+ public override void Save(UnityModManager.ModEntry modEntry)
+ {
+ Save(this, modEntry);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PortiaMods.sln b/PortiaMods.sln
index a7401e0..5e67a1b 100644
--- a/PortiaMods.sln
+++ b/PortiaMods.sln
@@ -81,6 +81,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenDungeons", "OpenDungeon
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostProcessing", "PostProcessing\PostProcessing.csproj", "{5AD3331E-8F85-4E91-96F0-C65972137ADA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomQuests", "CustomQuests\CustomQuests.csproj", "{06F79FB4-D84F-4C73-B804-D3D4A4813BE3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -243,6 +245,10 @@ Global
{5AD3331E-8F85-4E91-96F0-C65972137ADA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AD3331E-8F85-4E91-96F0-C65972137ADA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AD3331E-8F85-4E91-96F0-C65972137ADA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {06F79FB4-D84F-4C73-B804-D3D4A4813BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {06F79FB4-D84F-4C73-B804-D3D4A4813BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {06F79FB4-D84F-4C73-B804-D3D4A4813BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {06F79FB4-D84F-4C73-B804-D3D4A4813BE3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PostProcessing/Main.cs b/PostProcessing/Main.cs
index b2baab6..5f75ecc 100644
--- a/PostProcessing/Main.cs
+++ b/PostProcessing/Main.cs
@@ -1,4 +1,5 @@
using Harmony12;
+using Hont.ExMethod.Collection;
using NovaEnv;
using Pathea.WeatherNs;
using System;
@@ -30,6 +31,21 @@ public static partial class Main
"Very Large"
};
+ private static string[] fxaaPresets = new string[] {
+ "Extreme Performance",
+ "Performance",
+ "Default",
+ "Quality",
+ "Extreme Quality"
+ };
+
+ private static Dictionary sampleCounts = new Dictionary {
+ { "Lowest",3 },
+ { "Low",6 },
+ { "Medium",10 },
+ { "High",16 },
+ };
+
public static void Dbgl(string str = "", bool pref = true)
{
if (isDebug)
@@ -435,6 +451,106 @@ private static void OnGUI(UnityModManager.ModEntry modEntry)
}
+ GUILayout.Space(10f);
+
+
+ settings.customAO = GUILayout.Toggle(settings.customAO, "Use Custom Ambient Occlusion", new GUILayoutOption[0]);
+ if (settings.customAO)
+ {
+ GUILayout.Space(10f);
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(indentSpace);
+ GUILayout.BeginVertical();
+
+ GUILayout.Label(new GUIContent(string.Format("Intensity {0:F2} ", settings.AOIntensity), "Degree of darkness produced by the effect."), new GUILayoutOption[0]);
+ settings.AOIntensity = GUILayout.HorizontalSlider((float)settings.AOIntensity * 100f, 0f, 400f) / 100f;
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.Label(new GUIContent(string.Format("Radius {0:F2} ", settings.AORadius), "Radius of sample points, which affects extent of darkened areas."), new GUILayoutOption[0]);
+ settings.AORadius = GUILayout.HorizontalSlider((float)settings.AORadius * 10000f, 1f, 10000) / 10000f;
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.Label(new GUIContent(string.Format("Sample Count {0:F2} ", sampleCounts.Keys.ToArray()[settings.AOSampleCount]), "Number of sample points, which affects quality and performance."), new GUILayoutOption[0]);
+ settings.AOSampleCount = (int)GUILayout.HorizontalSlider((float)settings.AOSampleCount, 0f, 3f);
+
+ GUILayout.Space(10f);
+
+
+ settings.AODownsampling = GUILayout.Toggle(settings.AODownsampling, new GUIContent("Downsample", "Halves the resolution of the effect to increase performance at the cost of visual quality."), new GUILayoutOption[0]);
+ GUILayout.Space(10f);
+
+ settings.AOForceForwardCompatibility = GUILayout.Toggle(settings.AOForceForwardCompatibility, new GUIContent("Force Forward Compatibility", "Forces compatibility with Forward rendered objects when working with the Deferred rendering path."), new GUILayoutOption[0]);
+ GUILayout.Space(10f);
+
+ settings.AOAmbientOnly = GUILayout.Toggle(settings.AOAmbientOnly, new GUIContent("Ambient Only", "Enables the ambient-only mode in that the effect only affects ambient lighting. This mode is only available with the Deferred rendering path and HDR rendering."), new GUILayoutOption[0]);
+ GUILayout.Space(10f);
+
+ settings.AOHighPrecision = GUILayout.Toggle(settings.AOHighPrecision, new GUIContent("High Precision", "Toggles the use of a higher precision depth texture with the forward rendering path (may impact performances). Has no effect with the deferred rendering path."), new GUILayoutOption[0]);
+ GUILayout.Space(10f);
+
+ GUILayout.EndVertical();
+ GUILayout.EndHorizontal();
+
+ }
+
+ GUILayout.Space(10f);
+
+
+ settings.customAA = GUILayout.Toggle(settings.customAA, "Use Custom Anti-Aliasing", new GUILayoutOption[0]);
+ if (settings.customAA)
+ {
+ GUILayout.Space(10f);
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(indentSpace);
+ GUILayout.BeginVertical();
+
+ settings.AAMethodTaa = !GUILayout.Toggle(!settings.AAMethodTaa, "Use Fxaa Anti-Aliasing", new GUILayoutOption[0]);
+ settings.AAMethodTaa = GUILayout.Toggle(settings.AAMethodTaa, "Use Taa Anti-Aliasing", new GUILayoutOption[0]);
+
+ if (settings.AAMethodTaa)
+ {
+ GUILayout.Label(new GUIContent(string.Format("Jitter Spread {0:F2} ", settings.AAJitterSpread), "The diameter (in texels) inside which jitter samples are spread. Smaller values result in crisper but more aliased output, while larger values result in more stable but blurrier output."), new GUILayoutOption[0]);
+ settings.AAJitterSpread = GUILayout.HorizontalSlider((float)settings.AAJitterSpread*100f, 10f, 100f)/100f;
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.Label(new GUIContent(string.Format("Sharpen {0:F2} ", settings.AASharpen), "Controls the amount of sharpening applied to the color buffer."), new GUILayoutOption[0]);
+ settings.AASharpen = GUILayout.HorizontalSlider((float)settings.AASharpen * 100f, 0, 300f)/100f;
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.Label(new GUIContent(string.Format("Stationary Blending {0:F2} ", settings.AAStationaryBlending), "The blend coefficient for a stationary fragment. Controls the percentage of history sample blended into the final color."), new GUILayoutOption[0]);
+ settings.AAStationaryBlending = GUILayout.HorizontalSlider((float)settings.AAStationaryBlending * 100f, 0f, 99f)/100f;
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.Label(new GUIContent(string.Format("Motion Blending {0:F2} ", settings.AAMotionBlending), "The blend coefficient for a fragment with significant motion. Controls the percentage of history sample blended into the final color."), new GUILayoutOption[0]);
+ settings.AAMotionBlending = GUILayout.HorizontalSlider((float)settings.AAMotionBlending * 100f, 0f, 99f)/100f;
+
+ }
+ else
+ {
+ GUILayout.Label(new GUIContent(string.Format("Fxaa Preset {0} ", fxaaPresets[settings.AAFxaaPreset]), ""), new GUILayoutOption[0]);
+ settings.AAFxaaPreset = (int)GUILayout.HorizontalSlider((float)settings.AAFxaaPreset, 0f, 4f);
+
+
+ }
+
+ GUILayout.Space(10f);
+
+
+ GUILayout.EndVertical();
+ GUILayout.EndHorizontal();
+
+ }
+
GUILayout.Space(20f);
GUILayout.EndVertical();
diff --git a/PostProcessing/Patches.cs b/PostProcessing/Patches.cs
index b7b44c8..bf52bb6 100644
--- a/PostProcessing/Patches.cs
+++ b/PostProcessing/Patches.cs
@@ -25,6 +25,8 @@ static partial class Main
private static MotionBlurModel.Settings defaultMotionBlurSettings;
private static DepthOfFieldModel.Settings defaultDepthOfFieldSettings;
private static ColorGradingModel.Settings defaultColorGradingSettings;
+ private static AntialiasingModel.Settings defaultAASettings;
+ private static AmbientOcclusionModel.Settings defaultAOSettings;
[HarmonyPatch(typeof(PostProcessingBehaviour), "OnEnable")]
static class PostProcessingBehaviour_OnEnable_Patch
@@ -40,6 +42,8 @@ static void Prefix(PostProcessingBehaviour __instance)
defaultMotionBlurSettings = __instance.profile.motionBlur.settings;
defaultDepthOfFieldSettings = __instance.profile.depthOfField.settings;
defaultColorGradingSettings = __instance.profile.colorGrading.settings;
+ defaultAASettings = __instance.profile.antialiasing.settings;
+ defaultAOSettings = __instance.profile.ambientOcclusion.settings;
defaultPostProcessingSet = true;
}
}
@@ -48,9 +52,8 @@ static void Prefix(PostProcessingBehaviour __instance)
[HarmonyPatch(typeof(PostProcessingBehaviour), "OnPreCull")]
static class PostProcessingBehaviour_OnPreCull_Patch
{
- static void Postfix(PostProcessingBehaviour __instance, PostProcessingContext ___m_Context, ref VignetteComponent ___m_Vignette, ref BloomComponent ___m_Bloom, ref EyeAdaptationComponent ___m_EyeAdaptation, ref DepthOfFieldComponent ___m_DepthOfField, ref MotionBlurComponent ___m_MotionBlur, ref ColorGradingComponent ___m_ColorGrading)
+ static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m_Bloom, ref EyeAdaptationComponent ___m_EyeAdaptation, ref DepthOfFieldComponent ___m_DepthOfField, ref MotionBlurComponent ___m_MotionBlur, ref ColorGradingComponent ___m_ColorGrading, ref TaaComponent ___m_Taa, ref FxaaComponent ___m_Fxaa, ref AmbientOcclusionComponent ___m_AmbientOcclusion)
{
- PostProcessingContext postProcessingContext = ___m_Context;
if (enabled && settings.customVignette)
{
@@ -153,10 +156,12 @@ static void Postfix(PostProcessingBehaviour __instance, PostProcessingContext __
};
___m_DepthOfField.model.settings = dSettings;
+ ___m_DepthOfField.model.enabled = true;
}
else
{
___m_DepthOfField.model.settings = defaultDepthOfFieldSettings;
+ ___m_DepthOfField.model.enabled = false;
}
if (enabled && settings.customColorGrading)
@@ -197,6 +202,69 @@ static void Postfix(PostProcessingBehaviour __instance, PostProcessingContext __
{
___m_ColorGrading.model.settings = defaultColorGradingSettings;
}
+
+ if (enabled && settings.customAO)
+ {
+ AmbientOcclusionModel.Settings aSettings = new AmbientOcclusionModel.Settings
+ {
+ intensity = settings.AOIntensity,
+ radius = settings.AORadius,
+ sampleCount = (AmbientOcclusionModel.SampleCount)sampleCounts.Values.ToArray()[settings.AOSampleCount],
+ downsampling = settings.AODownsampling,
+ forceForwardCompatibility = settings.AOForceForwardCompatibility,
+ ambientOnly = settings.AOAmbientOnly,
+ highPrecision = settings.AOHighPrecision
+ };
+
+ ___m_AmbientOcclusion.model.settings = aSettings;
+ }
+ else
+ {
+ ___m_AmbientOcclusion.model.settings = defaultAOSettings;
+ }
+
+ if (enabled && settings.customAA)
+ {
+ AntialiasingModel.FxaaSettings afSettings = new AntialiasingModel.FxaaSettings
+ {
+ preset = (AntialiasingModel.FxaaPreset) settings.AAFxaaPreset
+ };
+
+ AntialiasingModel.TaaSettings atSettings = new AntialiasingModel.TaaSettings
+ {
+ jitterSpread = settings.AAJitterSpread,
+ sharpen = settings.AASharpen,
+ stationaryBlending = settings.AAStationaryBlending,
+ motionBlending = settings.AAMotionBlending
+ };
+
+ AntialiasingModel.Settings aSettings = new AntialiasingModel.Settings
+ {
+ method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa,
+ fxaaSettings = afSettings,
+ taaSettings = atSettings
+ };
+
+ ___m_Taa.model.settings = aSettings;
+ ___m_Fxaa.model.settings = aSettings;
+ if (settings.AAMethodTaa)
+ {
+ ___m_Taa.model.enabled = true;
+ ___m_Fxaa.model.enabled = false;
+ }
+ else
+ {
+ ___m_Taa.model.enabled = false;
+ ___m_Fxaa.model.enabled = true;
+ }
+ }
+ else
+ {
+ ___m_Taa.model.settings = defaultAASettings;
+ ___m_Fxaa.model.settings = defaultAASettings;
+ ___m_Taa.model.enabled = false;
+ ___m_Fxaa.model.enabled = false;
+ }
}
}
}
diff --git a/PostProcessing/Settings.cs b/PostProcessing/Settings.cs
index 55af8bb..2f2065f 100644
--- a/PostProcessing/Settings.cs
+++ b/PostProcessing/Settings.cs
@@ -10,6 +10,8 @@ public class Settings : UnityModManager.ModSettings
public bool customMotionBlur = false;
public bool customColorGrading = false;
public bool customDepthOfField = false;
+ public bool customAA = false;
+ public bool customAO = false;
public float vignetteColorRed = 0f;
public float vignetteColorGreen = 0f;
@@ -67,6 +69,21 @@ public class Settings : UnityModManager.ModSettings
public float colorGradingSaturation = 1f;
public float colorGradingContrast = 1f;
+ public bool AAMethodTaa = false;
+ public int AAFxaaPreset = 2;
+ public float AAJitterSpread = 0.75f;
+ public float AASharpen = 0.3f;
+ public float AAStationaryBlending = 0.95f;
+ public float AAMotionBlending = 0.85f;
+
+ public float AOIntensity = 1f;
+ public float AORadius = 0.3f;
+ public int AOSampleCount = 2;
+ public bool AODownsampling = true;
+ public bool AOForceForwardCompatibility = false;
+ public bool AOAmbientOnly = false;
+ public bool AOHighPrecision = false;
+
public string ToggleKey = "page down";
public override void Save(UnityModManager.ModEntry modEntry)
diff --git a/repository.json b/repository.json
index 790858f..044f831 100644
--- a/repository.json
+++ b/repository.json
@@ -25,7 +25,7 @@
{"Id": "MusicBox", "Version": "0.4.0"},
{"Id": "NoWiggle", "Version": "0.1.0"},
{"Id": "PennyComeBack", "Version": "0.1.0"},
- {"Id": "PostProcessing", "Version": "0.1.0"},
+ {"Id": "PostProcessing", "Version": "0.2.0"},
{"Id": "SaveAnyTime", "Version": "0.8.5"},
{"Id": "StorageAnywhere", "Version": "0.6.0"},
{"Id": "Teleport", "Version": "0.0.1"},