map viewer is back

This commit is contained in:
iAmAsval 2021-12-06 00:05:50 +01:00
parent 878b41b055
commit 66c8672ace
7 changed files with 57 additions and 144 deletions

@ -1 +1 @@
Subproject commit 2f2e881f50ce8b1fb27b5831227169df1720e436
Subproject commit 493afb80e59c1c97f4c0435dcfd81c07bf4a553c

View File

@ -199,8 +199,17 @@ namespace FModel.Creator.Bases.FN
{
var s = seasonNumber["Cosmetics.Filter.Season.".Length..];
var number = int.Parse(s);
if (number == 10)
s = "X";
switch (number)
{
case 10:
s = "X";
break;
case > 18:
number += 2;
s = number.ToString();
break;
}
var season = Utils.GetLocalizedResource("AthenaSeasonItemDefinitionInternal", "SeasonTextFormat", "Season {0}");
var introduced = Utils.GetLocalizedResource("Fort.Cosmetics", "CosmeticItemDescription_Season", "\nIntroduced in <SeasonText>{0}</>.");

View File

@ -6,12 +6,12 @@
<UseWPF>true</UseWPF>
<ApplicationIcon>FModel.ico</ApplicationIcon>
<Version>4.1.0</Version>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<FileVersion>4.1.0.0</FileVersion>
<AssemblyVersion>4.1.0.1</AssemblyVersion>
<FileVersion>4.1.0.1</FileVersion>
<IsPackable>false</IsPackable>
<IsPublishable>true</IsPublishable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<PublishSingleFile Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<StartupObject>FModel.App</StartupObject>
</PropertyGroup>

View File

@ -177,25 +177,25 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<!-- <MenuItem Header="Map Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_MapViewer" IsEnabled="{Binding IsReady}"> -->
<!-- <MenuItem.Icon> -->
<!-- <Viewbox Width="16" Height="16"> -->
<!-- <Canvas Width="24" Height="24"> -->
<!-- <Path Fill="{DynamicResource {x:Static adonisUi:Brushes.AccentForegroundBrush}}" Data="{StaticResource MapIcon}" /> -->
<!-- </Canvas> -->
<!-- </Viewbox> -->
<!-- </MenuItem.Icon> -->
<!-- <MenuItem.Style> -->
<!-- <Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}"> -->
<!-- <Setter Property="Visibility" Value="Collapsed"/> -->
<!-- <Style.Triggers> -->
<!-- <DataTrigger Binding="{Binding CUE4Parse.Game}" Value="{x:Static local:FGame.FortniteGame}"> -->
<!-- <Setter Property="Visibility" Value="Visible" /> -->
<!-- </DataTrigger> -->
<!-- </Style.Triggers> -->
<!-- </Style> -->
<!-- </MenuItem.Style> -->
<!-- </MenuItem> -->
<MenuItem Header="Map Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_MapViewer" IsEnabled="{Binding IsReady}">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.AccentForegroundBrush}}" Data="{StaticResource MapIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
<MenuItem.Style>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CUE4Parse.Game}" Value="{x:Static local:FGame.FortniteGame}">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</MenuItem.Style>
</MenuItem>
<MenuItem Header="Image Merger" Command="{Binding MenuCommand}" CommandParameter="Views_ImageMerger">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">

View File

