Skip to content

Commit c63721b

Browse files
authored
Merge pull request #561 from AllyJaxx/fortnite-creator-update
Updates to "Creator" features
2 parents c0a03ac + 99bcfb2 commit c63721b

File tree

10 files changed

+76
-26
lines changed

10 files changed

+76
-26
lines changed

FModel/Creator/Bases/FN/BaseBundle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public override void ParseForInfo()
5959
foreach (var reward in rewards)
6060
{
6161
if (!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue;
62-
quest.AddCompletionRequest(itemDefinition);
62+
quest.AddCompletionReward(itemDefinition);
6363
}
6464
_quests.Add(quest);
6565
}

FModel/Creator/Bases/FN/BaseCommunity.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ private string GetCosmeticSeason(string seasonNumber, bool bShort)
124124
if (!bShort) return base.GetCosmeticSeason(seasonNumber);
125125
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
126126
(int chapterIdx, int seasonIdx) = GetInternalSID(int.Parse(s));
127-
return $"C{chapterIdx} S{seasonIdx}";
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+
};
128135
}
129136

130137
private new void DrawBackground(SKCanvas c)

FModel/Creator/Bases/FN/BaseIcon.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,19 @@ protected string GetCosmeticSeason(string seasonNumber)
257257

258258
var season = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "SeasonTextFormat", "Season {0}");
259259
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")));
260261
if (initial <= 10) return Utils.RemoveHtmlTags(string.Format(introduced, string.Format(season, s)));
261262

262263
var chapter = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterTextFormat", "Chapter {0}");
263264
var chapterFormat = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "ChapterSeasonTextFormat", "{0}, {1}");
264265
var d = string.Format(chapterFormat, string.Format(chapter, chapterIdx), string.Format(season, seasonIdx));
265-
return Utils.RemoveHtmlTags(string.Format(introduced, d));
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+
};
266273
}
267274

268275
protected void CheckGameplayTags(FInstancedStruct[] dataList)

FModel/Creator/Bases/FN/BaseIconStats.cs

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,44 +84,68 @@ public override void ParseForInfo()
8484
weaponStatHandle.TryGetValue(out UDataTable dataTable, "DataTable") &&
8585
dataTable.TryGetDataTableRow(weaponRowName.Text, StringComparison.OrdinalIgnoreCase, out var weaponRowValue))
8686
{
87-
if (weaponRowValue.TryGetValue(out int bpc, "BulletsPerCartridge"))
87+
weaponRowValue.TryGetValue(out float dmgPb, "DmgPB"); //Damage at point blank
88+
weaponRowValue.TryGetValue(out float mdpc, "MaxDamagePerCartridge"); //Max damage a weapon can do in a single hit, usually used for shotguns
89+
weaponRowValue.TryGetValue(out float dmgCritical, "DamageZone_Critical"); //Headshot multiplier
90+
weaponRowValue.TryGetValue(out int clipSize, "ClipSize"); //Item magazine size
91+
weaponRowValue.TryGetValue(out float firingRate, "FiringRate"); //Item firing rate, value is shots per second
92+
weaponRowValue.TryGetValue(out float armTime, "ArmTime"); //Time it takes for traps to be able to be set off
93+
weaponRowValue.TryGetValue(out float reloadTime, "ReloadTime"); //Time it takes for a weapon to reload
94+
weaponRowValue.TryGetValue(out int bpc, "BulletsPerCartridge"); //Amount of pellets shot by a weapon at once, usually for shotguns
95+
weaponRowValue.TryGetValue(out float heatMax, "OverheatingMaxValue"); //Maximum heat overheating weapons can hold before they need to cool off
96+
weaponRowValue.TryGetValue(out float heatPerShot, "OverheatHeatingValue"); //Heat generated per shot on overheat weapons
97+
weaponRowValue.TryGetValue(out float overheatCooldown, "OverheatedCooldownDelay"); //Cooldown after a weapon reaches its maximum heat capacity
8898
{
8999
var multiplier = bpc != 0f ? bpc : 1;
90-
if (weaponRowValue.TryGetValue(out float dmgPb, "DmgPB") && dmgPb != 0f)
100+
if (dmgPb != 0f)
91101
{
92-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "35D04D1B45737BEA25B69686D9E085B9", "Damage"), dmgPb * multiplier, 200));
102+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "35D04D1B45737BEA25B69686D9E085B9", "Damage"), dmgPb * multiplier, 160));
93103
}
94104

