Show trainer name&id for registered Stadium teams in dropdown

This commit is contained in:
Kurt 2020-10-09 20:31:13 -07:00
parent 6b1fff05bd
commit bb65f2d2c2
4 changed files with 38 additions and 7 deletions

View File

@ -177,7 +177,16 @@ public string GetTeamName(int team)
var teamsPerType = Japanese ? TeamCountJ : TeamCountU;
var type = team / teamsPerType;
var index = team % teamsPerType;
return $"{GetTeamTypeName(type).Replace('_', ' ')} {index + 1}";
var name = $"{GetTeamTypeName(type).Replace('_', ' ')} {index + 1}";
var ofs = GetTeamOffset(team);
var otOfs = ofs + (Japanese ? 2 : 1);
var str = GetString(otOfs, Japanese ? 5 : 7);
if (string.IsNullOrWhiteSpace(str))
return name;
var idOfs = ofs + (Japanese ? 0xC : 0x8);
var id = BigEndian.ToUInt16(Data, idOfs);
return $"{name} [{id:D5}:{str}]";
}
private string GetTeamTypeName(int type)

View File

@ -89,7 +89,18 @@ protected override PKM GetPKM(byte[] data)
public override int GetBoxOffset(int box) => Box + ListHeaderSize + (box * BoxSizeJ);
public static int GetTeamOffset(int team) => 0 + ListHeaderSize + (team * TeamSizeJ);
public static string GetTeamName(int team) => $"Team {team + 1}";
public string GetTeamName(int team)
{
var name = $"Team {team + 1}";
var ofs = GetTeamOffset(team);
var str = GetString(ofs + 2, 5);
if (string.IsNullOrWhiteSpace(str))
return name;
var id = BigEndian.ToUInt16(Data, ofs + 8);
return $"{name} [{id:D5}:{str}]";
}
public override SlotGroup GetTeam(int team)
{

View File

@ -130,7 +130,17 @@ public static int GetTeamOffset(int team)
return 0x4000 + ((team - 40) * TeamSize);
}
public static string GetTeamName(int team) => $"{((Stadium2TeamType)(team / TeamCountType)).ToString().Replace('_', ' ')} {(team % 10) + 1}";
public string GetTeamName(int team)
{
var name = $"{((Stadium2TeamType) (team / TeamCountType)).ToString().Replace('_', ' ')} {(team % 10) + 1}";
var ofs = GetTeamOffset(team);
var str = GetString(ofs + 4, 7);
if (string.IsNullOrWhiteSpace(str))
return name;
var id = BigEndian.ToUInt16(Data, ofs + 2);
return $"{name} [{id:D5}:{str}]";
}
public override string GetBoxName(int box)
{

View File

@ -41,7 +41,7 @@ private void InitializeComponent()
// B_BoxRight
//
this.B_BoxRight.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.B_BoxRight.Location = new System.Drawing.Point(194, 3);
this.B_BoxRight.Location = new System.Drawing.Point(206, 3);
this.B_BoxRight.Name = "B_BoxRight";
this.B_BoxRight.Size = new System.Drawing.Size(27, 23);
this.B_BoxRight.TabIndex = 68;
@ -52,7 +52,7 @@ private void InitializeComponent()
// B_BoxLeft
//
this.B_BoxLeft.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.B_BoxLeft.Location = new System.Drawing.Point(28, 3);
this.B_BoxLeft.Location = new System.Drawing.Point(16, 3);
this.B_BoxLeft.Name = "B_BoxLeft";
this.B_BoxLeft.Size = new System.Drawing.Size(27, 23);
this.B_BoxLeft.TabIndex = 67;
@ -63,10 +63,11 @@ private void InitializeComponent()
// CB_BoxSelect
//
this.CB_BoxSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_BoxSelect.DropDownWidth = 252;
this.CB_BoxSelect.FormattingEnabled = true;
this.CB_BoxSelect.Location = new System.Drawing.Point(61, 4);
this.CB_BoxSelect.Location = new System.Drawing.Point(48, 4);
this.CB_BoxSelect.Name = "CB_BoxSelect";
this.CB_BoxSelect.Size = new System.Drawing.Size(127, 21);
this.CB_BoxSelect.Size = new System.Drawing.Size(152, 21);
this.CB_BoxSelect.TabIndex = 66;
this.CB_BoxSelect.SelectedIndexChanged += new System.EventHandler(this.CB_BoxSelect_SelectedIndexChanged);
//