@ -235,7 +235,7 @@ namespace FModel.Settings
private IDictionary<FGame, EGame> _overridedGame = new Dictionary<FGame, EGame>
{
{FGame.Unknown, EGame.GAME_UE4_LATEST},
{FGame.FortniteGame, EGame.GAME_UE4_LATEST},
{FGame.FortniteGame, EGame.GAME_UE5_LATEST},
{FGame.ShooterGame, EGame.GAME_Valorant},
{FGame.DeadByDaylight, EGame.GAME_UE4_LATEST},
{FGame.OakGame, EGame.GAME_Borderlands3},

View File

@ -10,6 +10,7 @@ using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse.UE4.Assets.Objects;
using CUE4Parse.UE4.Objects.Core.i18N;
using CUE4Parse.UE4.Objects.Core.Math;
using CUE4Parse.UE4.Objects.GameplayTags;
using CUE4Parse.UE4.Objects.UObject;
using FModel.Creator;
using FModel.Extensions;
@ -95,13 +96,6 @@ namespace FModel.ViewModels
set => SetProperty(ref _brFireflies, value, "ApolloGameplay_Fireflies");
}
private bool _brCubeMovements;
public bool BrCubeMovements
{
get => _brCubeMovements;
set => SetProperty(ref _brCubeMovements, value, "ApolloGameplay_CubeMovements");
}
private bool _prLandmarks;
public bool PrLandmarks
{
@ -276,9 +270,6 @@ namespace FModel.ViewModels
case "ApolloGameplay_Fireflies":
await LoadFireflies();
break;
case "ApolloGameplay_CubeMovements":
await LoadCubeMovements();
break;
case "PapayaGameplay_CannonballGame":
await LoadCannonballGame();
break;
@ -383,13 +374,13 @@ namespace FModel.ViewModels
await _threadWorkerView.Begin(_ =>
{
if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerBR.Default__UIMapManagerBR_C", out UObject mapManager) ||
!mapManager.TryGetValue(out UObject mapMaterial, "MapMaterial") ||
!mapMaterial.TryGetValue(out FStructFallback cachedExpressionData, "CachedExpressionData") ||
!cachedExpressionData.TryGetValue(out FStructFallback parameters, "Parameters") ||
!parameters.TryGetValue(out UTexture2D[] textureValues, "TextureValues")) return;
// if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerBR.Default__UIMapManagerBR_C", out UObject mapManager) ||
// !mapManager.TryGetValue(out UObject mapMaterial, "MapMaterial") ||
// !mapMaterial.TryGetValue(out FStructFallback cachedExpressionData, "CachedExpressionData") ||
// !cachedExpressionData.TryGetValue(out FStructFallback parameters, "Parameters") ||
// !parameters.TryGetValue(out UTexture2D[] textureValues, "TextureValues")) return;
_bitmaps[0][_FIRST_BITMAP] = new MapLayer{Layer = Utils.GetBitmap(textureValues[0]), IsEnabled = true};
_bitmaps[0][_FIRST_BITMAP] = new MapLayer{Layer = Utils.GetBitmap("FortniteGame/Content/Athena/Apollo/Maps/UI/Apollo_Terrain_Minimap.Apollo_Terrain_Minimap"), IsEnabled = true};
_brMiniMapImage = GetImageSource(_bitmaps[0][_FIRST_BITMAP].Layer);
});
}
@ -401,11 +392,11 @@ namespace FModel.ViewModels
await _threadWorkerView.Begin(_ =>
{
if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerPapaya.Default__UIMapManagerPapaya_C", out UObject mapManager) ||
!mapManager.TryGetValue(out UMaterial mapMaterial, "MapMaterial") ||
mapMaterial.ReferencedTextures.Count < 1) return;
// if (!Utils.TryLoadObject("FortniteGame/Content/UI/IngameMap/UIMapManagerPapaya.Default__UIMapManagerPapaya_C", out UObject mapManager) ||
// !mapManager.TryGetValue(out UMaterial mapMaterial, "MapMaterial") ||
// mapMaterial.ReferencedTextures.Count < 1) return;
_bitmaps[1][_FIRST_BITMAP] = new MapLayer{Layer = Utils.GetBitmap(mapMaterial.ReferencedTextures[0] as UTexture2D), IsEnabled = true};
_bitmaps[1][_FIRST_BITMAP] = new MapLayer{Layer = Utils.GetBitmap("FortniteGame/Content/Athena/Apollo/Maps/Special/Papaya/UI/MiniMapPapaya.MiniMapPapaya"), IsEnabled = true};
_prMiniMapImage = GetImageSource(_bitmaps[1][_FIRST_BITMAP].Layer);
});
}
@ -474,12 +465,16 @@ namespace FModel.ViewModels
var patrolsPathBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(patrolsPathBitmap);
var exports = Utils.LoadExports("/NPCLibrary/LevelOverlays/Apollo_Terrain_NPCLibrary_Overlay_S18");
var exports = Utils.LoadExports("/NPCLibrary/LevelOverlays/Artemis_Overlay_S19_NPCLibrary");
foreach (var export in exports)
{
if (!export.ExportType.Equals("FortAthenaPatrolPath", StringComparison.OrdinalIgnoreCase) ||
!export.TryGetValue(out FPackageIndex[] patrolPoints, "PatrolPoints")) continue;
var displayName = export.Name["FortAthenaPatrolPath_".Length..];
if (export.TryGetValue(out FGameplayTagContainer gameplayTags, "GameplayTags") && gameplayTags.GameplayTags.Length > 0)
displayName = gameplayTags.GameplayTags[0].Text["Athena.AI.SpawnLocation.Tandem.".Length..];
if (!Utils.TryGetPackageIndexExport(patrolPoints[0], out UObject uObject) ||
!uObject.TryGetValue(out FPackageIndex rootComponent, "RootComponent") ||
!Utils.TryGetPackageIndexExport(rootComponent, out uObject) ||
@ -487,7 +482,6 @@ namespace FModel.ViewModels
var path = new SKPath();
var vector = GetMapPosition(relativeLocation, _brRadius);
var displayName = export.Name["FortAthenaPatrolPath_Tandem_S18_".Length..];
path.MoveTo(vector.X, vector.Y);
for (var i = 1; i < patrolPoints.Length; i++)
@ -737,7 +731,7 @@ namespace FModel.ViewModels
var upgradeBenchesBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(upgradeBenchesBitmap);
var exports = Utils.LoadExports("/NPCLibrary/LevelOverlays/Apollo_Terrain_NPCLibrary_Stations_UpgradeBenches");
var exports = Utils.LoadExports("/NPCLibrary/LevelOverlays/Artemis_Overlay_S19_UpgradeBenches");
foreach (var export in exports)
{
if (!export.ExportType.Equals("B_Athena_Spawner_UpgradeStation_C", StringComparison.OrdinalIgnoreCase)) continue;
@ -793,7 +787,7 @@ namespace FModel.ViewModels
var vendingMachinesBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(vendingMachinesBitmap);
var exports = Utils.LoadExports("FortniteGame/Content/Athena/Apollo/Maps/Special/ItemCollections/Apollo_Item_VendingMachines");
var exports = Utils.LoadExports("/NPCLibrary/LevelOverlays/Artemis_Overlay_S19_ServiceStations");
foreach (var export in exports)
{
if (!export.ExportType.Equals("B_Athena_Spawner_VendingMachine_MendingOnly_C", StringComparison.OrdinalIgnoreCase) &&
@ -874,93 +868,5 @@ namespace FModel.ViewModels
_bitmaps[0]["ApolloGameplay_TagsLocation"] = new MapLayer {Layer = tagsLocationBitmap, IsEnabled = false};
});
}
/// <summary>
/// FortniteGame/Plugins/GameFeatures/CorruptionGameplay/Content/CorruptionGameplay_LevelOverlay.uasset
/// too lazy to filters
/// </summary>
private async Task LoadCubeMovements()
{
await _threadWorkerView.Begin(_ =>
{
_fillPaint.StrokeWidth = 5;
var cubeMovementsBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(cubeMovementsBitmap);
if (!Utils.TryLoadObject("/CorruptionGameplay/Levels/CorruptionGameplay_ApolloTerrain_Overlay.BP_CubeMovementGradient_2", out UObject overlay) ||
!overlay.TryGetValue(out FSoftObjectPath[] cubeMovementStaticPaths, "cubeMovementStaticPaths") || cubeMovementStaticPaths.Length < 1)
return;
var oldColor = _pathPaint.Color;
_pathPaint.Color = SKColors.Purple;
foreach (var cubeMovementStaticPath in cubeMovementStaticPaths)
{
var objectPath = cubeMovementStaticPath.AssetPathName.Text.SubstringBeforeLast(".");
var objectName = cubeMovementStaticPath.SubPathString.SubstringAfterLast(".");
if (!Utils.TryLoadObject($"{objectPath}.{objectName}", out UObject staticPath))
return;
DrawCubeMovements(c, staticPath, true);
}
if (Utils.TryLoadObject("/CorruptionGameplay/Levels/CubeMovement/Apollo_CM_Gold_Overlay.CM_Spline_Gold", out UObject goldPath))
{
_pathPaint.Color = SKColors.Gold;
DrawCubeMovements(c, goldPath, false);
}
_pathPaint.Color = oldColor;
_bitmaps[0]["ApolloGameplay_CubeMovements"] = new MapLayer {Layer = cubeMovementsBitmap, IsEnabled = false};
});
}
private void DrawCubeMovements(SKCanvas c, UObject staticPath, bool fixLocation)
{
if (!staticPath.TryGetValue(out FStructFallback[] pathTravelers, "PathTravelers") || pathTravelers.Length < 1 ||
!pathTravelers[0].TryGetValue(out FPackageIndex[] generatedSplinesArray, "GeneratedSplinesArray") || generatedSplinesArray.Length < 1)
return;
UObject uObject;
var parentRelativeLocation = new FVector();
if (fixLocation)
{
if (!pathTravelers[0].TryGetValue(out FPackageIndex pathTraveler, "PathTraveler") ||
!Utils.TryGetPackageIndexExport(pathTraveler, out uObject) ||
!uObject.TryGetValue(out FPackageIndex rootComponent, "RootComponent") ||
!Utils.TryGetPackageIndexExport(rootComponent, out uObject) ||
!uObject.TryGetValue(out parentRelativeLocation, "RelativeLocation"))
return;
}
var bDone = false;
var path = new SKPath();
foreach (var generatedSpline in generatedSplinesArray)
{
if (!Utils.TryGetPackageIndexExport(generatedSpline, out uObject) ||
!uObject.TryGetValue(out FVector relativeLocation, "RelativeLocation")) continue;
if (!uObject.TryGetValue(out FStructFallback splineCurves, "SplineCurves") ||
!splineCurves.TryGetValue(out FStructFallback positions, "Position") ||
!positions.TryGetValue(out FStructFallback[] positionPoints, "Points")) continue;
foreach (var positionPoint in positionPoints)
{
if (!positionPoint.TryGetValue(out FVector point, "OutVal")) continue;
var vector = GetMapPosition(parentRelativeLocation + relativeLocation + point, _brRadius);
if (!bDone)
{
path.MoveTo(vector.X, vector.Y);
bDone = true;
}
else
{
path.LineTo(vector.X, vector.Y);
}
}
}
c.DrawPath(path, _pathPaint);
}
}
}

View File

@ -33,14 +33,12 @@
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<CheckBox Content="Upgrade Benches" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrUpgradeBenches}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<CheckBox Content="Phonebooths" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrPhonebooths}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<!-- <CheckBox Content="Phonebooths" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrPhonebooths}" -->
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> -->
<CheckBox Content="Weapon-o-matic/Mending Machines" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrVendingMachines}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<CheckBox Content="Fireflies" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrFireflies}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<CheckBox Content="Cube Movements" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrCubeMovements}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
<!-- <CheckBox Content="Fireflies" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrFireflies}" -->
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> -->
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="PrTemplate">