95-
if (weaponRowValue.TryGetValue(out float mdpc, "MaxDamagePerCartridge") && mdpc >= 0f)
105+
if (mdpc > 0f && dmgPb * dmgCritical * multiplier > mdpc)
96106
{
97-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), mdpc, 200));
107+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), mdpc, 160));
98108
}
99-
else if (weaponRowValue.TryGetValue(out float dmgCritical, "DamageZone_Critical"))
109+
110+
else if (dmgCritical != 0f && dmgCritical != 1f && dmgPb != 0f)
100111
{
101-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), dmgPb * dmgCritical * multiplier, 200));
112+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), dmgPb * dmgCritical * multiplier, 160));
102113
}
103114
}
115+
if (clipSize > 999f || clipSize == 0f)
116+
{
117+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "068239DD4327B36124498C9C5F61C038", "Magazine Size"), Utils.GetLocalizedResource("", "0FAE8E5445029F2AA209ADB0FE49B23C", "Infinite"), -1));
118+
}
119+
120+
else if (clipSize != 0f)
121+
{
122+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "068239DD4327B36124498C9C5F61C038", "Magazine Size"), clipSize, 40));
123+
}
104124

105-
if (weaponRowValue.TryGetValue(out int clipSize, "ClipSize") && clipSize != 0)
125+
if (firingRate != 0f)
106126
{
107-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "068239DD4327B36124498C9C5F61C038", "Magazine Size"), clipSize, 50));
127+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "27B80BA44805ABD5A2D2BAB2902B250C", "Fire Rate"), firingRate, 11));
108128
}
109129

110-
if (weaponRowValue.TryGetValue(out float firingRate, "FiringRate") && firingRate != 0f)
130+
if (armTime != 0f)
111131
{
112-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "27B80BA44805ABD5A2D2BAB2902B250C", "Fire Rate"), firingRate, 15));
132+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "3BFEB8BD41A677CC5F45B9A90D6EAD6F", "Arming Delay"), armTime, 5));
113133
}
114134

115-
if (weaponRowValue.TryGetValue(out float armTime, "ArmTime") && armTime != 0f)
135+
if (reloadTime != 0f && clipSize < 999f && clipSize != 0f)
116136
{
117-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "3BFEB8BD41A677CC5F45B9A90D6EAD6F", "Arming Delay"), armTime, 125));
137+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "6EA26D1A4252034FBD869A90F9A6E49A", "Reload Time"), reloadTime, 10));
118138
}
119139

120-
if (weaponRowValue.TryGetValue(out float reloadTime, "ReloadTime") && reloadTime != 0f)
140+
if (overheatCooldown != 0f && clipSize > 999f || overheatCooldown != 0f && clipSize == 0f)
121141
{
122-
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "6EA26D1A4252034FBD869A90F9A6E49A", "Reload Time"), reloadTime, 15));
142+
_statistics.Add(new IconStat("Overheat Cooldown", overheatCooldown, 5));
123143
}
124144

