Skip to content

Commit

Permalink
Merge pull request #147 from LoadedCamel/dev
Browse files Browse the repository at this point in the history
3.4.5 PR
  • Loading branch information
Metalios authored Sep 13, 2022
2 parents ecdd33d + 8a04c27 commit 345576d
Show file tree
Hide file tree
Showing 40 changed files with 388 additions and 400 deletions.
3 changes: 2 additions & 1 deletion MidsReborn/Core/Base/Data_Classes/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ public string BuildEffectStringShort(bool noMag = false, bool simple = false, bo

public string BuildEffectString(bool simple = false, string specialCat = "", bool noMag = false, bool grouped = false, bool useBaseProbability = false, bool fromPopup = false, bool editorDisplay = false, bool dvDisplay = false, bool ignoreConditions = false)
{
if (MidsContext.Config is null) return string.Empty;
var sBuild = string.Empty;
var sSubEffect = string.Empty;
var sSubSubEffect = string.Empty;
Expand Down Expand Up @@ -1476,7 +1477,7 @@ public string BuildEffectString(bool simple = false, string specialCat = "", boo
sSubEffect = Enum.GetName(PowerAttribs.GetType(), PowerAttribs);
sBuild = sSubEffect switch
{
"Accuracy" => $"{sEffect}({sSubEffect}) to {AtrModAccuracy} ({Convert.ToDecimal(AtrModAccuracy * DatabaseAPI.ServerData.BaseToHit * 100f):0.##}%)",
"Accuracy" => $"{sEffect}({sSubEffect}) to {AtrModAccuracy} ({Convert.ToDecimal(AtrModAccuracy * MidsContext.Config.ScalingToHit * 100f):0.##}%)",
"ActivateInterval" => $"{sEffect}({sSubEffect}) to {AtrModActivatePeriod} second(s)",
"Arc" => $"{sEffect}({sSubEffect}) to {AtrModArc} degrees",
"CastTime" => $"{sEffect}({sSubEffect}) to {AtrModCastTime} second(s)",
Expand Down
8 changes: 4 additions & 4 deletions MidsReborn/Core/Base/Master_Classes/MidsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public static class MidsContext
public const string AppName = "Mids' Reborn";
private const int AppMajorVersion = 3;
private const int AppMinorVersion = 4;
private const int AppBuildVersion = 3;
private const int AppRevisionVersion = 43;
private const int AppBuildVersion = 5;
private const int AppRevisionVersion = 2;

public const string AssemblyVersion = "3.4.3";
public const string AssemblyFileVersion = "3.4.3.43";
public const string AssemblyVersion = "3.4.5";
public const string AssemblyFileVersion = "3.4.5.2";
public static Version AppFileVersion { get; set; } = new(AppMajorVersion, AppMinorVersion, AppBuildVersion, AppRevisionVersion);

public const string AppVersionStatus = "";
Expand Down
37 changes: 26 additions & 11 deletions MidsReborn/Core/ConfigData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public enum ETotalsWindowTitleStyle

public Enums.eSpeedMeasure SpeedFormat = Enums.eSpeedMeasure.MilesPerHour;
public string UpdatePath = "https://midsreborn.com/mids_updates/app/update_manifest.xml";
public string AppChangeLog { get; set; }
public string DbChangeLog { get; set; }
public string? AppChangeLog { get; set; }
public string? DbChangeLog { get; set; }
public bool CoDEffectFormat = false;


Expand Down Expand Up @@ -84,14 +84,16 @@ public ConfigData()
public FontSettings RtFont { get; } = new();
public Dictionary<string, int> TeamMembers { get; }

public string WindowState { get; set; }
public string? WindowState { get; set; }
public Rectangle Bounds { get; set; }

public bool ApplicationRegistered { get; set; }
public bool Authorized { get; set; }
public bool Registered { get; set; }
public bool UseOldTotalsWindow { get; set; }
public float BaseAcc { get; set; } = 0.75f;

public float ScalingToHit { get; set; } = DatabaseAPI.ServerData.BaseToHit;

public bool DoNotUpdateFileAssociation { get; set; }
public int ExempHigh { get; set; } = 50;
public int TeamSize { get; set; } = 1;
Expand Down Expand Up @@ -166,11 +168,11 @@ public string BuildsPath
}
}

public string DataPath { get; set; }
public string? DataPath { get; set; }

private string _savePath = Files.FDefaultPath;
private string? _savePath = Files.FDefaultPath;

public string SavePath
public string? SavePath
{
get => _savePath;
set
Expand All @@ -192,9 +194,6 @@ public string SavePath

public bool FirstRun { get; set; }




public Enums.RewardCurrency PreferredCurrency = Enums.RewardCurrency.RewardMerit;

public bool ShowSelfBuffsAny { get; set; }
Expand All @@ -210,6 +209,22 @@ internal static ConfigData? Current
}
}

internal readonly List<KeyValuePair<string, float>> RelativeScales = new()
{
new KeyValuePair<string, float>("Enemy Relative Level: -4", 0.95f),
new KeyValuePair<string, float>("Enemy Relative Level: -3", 0.9f),
new KeyValuePair<string, float>("Enemy Relative Level: -2", 0.85f),
new KeyValuePair<string, float>("Enemy Relative Level: -1", 0.8f),
new KeyValuePair<string, float>("Enemy Relative Level: Default", 0.75f),
new KeyValuePair<string, float>("Enemy Relative Level: +1", 0.65f),
new KeyValuePair<string, float>("Enemy Relative Level: +2", 0.56f),
new KeyValuePair<string, float>("Enemy Relative Level: +3", 0.48f),
new KeyValuePair<string, float>("Enemy Relative Level: +4", 0.39f),
new KeyValuePair<string, float>("Enemy Relative Level: +5", 0.3f),
new KeyValuePair<string, float>("Enemy Relative Level: +6", 0.2f),
new KeyValuePair<string, float>("Enemy Relative Level: +7", 0.08f)
};

public void ResetBuildsPath()
{
BuildsPath = Files.FDefaultBuildsPath;
Expand All @@ -232,7 +247,7 @@ public static void Initialize(ISerialize serializer)
}
}

