mirror of
https://github.com/HolographicHat/Yae.git
synced 2026-03-15 08:33:16 +08:00
prefer using field id from config
This commit is contained in:
@@ -16,8 +16,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
|
<OptimizationPreference>Size</OptimizationPreference>
|
||||||
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -29,6 +28,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Sentry" Version="5.6.0" />
|
||||||
<PackageReference Include="Spectre.Console" Version="0.50.1-preview.0.3" />
|
<PackageReference Include="Spectre.Console" Version="0.50.1-preview.0.3" />
|
||||||
<PackageReference Include="Spectre.Console.Analyzer" Version="1.0.0">
|
<PackageReference Include="Spectre.Console.Analyzer" Version="1.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@@ -82,7 +82,14 @@ public class AchievementAllDataNotify {
|
|||||||
return new AchievementAllDataNotify();
|
return new AchievementAllDataNotify();
|
||||||
}
|
}
|
||||||
uint tId, sId, iId, currentId, totalId;
|
uint tId, sId, iId, currentId, totalId;
|
||||||
if (data.Count > 20) { /* uwu */
|
if (data.All(CheckKnownFieldIdIsValid)) {
|
||||||
|
var info = GlobalVars.AchievementInfo.PbInfo;
|
||||||
|
iId = info.Id;
|
||||||
|
tId = info.FinishTimestamp;
|
||||||
|
sId = info.Status;
|
||||||
|
totalId = info.TotalProgress;
|
||||||
|
currentId = info.CurrentProgress;
|
||||||
|
} else if (data.Count > 20) {
|
||||||
(tId, var cnt) = data // ↓ 2020-09-15 04:15:14
|
(tId, var cnt) = data // ↓ 2020-09-15 04:15:14
|
||||||
.GroupKeys(value => value > 1600114514).Select(g => (g.Key, g.Count())).MaxBy(p => p.Item2);
|
.GroupKeys(value => value > 1600114514).Select(g => (g.Key, g.Count())).MaxBy(p => p.Item2);
|
||||||
sId = data // FINISHED ↓ ↓ REWARD_TAKEN
|
sId = data // FINISHED ↓ ↓ REWARD_TAKEN
|
||||||
@@ -97,21 +104,14 @@ public class AchievementAllDataNotify {
|
|||||||
.Select(g => (FieldIds: g.Key, Count: g.Count()))
|
.Select(g => (FieldIds: g.Key, Count: g.Count()))
|
||||||
.MaxBy(p => p.Count)
|
.MaxBy(p => p.Count)
|
||||||
.FieldIds;
|
.FieldIds;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// ReSharper disable once LocalizableElement
|
// ReSharper disable once LocalizableElement
|
||||||
AnsiConsole.WriteLine($"Id={iId}, Status={sId}, Total={totalId}, Current={currentId}, Timestamp={tId}");
|
AnsiConsole.WriteLine($"Id={iId}, Status={sId}, Total={totalId}, Current={currentId}, Timestamp={tId}");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
var info = GlobalVars.AchievementInfo.PbInfo; // ...
|
AnsiConsole.WriteLine(App.WaitMetadataUpdate);
|
||||||
iId = info.Id;
|
Environment.Exit(0);
|
||||||
tId = info.FinishTimestamp;
|
return null!;
|
||||||
sId = info.Status;
|
|
||||||
totalId = info.TotalProgress;
|
|
||||||
currentId = info.CurrentProgress;
|
|
||||||
if (data.Any(dict => !dict.ContainsKey(iId) || !dict.ContainsKey(sId) || !dict.ContainsKey(totalId))) {
|
|
||||||
AnsiConsole.WriteLine(App.WaitMetadataUpdate);
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new AchievementAllDataNotify {
|
return new AchievementAllDataNotify {
|
||||||
AchievementList = data.Select(dict => new AchievementItem {
|
AchievementList = data.Select(dict => new AchievementItem {
|
||||||
@@ -122,6 +122,18 @@ public class AchievementAllDataNotify {
|
|||||||
FinishTimestamp = dict.GetValueOrDefault(tId),
|
FinishTimestamp = dict.GetValueOrDefault(tId),
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
// ReSharper disable once ConvertIfStatementToSwitchStatement
|
||||||
|
static bool CheckKnownFieldIdIsValid(Dictionary<uint, uint> data) {
|
||||||
|
var info = GlobalVars.AchievementInfo;
|
||||||
|
var status = data.GetValueOrDefault(info.PbInfo.Status, 114514u);
|
||||||
|
if (status is 0 or > 3) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (status > 1 && data.GetValueOrDefault(info.PbInfo.FinishTimestamp) < 1600114514) { // 2020-09-15 04:15:14
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return info.Items.ContainsKey(data.GetValueOrDefault(info.PbInfo.Id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user