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); }
private void listView_npc_data_SelectedIndexChanged(object sender, EventArgs e) { string text = ""; if (listView_npc_data.SelectedIndices.Count > 0) { //action to this item uint id = Util.GetUInt32(listView_npc_data.Items[listView_npc_data.SelectedIndices[0]].SubItems[2].Text); NPCInfo npc = null; if (Globals.NPCLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI)) { try { npc = Util.GetNPC(id); } finally { Globals.NPCLock.ExitReadLock(); } } if (npc != null) { text = npc.Name + Environment.NewLine + npc.Title + Environment.NewLine + (npc.isAttackable == 0x00 ? "Invincible" : "Attackable") + Environment.NewLine + "Cast Speed: " + npc.MatkSpeed.ToString() + Environment.NewLine + "Attack Speed: " + (npc.AttackSpeedMult * npc.PatkSpeed).ToString() + Environment.NewLine + "Run Speed: " + (npc.RunSpeed * npc.MoveSpeedMult).ToString() + Environment.NewLine + "R: " + Util.GetItemName(npc.RHand) + Environment.NewLine + "LR: " + Util.GetItemName(npc.LRHand) + Environment.NewLine + "L: " + Util.GetItemName(npc.LHand) + Environment.NewLine + (npc.isAlikeDead == 0x00 ? "Alive" : "Dead") + Environment.NewLine + /*(npc.isInvisible == 0x00 ? "Spawned" : "Summoned") + Environment.NewLine +*/ "Karma: " + npc.Karma.ToString() + Environment.NewLine + "Abnormal Effects: " + npc.AbnormalEffects.ToString() + Environment.NewLine + "X: " + npc.X.ToString() + Environment.NewLine + "Y: " + npc.Y.ToString() + Environment.NewLine + "Z: " + npc.Z.ToString() + Environment.NewLine + "Dist: " + Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, npc.X, npc.Y, npc.Z).ToString() + Environment.NewLine + "Cur HP: " + npc.Cur_HP + Environment.NewLine + "Max HP: " + npc.Max_HP + Environment.NewLine + (npc.isInvisible == 0x00 ? "Visible" : "Invisible") + Environment.NewLine + "Type ID: " + npc.NPCID + Environment.NewLine + "Unique ID: " + npc.ID + Environment.NewLine + "SummonedNameColor: " + npc.SummonedNameColor; } } toolTip1.SetToolTip(listView_npc_data, text); }
public static void CleanUp_NPC() { long now = System.DateTime.Now.Ticks; System.Collections.ArrayList remove = new System.Collections.ArrayList(); Globals.NPCLock.EnterReadLock(); try { foreach(NPCInfo npc in Globals.gamedata.nearby_npcs.Values) { int dist = Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, npc.X, npc.Y, npc.Z); if (npc.RemoveAt <= now && dist >= Globals.REMOVE_RANGE_INNER) { remove.Add(npc.ID); } else if (dist >= Globals.REMOVE_RANGE) { remove.Add(npc.ID); } } } catch { //oh well } finally { Globals.NPCLock.ExitReadLock(); } if (remove.Count > 0) { foreach (uint id in remove) { //Globals.l2net_home.Add_OnlyDebug("NPC Cleanup - Removing: " + id.ToString()); Remove_NPCInfo(id); } Globals.l2net_home.timer_npcs.Start(); } }
private void listView_items_data_SelectedIndexChanged(object sender, EventArgs e) { string text = ""; if (listView_items_data.SelectedIndices.Count > 0) { //action to this item uint id = Util.GetUInt32(listView_items_data.Items[listView_items_data.SelectedIndices[0]].SubItems[2].Text); ItemInfo item = null; if (Globals.ItemLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI)) { try { item = Util.GetItem(id); } finally { Globals.ItemLock.ExitReadLock(); } } if (item != null) { text = Util.GetItemName(item.ItemID) + Environment.NewLine + item.Count.ToString() + Environment.NewLine + (item.Stackable == 0x01 ? "Stacks" : "Single") + Environment.NewLine + "X: " + item.X.ToString() + Environment.NewLine + "Y: " + item.Y.ToString() + Environment.NewLine + "Z: " + item.Z.ToString() + Environment.NewLine + "Dist: " + Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, item.X, item.Y, item.Z).ToString() + Environment.NewLine + "Type ID: " + item.ItemID + Environment.NewLine + "Unique ID: " + item.ID; } } toolTip1.SetToolTip(listView_items_data, text); }
public static void CleanUp_Char() { System.Collections.ArrayList remove = new System.Collections.ArrayList(); Globals.PlayerLock.EnterReadLock(); try { foreach(CharInfo player in Globals.gamedata.nearby_chars.Values) { int dist = Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, player.X, player.Y, player.Z); if (dist >= Globals.REMOVE_RANGE) { remove.Add(player.ID); } } } catch { //oh well } finally { Globals.PlayerLock.ExitReadLock(); } if (remove.Count > 0) { foreach (uint id in remove) { //Globals.l2net_home.Add_OnlyDebug("Player Cleanup - Removing: " + id.ToString()); Remove_CharInfo(id); } Globals.l2net_home.timer_players.Start(); } }
public static void CleanUp_Item() { ArrayList remove = new ArrayList(); Globals.ItemLock.EnterReadLock(); try { foreach (ItemInfo item in Globals.gamedata.nearby_items.Values) { int dist = Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, item.X, item.Y, item.Z); if (dist >= Globals.REMOVE_RANGE) { remove.Add(item.ID); } } } catch { //oh well } finally { Globals.ItemLock.ExitReadLock(); } if (remove.Count > 0) { foreach (uint id in remove) { //Globals.l2net_home.Add_OnlyDebug("Item Cleanup - Removing: " + id.ToString()); Remove_Item(id); } Globals.l2net_home.timer_items.Start(); } }
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); } } }