This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelperTypes.cs
338 lines (293 loc) · 10.4 KB
/
HelperTypes.cs
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
using System;
using System.Collections.Generic;
using FFLogsLookup;
namespace HelperTypes
{
public class FflogsApiCredentials
{
public string id = null;
public string secret = null;
public string bearer_token;
public FflogsApiCredentials(string id, string secret)
{
this.id = id;
this.secret = secret;
}
public FflogsApiCredentials()
{
}
public FflogsApiCredentials(string bearerToken)
{
this.bearer_token = bearerToken;
}
}
public class Meta
{
public string hoverText;
public string longHoverText;
public string icon = "";
public bool erroredProcessing = false;
public Meta(string hoverText)
{
this.hoverText = hoverText;
}
public Meta() { }
}
public class RaidingTierPerformance
{
public Fight firstFight;
public Fight secondFight;
public Fight thirdFight;
public Fight fourthFight;
public Fight[] fightsArray;
public Meta meta = null;
public RaidingTierPerformance(Fight first, Fight second, Fight third, Fight fourth)
{
this.firstFight = first;
this.secondFight = second;
this.thirdFight = third;
this.fourthFight = fourth;
this.fightsArray = new Fight[] { first, second, third, fourth };
}
public RaidingTierPerformance(Fight[] fights)
{
if (fights.Length >= 1) this.firstFight = fights[0];
if (fights.Length >= 2) this.secondFight = fights[1];
if (fights.Length >= 3) this.thirdFight = fights[2];
if (fights.Length >= 4) this.fourthFight = fights[3];
this.fightsArray = fights;
}
public RaidingTierPerformance(Fight[] fights, Meta meta)
{
this.firstFight = fights[0];
this.secondFight = fights[1];
this.thirdFight = fights[2];
this.fourthFight = fights[3];
this.fightsArray = fights;
this.meta = meta;
}
public RaidingTierPerformance(int percentiles)
{
this.fightsArray = new Fight[]
{new Fight(percentiles), new Fight(percentiles), new Fight(percentiles), new Fight(percentiles) {part2 = new Fight(percentiles)}};
}
}
public class Fight
{
public string job;
public string bossname;
public float rdps;
public int kills;
public int medianPercentile;
public int highestPercentile;
public int id;
public bool savage;
public bool extreme;
public Fight part2;
public Meta meta;
public static Dictionary<int, string> ShortNameFromId = new Dictionary<int, string>()
{
// Shadowbringers
/* Promise */ { 73, "e9" }, { 74, "e10" }, { 75, "e11" }, { 76, "e12"}, {77, "e12s p2"},
/* Verse */ { 69, "e5" }, { 70, "e6" }, { 71, "e7" }, { 72, "e8"},
/* Gate */ { 65, "e1" }, { 66, "e2" }, { 67, "e3" }, { 68, "e4"},
// Stormblood
/* Alphascape */ { 60, "o9" }, { 61, "o10" }, { 62, "o11" }, { 63, "o12" }, { 64, "o12s p2" },
/* Sigmascape */ { 51, "o5" }, { 52, "o6" }, { 53, "o7" }, { 54, "o8" }, { 55, "o8s p2" },
/* Deltascape */ { 42, "o1" }, { 43, "o2" }, { 44, "o3" }, { 45, "o4" }, { 46, "o4s p2" },
};
public Fight(Meta meta, string name, int encounterId, string job, float rdps, int kills, int medianPercentile, int highestPercentile, bool savage, bool extreme)
{
this.bossname = name;
this.id = encounterId;
this.job = job;
this.rdps = rdps;
this.kills = kills;
this.medianPercentile = medianPercentile;
this.highestPercentile = highestPercentile;
this.savage = savage;
this.meta = meta;
this.extreme = extreme;
}
public Fight(int percent)
{
this.highestPercentile = percent;
this.savage = true;
this.extreme = false;
}
public Fight(int encounterId, bool savage, bool extreme)
{
this.id = encounterId;
this.kills = 0;
this.savage = savage;
this.extreme = extreme;
}
public string getShortName()
{
ShortNameFromId.TryGetValue(this.id, out string shortName);
if (!FflogRequestsHandler.GetFirstPartForFight(this.id, out _))
shortName += (this.savage ? "s" : "");
return shortName == "" ? this.bossname : shortName;
}
public int getHighestAvgForParts()
{
int avg = -1;
if (this.part2 != null)
{
avg = (int)((highestPercentile + this.part2.highestPercentile) / 2);
}
return avg;
}
public override string ToString()
{
return $"{this.getShortName()} - {this.bossname} : {this.job} ({this.kills}) {this.highestPercentile}/{this.medianPercentile}";
}
}
public class TargetInfo
{
public string firstname;
public string lastname;
public string world;
public TargetInfo(string firstname, string lastname, string world)
{
var strings = new string[] { firstname, lastname, world };
/*strings = strings.Select(s =>
{
char[] a = s.ToCharArray();
a[0] = char.ToUpper(a[0]);
return new string(a);
}).ToArray();*/
this.firstname = strings[0];
this.lastname = strings[1];
this.world = strings[2];
}
public TargetInfo() { }
public override string ToString()
{
return $"{this.firstname} {this.lastname} ({this.world})";
}
}
public class FflogsRequestParams
{
public TargetInfo player;
public bool showNormal;
public bool showUltimates;
public FflogsRequestParams(TargetInfo player, bool showNormal, bool showUltimates)
{
this.player = player;
this.showNormal = showNormal;
this.showUltimates = showUltimates;
}
// 32 tea, 30 ucob uwu (shb), 23 uwu og, 19 ucob og (zone id
// 1050 tea, 1048 uwu, 1047 ucob, 1042 uwu og, 1039 ucob og (encounter id
}
public class FflogsApiResponse
{
public TData data { get; set; }
public class TData
{
public TCharacterData characterData { get; set; }
public class TCharacterData
{
public TCharacter character { get; set; }
}
}
}
public class UltFflogsApiResponse
{
public TData data { get; set; }
public class TData
{
public TCharacterData characterData { get; set; }
public class TCharacterData
{
public TUltCharacter ultCharacter { get; set; }
public override string ToString()
{
return "(characterData: " + ultCharacter + " )";
}
}
public override string ToString()
{
return "( data: " + this.characterData + " )";
}
}
public override string ToString()
{
return "(" + this.data + ")";
}
}
public class TUltCharacter
{
public bool hidden { get; set; }
public TRaidingTierData? ultimate1 { get; set; }
public TRaidingTierData? ultimate2 { get; set; }
public TRaidingTierData? ultimate3 { get; set; }
public TRaidingTierData? ultimate4 { get; set; }
public override string ToString()
{
var ult = "";
foreach (var rtd in new List<TRaidingTierData>() {ultimate1, ultimate2, ultimate3, ultimate4})
{
if (rtd != null) ult += rtd.ToString();
}
return "(character: \n hidden: "+hidden+"\n "+ult+" )";
}
}
public class TCharacter
{
public bool hidden { get; set; }
public TRaidingTierData raidingTierData { get; set; }
}
public class TRaidingTierData
{
public float? bestPerformanceAverage { get; set; }
public float? medianPerformanceAverage { get; set; }
public int difficulty { get; set; }
public string metric { get; set; }
public int partition { get; set; }
public int zone { get; set; }
public TAllStar[] allStars { get; set; }
public TRanking[] rankings { get; set; }
public override string ToString()
{
var encnames = "";
foreach (var enc in rankings)
{
encnames += " " + enc.encounter.name;
}
return ""+encnames;
}
}
#nullable enable
public class TAllStar
{
public int? partition { get; set; }
public string? spec { get; set; }
public float? points { get; set; }
public int? possiblePoint { get; set; }
public int? rank { get; set; }
public float? rankPercent { get; set; }
public int? total { get; set; }
}
public class TRanking
{
public TEncounter? encounter { get; set; }
public float? rankPercent { get; set; }
public float? medianPercent { get; set; }
public int totalKills { get; set; }
public int fastestKill { get; set; }
public string? spec { get; set; }
public string? bestSpec { get; set; }
public float bestAmount { get; set; }
public override string ToString()
{
return $"( encID:{encounter?.id}, encName:{encounter?.name} ) - ( hi:{rankPercent}, med:{medianPercent} ) - (totalKills:{totalKills}, bestSpec:{bestSpec})";
}
}
public class TEncounter
{
public int id { get; set; }
public string? name { get; set; }
}
}