From 597e9cfe22758e44003c57bca3033c4a2bd606ba Mon Sep 17 00:00:00 2001 From: JvE Date: Thu, 15 Dec 2022 18:45:30 +0100 Subject: [PATCH 1/2] Fix for #2430 %god fails to resolve for Fighters Trainers --- Assets/Scripts/Game/Questing/QuestMCP.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Game/Questing/QuestMCP.cs b/Assets/Scripts/Game/Questing/QuestMCP.cs index c08df51e61..380f20a40b 100644 --- a/Assets/Scripts/Game/Questing/QuestMCP.cs +++ b/Assets/Scripts/Game/Questing/QuestMCP.cs @@ -209,13 +209,14 @@ public override string God() factionId = (int)GameManager.Instance.PlayerEnterExit.FactionID; } else - { + { factionId = GameManager.Instance.PlayerGPS.GetTempleOfCurrentRegion(); } - if (factionId == 0) + if (factionId == 0 || factionId == (int)FactionFile.FactionIDs.The_Fighters_Guild) { - // Classic returns "BLANK" if no temple is found, here we return a random deity name + // Classic returns "BLANK" if no temple is found, here we return a random deity name. + // We do the same for Fighters Guild halls, which are are considered temples in some areas. const int minGodID = 21; const int maxGodID = 35; From a9190c53e509ba95083c876aec4d6ec15c52c716 Mon Sep 17 00:00:00 2001 From: JvE Date: Thu, 15 Dec 2022 19:10:51 +0100 Subject: [PATCH 2/2] Fix additional bug in the random divine selection. --- Assets/Scripts/Game/Questing/QuestMCP.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Game/Questing/QuestMCP.cs b/Assets/Scripts/Game/Questing/QuestMCP.cs index 380f20a40b..7e7c5cfb2e 100644 --- a/Assets/Scripts/Game/Questing/QuestMCP.cs +++ b/Assets/Scripts/Game/Questing/QuestMCP.cs @@ -217,10 +217,8 @@ public override string God() { // Classic returns "BLANK" if no temple is found, here we return a random deity name. // We do the same for Fighters Guild halls, which are are considered temples in some areas. - const int minGodID = 21; - const int maxGodID = 35; + var god = GetRandomDivine(); - FactionFile.FactionIDs god = (FactionFile.FactionIDs)UnityEngine.Random.Range(minGodID, maxGodID + 1); return god.ToString(); } @@ -259,6 +257,22 @@ public override string Direction() return TextManager.Instance.GetLocalizedText("resolvingError"); } + + private static FactionFile.FactionIDs GetRandomDivine() + { + switch (UnityEngine.Random.Range(0, 9)) + { + case 0: return FactionFile.FactionIDs.Arkay; + case 1: return FactionFile.FactionIDs.Zen; + case 2: return FactionFile.FactionIDs.Mara; + case 3: return FactionFile.FactionIDs.Ebonarm; + case 4: return FactionFile.FactionIDs.Akatosh; + case 5: return FactionFile.FactionIDs.Julianos; + case 6: return FactionFile.FactionIDs.Dibella; + case 7: return FactionFile.FactionIDs.Stendarr; + default: return FactionFile.FactionIDs.Kynareth; + } + } } } }