AdvancedLogParser.PlayerDetails.PlayerDetails C# (CSharp) Method

PlayerDetails() public method

public PlayerDetails ( Player player ) : System
player Player
return System
        public PlayerDetails(Player player)
        {
            characterBox.Columns.Add("Name");
            characterBox.Columns.Add("Class/Level");
            characterBox.Columns.Add("DM?");
            characterBox.Columns.Add("Dead?");

            characterBox.Columns[0].Width = 200;
            characterBox.Columns[1].Width = 200;
            characterBox.Columns[2].Width = 50;
            characterBox.Columns[3].Width = 50;

            characterBox.Width = 520;
            characterBox.Height = 490;

            characterBox.ColumnClick += ColumnSort;
            characterBox.DoubleClick += CharacterDoubleClick;
            characterBox.View = View.Details;

            characterBox.Location = new Point(200, 0);

            characterBox.FullRowSelect = true;

            this.Width = 730;
            this.Height = 520;

            this.Name = player.CommunityIds[0];
            this.Text = this.Name;

            cdKeyLabel.Text = "CD Key:";
            cdKeyLabel.Size = cdKeyLabel.PreferredSize;
            cdKeyLabel.Location = new Point(5, 5);
            cdKeyValue.Text = player.CDKey;
            cdKeyValue.Size = cdKeyValue.PreferredSize;
            cdKeyValue.Location = new Point(100, cdKeyLabel.Location.Y);

            firstLoginLabel.Text = "First Login:";
            firstLoginLabel.Size = firstLoginLabel.PreferredSize;
            firstLoginLabel.Location = new Point(5, cdKeyLabel.Location.Y + cdKeyLabel.Height);
            firstLoginValue.Text = String.Format("{0:yyyy/MM/dd}", player.FirstLogin);
            firstLoginValue.Size = firstLoginValue.PreferredSize;
            firstLoginValue.Location = new Point(100, firstLoginLabel.Location.Y);

            lastLoginLabel.Text = "Last Login:";
            lastLoginLabel.Size = lastLoginLabel.PreferredSize;
            lastLoginLabel.Location = new Point(5, firstLoginLabel.Location.Y + firstLoginLabel.Height);
            lastLoginValue.Text = String.Format("{0:yyyy/MM/dd}", player.LastLogin);
            lastLoginValue.Size = lastLoginValue.PreferredSize;
            lastLoginValue.Location = new Point(100, lastLoginLabel.Location.Y);

            if (player.Is18Plus)
            {
                Is18Plus.Text = "Is the age of majority";
            }
            else
            {
                Is18Plus.Text = "Is NOT the age of majority";
                Is18Plus.ForeColor = Color.Red;
                Is18Plus.BackColor = Color.Yellow;
            }
            Is18Plus.Size = Is18Plus.PreferredSize;
            Is18Plus.Location = new Point(5, lastLoginLabel.Location.Y + lastLoginLabel.Height);
            if (player.IsBanned)
            {
                IsBanned.Text = "Has been BANNED";
                IsBanned.ForeColor = Color.Red;
                IsBanned.BackColor = Color.Yellow;
            }
            else
            {
                IsBanned.Text = "Has not been banned.";
            }
            IsBanned.Size = IsBanned.PreferredSize;
            IsBanned.Location = new Point(5, Is18Plus.Location.Y + Is18Plus.Height);
            if (player.IsDM)
            {
                IsDM.Text = "Is a DM";
            }
            else
            {
                IsDM.Text = "Is not a DM";
            }
            IsDM.Size = IsDM.PreferredSize;
            IsDM.Location = new Point(5, IsBanned.Location.Y + IsBanned.Height);

            foreach (Character ownedChar in player.Characters)
            {
                string classLevel = ClassToAbbreviation(ownedChar.Class1) + ownedChar.Level1;
                if (ownedChar.Class2 < 255)
                {
                    classLevel += "/" + ClassToAbbreviation(ownedChar.Class2) + ownedChar.Level2;
                }
                if (ownedChar.Class3 < 255)
                {
                    classLevel += "/" + ClassToAbbreviation(ownedChar.Class3) + ownedChar.Level3;
                }
                string dm = "";
                string dead = ((ownedChar.Status & 0x001) == 0x001) ? "Y" : "";
                characterBox.Items.Add(new ListViewItem(new string[] { ownedChar.Name, classLevel, dm, dead, ownedChar.Id.ToString() }));
            }

            this.Controls.Add(characterBox);
            this.Controls.Add(cdKeyLabel);
            this.Controls.Add(cdKeyValue);
            this.Controls.Add(firstLoginLabel);
            this.Controls.Add(firstLoginValue);
            this.Controls.Add(lastLoginLabel);
            this.Controls.Add(lastLoginValue);
            this.Controls.Add(IsBanned);
            this.Controls.Add(Is18Plus);
            this.Controls.Add(IsDM);
        }