コード例 #1
0
        private void listView_players_data_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = "";

            if (listView_players_data.SelectedIndices.Count > 0)
            {
                //action to this item
                uint     id     = Util.GetUInt32(listView_players_data.Items[listView_players_data.SelectedIndices[0]].SubItems[5].Text);
                CharInfo player = null;

                if (Globals.PlayerLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI))
                {
                    try
                    {
                        player = Util.GetChar(id);
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitReadLock();
                    }
                }

                if (player != null)
                {
                    text = player.Name + Environment.NewLine +
                           player.Title + Environment.NewLine +
                           (player.Sex == 0 ? "Male " : "Female ") + Util.GetRace(player.Race) + " " + Util.GetClass(player.Class) + Environment.NewLine +
                           "R: " + (player.EnchantAmount == 0 ? "" : "+" + player.EnchantAmount.ToString() + " ") + Util.GetItemName(player.RHand) + Environment.NewLine +
                           "LR: " + Util.GetItemName(player.LRHand) + Environment.NewLine +
                           "L: " + Util.GetItemName(player.LHand) + Environment.NewLine +
                           Util.GetItemName(player.Head) + Environment.NewLine +
                           Util.GetItemName(player.Gloves) + Environment.NewLine +
                           Util.GetItemName(player.Feet) + Environment.NewLine +
                           Util.GetItemName(player.Chest) + Environment.NewLine +
                           Util.GetItemName(player.Legs) + Environment.NewLine +
                           Util.GetItemName(player.Back) + Environment.NewLine +
                           Util.GetItemName(player.Hair) + Environment.NewLine +
                           "PvP Flag: " + player.PvPFlag.ToString() + Environment.NewLine +
                           (player.isAlikeDead == 0x00 ? "Alive" : "Dead") + Environment.NewLine +
                           "Karma: " + player.Karma.ToString() + Environment.NewLine +
                           "Cast Speed: " + player.MatkSpeed.ToString() + Environment.NewLine +
                           "Attack Speed: " + (player.PatkSpeed /* * player.AttackSpeedMult*/).ToString() + Environment.NewLine +
                           "Run Speed: " + (player.RunSpeed * player.MoveSpeedMult).ToString() + Environment.NewLine +
                           "Rec: " + player.RecAmount.ToString() + Environment.NewLine +
                           "X: " + player.X.ToString() + Environment.NewLine +
                           "Y: " + player.Y.ToString() + Environment.NewLine +
                           "Z: " + player.Z.ToString() + Environment.NewLine +
                           "Dist: " + Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, player.X, player.Y, player.Z).ToString() + Environment.NewLine +
                           "Unique ID: " + player.ID + Environment.NewLine +
                           "Name Color: " + player.NameColor.ToString();
                }
            }

            toolTip1.SetToolTip(listView_players_data, text);
        }