Skip to content

Commit

Permalink
Fixed 1.0.2.5 Elder removal update
Browse files Browse the repository at this point in the history
  • Loading branch information
Piranha91 committed Dec 5, 2023
1 parent 8078bc1 commit 402cf39
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
44 changes: 28 additions & 16 deletions SynthEBD/Patcher/PatcherAux/UpdateHandler.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using DynamicData;
using Microsoft.Extensions.Logging;
using Mutagen.Bethesda.Plugins;
using System;
Expand Down Expand Up @@ -187,31 +188,42 @@ private void UpdateV1025RaceGroupings()
{
if (!_patcherState.UpdateLog.Performed1_0_2_5RGUpdate)
{
if (MessageWindow.DisplayNotificationYesNo("Version 1.0.2.5 Update", new List<string>() { "In previous SynthEBD versions, the Humanoid Playable race grouping erroneously included Elder Race.", "Would you like to fix this? (Recommend: Yes)"}, Environment.NewLine))
List<VM_RaceGrouping> toUpdateVMs = new();
var humanoidPlayableVM = _generalVM.RaceGroupingEditor.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase) && (x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRace.FormKey) || x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRaceVampire.FormKey))).FirstOrDefault();
if (humanoidPlayableVM != null)
{
var humanoidPlayableVM = _generalVM.RaceGroupingEditor.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (humanoidPlayableVM != null && (humanoidPlayableVM.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRace.FormKey) || humanoidPlayableVM.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRaceVampire.FormKey)))
toUpdateVMs.Add(humanoidPlayableVM);
}

foreach (var assetPack in _texMeshVM.AssetPacks)
{
humanoidPlayableVM = assetPack.RaceGroupingEditor.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase) && (x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRace.FormKey) || x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRaceVampire.FormKey))).FirstOrDefault();
if (humanoidPlayableVM != null)
{
toUpdateVMs.Add(humanoidPlayableVM);
}
}

RemoveEldersFromGrouping(humanoidPlayableVM.Races);
List<RaceGrouping> toUpdateMs = new();
foreach (var assetPack in _patcherState.AssetPacks)
{
var humanoidPlayableM = assetPack.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase) && (x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRace.FormKey) || x.Races.Contains(Mutagen.Bethesda.FormKeys.SkyrimSE.Skyrim.Race.ElderRaceVampire.FormKey))).FirstOrDefault();
if (humanoidPlayableM != null)
{
toUpdateMs.Add(humanoidPlayableM);
}
}

foreach (var assetPack in _texMeshVM.AssetPacks)
if ((toUpdateVMs.Any() || toUpdateMs.Any()) && MessageWindow.DisplayNotificationYesNo("Version 1.0.2.5 Update", new List<string>() { "In previous SynthEBD versions, the Humanoid Playable race grouping erroneously included Elder Race.", "Would you like to fix this? (Recommend: Yes)"}, Environment.NewLine))
{
foreach (var vm in toUpdateVMs)
{
var humanoidPlayableM = assetPack.RaceGroupingEditor.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (humanoidPlayableM != null)
{
RemoveEldersFromGrouping(humanoidPlayableM.Races);
}
RemoveEldersFromGrouping(vm.Races);
}

foreach (var assetPack in _patcherState.AssetPacks)
foreach (var m in toUpdateMs)
{
var humanoidPlayableM = assetPack.RaceGroupings.Where(x => x.Label.Equals("Humanoid Playable", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (humanoidPlayableM != null)
{
RemoveEldersFromGrouping(humanoidPlayableM.Races);
}
RemoveEldersFromGrouping(m.Races);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions SynthEBD/Settings/Settings_General/DefaultRaceGroupings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@ public class DefaultRaceGroupings
Skyrim.Race.OrcRace.FormKey,
Skyrim.Race.RedguardRace.FormKey,
Skyrim.Race.WoodElfRace.FormKey,
Skyrim.Race.ElderRace.FormKey,
Skyrim.Race.NordRaceVampire.FormKey,
Skyrim.Race.BretonRaceVampire.FormKey,
Skyrim.Race.DarkElfRaceVampire.FormKey,
Skyrim.Race.HighElfRaceVampire.FormKey,
Skyrim.Race.ImperialRaceVampire.FormKey,
Skyrim.Race.OrcRaceVampire.FormKey,
Skyrim.Race.RedguardRaceVampire.FormKey,
Skyrim.Race.WoodElfRaceVampire.FormKey,
Skyrim.Race.ElderRaceVampire.FormKey,
Skyrim.Race.WoodElfRaceVampire.FormKey
}
};

Expand Down

0 comments on commit 402cf39

Please sign in to comment.