-
Notifications
You must be signed in to change notification settings - Fork 0
/
OriginitePrimePacks.linq
134 lines (105 loc) · 3.17 KB
/
OriginitePrimePacks.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<Query Kind="Program"/>
// Arknights packs store Originite Prime price calculator.
#nullable enable
#load "./lib/Extensions.linq"
/*
#define DUMP_ORIGINITE_PRIME_ORIGINAL_PACKS
//*/
void Main()
{
const string title = $"{nameof(OriginitePrime)} Packs";
const string originalIitle = $"Original {title}";
var uri = new WikiHyperlinq("Packs_Store").Uri;
// Pack list can be found at https://arknights.wiki.gg/wiki/Packs_Store
// TODO: Add packs.
// TODO: See PrimePrice column, less is better.
var originitePrime = new OriginitePrime[]
{
new("Piece", 1+2, 0.99),
new("Cluster", 6+6, 4.99),
new("Pile", 20+20, 14.99),
new("Pack", 40+40, 29.99),
new("Box", 66+66, 49.99),
new("Crate", 130+130, 99.99),
Pack.Is("Lin's Wallet",
9.99).HasPrimes(16).HasLMD(700_000)
}.Select(static (v, i) => { v.ID = i+1; return v; })
#if DUMP_ORIGINITE_PRIME_ORIGINAL_PACKS
.Dump(originalIitle);
originalIitle.AsHyperlink(uri);
#endif
;
originitePrime
.Where( static o => o.TotalPrice != 0)
.OrderBy(static o => o.PrimePrice)
.Dump(title);
title.AsHyperlink(uri);
}
static object ToDump(object input) =>
input switch
{
double doubleValue =>
Round(doubleValue, 2),
bool boolValue =>
boolValue ? WithStyle("✅", "display: block; text-align: center") : Empty,
_ => input
};
record OriginitePrime(string Name, double Primes, double TotalPrice, bool Pack = false)
{
public double PrimePrice { get; } = TotalPrice / Primes;
public int ID { get; set; }
}
class Pack
{
// TODO: Specify your level max sanity.
private const double SanityPerPrime = 135;
// TODO: Specify LMD farm gain.
private const double LMDFarmGain = 10_000;
// TODO: Specify LMD farm sanity.
private const double LMDFarmSanity = 36;
private const int ChipFarmSanity = 18;
private const int ChipPackFarmSanity = 36;
public string Name { get; }
public double Price { get; }
public double LMDSanity { get; private set; }
public int ChipsSanity { get; private set; }
public int ChipPacksSanity { get; private set; }
public int Primes { get; private set; }
public double TotalPrimes =>
((LMDSanity + ChipsSanity + ChipPacksSanity) / SanityPerPrime) + Primes;
private Pack(string name, double price) =>
(Name, Price) = (name, price);
public static Pack Is(string name, double price) =>
new Pack(name, price);
public Pack HasPrimes(int count)
{
Primes = count;
return this;
}
public Pack HasLMD(int count)
{
LMDSanity = count * LMDFarmSanity / LMDFarmGain;
return this;
}
public Pack HasChips(int count)
{
ChipsSanity = count * ChipFarmSanity;
return this;
}
public Pack HasChipPacks(int count)
{
ChipPacksSanity = count * ChipPackFarmSanity;
return this;
}
public static implicit operator OriginitePrime(Pack pack) =>
new OriginitePrime(pack.Name, pack.TotalPrimes, pack.Price, true);
}
class WikiHyperlinq : Hyperlinq
{
public WikiHyperlinq(string uri, string? fragment = null, string? text = null)
: base($"https://arknights.wiki.gg/wiki/{uri.Replace(' ', '_')}{GetFragment(fragment)}", text ?? uri)
{
}
private static string GetFragment(string? fragment) =>
$"{(IsNullOrWhiteSpace(fragment) ? Empty : "#")}{fragment}";
}