_current.InitializeComponent();
_current?.InitializeComponent();
}

private void InitializeComponent()
Expand Down
36 changes: 18 additions & 18 deletions MidsReborn/Core/DatabaseAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ private static void CheckEhcBoosts()

public static bool RealmUsesToxicDef() => DatabaseName.Equals("Homecoming");

public static void SaveServerData(string iPath)
public static void SaveServerData(string? iPath)
{
var path = Files.SelectDataFileSave(Files.MxdbFileSd, iPath);
FileStream fileStream;
Expand Down Expand Up @@ -1330,7 +1330,7 @@ public static void SaveServerData(string iPath)
}
}

public static bool LoadServerData(string iPath)
public static bool LoadServerData(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileSd, iPath);

Expand Down Expand Up @@ -1393,7 +1393,7 @@ public static bool LoadServerData(string iPath)
return true;
}

public static void SaveMainDatabase(ISerialize serializer, string iPath)
public static void SaveMainDatabase(ISerialize serializer, string? iPath)
{
CheckEhcBoosts();
var path = Files.SelectDataFileSave(Files.MxdbFileDb, iPath);
Expand Down Expand Up @@ -1473,7 +1473,7 @@ private static void saveEnts()
var serialized = JsonConvert.SerializeObject(Database.Entities, Formatting.Indented);
File.WriteAllText($@"{Application.StartupPath}\\data\\Ents.json", serialized);
}
public static bool LoadMainDatabase(string iPath)
public static bool LoadMainDatabase(string? iPath)
{
ClearLookups();
var path = Files.SelectDataFileLoad(Files.MxdbFileDb, iPath);
Expand Down Expand Up @@ -1605,7 +1605,7 @@ public static bool LoadMainDatabase(string iPath)
return true;
}

public static void LoadDatabaseVersion(string iPath)
public static void LoadDatabaseVersion(string? iPath)
{
var target = Files.SelectDataFileLoad(Files.MxdbFileDb, iPath);
Database.Version = GetDatabaseVersion(target);
Expand Down Expand Up @@ -1646,7 +1646,7 @@ private static Version GetDatabaseVersion(string fp)
return version;
}

public static bool LoadEffectIdsDatabase(string iPath)
public static bool LoadEffectIdsDatabase(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileEffectIds, iPath);
if (File.Exists(path))
Expand Down Expand Up @@ -1688,7 +1688,7 @@ public static bool LoadEffectIdsDatabase(string iPath)
return true;
}

public static void SaveEffectIdsDatabase(string iPath)
public static void SaveEffectIdsDatabase(string? iPath)
{
var path = Files.SelectDataFileSave(Files.MxdbFileEffectIds, iPath);

Expand Down Expand Up @@ -1723,7 +1723,7 @@ public static void SaveEffectIdsDatabase(string iPath)
}
}