145+
if (heatMax != 0f && heatPerShot != 0f && clipSize > 999f || heatMax != 0f && heatPerShot != 0f && clipSize == 0f)
146+
{
147+
_statistics.Add(new IconStat("Shots to Overheat", Math.Ceiling(heatMax / heatPerShot), 80));
148+
}
125149
if ((Object.ExportType.Equals("FortContextTrapItemDefinition", StringComparison.OrdinalIgnoreCase) ||
126150
Object.ExportType.Equals("FortTrapItemDefinition", StringComparison.OrdinalIgnoreCase)) &&
127151
weaponRowValue.TryGetValue(out UDataTable durabilityTable, "Durability") &&
@@ -285,6 +309,10 @@ public void Draw(SKCanvas c, SKColor sliderColor, int width, int height, ref flo
285309
_statPaint.Color = SKColors.White;
286310
c.DrawText(_value.ToString(), new SKPoint(width - 50, y + 10), _statPaint);
287311

312+
if (_maxValue == -1) //fill bar if max value is set to -1, for things that don't return a number here but should still be represented as the maximum value
313+
{
314+
c.DrawRect(new SKRect(height * 2, y, Math.Min(width - height, sliderRight), y + 5), _statPaint);
315+
}
288316
if (_maxValue < 1 || !float.TryParse(_value.ToString(), out var floatValue)) return;
289317
if (floatValue < 0)
290318
floatValue = 0;

FModel/Creator/Bases/FN/BaseQuest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public BaseQuest(int completionCount, EIconStyle style) : this(null, style) // c
4444
DisplayName = ReformatString(description, completionCount.ToString(), completionCount < 0);
4545
}
4646

47-
public void AddCompletionRequest(FSoftObjectPath itemDefinition)
47+
public void AddCompletionReward(FSoftObjectPath itemDefinition)
4848
{
4949
_rewards.Add(itemDefinition.TryLoad(out UObject uObject) ? new Reward(uObject) : new Reward());
5050
}
5151

52-
public void AddCompletionRequest(int quantity, string reward)
52+
public void AddCompletionReward(int quantity, string reward)
5353
{
5454
_rewards.Add(new Reward(quantity, reward));
5555
}

FModel/Creator/CreatorPackage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public bool TryConstructCreator([MaybeNullWhen(false)] out UCreator creator)
4949
case "CosmeticShoesItemDefinition":
5050
case "AthenaPickaxeItemDefinition":
5151
case "AthenaGadgetItemDefinition":
52-
case "AthenaGliderItemDefinition":
52+
case "AthenaGliderItemDefinition":
53+
case "AthenaHatItemDefinition":
5354
case "AthenaSprayItemDefinition":
5455
case "AthenaDanceItemDefinition":
5556
case "AthenaEmojiItemDefinition":

FModel/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ private async void OnLoaded(object sender, RoutedEventArgs e)
6363

6464
await ApplicationViewModel.InitOodle();
6565
await ApplicationViewModel.InitZlib();
66-
await ApplicationViewModel.InitDetex();
6766
await _applicationView.CUE4Parse.Initialize();
6867
await _applicationView.AesManager.InitAes();
6968
await _applicationView.UpdateProvider(true);
@@ -74,6 +73,7 @@ await Task.WhenAll(
7473
_applicationView.CUE4Parse.VerifyConsoleVariables(),
7574
_applicationView.CUE4Parse.VerifyOnDemandArchives(),
7675
_applicationView.CUE4Parse.InitMappings(),
76+
ApplicationViewModel.InitDetex(),
7777
ApplicationViewModel.InitVgmStream(),
7878
ApplicationViewModel.InitImGuiSettings(newOrUpdated),
7979
Task.Run(() =>

FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ public CommunityDesign GetDesign(string designName)
106106

107107
public void CheckForUpdates(bool launch = false)
108108
{
109-
if (DateTime.Now < UserSettings.Default.NextUpdateCheck) return;
109+
if (DateTime.Now < UserSettings.Default.NextUpdateCheck)
110+
{
111+
Log.Warning("Updates have been silenced until {DateTime}", UserSettings.Default.NextUpdateCheck);
112+
return;
113+
}
110114

111115
if (launch)
112116
{
@@ -140,7 +144,8 @@ private void CheckForUpdateEvent(UpdateInfoEventArgs args)
140144
{
141145
UserSettings.Default.LastUpdateCheck = DateTime.Now;
142146

143-
if (((CustomMandatory)args.Mandatory).CommitHash == Constants.APP_COMMIT_ID)
147+
var targetHash = ((CustomMandatory) args.Mandatory).CommitHash;
148+
if (targetHash == Constants.APP_COMMIT_ID)
144149
{
145150
if (UserSettings.Default.ShowChangelog)
146151
ShowChangelog(args);
@@ -152,6 +157,7 @@ private void CheckForUpdateEvent(UpdateInfoEventArgs args)
152157
UserSettings.Default.ShowChangelog = currentVersion != args.InstalledVersion;
153158

154159
const string message = "A new update is available!";
160+
Log.Warning("{message} Version {CurrentVersion} ({Hash})", message, currentVersion, targetHash);
155161
Helper.OpenWindow<AdonisWindow>(message, () => new UpdateView { Title = message, ResizeMode = ResizeMode.NoResize }.ShowDialog());
156162
}
157163
else

FModel/ViewModels/ApplicationViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public static async ValueTask InitZlib()
260260
ZlibHelper.Initialize(zlibPath);
261261
}
262262

263-
public static async ValueTask InitDetex()
263+
public static async Task InitDetex()
264264
{
265265
var detexPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", DetexHelper.DLL_NAME);
266266
if (File.Exists(DetexHelper.DLL_NAME))

FModel/Views/Resources/Controls/Rtb/CustomRichTextBox.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Windows.Documents;
77
using System.Windows.Input;
88
using System.Windows.Media;
9+
using System.Windows.Threading;
910

1011
namespace FModel.Views.Resources.Controls;
1112

@@ -54,7 +55,7 @@ public static void Append(ELog type, Action job)
5455
}
5556

5657
job();
57-
});
58+
}, DispatcherPriority.Background);
5859
}
5960

6061
public static void Text(string message, string color, bool newLine = false)

0 commit comments

Comments
 (0)