private void UpdatePlayerListInternal() { bool Active = true; float x = Globals.gamedata.my_char.X; float y = Globals.gamedata.my_char.Y; float z = Globals.gamedata.my_char.Z; System.Collections.ArrayList dirty_items = new System.Collections.ArrayList(); for (int i = 0; i < listView_players_data_items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_players_data_items[i]).SubItems[5].Text); if (Globals.gamedata.nearby_chars.ContainsKey(id)) { CharInfo player = Util.GetChar(id); player.InList = true; //update it ((ListViewItem)listView_players_data_items[i]).SubItems[0].Text = player.WarState.ToString(); //((ListViewItem)listView_players_data_items[i]).SubItems[1].Text = player.Name; if (Active) { ((ListViewItem)listView_players_data_items[i]).SubItems[2].Text = Util.GetClass(player.Class) + (player.isAlikeDead == 0x00 ? " :A: " : " :D: ") + ((int)Util.Distance(x, y, z, player.X, player.Y, player.Z)).ToString("0000"); } else { ((ListViewItem)listView_players_data_items[i]).SubItems[2].Text = Util.GetClass(player.Class); } ((ListViewItem)listView_players_data_items[i]).SubItems[3].Text = player.ClanName; //clan ((ListViewItem)listView_players_data_items[i]).SubItems[4].Text = player.AllyName; //ally //((ListViewItem)listView_players_data_items[i]).SubItems[5].Text = player.ID.ToString();//didnt change ((ListViewItem)listView_players_data_items[i]).ImageIndex = player.ClanCrestIndex; } else { dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_players_data_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (CharInfo player in Globals.gamedata.nearby_chars.Values) { //find the item in our arraylist... if (!player.InList) { player.InList = true; //add it System.Windows.Forms.ListViewItem ObjListItem; ObjListItem = new ListViewItem(player.WarState.ToString()); //war ObjListItem.SubItems.Add(player.Name); //name if (Active) { ObjListItem.SubItems.Add(Util.GetClass(player.Class) + (player.isAlikeDead == 0x00 ? " :A: " : " :D: ") + ((int)Util.Distance(x, y, z, player.X, player.Y, player.Z)).ToString("0000"));//class } else { ObjListItem.SubItems.Add(Util.GetClass(player.Class)); //class } ObjListItem.SubItems.Add(player.ClanName); //clan ObjListItem.SubItems.Add(player.AllyName); //ally ObjListItem.SubItems.Add(player.ID.ToString()); //ID //UpdateClanInfo(ObjListItem); if (player.ClanCrestIndex != 0) { ObjListItem.ImageIndex = player.ClanCrestIndex; } else { ObjListItem.ImageIndex = -1; } //oop cache if (Globals.gamedata.botoptions.OOPNamesArray.Contains(player.Name.ToUpperInvariant())) { if (!Globals.gamedata.botoptions.OOPIDs.Contains(player.ID)) { Globals.gamedata.botoptions.OOPIDs.Add(player.ID); } } listView_players_data_items.Add(ObjListItem); } } }
public void Set_MemberInfo(ByteBuffer buff, bool update) { if (this.label_clan_level.InvokeRequired) { Set_MemberInfo_Callback d = new Set_MemberInfo_Callback(Set_MemberInfo); label_clan_level.Invoke(d, new object[] { buff, update }); return; } string mem_name = buff.ReadString(); //Util.Get_String(buff,ref offset); uint mem_level = buff.ReadUInt32(); //System.BitConverter.ToInt32(buff,offset);offset+=4; uint mem_class = buff.ReadUInt32(); //System.BitConverter.ToUInt32(buff,offset);offset+=4; buff.ReadUInt32(); //sex buff.ReadUInt32(); //race uint mem_online = buff.ReadUInt32(); //online if (Globals.gamedata.Chron <= Chronicle.CT2_6) { buff.ReadUInt32();//pledge type } if (Globals.gamedata.Chron >= Chronicle.CT3_0) { buff.ReadUInt32(); //Sponsor } if (mem_name == "") { return; } bool found = false; foreach (System.Windows.Forms.ListViewItem obj in Globals.l2net_home.listView_char_clan.Items) { if (System.String.Equals(obj.SubItems[0].Text, mem_name)) { obj.SubItems[1].Text = mem_level.ToString(); obj.SubItems[2].Text = Util.GetClass(mem_class); if (mem_online != 0) { if (obj.SubItems[3].Text == "X") { } else { Globals.ClanOnline++; obj.SubItems[3].Text = "X"; } } else { if (obj.SubItems[3].Text == " ") { } else { Globals.ClanOnline--; obj.SubItems[3].Text = " "; } } found = true; } } if (!found) { System.Windows.Forms.ListViewItem ObjListItem = Globals.l2net_home.listView_char_clan.Items.Add(mem_name); ObjListItem.SubItems.Add(mem_level.ToString()); ObjListItem.SubItems.Add(Util.GetClass(mem_class)); if (mem_online != 0) { Globals.ClanOnline++; ObjListItem.SubItems.Add("X"); } else { ObjListItem.SubItems.Add(" "); } if (update) { Globals.ClanMembers++; } } if (update) { label_clan_online.Text = Globals.m_ResourceManager.GetString("col_Online") + ": " + Globals.ClanOnline.ToString() + "/" + Globals.ClanMembers.ToString(); } }
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); }