PartyDamage/Evaluator.cs
2024-07-29 01:10:24 -04:00

569 lines
17 KiB
C#

using System.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
namespace PartyDamage;
public class Evaluator {
public required Guid Id { get; init; }
public required string Name { get; init; }
public string? ConfigName { get; init; }
public required uint BattleTalkImage { get; init; }
public required bool Default { get; init; }
public required Dictionary<Evaluation, SeString[]> Lines { get; init; }
public bool IsMammet { get; init; }
public SeString? GetLineFor(Evaluation evaluation, bool blend, int rank) {
var lines = new List<SeString>();
if (blend) {
if (evaluation.Next() is { } next && this.Lines.TryGetValue(next, out var nextLines)) {
lines.AddRange(nextLines);
}
if (evaluation.Previous() is { } prev && this.Lines.TryGetValue(prev, out var prevLines)) {
lines.AddRange(prevLines);
}
}
if (this.Lines.TryGetValue(evaluation, out var currentLines)) {
lines.AddRange(currentLines);
}
if (lines.Count == 0) {
return null;
}
var template = Random.Shared.GetItems(lines.ToArray(), 1)[0];
var line = new SeStringBuilder();
foreach (var payload in template.Payloads) {
if (payload is not TextPayload text) {
line.Add(payload);
continue;
}
var newText = this.IsMammet
? Mammetise(text.Text!)
: text.Text!;
newText = string.Format(
newText,
rank
);
line.AddText(newText);
}
return line.Build();
}
private static string Mammetise(string input) {
var newText = new StringBuilder();
var upper = true;
foreach (var ch in input) {
if (!char.IsLetter(ch)) {
newText.Append(ch);
continue;
}
newText.Append(upper ? char.ToUpperInvariant(ch) : char.ToLowerInvariant(ch));
upper = !upper;
}
return newText.ToString();
}
public static readonly Guid RandomId = new("00000000-0000-0000-0000-000000000001");
public static readonly Evaluator[] Evaluators = [
new Evaluator {
Id = new Guid("ebbccc44-13b5-4843-a635-3b693fe47840"),
Name = "Parser Mammet",
BattleTalkImage = 73160,
Default = true,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
"Parse result: greatly exceeds expectations!",
"Parse result: excellent!",
"Parse result: fantastic!",
"Parse result: extraordinary!",
],
[Evaluation.Good] = [
"Parse result: good.",
"Parse result: above expectations.",
"Parse result: great.",
"Parse result: more than adequate.",
],
[Evaluation.Fair] = [
"Parse result: meets expectations.",
"Parse result: adequate.",
"Parse result: satisfactory.",
"Parse result: baseline.",
],
[Evaluation.Poor] = [
"Parse result: below expectations...",
"Parse result: poor...",
"Parse result: perfunctory performance...",
"Parse result: inadequate...",
],
[Evaluation.Awful] = [
"Parse result: ★※☆ extremely ★※☆ poor...",
"Parse result: failure...",
"Parse result: far below expectations...",
"Parse result: ★※☆ terrible...",
],
},
IsMammet = true,
},
new Evaluator {
Id = new Guid("3e833290-bc1f-4318-9461-391dcc66c739"),
Name = "Ranking Mammet",
ConfigName = "Ranking Mammet (displays rank explicitly)",
BattleTalkImage = 73160,
Default = false,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
"You ranked #{0}.",
],
[Evaluation.Good] = [
"You ranked #{0}.",
],
[Evaluation.Fair] = [
"You ranked #{0}.",
],
[Evaluation.Poor] = [
"You ranked #{0}.",
],
[Evaluation.Awful] = [
"You ranked #{0}.",
],
},
},
new Evaluator {
Id = new Guid("5053c386-192a-416f-b025-223af8d592bf"),
Name = "G'raha Tia",
BattleTalkImage = 73012,
Default = true,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
"Impressive! No surprise coming from someone as skilled as you.",
"Our champion again proves their worth. Well done, friend!",
],
[Evaluation.Good] = [
"A hard-fought battle, but you prevailed. Good job.",
"Seems like you had it well under control.",
],
[Evaluation.Fair] = [
"A bit of a rough fight, no?",
"Right, then. On to the next battle.",
],
[Evaluation.Poor] = [
"Would that I were there... I might have been able to help you.",
"Not your best work, but you can't be perfect all the time.",
],
[Evaluation.Awful] = [
"Do you need some rest? There's no shame in taking a break.",
"Perhaps you need some more training.",
],
},
},
new Evaluator {
Id = new Guid("1dd9addb-f0d3-4a8d-b087-62ae10cb5423"),
Name = "Wuk Lamat",
BattleTalkImage = 73265,
Default = true,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
new SeStringBuilder()
.AddText("Incredible! You ")
.AddItalics("have")
.AddText(" to show me how to do that sometime!")
.Build(),
"Amazing! You truly are the best there is!",
],
[Evaluation.Good] = [
"Nice job! You're pretty good at this, huh?",
"It looked like you did pretty well to me!",
],
[Evaluation.Fair] = [
"Were you holding back during that one?",
"I feel like I could've kept up with you that time.",
],
[Evaluation.Poor] = [
new SeStringBuilder()
.AddText("Hey... Is Eorzea's champion ")
.AddItalics("slacking")
.AddText("? Huh. What will everyone say when I tell them?")
.Build(),
new SeStringBuilder()
.AddText("I ")
.AddItalics("know")
.AddText(" you can do better than that!")
.Build(),
],
[Evaluation.Awful] = [
new SeStringBuilder()
.AddText("Hey, are you okay? Take a minute, and then ")
.AddItalics("really")
.AddText(" put all you've got into the next fight!")
.Build(),
"It's okay. I won't tell anyone about that.",
],
},
},
new Evaluator {
Id = new Guid("3f862fca-cb18-4f48-b067-71b116070fa8"),
Name = "Estinien",
BattleTalkImage = 73007,
Default = true,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
"Ha! Well fought, friend! If only I had been there to join you. It looked fun.",
"Now there's a fight that will make a good story. Expertly fought.",
],
[Evaluation.Good] = [
"A good fight, friend. A performance I've come to expect from you.",
"'Twas nothing you couldn't handle.",
],
[Evaluation.Fair] = [
"No need to strain yourself.",
"Take care. That fight seemed your equal.",
],
[Evaluation.Poor] = [
"Surely that's not your best.",
"You needn't hold back on my account.",
],
[Evaluation.Awful] = [
"Need I show you how to do battle?",
"Hmph. A disappointing showing...",
],
}
},
new Evaluator {
Id = new Guid("37ac5883-c008-4dc2-8c6b-a605a4698c04"),
Name = "Thancred",
ConfigName = "Thancred (\"This is Thancred\" meme)",
BattleTalkImage = 73013,
Default = false,
Lines = new Dictionary<Evaluation, SeString[]> {
[Evaluation.Best] = [
"This is Thancred.",
],
[Evaluation.Good] = [
"This is Thancred.",
],
[Evaluation.Fair] = [
"This is Thancred.",
],
[Evaluation.Poor] = [
"This is Thancred.",
],
[Evaluation.Awful] = [
"This is Thancred.",
],
},
},
];
}
public enum Evaluation {
Best,
Good,
Fair,
Poor,
Awful,
}
public static class EvaluationExt {
public static Evaluation? Next(this Evaluation evaluation) {
if (evaluation == 0) {
return null;
}
return evaluation - 1;
}
public static Evaluation? Previous(this Evaluation evaluation) {
if (evaluation == Evaluation.Awful) {
return null;
}
return evaluation + 1;
}
}
// 001 Venat
// 002 Zenos
// 003 Evil? Zenos
// 004 Fandaniel
// 005 ? some garlean
// 006 ?
// 007 Estinien
// 008 Alphinaud
// 009 radiant host dude
// 010 Forchenault
// 011 Alisaie
// 012 G'raha Tia
// 013 Thancred
// 014 oh god I should know his name
// 015 one of the padjali, the boy
// 016 Emmanelaine or however you spell it
// 017 ?
// 018 Lucia
// 019 Pipin?
// 020 Lyse
// 021 Magnai for sure
// 022 Sadu
// 023 Cirina
// 024 Thancred again
// 025 Y'shtola
// 026 Urianger
// 027 Nero with helmet on
// 028 different alphinaud's dad
// 029 Kan-E-Senna
// 030 Aymeric
// 031 ?
// 032 Hien
// 033 ? (monster)
// 034 Alphinaud again
// 035 Estinien casual
// 036 Alisaie cold attire
// 037 some kobold
// 038 bearded roe
// 039 ?
// 040 ardbert with ascian mask?
// 041 ardbert but creepy smile
// 042 ?
// 043 oh god some fviera
// 044 another fviera
// 045 yet another fviera
// 046 ? soranus
// 047 gaius?
// 048 imperial buckethead
// 049 imperial helmet
// 050 ? soranus
// 051 imperial helmet but less aggro
// 052 Lyna
// 053 Alphinaud in a red shawl
// 054 mustachioed-man with horn helmet
// 055 different horn helmet
// 056 Alisaie in a red a shawl
// 057 horn helmet
// 058 horn helmet
// 059 fu manchu man
// 060 Minfilia (Ryne)
// 061 Alisaie cold attire
// 062 Alphi cold attire
// 063 Ranjit?
// 064 Ryne
// 065 Female Jester red
// 066 Female Jester blue
// 067 a dwarf
// 068 Fandaniel hood covering eyes
// 069 Merlwyb
// 070 Vrtra boy avatar
// 071 Krile
// 072 Tataru
// 073 Hydaelyn?
// 074 Faurchenault
// 075 Vrtra
// 076 some boss
// 077 Zero
// 078 Vrtra man avatar
// 079 Zenos Helmet?
// 080 Lyse in red dress
// 081 Yugiri
// 082 Zenos? helmet revealing eyes
// 083 Sadu
// 084 some blue au ra male
// 085 Y'shtola
// 086 garlean guy
// 087 garlean pot helmet
// 088 garlean bucket helmet
// 089 garlean pot helmet
// 090 purple haired chin strap guy
// 091 garlean bucket helmet
// 092 evil oni?
// 093 Asahi
// 094 Lakshmi
// 095 cripple man
// 096 criminal woman
// 097 ?
// 098 some machine?
// 099 some guy with radiation hair
// 100 Krile but happy
// 101 lalafell in horn helmet
// 102 some ala mhigan resistance guy
// 103 criminal lady again
// 104 Lyse in red jacket
// 105 green Kojin main guy
// 106 Yotsuyu
// 107 magnai
// 108 Gosetsu
// 109 old guy
// 110 imperial bucket head
// 111 some guy with a scar maybe ala mhigan resistance
// 112 Thancred with blindfold?
// 113 face mask ala mhigan resistance
// 114 imperial pot helmet
// 115 lupin guy
// 116 another lupin
// 117 imperial pot helmet but roe
// 118 straw hat
// 119 some boy
// 120 Raubahn
// 121 Sultana?
// 122 elezen man
// 123 angry bird thing
// 124 Haurchefant
// 125 Tataru
// 126 no idea elezen
// 127 eyepatch elezen
// 128 Alphinaud old outfit
// 129 Yugiri with dagger
// 130 Raubahn maybe with two arms?
// 131 some uldahn lalafell
// 132 Ilberd
// 133 a crystal brave
// 134 diff crystal brave
// 135 woman crystal brave
// 136 Estinien full armour
// 137 some dude in chain mail elezen face plate
// 138 someone other person in same outfit not elezen maybe hyur
// 139 Hilda
// 140 elezen guy
// 141 ishgardian soldier face plate chain mail
// 142 a vanu vanu or gundu or whatever
// 143 goblin brayflox
// 144 the machine boss from brayflox hard
// 145 imperial in cool helmet (not gaius?)
// 146 red dragoon but doesn't look like estinien
// 147 some child
// 148 some old elezen
// 149 emmanelaine's brother
// 150 old elezen woman
// 151 someone in a hat
// 152 other person in a hat
// 153 Raubahn in big helmet
// 154 Ardbert?
// 155 old outfit Urianger no mask
// 156 Yda
// 157 imperial pot helmet long hair
// 158 ???
// 159 ???
// 160 mammet with green face
// 161 Hancock
// 162 pink haired fem elezen
// 163 not sure dragoon
// 164 Papalymo
// 165 old Thancred
// 166 some elezen girl
// 167 Yugiri in full face mask
// 168 roe in big plate armour
// 169 child f (doman?)
// 170 another child m
// 171 m elezen caster in witch's hat
// 172 another child m/f
// 173 another child m
// 174 Thancred ascian mask
// 175 full armour person
// 176 red imperial buckethead
// 177 Minfilia (original)
// 178 Urianger (old outfit with mask thing)
// 179 imperial pot helmet
// 180 imperial pot helmet
// 181 biggs or wedge (the lala)
// 182 biggs or wedge (the roe)
// 183 imperial buckethead
// 184 Cid (old outfit)
// 185 imperial pot helmet
// 186 imperial pot helmet (roe)
// 187 Y'shtola with normal sight and aetherometer or whatever
// 188 crazy hair girl
// 189 an elezen with a beard whoa
// 190 some kind of monster? maybe old mamool ja
// 191 Haurchefant in chain mail
// 192 Haurchefant in chain mail
// 193 elezen with a soul patch
// 194 young elezen (emman?)
// 195 elezen with awful facial hair
// 196 roe with straw hat (not the ronin kind)
// 197 generic man
// 198 generic anime man
// 199 Ranjit
// 200 Amalj'aa
// 201 shirtless roe man
// 202 different shirtless roe man
// 203 mutton chops guy
// 204 elezen with a sick red beard whoa
// 205 imperial pot helmet roe beard
// 206 creepy mask miqo
// 207 sylph purple
// 208 sylph green
// 209 weird monster guy
// 210 Erenville
// 211 Wuk Lamat (with hat)
// 212 giant Toucan
// 213 Arkasodara
// 214 some guy
// 215 imperial pot helmet
// 216 gridanian guy?
// 217 lady with cap
// 218 man with cap
// 219 roe with hat
// 220 lalafell with pot helm
// 221 miqo with pot helm
// 222 dude with mask
// 223 girl with pot helm
// 224 lala with pot helm
// 225 guy with cool hair
// 226 dude with pot helm
// 227 lala pot helm
// 228 hyur pot helm
// 229 pot helm
// 230 roe with bandana mask
// 231 yet another pot helm
// 232 poooot helm
// 233 thief rogue?
// 234 full face mask ascian with red floaty mask and hood
// 235 POT. HELM.
// 236 ph
// 237 roe man
// 238 sailor roe man
// 239 maelstrom roe lady
// 240 Mamool Ja
// 241 pot helm
// 242 creepy mask guy
// 243 wood wailer creepy mask
// 244 ix...al?
// 245 cfm
// 246 cfm ww
// 247 elezen with face paint
// 248 Moogle
// 249 lala with tiara and mustache
// 250 boy
// 251 hooded m roe
// 252 hyur m
// 253 hyur m
// 254 Papa...lymo?
// 255 dude
// 256 Emet Selch elpis version
// 257 Krile
// 258 Gulool Ja Ja with cover for dead head
// 259 some mamool ja
// 260 Bakool Ja Ja mystic
// 261 Bakool Ja Ja both heads
// 262 a mamool ja
// 263 another mamool ja
// 264 another mamool ja
// 265 Wuk Lamat without hat
// 266 Koana
// 267 old Gulool Ja Ja with both heads alive
// 268 head of resolve
// 269 head of reason
// 270 Sphene
// 271 evil Otis in machine form
// 272 good Otis in machine form
// 273 Sphene final boss form
// 274 looks like Zero kind of
// "73" + str(number) for index