public static bool LoadLevelsDatabase(string iPath)
public static bool LoadLevelsDatabase(string? iPath)
{
var path = string.Empty;
switch (MidsContext.Config.BuildMode)
Expand Down Expand Up @@ -1763,7 +1763,7 @@ public static bool LoadLevelsDatabase(string iPath)
return true;
}

public static void LoadOrigins(string iPath)
public static void LoadOrigins(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileOrigins, iPath);

Expand Down Expand Up @@ -1921,7 +1921,7 @@ public static void AssignRecipeIDs()
}
}

public static void LoadRecipes(string iPath)
public static void LoadRecipes(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileRecipe, iPath);

Expand Down Expand Up @@ -1985,7 +1985,7 @@ private static void SaveRecipesRaw(ISerialize serializer, string fn, string name
ConfigData.SaveRawMhd(serializer, toSerialize, fn, null);
}

public static void SaveRecipes(ISerialize serializer, string iPath)
public static void SaveRecipes(ISerialize serializer, string? iPath)
{
var path = Files.SelectDataFileSave(Files.MxdbFileRecipe, iPath);

Expand Down Expand Up @@ -2023,7 +2023,7 @@ public static void SaveRecipes(ISerialize serializer, string iPath)
}
}

public static void LoadSalvage(string iPath)
public static void LoadSalvage(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileSalvage, iPath);

Expand Down Expand Up @@ -2087,7 +2087,7 @@ private static void SaveSalvageRaw(ISerialize serializer, string fn, string name
ConfigData.SaveRawMhd(serializer, toSerialize, fn, null);
}

public static void SaveSalvage(ISerialize serializer, string iPath)
public static void SaveSalvage(ISerialize serializer, string? iPath)
{
var path = Files.SelectDataFileSave(Files.MxdbFileSalvage, iPath);

Expand Down Expand Up @@ -2149,7 +2149,7 @@ private static void SaveEnhancementDbRaw(ISerialize serializer, string filename,
ConfigData.SaveRawMhd(serializer, toSerialize, filename, null);
}

public static void SaveEnhancementDb(ISerialize serializer, string iPath)
public static void SaveEnhancementDb(ISerialize serializer, string? iPath)
{
var path = Files.SelectDataFileSave(Files.MxdbFileEnhDb, iPath);

Expand Down Expand Up @@ -2180,7 +2180,7 @@ public static void SaveEnhancementDb(ISerialize serializer, string iPath)
}
}

public static void LoadEnhancementDb(string iPath)
public static void LoadEnhancementDb(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileEnhDb, iPath);

Expand Down Expand Up @@ -2256,7 +2256,7 @@ public static void LoadEnhancementDb(string iPath)
}
}

public static bool LoadEnhancementClasses(string iPath)
public static bool LoadEnhancementClasses(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileEClasses, iPath);

Expand Down Expand Up @@ -2303,7 +2303,7 @@ public static bool LoadEnhancementClasses(string iPath)
return true;
}

public static void LoadTypeGrades(string iPath)
public static void LoadTypeGrades(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.JsonFileTypeGrades, iPath);
var jsonData = File.ReadAllText(path);
Expand Down Expand Up @@ -2477,7 +2477,7 @@ public static TypeGrade GetSpecialEnhByName(string name)
streamReader.Close();
}*/

public static bool LoadMaths(string iPath)
public static bool LoadMaths(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.MxdbFileMaths, iPath);

Expand Down
2 changes: 1 addition & 1 deletion MidsReborn/Core/Expressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static Dictionary<string, string> CommandsDict(IEffect sourceFx)
{ "maxEndurance", $"{MidsContext.Character.DisplayStats.EnduranceMaxEnd}" },
{ "rand()", $"{sourceFx.Rand}" },
{ "cur.kToHit", $"{MidsContext.Character.DisplayStats.BuffToHit}"},
{ "base.kToHit", $"{DatabaseAPI.ServerData.BaseToHit}"},
{ "base.kToHit", $"{MidsContext.Config.ScalingToHit}"},
{ "source>Max.kHitPoints", $"{MidsContext.Character.Totals.HPMax}" },
{ "source>Base.kHitPoints", $"{MidsContext.Character.Archetype.Hitpoints}"}
};
Expand Down
8 changes: 4 additions & 4 deletions MidsReborn/Core/Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public static class Files

