Skip to content

Commit

Permalink
extension cleanup, typos, and some renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
cengelha committed Sep 4, 2023
1 parent c51129f commit bb24b3e
Show file tree
Hide file tree
Showing 26 changed files with 443 additions and 415 deletions.
5 changes: 5 additions & 0 deletions libNOM.io/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,14 @@ public class Container : IComparable<Container>, IEquatable<Container>

public GameVersionEnum GameVersion { get; internal set; } = GameVersionEnum.Unknown;

// Maximum length in-game is 42 characters.
public string SaveName // { get; set; }
{
get => string.IsNullOrEmpty(Extra.SaveName) ? Json.GetSaveName(_jsonObject) : Extra.SaveName;
set
{
value = value.AsSpanSubstring(0, Constants.SAVE_RENAMING_LENGTH_INGAME).ToString();

if (_jsonObject is not null)
SetJsonValue(value, "6f=.Pk4", "PlayerStateData.SaveName");

Expand All @@ -250,6 +253,8 @@ public class Container : IComparable<Container>, IEquatable<Container>
get => string.IsNullOrEmpty(Extra.SaveSummary) ? Json.GetSaveSummary(_jsonObject) : Extra.SaveSummary;
set
{
value = value.AsSpanSubstring(0, Constants.SAVE_RENAMING_LENGTH_MANIFEST - 1).ToString();

if (_jsonObject is not null)
SetJsonValue(value, "6f=.n:R", "PlayerStateData.SaveSummary");

Expand Down
38 changes: 19 additions & 19 deletions libNOM.io/Enums/DifficultyEnum.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace libNOM.io.Enums;


// libMBIN\Source\NMS\GameComponents\GcActiveSurvivalBarsDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcActiveSurvivalBarsDifficultyOption.cs#L7
public enum ActiveSurvivalBarsDifficultyEnum : uint
{
None,
Expand All @@ -10,39 +10,39 @@ public enum ActiveSurvivalBarsDifficultyEnum : uint
All,
}

// libMBIN\Source\NMS\GameComponents\GcHazardDrainDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcHazardDrainDifficultyOption.cs#L7
public enum HazardDrainDifficultyEnum : uint
{
Slow,
Normal,
Fast,
}

// libMBIN\Source\NMS\GameComponents\GcEnergyDrainDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcEnergyDrainDifficultyOption.cs#L7
public enum EnergyDrainDifficultyEnum : uint
{
Slow,
Normal,
Fast,
}

// libMBIN\Source\NMS\GameComponents\GcSubstanceCollectionDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcSubstanceCollectionDifficultyOption.cs#L7
public enum SubstanceCollectionDifficultyEnum : uint
{
High,
Normal,
Low,
}

// libMBIN\Source\NMS\GameComponents\GcSprintingCostDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcSprintingCostDifficultyOption.cs#L7
public enum SprintingCostDifficultyEnum : uint
{
Free,
Low,
Full,
}

// libMBIN\Source\NMS\GameComponents\GcScannerRechargeDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcScannerRechargeDifficultyOption.cs#L7
public enum ScannerRechargeDifficultyEnum : uint
{
VeryFast,
Expand All @@ -51,7 +51,7 @@ public enum ScannerRechargeDifficultyEnum : uint
Slow,
}

// libMBIN\Source\NMS\GameComponents\GcDamageReceivedDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcDamageReceivedDifficultyOption.cs#L7
public enum DamageReceivedDifficultyEnum : uint
{
None,
Expand All @@ -60,15 +60,15 @@ public enum DamageReceivedDifficultyEnum : uint
High,
}

// libMBIN\Source\NMS\GameComponents\GcBreakTechOnDamageDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcBreakTechOnDamageDifficultyOption.cs#L7
public enum BreakTechOnDamageProbabilityEnum : uint
{
None,
Low,
High,
}

// libMBIN\Source\NMS\GameComponents\GcDeathConsequencesDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcDeathConsequencesDifficultyOption.cs#L7
public enum DeathConsequencesDifficultyEnum : uint
{
None,
Expand All @@ -77,7 +77,7 @@ public enum DeathConsequencesDifficultyEnum : uint
DestroySave,
}

// libMBIN\Source\NMS\GameComponents\GcChargingRequirementsDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcChargingRequirementsDifficultyOption.cs#L7
public enum ChargingRequirementsDifficultyEnum : uint
{
None,
Expand All @@ -86,7 +86,7 @@ public enum ChargingRequirementsDifficultyEnum : uint
High,
}

// libMBIN\Source\NMS\GameComponents\GcFuelUseDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcFuelUseDifficultyOption.cs#L7
public enum FuelUseDifficultyEnum : uint
{
Free,
Expand All @@ -95,7 +95,7 @@ public enum FuelUseDifficultyEnum : uint
Expensive,
}

// libMBIN\Source\NMS\GameComponents\GcLaunchFuelCostDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcLaunchFuelCostDifficultyOption.cs#L7
public enum LaunchFuelCostDifficultyEnum : uint
{
Free,
Expand All @@ -104,7 +104,7 @@ public enum LaunchFuelCostDifficultyEnum : uint
High,
}

// libMBIN\Source\NMS\GameComponents\GcCurrencyCostDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcCurrencyCostDifficultyOption.cs#L7
public enum CurrencyCostDifficultyEnum : uint
{
Free,
Expand All @@ -113,31 +113,31 @@ public enum CurrencyCostDifficultyEnum : uint
Expensive,
}

// libMBIN\Source\NMS\GameComponents\GcItemShopAvailabilityDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcItemShopAvailabilityDifficultyOption.cs#L7
public enum ItemShopAvailabilityDifficultyEnum : uint
{
High,
Normal,
Low,
}

// libMBIN\Source\NMS\GameComponents\GcInventoryStackLimitsDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcInventoryStackLimitsDifficultyOption.cs#L7
public enum InventoryStackLimitsDifficultyEnum : uint
{
High,
Normal,
Low,
}

// libMBIN\Source\NMS\GameComponents\GcDamageGivenDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcDamageGivenDifficultyOption.cs#L7
public enum DamageGivenDifficultyEnum : uint
{
High,
Normal,
Low,
}

// libMBIN\Source\NMS\GameComponents\GcCombatTimerDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcCombatTimerDifficultyOption.cs#L7
public enum CombatTimerDifficultyOptionEnum : uint
{
Off,
Expand All @@ -146,15 +146,15 @@ public enum CombatTimerDifficultyOptionEnum : uint
Fast,
}

// libMBIN\Source\NMS\GameComponents\GcCreatureHostilityDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcCreatureHostilityDifficultyOption.cs#L7
public enum CreatureHostilityDifficultyEnum : uint
{
NeverAttack,
AttackIfProvoked,
FullEcosystem,
}

// libMBIN\Source\NMS\GameComponents\GcReputationGainDifficultyOption.cs
// https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcReputationGainDifficultyOption.cs#L7
public enum ReputationGainDifficultyEnum : uint
{
VeryFast,
Expand Down
2 changes: 1 addition & 1 deletion libNOM.io/Enums/DifficultyPresetTypeEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Specifies all available difficulties (PresetGameModeEnum was used for this before 4.00).
/// </summary>
/// <seealso cref="libMBIN\Source\NMS\GameComponents\GcDifficultyPresetType.cs"/>
/// <seealso href="https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcDifficultyPresetType.cs#L7"/>
public enum DifficultyPresetTypeEnum : uint
{
Invalid,
Expand Down
2 changes: 1 addition & 1 deletion libNOM.io/Enums/PersistentBaseTypesEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// <summary>
/// Specifies the different types a base can have.
/// </summary>
/// <seealso cref="libMBIN\Source\NMS\GameComponents\GcPersistentBaseTypes.cs"/>
/// <seealso href="https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcPersistentBaseTypes.cs#L7"/>
internal enum PersistentBaseTypesEnum : uint
{
HomePlanetBase,
Expand Down
2 changes: 1 addition & 1 deletion libNOM.io/Enums/PresetGameModeEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Specifies all game modes.
/// </summary>
/// <seealso cref="libMBIN\Source\NMS\GameComponents\GcGameMode.cs"/>
/// <seealso href="https://github.com/monkeyman192/MBINCompiler/blob/development/libMBIN/Source/NMS/GameComponents/GcGameMode.cs#L7"/>
public enum PresetGameModeEnum : ushort
{
Unspecified,
Expand Down
16 changes: 0 additions & 16 deletions libNOM.io/Extensions/Boolean.cs

This file was deleted.

16 changes: 16 additions & 0 deletions libNOM.io/Extensions/DateTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace libNOM.io.Extensions;


internal static class DateTimeOffsetExtensions
{
/// <summary>
/// Nullifies the last four digits of the current <see cref="DateTimeOffset"/> object.
/// </summary>
/// <param name="self"></param>
/// <returns></returns>
internal static DateTimeOffset ToBlobFileTime(this DateTimeOffset self)
{
var ticks = self.Ticks % (long)(Math.Pow(10, 4)) * -1; // get last four digits negative
return self.AddTicks(ticks);
}
}
34 changes: 0 additions & 34 deletions libNOM.io/Extensions/HumanizerLikeExtensions.cs

This file was deleted.

Loading

0 comments on commit bb24b3e

Please sign in to comment.