Commit 39c67dff authored by Senator John's avatar Senator John 💬

Merge branch 'patch' into 'master'

Implemented Overframe and Some Bug fixes

See merge request !26
parents b2c3a0fc 12739029
This diff is collapsed.
...@@ -114,8 +114,9 @@ namespace MDPro3.Duel.YGOSharp ...@@ -114,8 +114,9 @@ namespace MDPro3.Duel.YGOSharp
if (code > 100) if (code > 100)
{ {
// Replace pre-release ids with official ids (if mapping exists). // Replace pre-release ids with official ids only for playable deck sections.
code = YdkIdHelper.ToOfficial(code); if (flag >= 1 && flag <= 3)
code = YdkIdHelper.ToOfficial(code);
switch (flag) switch (flag)
{ {
...@@ -337,4 +338,4 @@ namespace MDPro3.Duel.YGOSharp ...@@ -337,4 +338,4 @@ namespace MDPro3.Duel.YGOSharp
return value; return value;
} }
} }
} }
\ No newline at end of file
...@@ -25,6 +25,14 @@ namespace MDPro3 ...@@ -25,6 +25,14 @@ namespace MDPro3
private static readonly Regex _ydkIdLine = private static readonly Regex _ydkIdLine =
new Regex(@"^(\s*#?\s*)(\d+)(\s*)$", RegexOptions.Compiled); new Regex(@"^(\s*#?\s*)(\d+)(\s*)$", RegexOptions.Compiled);
private enum DeckSection
{
None,
Main,
Extra,
Side
}
public static void EnsureLoaded() public static void EnsureLoaded()
{ {
if (_loaded) return; if (_loaded) return;
...@@ -107,12 +115,12 @@ namespace MDPro3 ...@@ -107,12 +115,12 @@ namespace MDPro3
changed += NormalizeList(deck.Main); changed += NormalizeList(deck.Main);
changed += NormalizeList(deck.Extra); changed += NormalizeList(deck.Extra);
changed += NormalizeList(deck.Side); changed += NormalizeList(deck.Side);
changed += NormalizeList(deck.Pickup);
return changed; return changed;
} }
/// <summary> /// <summary>
/// Reads a .ydk file and rewrites it on disk, replacing pre-release ids with official ids. /// Reads a .ydk file and rewrites it on disk, replacing pre-release ids with official ids
/// only inside #main, #extra and !side sections.
/// Returns the number of lines changed. /// Returns the number of lines changed.
/// </summary> /// </summary>
public static int NormalizeYdkFile(string path) public static int NormalizeYdkFile(string path)
...@@ -138,12 +146,42 @@ namespace MDPro3 ...@@ -138,12 +146,42 @@ namespace MDPro3
var lines = original.Replace("\r\n", "\n").Split('\n'); var lines = original.Replace("\r\n", "\n").Split('\n');
var changed = 0; var changed = 0;
var section = DeckSection.None;
for (int i = 0; i < lines.Length; i++) for (int i = 0; i < lines.Length; i++)
{ {
var line = lines[i]; var line = lines[i];
var trimmed = line.TrimStart();
if (trimmed.StartsWith("#main", StringComparison.Ordinal))
{
section = DeckSection.Main;
continue;
}
if (trimmed.StartsWith("#extra", StringComparison.Ordinal))
{
section = DeckSection.Extra;
continue;
}
if (trimmed.StartsWith("!side", StringComparison.Ordinal))
{
section = DeckSection.Side;
continue;
}
var m = _ydkIdLine.Match(line); var m = _ydkIdLine.Match(line);
if (!m.Success) continue; if (!m.Success)
{
// Any other ydk directive/header exits card sections.
if (trimmed.StartsWith("#", StringComparison.Ordinal) ||
trimmed.StartsWith("!", StringComparison.Ordinal))
{
section = DeckSection.None;
}
continue;
}
if (section == DeckSection.None) continue;
if (!int.TryParse(m.Groups[2].Value, out var id)) continue; if (!int.TryParse(m.Groups[2].Value, out var id)) continue;
if (id <= 100) continue; if (id <= 100) continue;
......
...@@ -121,8 +121,9 @@ namespace MDPro3.Utility ...@@ -121,8 +121,9 @@ namespace MDPro3.Utility
public static string GetRightBracket() public static string GetRightBracket()
{ {
if (NeedSmallBracket()) var language = GetConfig();
return "]"; if (UseLatin(language))
return "] ";
return "】"; return "】";
} }
......
...@@ -1401,4 +1401,41 @@ ...@@ -1401,4 +1401,41 @@
101304116 19144623 101304116 19144623
101304154 52782440 101304154 52782440
100254201 48016074 100254201 48016074
100254202 11911336 100254202 11911336
\ No newline at end of file 100200284 60516416
100256001 88570003
100256002 14965712
100256003 41350417
100256004 87758525
100256005 13243124
100256006 40237839
100256007 76636978
100256008 13021682
100256009 49415281
100256010 76504386
100256011 12908094
100256012 48393693
100256013 75787708
100256014 1186447
100256015 48171151
100256016 74665150
100256017 64865
100256018 37458564
100256019 73443672
100256020 847217
100256021 32236916
100256022 68721020
100256023 5125629
100256024 31114334
100256025 68508433
100201001 4993187
100259001 81684048
100259002 18078153
100259003 54077752
100259004 80461466
100259005 17856505
100259006 43355214
100259007 80749819
100259008 16734927
100259009 42138622
100259010 75527221
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment