unit untAttrRace;

interface

uses
  Classes, SysUtils, System.Generics.Collections;

type

  TTriple<A, B, C> = record
    First: A;
    Second: B;
    Third: C;
    constructor Create(const AFirst: A; const ASecond: B; const AThird: C);
  end;

  TYGOValueList = class
  private
    class var None: TTriple<Int64, String, String>;
    class var FAttrList: TArray<TTriple<Int64, String, String>>;
    class var FRaceList: TArray<TTriple<Int64, String, String>>;
  public
    class procedure Init;
    class function GetAttrList: TArray<TTriple<Int64, String, String>>;
    class function GetRaceList: TArray<TTriple<Int64, String, String>>;
    class function AttrIdToItem(AId: Int64): TTriple<Int64, String, String>;
    class function RaceIdToItem(AId: Int64): TTriple<Int64, String, String>;
  end;

implementation

{ TTriple<A, B, C> }

constructor TTriple<A, B, C>.Create(const AFirst: A; const ASecond: B;
  const AThird: C);
begin
  First := AFirst;
  Second := ASecond;
  Third := AThird;
end;

class function TYGOValueList.AttrIdToItem(AId: Int64): TTriple<Int64, String, String>;
var
  i: Integer;
begin
  Result := None;
  for i := 0 to Length(FAttrList) - 1 do begin
    if FAttrList[i].First = AId then begin
      Exit(FAttrList[i]);
    end;
  end;
end;

class function TYGOValueList.GetAttrList: TArray<TTriple<Int64, String, String>>;
begin
  Exit(FAttrList);
end;

class function TYGOValueList.GetRaceList: TArray<TTriple<Int64, String, String>>;
begin
  Exit(FRaceList);
end;

{ TMonsterAttribute }

class procedure TYGOValueList.Init;
begin

  None := TTriple<Int64, String, String>.Create(0, '', '');

  SetLength(FAttrList, 7);
  FAttrList[0] := TTriple<Int64, String, String>.Create($01, 'ATTRIBUTE_EARTH', '地');
  FAttrList[1] := TTriple<Int64, String, String>.Create($02, 'ATTRIBUTE_WATER', '水');
  FAttrList[2] := TTriple<Int64, String, String>.Create($04, 'ATTRIBUTE_FIRE', '炎');
  FAttrList[3] := TTriple<Int64, String, String>.Create($08, 'ATTRIBUTE_WIND', '风');
  FAttrList[4] := TTriple<Int64, String, String>.Create($10, 'ATTRIBUTE_LIGHT', '光');
  FAttrList[5] := TTriple<Int64, String, String>.Create($20, 'ATTRIBUTE_DARK', '暗');
  FAttrList[6] := TTriple<Int64, String, String>.Create($40, 'ATTRIBUTE_DIVINE', '神');

  SetLength(FRaceList, 26);
  FRaceList[0] := TTriple<Int64, String, String>.Create($01, 'RACE_WARRIOR', '战士');
  FRaceList[1] := TTriple<Int64, String, String>.Create($02, 'RACE_SPELLCASTER', '魔法师');
  FRaceList[2] := TTriple<Int64, String, String>.Create($04, 'RACE_FAIRY', '天使');
  FRaceList[3] := TTriple<Int64, String, String>.Create($08, 'RACE_FIEND', '恶魔');
  FRaceList[4] := TTriple<Int64, String, String>.Create($10, 'RACE_ZOMBIE', '不死');
  FRaceList[5] := TTriple<Int64, String, String>.Create($20, 'RACE_MACHINE', '机械');
  FRaceList[6] := TTriple<Int64, String, String>.Create($40, 'RACE_AQUA', '水');
  FRaceList[7] := TTriple<Int64, String, String>.Create($80, 'RACE_PYRO', '炎');
  FRaceList[8] := TTriple<Int64, String, String>.Create($100, 'RACE_ROCK', '岩石');
  FRaceList[9] := TTriple<Int64, String, String>.Create($200, 'RACE_WINDBEAST', '鸟兽');

  FRaceList[10] := TTriple<Int64, String, String>.Create($400, 'RACE_PLANT', '植物');
  FRaceList[11] := TTriple<Int64, String, String>.Create($800, 'RACE_INSECT', '昆虫');
  FRaceList[12] := TTriple<Int64, String, String>.Create($1000, 'RACE_THUNDER', '雷');
  FRaceList[13] := TTriple<Int64, String, String>.Create($2000, 'RACE_DRAGON', '龙');
  FRaceList[14] := TTriple<Int64, String, String>.Create($4000, 'RACE_BEAST', '兽');
  FRaceList[15] := TTriple<Int64, String, String>.Create($8000, 'RACE_BEASTWARRIOR', '兽战士');
  FRaceList[16] := TTriple<Int64, String, String>.Create($10000, 'RACE_DINOSAUR', '恐龙');
  FRaceList[17] := TTriple<Int64, String, String>.Create($20000, 'RACE_FISH', '鱼');
  FRaceList[18] := TTriple<Int64, String, String>.Create($40000, 'RACE_SEASERPENT', '海龙');
  FRaceList[19] := TTriple<Int64, String, String>.Create($80000, 'RACE_REPTILE', '爬虫类');

  FRaceList[20] := TTriple<Int64, String, String>.Create($100000, 'RACE_PSYCHO', '念动力');
  FRaceList[21] := TTriple<Int64, String, String>.Create($200000, 'RACE_DIVINE', '幻神兽');
  FRaceList[22] := TTriple<Int64, String, String>.Create($400000, 'RACE_CREATORGOD', '创造神');
  FRaceList[23] := TTriple<Int64, String, String>.Create($800000, 'RACE_WYRM', '幻龙');
  FRaceList[24] := TTriple<Int64, String, String>.Create($1000000, 'RACE_CYBERSE', '电子界');
  FRaceList[25] := TTriple<Int64, String, String>.Create($2000000, 'RACE_ILLUSION', '幻想魔');
end;

class function TYGOValueList.RaceIdToItem(AId: Int64): TTriple<Int64, String, String>;
var
  i: Integer;
begin
  Result := None;
  for i := 0 to Length(FRaceList) - 1 do begin
    if FRaceList[i].First = AId then begin
      Exit(FRaceList[i]);
    end;
  end;
end;

initialization
  TYGOValueList.Init;

end.
