Static helper that maps club names to catalog indices, display names, short names and crest asset paths. Keeps a legacy name table so old saves resolve to the renamed clubs, and has special-case crests for two exhibition sides.
using System;
namespace Socer;
public static class ClubIdentity
{
static readonly string[] Assets={"barceluna","mancaster","royal-madrid","chelford","liverport","bavaria","saint-lune","juventra"};
static readonly string[] ShortNames={"BARCELUNA","MANCASTER","ROYAL MADRID","CHELFORD","LIVERPORT","BAVARIA","PARIS S.-LUNE","JUVENTRA"};
static readonly string[] LegacyNames={"NORTH","PORT","ATLAS","SPARK","ORBIT","WAVE","GRANITE","VECTOR"};
public static int Index(string name)
{
string value=(name??"").ToUpperInvariant();
int index=Array.FindIndex(ClubCatalog.All,c=>c.Name==value);
if(index<0)index=Array.IndexOf(LegacyNames,value);
if(index<0 && value=="SOUTH")index=1;
return index;
}
public static string DisplayName(string name)=>Index(name) is var index && index>=0?ClubCatalog.Get(index).Name:name??"";
public static string ShortName(int team)=>team<8?ShortNames[Math.Clamp(team,0,7)]:ClubCatalog.Get(team).Name;
public static string ShortName(string name)=>Index(name) is var index && index>=0?ShortName(index):name??"";
public static string Crest(int team)=>ClubCatalog.Get(team).Crest;
// Exhibition sides borrow two distinct regional badges rather than both
// falling back to the player's famous club crest.
public static string Crest(string name)=>name switch
{
"ФК Контент"=>Crest(8),"ФК Хайп"=>Crest(19),
_=>Crest(Math.Max(0,Index(name)))
};
}