Skip to content

Commit 75bdfc1

Browse files
committed
automated GetInternalSID using Athena_SeasonTitles
1 parent 66bdddd commit 75bdfc1

File tree

5 files changed

+31
-59
lines changed

5 files changed

+31
-59
lines changed

FModel/Creator/Bases/FN/BaseCommunity.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,9 @@ private string GetCosmeticSeason(string seasonNumber, bool bShort)
123123
{
124124
if (!bShort) return base.GetCosmeticSeason(seasonNumber);
125125
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
126-
(int chapterIdx, int seasonIdx) = GetInternalSID(int.Parse(s));
127-
return s switch
128-
{
129-
"10" => $"C{chapterIdx} SX",
130-
"27" => $"Fortnite: OG",
131-
"32" => $"Fortnite: Remix",
132-
"35" => $"C{chapterIdx} MS1",
133-
_ => $"C{chapterIdx} S{seasonIdx}"
134-
};
126+
(string chapterIdx, string seasonIdx, bool onlySeason) = GetInternalSID(s);
127+
var prefix = int.TryParse(seasonIdx, out _) ? "S" : "";
128+
return onlySeason ? $"{prefix}{seasonIdx}" : $"C{chapterIdx} {prefix}{seasonIdx}";
135129
}
136130

137131
private new void DrawBackground(SKCanvas c)

FModel/Creator/Bases/FN/BaseIcon.cs

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -221,55 +221,32 @@ protected string GetCosmeticSet(string setName)
221221
return Utils.RemoveHtmlTags(string.Format(format, name));
222222
}
223223

224-
protected (int, int) GetInternalSID(int number)
224+
protected (string, string, bool) GetInternalSID(string number)
225225
{
226-
static int GetSeasonsInChapter(int chapter) => chapter switch
227-
{
228-
1 => 10,
229-
2 => 8,
230-
3 => 4,
231-
4 => 5,
232-
5 => 5,
233-
_ => 10
234-
};
235-
236-
var chapterIdx = 0;
237-
var seasonIdx = 0;
238-
while (number > 0)
239-
{
240-
var seasonsInChapter = GetSeasonsInChapter(++chapterIdx);
241-
if (number > seasonsInChapter)
242-
number -= seasonsInChapter;
243-
else
244-
{
245-
seasonIdx = number;
246-
number = 0;
247-
}
248-
}
249-
return (chapterIdx, seasonIdx);
226+
if (!Utils.TryLoadObject("FortniteGame/Plugins/GameFeatures/BattlePassBase/Content/DataTables/Athena_SeasonTitles.Athena_SeasonTitles", out UDataTable seasonTitles) ||
227+
!seasonTitles.TryGetDataTableRow(number, StringComparison.InvariantCulture, out var row) ||
228+
!row.TryGetValue(out FText chapterText, "DisplayChapterText") ||
229+
!row.TryGetValue(out FText seasonText, "DisplaySeasonText") ||
230+
!row.TryGetValue(out FName displayType, "DisplayType"))
231+
return (string.Empty, string.Empty, true);
232+
233+
var onlySeason = displayType.Text.EndsWith("::OnlySeason") || (chapterText.Text == seasonText.Text && !int.TryParse(seasonText.Text, out _));
234+
return (chapterText.Text, seasonText.Text, onlySeason);
250235
}
251236

252237
protected string GetCosmeticSeason(string seasonNumber)
253238
{
254239
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
255-
var initial = int.Parse(s);
256-
(int chapterIdx, int seasonIdx) = GetInternalSID(initial);
240+
(string chapterIdx, string seasonIdx, bool onlySeason) = GetInternalSID(s);
257241

258242
var season = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "SeasonTextFormat", "Season {0}");
259243
var introduced = Utils.GetLocalizedResource("Fort.Cosmetics", "CosmeticItemDescription_Season", "\nIntroduced in <SeasonText>{0}</>.");
260-
if (s == "10") return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, "X")));
261-
if (initial <= 10) return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, s)));
244+
if (onlySeason) return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, seasonIdx)));
262245

263246
var chapter = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterTextFormat", "Chapter {0}");
264247
var chapterFormat = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterSeasonTextFormat", "{0}, {1}");
265248
var d = string.Format(chapterFormat, string.Format(chapter, chapterIdx), string.Format(season, seasonIdx));
266-
return s switch
267-
{
268-
"27" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format("Fortnite: OG"))),
269-
"32" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format("Fortnite: Remix"))),
270-
"35" => Utils.RemoveHtmlTags(string.Format(introduced, string.Format(chapterFormat, string.Format(chapter, chapterIdx), string.Format("MS1")))),
271-
_ => Utils.RemoveHtmlTags(string.Format(introduced, d))
272-
};
249+
return Utils.RemoveHtmlTags(string.Format(introduced, d));
273250
}
274251

