Initial Implementation of SSBU PlayReport usage! #638
@ -46,14 +46,17 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
"01006a800016e000",
|
"01006a800016e000",
|
||||||
spec => spec
|
spec => spec
|
||||||
.AddSparseMultiValueFormatter(
|
.AddSparseMultiValueFormatter(
|
||||||
new []{
|
[
|
||||||
// Metadata to figure out what PlayReport we have.
|
// Metadata to figure out what PlayReport we have.
|
||||||
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count", "adv_slot",
|
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
||||||
|
"adv_slot",
|
||||||
// List of Fighters
|
// List of Fighters
|
||||||
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter", "player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
||||||
|
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
||||||
// List of rankings/placements
|
// List of rankings/placements
|
||||||
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank", "player_6_rank", "player_7_rank", "player_8_rank"
|
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
||||||
},
|
"player_6_rank", "player_7_rank", "player_8_rank"
|
||||||
|
],
|
||||||
SuperSmashBrosUltimate_Mode
|
SuperSmashBrosUltimate_Mode
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -77,8 +80,8 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
|
|
||||||
private static FormattedValue SuperMario3DWorldOrBowsersFury(SingleValue value)
|
private static FormattedValue SuperMario3DWorldOrBowsersFury(SingleValue value)
|
||||||
=> value.Matched.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
=> value.Matched.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
||||||
|
|
||||||
private static FormattedValue MarioKart8Deluxe_Mode(SingleValue value)
|
private static FormattedValue MarioKart8Deluxe_Mode(SingleValue value)
|
||||||
=> value.Matched.StringValue switch
|
=> value.Matched.StringValue switch
|
||||||
{
|
{
|
||||||
// Single Player
|
// Single Player
|
||||||
@ -109,7 +112,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
private static FormattedValue PokemonSVUnionCircle(SingleValue value)
|
private static FormattedValue PokemonSVUnionCircle(SingleValue value)
|
||||||
=> value.Matched.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
=> value.Matched.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
||||||
|
|
||||||
private static FormattedValue PokemonSVArea(SingleValue value)
|
private static FormattedValue PokemonSVArea(SingleValue value)
|
||||||
=> value.Matched.StringValue switch
|
=> value.Matched.StringValue switch
|
||||||
{
|
{
|
||||||
// Base Game Locations
|
// Base Game Locations
|
||||||
@ -142,184 +145,205 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
//TODO DLC Locations
|
//TODO DLC Locations
|
||||||
_ => FormattedValue.ForceReset
|
_ => FormattedValue.ForceReset
|
||||||
};
|
};
|
||||||
private static FormattedValue SuperSmashBrosUltimate_Mode(SparseMultiValue valuesWrapper)
|
|
||||||
|
private static FormattedValue SuperSmashBrosUltimate_Mode(SparseMultiValue values)
|
||||||
|
{
|
||||||
|
// Check if the PlayReport is for a challenger approach or an achievement.
|
||||||
|
if (values.Matched.TryGetValue("fighter", out var fighter) && values.Matched.ContainsKey("reason"))
|
||||||
{
|
{
|
||||||
var values = valuesWrapper.Matched;
|
return $"Challenger Approaches - {SuperSmashBrosUltimate_Character(fighter)}";
|
||||||
// Check if the PlayReport is for a challenger approach or an achievement.
|
}
|
||||||
if (values.TryGetValue("fighter", out var fighter) && values.ContainsKey("reason"))
|
|
||||||
{
|
if (values.Matched.TryGetValue("fighter", out fighter) && values.Matched.ContainsKey("challenge_count"))
|
||||||
return $"Challenger Approaches - {SuperSmashBrosUltimate_Character(fighter)}";
|
{
|
||||||
}
|
return $"Fighter Unlocked - {SuperSmashBrosUltimate_Character(fighter)}";
|
||||||
if (values.TryGetValue("fighter", out fighter) && values.ContainsKey("challenge_count"))
|
}
|
||||||
{
|
|
||||||
return $"Fighter Unlocked - {SuperSmashBrosUltimate_Character(fighter)}";
|
if (values.Matched.TryGetValue("anniversary", out var anniversary))
|
||||||
}
|
{
|
||||||
if (values.TryGetValue("anniversary", out var anniversary)) {
|
return $"Achievement Unlocked - ID: {anniversary}";
|
||||||
return $"Achievement Unlocked - ID: {anniversary}";
|
}
|
||||||
}
|
|
||||||
if (values.ContainsKey("adv_slot")) {
|
if (values.Matched.ContainsKey("adv_slot"))
|
||||||
return $"Playing Adventure Mode"; // Doing this as it can be a placeholder until we can grab the character.
|
{
|
||||||
}
|
return
|
||||||
// Check if we have a match_mode at this point, if not, go to default.
|
$"Playing Adventure Mode"; // Doing this as it can be a placeholder until we can grab the character.
|
||||||
if (!values.TryGetValue("match_mode", out var matchMode))
|
}
|
||||||
{
|
|
||||||
return "Smashing";
|
// Check if we have a match_mode at this point, if not, go to default.
|
||||||
}
|
if (!values.Matched.TryGetValue("match_mode", out var matchMode))
|
||||||
return matchMode.BoxedValue switch
|
{
|
||||||
{
|
return "Smashing";
|
||||||
0 when values.TryGetValue("player_1_fighter", out var player) && values.TryGetValue("player_2_fighter", out var challenger)
|
}
|
||||||
=> $"Last Smashed: {SuperSmashBrosUltimate_Character(challenger)}'s Fighter Challenge - {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
1 => $"Last Smashed: Normal Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
return matchMode.BoxedValue switch
|
||||||
2 when values.TryGetValue("player_1_rank", out var team)
|
{
|
||||||
=> team.BoxedValue is 0 ? "Last Smashed: Squad Strike - Red Team Wins"
|
0 when values.Matched.TryGetValue("player_1_fighter", out var player) &&
|
||||||
|
values.Matched.TryGetValue("player_2_fighter", out var challenger)
|
||||||
|
=> $"Last Smashed: {SuperSmashBrosUltimate_Character(challenger)}'s Fighter Challenge - {SuperSmashBrosUltimate_Character(player)}",
|
||||||
|
1 => $"Last Smashed: Normal Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
|
2 when values.Matched.TryGetValue("player_1_rank", out var team)
|
||||||
|
=> team.BoxedValue is 0
|
||||||
|
? "Last Smashed: Squad Strike - Red Team Wins"
|
||||||
: "Last Smashed: Squad Strike - Blue Team Wins",
|
: "Last Smashed: Squad Strike - Blue Team Wins",
|
||||||
3 => $"Last Smashed: Custom Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
3 => $"Last Smashed: Custom Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
4 => $"Last Smashed: Super Sudden Death - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
4 => $"Last Smashed: Super Sudden Death - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
5 => $"Last Smashed: Smashdown - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
5 => $"Last Smashed: Smashdown - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
6 => $"Last Smashed: Tourney Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
6 => $"Last Smashed: Tourney Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
7 when values.TryGetValue("player_1_fighter", out var player)
|
7 when values.Matched.TryGetValue("player_1_fighter", out var player)
|
||||||
=> $"Last Smashed: Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
=> $"Last Smashed: Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
||||||
8 when values.TryGetValue("player_1_fighter", out var player)
|
8 when values.Matched.TryGetValue("player_1_fighter", out var player)
|
||||||
=> $"Playing Adventure Mode as {SuperSmashBrosUltimate_Character(player)}",
|
=> $"Playing Adventure Mode as {SuperSmashBrosUltimate_Character(player)}",
|
||||||
10 when values.TryGetValue("match_submode", out var battle) && values.TryGetValue("player_1_fighter", out var player)
|
10 when values.Matched.TryGetValue("match_submode", out var battle) &&
|
||||||
=> $"Last Smashed: Classic Mode, Battle {(int)battle.BoxedValue + 1}/8 as {SuperSmashBrosUltimate_Character(player)}",
|
values.Matched.TryGetValue("player_1_fighter", out var player)
|
||||||
12 => $"Last Smashed: Century Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
=> $"Last Smashed: Classic Mode, Battle {(int)battle.BoxedValue + 1}/8 as {SuperSmashBrosUltimate_Character(player)}",
|
||||||
13 => $"Last Smashed: All-Star Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
12 => $"Last Smashed: Century Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
14 => $"Last Smashed: Cruel Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
13 => $"Last Smashed: All-Star Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
15 when values.TryGetValue("player_1_fighter", out var player)
|
14 => $"Last Smashed: Cruel Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
=> $"Last Smashed: Home-Run Contest - {SuperSmashBrosUltimate_Character(player)}",
|
15 when values.Matched.TryGetValue("player_1_fighter", out var player)
|
||||||
16 when values.TryGetValue("player_1_fighter", out var player1) && values.TryGetValue("player_2_fighter", out var player2)
|
=> $"Last Smashed: Home-Run Contest - {SuperSmashBrosUltimate_Character(player)}",
|
||||||
=> $"Last Smashed: Home-Run Content (Co-op) - {SuperSmashBrosUltimate_Character(player1)} and {SuperSmashBrosUltimate_Character(player2)}",
|
16 when values.Matched.TryGetValue("player_1_fighter", out var player1) &&
|
||||||
17 => $"Last Smashed: Home-Run Contest (Versus) - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
values.Matched.TryGetValue("player_2_fighter", out var player2)
|
||||||
18 when values.TryGetValue("player_1_fighter", out var player1) && values.TryGetValue("player_2_fighter", out var player2)
|
=> $"Last Smashed: Home-Run Content (Co-op) - {SuperSmashBrosUltimate_Character(player1)} and {SuperSmashBrosUltimate_Character(player2)}",
|
||||||
=> $"Fresh out of Training mode - {SuperSmashBrosUltimate_Character(player1)} with {SuperSmashBrosUltimate_Character(player2)}",
|
17 => $"Last Smashed: Home-Run Contest (Versus) - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
58 => $"Last Smashed: LDN Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
18 when values.Matched.TryGetValue("player_1_fighter", out var player1) &&
|
||||||
63 when values.TryGetValue("player_1_fighter", out var player)
|
values.Matched.TryGetValue("player_2_fighter", out var player2)
|
||||||
=> $"Last Smashed: DLC Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
=> $"Fresh out of Training mode - {SuperSmashBrosUltimate_Character(player1)} with {SuperSmashBrosUltimate_Character(player2)}",
|
||||||
_ => "Smashing"
|
58 => $"Last Smashed: LDN Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
||||||
};
|
63 when values.Matched.TryGetValue("player_1_fighter", out var player)
|
||||||
}
|
=> $"Last Smashed: DLC Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
||||||
private static string SuperSmashBrosUltimate_Character(Value value) =>
|
_ => "Smashing"
|
||||||
BinaryPrimitives.ReverseEndianness(BitConverter.ToInt64(((MsgPack.MessagePackExtendedTypeObject)value.BoxedValue).GetBody(), 0)) switch
|
|
||||||
{
|
|
||||||
0x0 => "Mario",
|
|
||||||
0x1 => "Donkey Kong",
|
|
||||||
0x2 => "Link",
|
|
||||||
0x3 => "Samus",
|
|
||||||
0x4 => "Dark Samus",
|
|
||||||
0x5 => "Yoshi",
|
|
||||||
0x6 => "Kirby",
|
|
||||||
0x7 => "Fox",
|
|
||||||
0x8 => "Pikachu",
|
|
||||||
0x9 => "Luigi",
|
|
||||||
0xA => "Ness",
|
|
||||||
0xB => "Captain Falcon",
|
|
||||||
0xC => "Jigglypuff",
|
|
||||||
0xD => "Peach",
|
|
||||||
0xE => "Daisy",
|
|
||||||
0xF => "Bowser",
|
|
||||||
0x10 => "Ice Climbers",
|
|
||||||
0x11 => "Sheik",
|
|
||||||
0x12 => "Zelda",
|
|
||||||
0x13 => "Dr. Mario",
|
|
||||||
0x14 => "Pichu",
|
|
||||||
0x15 => "Falco",
|
|
||||||
0x16 => "Marth",
|
|
||||||
0x17 => "Lucina",
|
|
||||||
0x18 => "Young Link",
|
|
||||||
0x19 => "Ganondorf",
|
|
||||||
0x1A => "Mewtwo",
|
|
||||||
0x1B => "Roy",
|
|
||||||
0x1C => "Chrom",
|
|
||||||
0x1D => "Mr Game & Watch",
|
|
||||||
0x1E => "Meta Knight",
|
|
||||||
0x1F => "Pit",
|
|
||||||
0x20 => "Dark Pit",
|
|
||||||
0x21 => "Zero Suit Samus",
|
|
||||||
0x22 => "Wario",
|
|
||||||
0x23 => "Snake",
|
|
||||||
0x24 => "Ike",
|
|
||||||
0x25 => "Pokémon Trainer",
|
|
||||||
0x26 => "Diddy Kong",
|
|
||||||
0x27 => "Lucas",
|
|
||||||
0x28 => "Sonic",
|
|
||||||
0x29 => "King Dedede",
|
|
||||||
0x2A => "Olimar",
|
|
||||||
0x2B => "Lucario",
|
|
||||||
0x2C => "R.O.B.",
|
|
||||||
0x2D => "Toon Link",
|
|
||||||
0x2E => "Wolf",
|
|
||||||
0x2F => "Villager",
|
|
||||||
0x30 => "Mega Man",
|
|
||||||
0x31 => "Wii Fit Trainer",
|
|
||||||
0x32 => "Rosalina & Luma",
|
|
||||||
0x33 => "Little Mac",
|
|
||||||
0x34 => "Greninja",
|
|
||||||
0x35 => "Palutena",
|
|
||||||
0x36 => "Pac-Man",
|
|
||||||
0x37 => "Robin",
|
|
||||||
0x38 => "Shulk",
|
|
||||||
0x39 => "Bowser Jr.",
|
|
||||||
0x3A => "Duck Hunt",
|
|
||||||
0x3B => "Ryu",
|
|
||||||
0x3C => "Ken",
|
|
||||||
0x3D => "Cloud",
|
|
||||||
0x3E => "Corrin",
|
|
||||||
0x3F => "Bayonetta",
|
|
||||||
0x40 => "Richter",
|
|
||||||
0x41 => "Inkling",
|
|
||||||
0x42 => "Ridley",
|
|
||||||
0x43 => "King K. Rool",
|
|
||||||
0x44 => "Simon",
|
|
||||||
0x45 => "Isabelle",
|
|
||||||
0x46 => "Incineroar",
|
|
||||||
0x47 => "Mii Brawler",
|
|
||||||
0x48 => "Mii Swordfighter",
|
|
||||||
0x49 => "Mii Gunner",
|
|
||||||
0x4A => "Piranha Plant",
|
|
||||||
0x4B => "Joker",
|
|
||||||
0x4C => "Hero",
|
|
||||||
0x4D => "Banjo",
|
|
||||||
0x4E => "Terry",
|
|
||||||
0x4F => "Byleth",
|
|
||||||
0x50 => "Min Min",
|
|
||||||
0x51 => "Steve",
|
|
||||||
0x52 => "Sephiroth",
|
|
||||||
0x53 => "Pyra/Mythra",
|
|
||||||
0x54 => "Kazuya",
|
|
||||||
0x55 => "Sora",
|
|
||||||
0xFE => "Random",
|
|
||||||
0xFF => "Scripted Entity",
|
|
||||||
_ => "Unknown"
|
|
||||||
};
|
};
|
||||||
private static string SuperSmashBrosUltimate_PlayerListing(Dictionary<string, Value> values)
|
}
|
||||||
{
|
|
||||||
var players = new List<(string Character, int PlayerNumber, int? Rank)>();
|
|
||||||
|
|
||||||
foreach (var player in values)
|
|
||||||
{
|
|
||||||
if (player.Key.StartsWith("player_") && player.Key.EndsWith("_fighter") && player.Value.BoxedValue is not null)
|
|
||||||
{
|
|
||||||
int playerNumber = int.Parse(player.Key.Split('_')[1]);
|
|
||||||
string character = SuperSmashBrosUltimate_Character(player.Value);
|
|
||||||
int? rank = values.TryGetValue($"player_{playerNumber}_rank", out var rankValue) ? (int)rankValue.BoxedValue : null;
|
|
||||||
|
|
||||||
players.Add((character, playerNumber, rank));
|
private static string SuperSmashBrosUltimate_Character(Value value) =>
|
||||||
}
|
BinaryPrimitives.ReverseEndianness(
|
||||||
}
|
BitConverter.ToInt64(((MsgPack.MessagePackExtendedTypeObject)value.BoxedValue).GetBody(), 0)) switch
|
||||||
|
|
||||||
players = players.OrderBy(p => p.Rank ?? int.MaxValue).ToList();
|
|
||||||
string RankMedal(int? rank) => rank switch
|
|
||||||
{
|
{
|
||||||
0 => "🥇",
|
0x0 => "Mario",
|
||||||
1 => "🥈",
|
0x1 => "Donkey Kong",
|
||||||
2 => "🥉",
|
0x2 => "Link",
|
||||||
_ => ""
|
0x3 => "Samus",
|
||||||
|
0x4 => "Dark Samus",
|
||||||
|
0x5 => "Yoshi",
|
||||||
|
0x6 => "Kirby",
|
||||||
|
0x7 => "Fox",
|
||||||
|
0x8 => "Pikachu",
|
||||||
|
0x9 => "Luigi",
|
||||||
|
0xA => "Ness",
|
||||||
|
0xB => "Captain Falcon",
|
||||||
|
0xC => "Jigglypuff",
|
||||||
|
0xD => "Peach",
|
||||||
|
0xE => "Daisy",
|
||||||
|
0xF => "Bowser",
|
||||||
|
0x10 => "Ice Climbers",
|
||||||
|
0x11 => "Sheik",
|
||||||
|
0x12 => "Zelda",
|
||||||
|
0x13 => "Dr. Mario",
|
||||||
|
0x14 => "Pichu",
|
||||||
|
0x15 => "Falco",
|
||||||
|
0x16 => "Marth",
|
||||||
|
0x17 => "Lucina",
|
||||||
|
0x18 => "Young Link",
|
||||||
|
0x19 => "Ganondorf",
|
||||||
|
0x1A => "Mewtwo",
|
||||||
|
0x1B => "Roy",
|
||||||
|
0x1C => "Chrom",
|
||||||
|
0x1D => "Mr Game & Watch",
|
||||||
|
0x1E => "Meta Knight",
|
||||||
|
0x1F => "Pit",
|
||||||
|
0x20 => "Dark Pit",
|
||||||
|
0x21 => "Zero Suit Samus",
|
||||||
|
0x22 => "Wario",
|
||||||
|
0x23 => "Snake",
|
||||||
|
0x24 => "Ike",
|
||||||
|
0x25 => "Pokémon Trainer",
|
||||||
|
0x26 => "Diddy Kong",
|
||||||
|
0x27 => "Lucas",
|
||||||
|
0x28 => "Sonic",
|
||||||
|
0x29 => "King Dedede",
|
||||||
|
0x2A => "Olimar",
|
||||||
|
0x2B => "Lucario",
|
||||||
|
0x2C => "R.O.B.",
|
||||||
|
0x2D => "Toon Link",
|
||||||
|
0x2E => "Wolf",
|
||||||
|
0x2F => "Villager",
|
||||||
|
0x30 => "Mega Man",
|
||||||
|
0x31 => "Wii Fit Trainer",
|
||||||
|
0x32 => "Rosalina & Luma",
|
||||||
|
0x33 => "Little Mac",
|
||||||
|
0x34 => "Greninja",
|
||||||
|
0x35 => "Palutena",
|
||||||
|
0x36 => "Pac-Man",
|
||||||
|
0x37 => "Robin",
|
||||||
|
0x38 => "Shulk",
|
||||||
|
0x39 => "Bowser Jr.",
|
||||||
|
0x3A => "Duck Hunt",
|
||||||
|
0x3B => "Ryu",
|
||||||
|
0x3C => "Ken",
|
||||||
|
0x3D => "Cloud",
|
||||||
|
0x3E => "Corrin",
|
||||||
|
0x3F => "Bayonetta",
|
||||||
|
0x40 => "Richter",
|
||||||
|
0x41 => "Inkling",
|
||||||
|
0x42 => "Ridley",
|
||||||
|
0x43 => "King K. Rool",
|
||||||
|
0x44 => "Simon",
|
||||||
|
0x45 => "Isabelle",
|
||||||
|
0x46 => "Incineroar",
|
||||||
|
0x47 => "Mii Brawler",
|
||||||
|
0x48 => "Mii Swordfighter",
|
||||||
|
0x49 => "Mii Gunner",
|
||||||
|
0x4A => "Piranha Plant",
|
||||||
|
0x4B => "Joker",
|
||||||
|
0x4C => "Hero",
|
||||||
|
0x4D => "Banjo",
|
||||||
|
0x4E => "Terry",
|
||||||
|
0x4F => "Byleth",
|
||||||
|
0x50 => "Min Min",
|
||||||
|
0x51 => "Steve",
|
||||||
|
0x52 => "Sephiroth",
|
||||||
|
0x53 => "Pyra/Mythra",
|
||||||
|
0x54 => "Kazuya",
|
||||||
|
0x55 => "Sora",
|
||||||
|
0xFE => "Random",
|
||||||
|
0xFF => "Scripted Entity",
|
||||||
|
_ => "Unknown"
|
||||||
};
|
};
|
||||||
|
|
||||||
return players.Count > 4
|
private static string SuperSmashBrosUltimate_PlayerListing(SparseMultiValue values)
|
||||||
? $"{players.Count} Players - " + string.Join(", ", players.Take(3).Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"))
|
{
|
||||||
: string.Join(", ", players.Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"));
|
List<(string Character, int PlayerNumber, int? Rank)> players = [];
|
||||||
|
|
||||||
|
foreach (var player in values.Matched)
|
||||||
|
{
|
||||||
|
if (player.Key.StartsWith("player_") && player.Key.EndsWith("_fighter") &&
|
||||||
|
player.Value.BoxedValue is not null)
|
||||||
|
{
|
||||||
|
int playerNumber = int.Parse(player.Key.Split('_')[1]);
|
||||||
|
string character = SuperSmashBrosUltimate_Character(player.Value);
|
||||||
|
int? rank = values.Matched.TryGetValue($"player_{playerNumber}_rank", out var rankValue)
|
||||||
|
? (int)rankValue.BoxedValue
|
||||||
|
: null;
|
||||||
|
|
||||||
|
players.Add((character, playerNumber, rank));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
players = players.OrderBy(p => p.Rank ?? int.MaxValue).ToList();
|
||||||
|
|
||||||
|
string RankMedal(int? rank) => rank switch
|
||||||
|
{
|
||||||
|
0 => "🥇",
|
||||||
|
1 => "🥈",
|
||||||
|
2 => "🥉",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
|
||||||
|
return players.Count > 4
|
||||||
|
? $"{players.Count} Players - " + string.Join(", ",
|
||||||
|
players.Take(3).Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"))
|
||||||
|
: string.Join(", ", players.Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user