Skip to content

Commit 7e7d6d5

Browse files
Krowe-mohChompster864sval
authored
a bunch of stuff (#663)
Co-authored-by: Chompster86 <chompster86@gmail.com> Co-authored-by: Asval <asval.contactme@gmail.com>
1 parent 2212605 commit 7e7d6d5

24 files changed

Lines changed: 239 additions & 27 deletions

FModel/App.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ protected override void OnStartup(StartupEventArgs e)
9292
UserSettings.Default.AudioDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
9393
}
9494

95+
if (!Directory.Exists(UserSettings.Default.CodeDirectory))
96+
{
97+
createMe = true;
98+
UserSettings.Default.CodeDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
99+
}
100+
95101
if (!Directory.Exists(UserSettings.Default.ModelDirectory))
96102
{
97103
createMe = true;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using CUE4Parse.UE4.Assets.Exports;
2+
using CUE4Parse.UE4.Assets.Objects;
3+
using CUE4Parse.UE4.Objects.UObject;
4+
using SkiaSharp;
5+
6+
namespace FModel.Creator.Bases.FN;
7+
8+
public class BaseAssembledMesh : UCreator
9+
{
10+
public BaseAssembledMesh(UObject uObject, EIconStyle style) : base(uObject, style)
11+
{
12+
13+
}
14+
15+
public override void ParseForInfo()
16+
{
17+
if (Object.TryGetValue(out FInstancedStruct[] additionalData, "AdditionalData"))
18+
{
19+
foreach (var data in additionalData)
20+
{
21+
if (data.NonConstStruct?.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "SmallPreviewImage") == true)
22+
{
23+
Preview = Utils.GetBitmap(largePreview);
24+
}
25+
}
26+
}
27+
}
28+
29+
public override SKBitmap[] Draw()
30+
{
31+
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Premul);
32+
using var c = new SKCanvas(ret);
33+
34+
switch (Style)
35+
{
36+
case EIconStyle.NoBackground:
37+
DrawPreview(c);
38+
break;
39+
default:
40+
DrawBackground(c);
41+
DrawPreview(c);
42+
break;
43+
}
44+
45+
return new[] { ret };
46+
}
47+
}

FModel/Creator/Bases/FN/BaseIconStats.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public override void ParseForInfo()
8787
weaponRowValue.TryGetValue(out float dmgPb, "DmgPB"); //Damage at point blank
8888
weaponRowValue.TryGetValue(out float mdpc, "MaxDamagePerCartridge"); //Max damage a weapon can do in a single hit, usually used for shotguns
8989
weaponRowValue.TryGetValue(out float dmgCritical, "DamageZone_Critical"); //Headshot multiplier
90+
weaponRowValue.TryGetValue(out float envDmgPb, "EnvDmgPB"); //Structure damage at point blank
9091
weaponRowValue.TryGetValue(out int clipSize, "ClipSize"); //Item magazine size
9192
weaponRowValue.TryGetValue(out float firingRate, "FiringRate"); //Item firing rate, value is shots per second
9293
weaponRowValue.TryGetValue(out float swingTime, "SwingTime"); //Item swing rate, value is swing per second
@@ -115,6 +116,15 @@ public override void ParseForInfo()
115116
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), dmgPb * dmgCritical * multiplier, 160));
116117
}
117118
}
119+
{
120+
var envdmgmultiplier = bpc != 0f ? bpc : 1;
121+
if (envDmgPb != 0f)
122+
123+
{
124+
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "11AF67134E0F4E27E5E588806AB475BE", "Structure Damage"), envDmgPb * envdmgmultiplier, 160));
125+
}
126+
}
127+
118128
if (clipSize > 999f || clipSize == 0f)
119129
{
120130
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "068239DD4327B36124498C9C5F61C038", "Magazine Size"), Utils.GetLocalizedResource("", "0FAE8E5445029F2AA209ADB0FE49B23C", "Infinite"), -1));

FModel/Creator/CreatorPackage.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ public bool TryConstructCreator([MaybeNullWhen(false)] out UCreator creator)
100100
case "FortCodeTokenItemDefinition":
101101
case "FortSchematicItemDefinition":
102102
case "FortAlterableItemDefinition":
103+
case "SproutHousingItemDefinition":
103104
case "SparksKeyboardItemDefinition":
104105
case "FortWorldMultiItemDefinition":
105106
case "FortAlterationItemDefinition":
106107
case "FortExpeditionItemDefinition":
107108
case "FortIngredientItemDefinition":
108109
case "FortConsumableItemDefinition":
110+
case "SproutBuildingItemDefinition":
109111
case "StWFortAccoladeItemDefinition":
110112
case "FortAccountBuffItemDefinition":
111113
case "FortFOBCoreDecoItemDefinition":
@@ -163,6 +165,9 @@ public bool TryConstructCreator([MaybeNullWhen(false)] out UCreator creator)
163165
case "JunoAthenaDanceItemOverrideDefinition":
164166
creator = new BaseJuno(_object.Value, _style);
165167
return true;
168+
case "AssembledMeshSchema":
169+
creator = new BaseAssembledMesh(_object.Value, _style);
170+
return true;
166171
case "FortTandemCharacterData":
167172
creator = new BaseTandem(_object.Value, _style);
168173
return true;