275252
protected void CheckGameplayTags(FInstancedStruct[] dataList)

FModel/ViewModels/CUE4ParseViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
using CUE4Parse.UE4.Localization;
3131
using CUE4Parse.UE4.Objects.Core.Serialization;
3232
using CUE4Parse.UE4.Objects.Engine;
33-
using CUE4Parse.UE4.Oodle.Objects;
33+
using CUE4Parse.UE4.Oodle.Objects;
3434
using CUE4Parse.UE4.Pak;
3535
using CUE4Parse.UE4.Readers;
3636
using CUE4Parse.UE4.Shaders;
@@ -39,6 +39,7 @@
3939
using CUE4Parse_Conversion;
4040
using CUE4Parse_Conversion.Sounds;
4141
using CUE4Parse.FileProvider.Objects;
42+
using CUE4Parse.GameTypes.AshEchoes.FileProvider;
4243
using CUE4Parse.UE4.Assets;
4344
using CUE4Parse.UE4.BinaryConfig;
4445
using CUE4Parse.UE4.Objects.UObject;

FModel/Views/SettingsView.xaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,10 @@
465465
IsChecked="{Binding SaveSkeletonAsMesh, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
466466
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 0"/>
467467

468-
<TextBlock Grid.Row="16" Grid.Column="0" Text="Save HDR Textures as Radiance .hdr" VerticalAlignment="Center" />
469-
<CheckBox Grid.Row="16" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
470-
IsChecked="{Binding SaveHdrTexturesAsHdr, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
471-
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 0"/>
472-
473-
<Separator Grid.Row="17" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
468+
<Separator Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
474469

475-
<TextBlock Grid.Row="18" Grid.Column="0" Text="Nanite Format" VerticalAlignment="Center" Margin="0 0 0 5" />
476-
<ComboBox Grid.Row="18" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.NaniteMeshExportFormats}" SelectedItem="{Binding SettingsView.SelectedNaniteMeshExportFormat, Mode=TwoWay}"
470+
<TextBlock Grid.Row="17" Grid.Column="0" Text="Nanite Format" VerticalAlignment="Center" Margin="0 0 0 5" />
471+
<ComboBox Grid.Row="17" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.NaniteMeshExportFormats}" SelectedItem="{Binding SettingsView.SelectedNaniteMeshExportFormat, Mode=TwoWay}"
477472
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
478473
<ComboBox.ItemTemplate>
479474
<DataTemplate>
@@ -482,8 +477,8 @@
482477
</ComboBox.ItemTemplate>
483478
</ComboBox>
484479

485-
<TextBlock Grid.Row="19" Grid.Column="0" Text="Material Format" VerticalAlignment="Center" Margin="0 0 0 5" />
486-
<ComboBox Grid.Row="19" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.MaterialExportFormats}" SelectedItem="{Binding SettingsView.SelectedMaterialExportFormat, Mode=TwoWay}"
480+
<TextBlock Grid.Row="18" Grid.Column="0" Text="Material Format" VerticalAlignment="Center" Margin="0 0 0 5" />
481+
<ComboBox Grid.Row="18" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.MaterialExportFormats}" SelectedItem="{Binding SettingsView.SelectedMaterialExportFormat, Mode=TwoWay}"
487482
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
488483
<ComboBox.ItemTemplate>
489484
<DataTemplate>
@@ -492,15 +487,20 @@
492487
</ComboBox.ItemTemplate>
493488
</ComboBox>
494489

495-
<TextBlock Grid.Row="20" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
496-
<ComboBox Grid.Row="20" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
490+
<TextBlock Grid.Row="19" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
491+
<ComboBox Grid.Row="19" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
497492
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
498493
<ComboBox.ItemTemplate>
499494
<DataTemplate>
500495
<TextBlock Text="{Binding Converter={x:Static converters:EnumToStringConverter.Instance}}" />
501496
</DataTemplate>
502497
</ComboBox.ItemTemplate>
503498
</ComboBox>
499+
500+
<TextBlock Grid.Row="20" Grid.Column="0" Text="Save HDR Textures as Radiance .hdr" VerticalAlignment="Center" />
501+
<CheckBox Grid.Row="20" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
502+
IsChecked="{Binding SaveHdrTexturesAsHdr, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
503+
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
504504
</Grid>
505505
</DataTemplate>
506506
<DataTemplate x:Key="KeybindingsTemplate">

0 commit comments

Comments
 (0)