public static string FileData = string.Empty;
private static string FNameJsonConfig => Path.Combine(AppContext.BaseDirectory, RoamingFolder, JsonFileConfig);
public static string FDefaultPath => Path.Combine(AppContext.BaseDirectory, RoamingFolder, "Generic\\");
public static string? FDefaultPath => Path.Combine(AppContext.BaseDirectory, RoamingFolder, "Generic\\");
public static string FNamePowersRepl => Path.Combine(FPathAppData, MxdbPowersReplTable);
private static string FPathAppData => MidsContext.Config != null ? MidsContext.Config.DataPath : FDefaultPath;
private static string? FPathAppData => MidsContext.Config != null ? MidsContext.Config.DataPath : FDefaultPath;
public static string FDefaultBuildsPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), BuildsFolder);

public static string BaseDataPath => Path.Combine(AppContext.BaseDirectory, RoamingFolder);

public static string SelectDataFileLoad(string iDataFile, string iPath = "")
public static string SelectDataFileLoad(string iDataFile, string? iPath = "")
{
var filePath = Path.Combine(!string.IsNullOrWhiteSpace(iPath) ? iPath : FPathAppData, iDataFile);
if (Debugger.IsAttached)
Expand All @@ -55,7 +55,7 @@ public static string SelectDataFileLoad(string iDataFile, string iPath = "")
return filePath;
}

public static string SelectDataFileSave(string iDataFile, string iPath = "")
public static string SelectDataFileSave(string iDataFile, string? iPath = "")
{
var filePath = Path.Combine(!string.IsNullOrWhiteSpace(iPath) ? iPath : FPathAppData, iDataFile);
if (!Debugger.IsAttached) return filePath;
Expand Down
4 changes: 2 additions & 2 deletions MidsReborn/Core/I9Gfx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static IEnumerable<ImageInfo> GetBaseImages()
return retList;
}

private static IEnumerable<ImageInfo> GetExtendedImages(string path)
private static IEnumerable<ImageInfo> GetExtendedImages(string? path)
{
var retList = new List<ImageInfo>();
var files = Directory.GetFiles(path, ImageFilter, SearchOption.AllDirectories).ToList();
Expand Down Expand Up @@ -97,7 +97,7 @@ public static void SetOrigin(string iOrigin)
OriginIndex = DatabaseAPI.GetOriginIDByName(iOrigin);
}

public static async Task Initialize(string path)
public static async Task Initialize(string? path)
{
var baseImages = GetBaseImages().ToList();
var extendedImages = GetExtendedImages(path).ToList();
Expand Down
4 changes: 2 additions & 2 deletions MidsReborn/Core/Modifiers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void StoreRaw(ISerialize serializer, string path, string name)
ConfigData.SaveRawMhd(serializer, toSerialize, path, null);
}

public bool Load(string iPath)
public bool Load(string? iPath)
{
var path = Files.SelectDataFileLoad(Files.JsonFileModifiers, iPath);

Expand Down Expand Up @@ -119,7 +119,7 @@ public bool Load(string iPath)
return false;
}

public void Store(ISerialize serializer, string iPath = "")
public void Store(ISerialize serializer, string? iPath = "")
{
string path;
if (string.IsNullOrWhiteSpace(iPath))
Expand Down
8 changes: 4 additions & 4 deletions MidsReborn/Core/Utils/PatchCompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private string PatchFile

private string HashFile => Path.Combine(PatchPath, HashFileName);

private IEnumerable<FileData> CompileList(string path, EPatchType patchType)
private IEnumerable<FileData> CompileList(string? path, EPatchType patchType)
{
var files = new List<string>();
List<FileHash>? hashes = null;
Expand Down Expand Up @@ -135,7 +135,7 @@ private IEnumerable<FileData> CompileList(string path, EPatchType patchType)
return fileQueue;
}

public bool CreatePatchFile(string path, EPatchType patchType)
public bool CreatePatchFile(string? path, EPatchType patchType)
{
var boolReturn = false;
var compressedData = CompressData(path, patchType);
Expand All @@ -147,7 +147,7 @@ public bool CreatePatchFile(string path, EPatchType patchType)
return boolReturn;
}

private byte[]? CompressData(string path, EPatchType patchType)
private byte[]? CompressData(string? path, EPatchType patchType)
{
byte[]? outData;
MemoryStream patchStream;
Expand Down Expand Up @@ -197,7 +197,7 @@ public bool CreatePatchFile(string path, EPatchType patchType)
return outData;
}

private void DeletePriorPatch(string path)
private void DeletePriorPatch(string? path)
{
var filesToRemove = Directory.GetFiles(PatchPath, "*.mru").ToList();
if (!filesToRemove.Any()) return;
Expand Down
Loading

0 comments on commit 345576d

Please sign in to comment.