FModel/Resources/Cpp.xshd

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<Color name="BooleanConstants" foreground="#569cd6" fontWeight="bold" />
1919

2020
<RuleSet ignoreCase="false">
21+
<Rule color="Comment">(\/\/.*|\/\*[\s\S]*?\*\/)</Rule>
2122
<Span color="String" begin="&quot;" end="&quot;" />
2223
<!-- UE Macros -->
2324
<Keywords color="UEMacro">
@@ -44,10 +45,19 @@
4445
<Word>Int16</Word>
4546
<Word>Int32</Word>
4647
<Word>Int64</Word>
48+
<Word>int8</Word>
49+
<Word>int16</Word>
50+
<Word>int32</Word>
51+
<Word>int64</Word>
4752
<Word>uint</Word>
53+
<Word>UInt8</Word>
4854
<Word>UInt16</Word>
4955
<Word>UInt32</Word>
5056
<Word>UInt64</Word>
57+
<Word>uint8</Word>
58+
<Word>uint16</Word>
59+
<Word>uint32</Word>
60+
<Word>uint64</Word>
5161
<Word>float</Word>
5262
<Word>double</Word>
5363
<Word>bool</Word>
@@ -83,6 +93,7 @@
8393
<Word>inline</Word>
8494
<Word>constexpr</Word>
8595
<Word>default</Word>
96+
<Word>&amp;&amp;</Word>
8697
</Keywords>
8798

8899
<Keywords color="Pointer">
@@ -120,8 +131,6 @@
120131

121132
<Rule color="Brace">[\[\]\{\}]</Rule>
122133

123-
<Rule color="Comment">(\/\/.*|\/\*[\s\S]*?\*\/)</Rule>
124-
125134
<!-- Template Functions -->
126135
<Rule color="Function">\b[A-Za-z_][A-Za-z0-9_]*\b(?=&lt;)</Rule>
127136

FModel/Settings/UserSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ public string AudioDirectory
119119
set => SetProperty(ref _audioDirectory, value);
120120
}
121121

122+
private string _codeDirectory;
123+
public string CodeDirectory
124+
{
125+
get => _codeDirectory;
126+
set => SetProperty(ref _codeDirectory, value);
127+
}
128+
122129
private string _modelDirectory;
123130
public string ModelDirectory
124131
{

FModel/ViewModels/ApiEndpoints/DillyApiEndpoints.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace FModel.ViewModels.ApiEndpoints;
1111
public class DillyApiEndpoint : AbstractApiProvider
1212
{
1313
private Backup[] _backups;
14+
private ManifestInfoDilly[] _manifests;
1415

1516
public DillyApiEndpoint(RestClient client) : base(client) { }
1617

@@ -27,6 +28,19 @@ public Backup[] GetBackups(CancellationToken token)
2728
return _backups ??= GetBackupsAsync(token).GetAwaiter().GetResult();
2829
}
2930

31+
public async Task<ManifestInfoDilly[]> GetManifestsAsync(CancellationToken token)
32+
{
33+
var request = new FRestRequest($"https://export-service-new.dillyapis.com/v1/manifests");
34+
var response = await _client.ExecuteAsync<ManifestInfoDilly[]>(request, token).ConfigureAwait(false);
35+
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
36+
return response.Data;
37+
}
38+
39+
public ManifestInfoDilly[] GetManifests(CancellationToken token)
40+
{
41+
return _manifests ??= GetManifestsAsync(token).GetAwaiter().GetResult();
42+
}
43+
3044
public async Task<IDictionary<string, IDictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
3145
{
3246
var request = new FRestRequest("https://api.fortniteapi.com/v1/cloudstorage/hotfixes")

FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ public class Backup
2323
[J] public string Url { get; private set; }
2424
}
2525

26+
[DebuggerDisplay("{" + nameof(AppName) + "}")]
27+
public class ManifestInfoDilly
28+
{
29+
[J] public string AppName { get; private set; }
30+
[J] public string DownloadUrl { get; private set; }
31+
}
32+
2633
public class Donator
2734
{
2835
[J] public string Username { get; private set; }

FModel/ViewModels/ApplicationViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public ApplicationViewModel()
104104
if (UserSettings.Default.CurrentDir is null)
105105
{
106106
//If no game is selected, many things will break before a shutdown request is processed in the normal way.
107-
//A hard exit is preferable to an unhandled expection in this case
107+
//A hard exit is preferable to an unhandled exception in this case
108108
Environment.Exit(0);
109109
}
110110

@@ -126,7 +126,6 @@ public ApplicationViewModel()
126126
if (sender is not IAesVfsReader reader) return;
127127
CUE4Parse.GameDirectory.Disable(reader);
128128
};
129-
130129
CustomDirectories = new CustomDirectoriesViewModel();
131130
SettingsView = new SettingsViewModel();
132131
AesManager = new AesManagerViewModel(CUE4Parse);

0 commit comments

Comments
 (0)