private void FillInventoryList() { foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values) { //add it ListViewItem ObjListItem; if (inv_inf.isEquipped == 0x01 || inv_inf.Type2 == 0x03 || inv_inf.Type2 == 0x04) //Equipped, quest item or adena { //Do nothing } else { if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID listView_privatestoresell_inv.Items.Add(ObjListItem); } } }
public void LoadDrop(ByteBuffer buff) { DroppedBy = buff.ReadUInt32(); ID = buff.ReadUInt32(); ItemID = buff.ReadUInt32(); X = buff.ReadInt32(); Y = buff.ReadInt32(); Z = buff.ReadInt32(); if (CheckMobZ(DroppedBy)) { HasValidZ = true; } Stackable = buff.ReadUInt32(); lock (CountLock) { Count = buff.ReadUInt64(); } HasMesh = Util.GetItemHasMesh(ItemID); if (HasMesh) { string tempitemname = Util.GetItemName(ItemID); if (tempitemname.Length < 3) { HasMesh = false; GameData.meshless_ignored += 1; } } //Globals.l2net_home.Add_Text("length" + length + " ID" + ID + " ItemID " + ItemID + " X " + X + " Y " + Y + " Z " + Z + " Stackable " + Stackable + " Count " + Count + " HasMesh " + HasMesh, Globals.Green, TextType.BOT); }
private void FillInvenrotyList() { foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values) { //add it System.Windows.Forms.ListViewItem ObjListItem; if (inv_inf.isEquipped == 0x01) //Equipped { //Do nothing } else if (inv_inf.Type2 == 0x03) //quest item { //Do Nothing } else { if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID listView_trade_mychar.Items.Add(ObjListItem); } } }
public void Load(ByteBuffer buff) { ID = buff.ReadUInt32(); ItemID = buff.ReadUInt32(); X = buff.ReadInt32(); Y = buff.ReadInt32(); Z = buff.ReadInt32(); Stackable = buff.ReadUInt32(); //this is an item that was dropped previously... need to check for the Z range in the pickup function HasValidZ = true; Loadedin = true; lock (CountLock) { Count = buff.ReadUInt64(); } HasMesh = Util.GetItemHasMesh(ItemID); if (HasMesh) { string tempitemname = Util.GetItemName(ItemID); if (tempitemname.Length < 3) { HasMesh = false; GameData.meshless_ignored += 1; } } //Globals.l2net_home.Add_Text(" ID" + ID + " ItemID " + ItemID + " X " + X + " Y " + Y + " Z " + Z + " Stackable " + Stackable + " Count " + Count + " HasMesh " + HasMesh, Globals.Green, TextType.BOT); }
private void UpdateItemsListInternal() { System.Collections.ArrayList dirty_items = new System.Collections.ArrayList(); for (int i = 0; i < listView_items_data_items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_items_data_items[i]).SubItems[2].Text); if (Globals.gamedata.nearby_items.ContainsKey(id)) { ItemInfo item = Util.GetItem(id); item.InList = true; //update it //((ListViewItem)listView_items_data_items[i]).SubItems[0].Text = Util.GetItemName(item.ItemID); //((ListViewItem)listView_items_data_items[i]).SubItems[1].Text = item.Count.ToString(); //((ListViewItem)listView_items_data_items[i]).SubItems[2].Text = item.ID.ToString(); } else { dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_items_data_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (ItemInfo item in Globals.gamedata.nearby_items.Values) { if (!item.InList) { item.InList = true; string mesh_info = ""; if (!item.HasMesh) { mesh_info = " [NO MESH]"; } //add it System.Windows.Forms.ListViewItem ObjListItem; ObjListItem = new ListViewItem(Util.GetItemName(item.ItemID) + mesh_info); //ItmID ObjListItem.SubItems.Add(item.Count.ToString()); //Count ObjListItem.SubItems.Add(item.ID.ToString()); //ObjID ObjListItem.ImageIndex = AddInfo.Get_Item_Image_Index(item.ItemID); listView_items_data_items.Add(ObjListItem); } } }
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); }
private void FillBuyList() { //add System.Windows.Forms.ListViewItem ObjListItem; foreach (BuyList b_list in Globals.gamedata.buylist.Values) { ObjListItem = new ListViewItem(Util.GetItemName(b_list.ItemID)); ObjListItem.SubItems.Add(b_list.Price.ToString()); //Price ObjListItem.SubItems.Add(b_list.ItemID.ToString()); //Item ID //ObjListItem.SubItems.Add(b_list.ItemID.ToString()); //Buylist ID listView_buylist.Items.Add(ObjListItem); } }
private void fill_pet_inventory() { try { listView_petTake_PetInv.Items.Clear(); foreach (PetInventoryInfo inv_inf in Globals.gamedata.my_pet.inventory.Values) { //add it ListViewItem ObjListItem; if (inv_inf.isEquipped == 0x01) //Equipped { //Do nothing } else if (inv_inf.Type2 == 0x03) //quest item { //Do Nothing } else { if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID listView_petTake_PetInv.Items.Add(ObjListItem); } } } catch { //failed } }
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 void fill_pet_inventory() { try { listView_pet_PetInv.Items.Clear(); foreach (PetInventoryInfo inv_inf in Globals.gamedata.my_pet.inventory.Values) { //Add ListViewItem ObjListItem; if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString());//Count if (inv_inf.isEquipped == 0x01) { ObjListItem.SubItems.Add("X"); } else { ObjListItem.SubItems.Add(""); } ObjListItem.SubItems.Add(inv_inf.ID.ToString());//ObjID listView_pet_PetInv.Items.Add(ObjListItem); } } catch { //failed Globals.l2net_home.Add_Text("ERROR: Failed to fill pet inventory list", Globals.Red, TextType.BOT); } }
private void UpdateInventoryListInternal() { System.Collections.ArrayList dirty_items = new System.Collections.ArrayList(); #region Equipped Items if (radioButton_inv_equipped.Checked) { for (int i = 0; i < listView_inventory_items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_inventory_items[i]).SubItems[4].Text); if (Globals.gamedata.inventory.ContainsKey(id)) { //already in the list... InventoryInfo inv_inf = Util.GetInventory(id); if (inv_inf.isEquipped == 0x01) { inv_inf.InList = true; //update the entry if (inv_inf.Enchant == 0) { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = Util.GetItemName(inv_inf.ItemID); } else { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = "+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID); } ((ListViewItem)listView_inventory_items[i]).SubItems[1].Text = inv_inf.Count.ToString(); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = "X"; } else { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = " "; } //((ListViewItem)listView_inventory_items[i]).SubItems[3].Text = inv_inf.Slot.ToString();//Slot } else { //not in the list... //delete this item dirty_items.Add(i); } } else { //not in the list... //delete this item dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_inventory_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values) { if (!inv_inf.InList && inv_inf.isEquipped == 0x01) { inv_inf.InList = true; //add it System.Windows.Forms.ListViewItem ObjListItem; if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ObjListItem.SubItems.Add("X"); //Do_Equip(inv_inf); } else { ObjListItem.SubItems.Add(" "); } ObjListItem.SubItems.Add(inv_inf.Slot.ToString()); //Slot ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID ObjListItem.ImageIndex = AddInfo.Get_Item_Image_Index(inv_inf.ItemID); listView_inventory_items.Add(ObjListItem); } } } #endregion #region Normal Items if (radioButton_inv_items.Checked) { for (int i = 0; i < listView_inventory_items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_inventory_items[i]).SubItems[4].Text); if (Globals.gamedata.inventory.ContainsKey(id)) { //already in the list... InventoryInfo inv_inf = Util.GetInventory(id); if (inv_inf.isEquipped != 0x01 && inv_inf.Type2 != 0x03) { inv_inf.InList = true; //update the entry if (inv_inf.Enchant == 0) { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = Util.GetItemName(inv_inf.ItemID); } else { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = "+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID); } ((ListViewItem)listView_inventory_items[i]).SubItems[1].Text = inv_inf.Count.ToString(); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = "X"; } else { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = " "; } //((ListViewItem)listView_inventory_items[i]).SubItems[3].Text = inv_inf.Slot.ToString();//Slot } else { //not in the list... //delete this item dirty_items.Add(i); } } else { //not in the list... //delete this item dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_inventory_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values) { if (!inv_inf.InList && inv_inf.isEquipped != 0x01 && inv_inf.Type2 != 0x03) { inv_inf.InList = true; //add it System.Windows.Forms.ListViewItem ObjListItem; if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ObjListItem.SubItems.Add("X"); //Do_Equip(inv_inf); } else { ObjListItem.SubItems.Add(" "); } ObjListItem.SubItems.Add(inv_inf.Slot.ToString()); //Slot ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID ObjListItem.ImageIndex = AddInfo.Get_Item_Image_Index(inv_inf.ItemID); listView_inventory_items.Add(ObjListItem); } } } #endregion #region Quest Items if (radioButton_inv_quest.Checked) { for (int i = 0; i < listView_inventory_items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_inventory_items[i]).SubItems[4].Text); if (Globals.gamedata.inventory.ContainsKey(id)) { //already in the list... InventoryInfo inv_inf = Util.GetInventory(id); if (inv_inf.Type2 == 0x03) { inv_inf.InList = true; //update the entry if (inv_inf.Enchant == 0) { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = Util.GetItemName(inv_inf.ItemID); } else { ((ListViewItem)listView_inventory_items[i]).SubItems[0].Text = "+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID); } ((ListViewItem)listView_inventory_items[i]).SubItems[1].Text = inv_inf.Count.ToString(); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = "X"; } else { ((ListViewItem)listView_inventory_items[i]).SubItems[2].Text = " "; } //((ListViewItem)listView_inventory_items[i]).SubItems[3].Text = inv_inf.Slot.ToString();//Slot } else { //not in the list... //delete this item dirty_items.Add(i); } } else { //not in the list... //delete this item dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_inventory_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values) { if (!inv_inf.InList && inv_inf.Type2 == 0x03) { inv_inf.InList = true; //add it System.Windows.Forms.ListViewItem ObjListItem; if (inv_inf.Enchant == 0) { ObjListItem = new ListViewItem(Util.GetItemName(inv_inf.ItemID)); } else { ObjListItem = new ListViewItem("+" + inv_inf.Enchant.ToString() + " " + Util.GetItemName(inv_inf.ItemID)); } ObjListItem.SubItems.Add(inv_inf.Count.ToString()); //Count if (inv_inf.isEquipped == 0x01) //isEquipped { ObjListItem.SubItems.Add("X"); //Do_Equip(inv_inf); } else { ObjListItem.SubItems.Add(" "); } ObjListItem.SubItems.Add(inv_inf.Slot.ToString()); //Slot ObjListItem.SubItems.Add(inv_inf.ID.ToString()); //ObjID ObjListItem.ImageIndex = AddInfo.Get_Item_Image_Index(inv_inf.ItemID); listView_inventory_items.Add(ObjListItem); } } } #endregion }
public void updateStats(uint uID, uint uItemID, uint previousisEquipped, uint isEquipped, ulong previousCount, ulong newCount) { if (previousisEquipped == 1 || isEquipped == 1) { return; } long differenceint = 0; //this can be negative... if so we dont want to do anything... btw dont change these to ulong, or it will break, I'm warning you Oddi!!! don't do it!!! differenceint = (long)newCount - (long)previousCount; if (differenceint < 0) { //no way, I didn't lose any items like soulshots. return; } if (uItemID == 57) { //this is updated with the xp/sp stuff.... just because it updates more often. if (!Globals.gamedata.initial_Adena_Gained_received) { GameData.initial_Adena = Count; Globals.gamedata.initial_Adena_Gained_received = true; } else { GameData.current_Adena = Count; } } else { int countlistview = Globals.l2net_home.listView_stats.Items.Count; int found = 0; if (countlistview > 0) { for (int i = 0; i <= countlistview - 1; i++) { if (Globals.l2net_home.listView_stats.Items[i].SubItems[1].Text.Equals(uItemID.ToString())) { ulong current = 0; ulong replaceint = 0; //get the current listview's amount current = System.Convert.ToUInt64(Globals.l2net_home.listView_stats.Items[i].SubItems[2].Text); //necessary to add items together that aren't stackable. if (differenceint == 0) { differenceint += 1; } //add the listview's current amount and the amount we gained from this packet. replaceint = current + (ulong)differenceint; //replace the count for the specific item Globals.l2net_home.listView_stats.Items[i].SubItems[2].Text = replaceint.ToString(); //lets break out of this loop... i = countlistview; found = 1; } } } if (found == 0) { //didnt find the item, let's create a new item in our listview. ListViewItem statsItem = new ListViewItem(Util.GetItemName(uItemID)); statsItem.SubItems.Add(uItemID.ToString()); statsItem.SubItems.Add(differenceint.ToString()); statsItem.SubItems.Add(uID.ToString()); Globals.l2net_home.listView_stats.Items.Add(statsItem); } } }
private void listView_inventory_SelectedIndexChanged(object sender, EventArgs e) { string text = ""; if (listView_inventory.SelectedIndices.Count > 0) { uint id = Util.GetUInt32(listView_inventory.Items[listView_inventory.SelectedIndices[0]].SubItems[4].Text); InventoryInfo item = null; if (Globals.InventoryLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI)) { try { item = Util.GetInventory(id); } finally { Globals.InventoryLock.ExitReadLock(); } } if (item != null) { text = (item.Enchant == 0 ? "" : "+" + item.Enchant.ToString() + " ") + Util.GetItemName(item.ItemID) + Environment.NewLine + (item.isEquipped == 0x01 ? "Equipped" + Environment.NewLine : "") + "Count: " + item.Count.ToString() + Environment.NewLine + "Augment: " + item.AugID.ToString() + Environment.NewLine + "Mana: " + item.Mana.ToString() + Environment.NewLine + "Slot: " + item.Slot.ToString() + Environment.NewLine + "Type 1: " + item.Type.ToString() + Environment.NewLine + "Type 2: " + item.Type2.ToString() + Environment.NewLine + "Type 3: " + item.Type3.ToString() + Environment.NewLine + "Type 4: " + item.Type4.ToString() + Environment.NewLine + "Type ID: " + item.ItemID + Environment.NewLine + "Unique ID: " + item.ID; } } toolTip1.SetToolTip(listView_inventory, text); }
public static uint NEAREST_ITEM_DISTANCE(bool return_distance) { float mx = Globals.gamedata.my_char.X; float my = Globals.gamedata.my_char.Y; float mz = Globals.gamedata.my_char.Z; uint item_id = 0; uint dist = uint.MaxValue; uint ndist; bool myitem; Globals.DoNotItemLock.EnterReadLock(); Globals.ItemLock.EnterReadLock(); try { foreach (ItemInfo item in Globals.gamedata.nearby_items.Values) { myitem = false; //whitelist if (Globals.gamedata.botoptions.PickOnlyItemsInList == 1) { //main checks, we dont really care about mesh and stuff since it's a whitelist... if ((item.Ignore == false && ((item.HasValidZ && !item.Loadedin) || (item.Loadedin && Math.Abs(item.Z - Globals.gamedata.my_char.Z) < Globals.PICKUP_Z_Diff))) && ((Globals.gamedata.botoptions.IgnoreItems == 1 && Util.GetItemName(item.ItemID) != Globals.UnknownItem) || Globals.gamedata.botoptions.IgnoreItems == 0)) { //contains the item? if so, we can pick it up if (BotOptions.DoNotItems.Contains(item.ItemID)) { if (Globals.gamedata.botoptions.OnlyPickMine == 1) { try { Globals.MobListLock.EnterReadLock(); //lets check for mobs that were engaged with us, the droppedby value can be checked with our moblist if (Globals.gamedata.MobList.Contains(item.DroppedBy)) { myitem = true; //Globals.l2net_home.Add_Text("My item: " + Util.GetItemName(item.ItemID)); } } finally { Globals.MobListLock.ExitReadLock(); } } if (myitem || Globals.gamedata.botoptions.OnlyPickMine == 0) { //if everything checks out, let's register this item and keep trying to find a closer one. ndist = System.Convert.ToUInt32(System.Math.Sqrt(System.Math.Pow(mx - item.X, 2) + System.Math.Pow(my - item.Y, 2) + System.Math.Pow(mz - item.Z, 2))); if (ndist < dist) { item_id = item.ID; dist = ndist; } } } } else { //dont care about the item } } //donot without whitelist else { //main checks, check for everything. if (((item.Ignore == false && item.HasMesh && ((item.HasValidZ && !item.Loadedin) || (item.Loadedin && Math.Abs(item.Z - Globals.gamedata.my_char.Z) < Globals.PICKUP_Z_Diff)) && Globals.gamedata.botoptions.IgnoreMeshlessItems == 1) || (item.Ignore == false && Globals.gamedata.botoptions.IgnoreMeshlessItems == 0)) && ((Globals.gamedata.botoptions.IgnoreItems == 1 && Util.GetItemName(item.ItemID) != Globals.UnknownItem) || Globals.gamedata.botoptions.IgnoreItems == 0)) { //does not contain the item? if so, we can pick it up if (!BotOptions.DoNotItems.Contains(item.ItemID)) { if (Globals.gamedata.botoptions.OnlyPickMine == 1) { try { Globals.MobListLock.EnterReadLock(); if (Globals.gamedata.MobList.Contains(item.DroppedBy)) { myitem = true; //Globals.l2net_home.Add_Text("My item: " + Util.GetItemName(item.ItemID)); } } finally { Globals.MobListLock.ExitReadLock(); } } if (myitem || Globals.gamedata.botoptions.OnlyPickMine == 0) { //if everything checks out, let's register this item and keep trying to find a closer one. ndist = System.Convert.ToUInt32(System.Math.Sqrt(System.Math.Pow(mx - item.X, 2) + System.Math.Pow(my - item.Y, 2) + System.Math.Pow(mz - item.Z, 2))); if (ndist < dist) { item_id = item.ID; dist = ndist; } } } } else { //dont care about the item } } } } finally { Globals.ItemLock.ExitReadLock(); Globals.DoNotItemLock.ExitReadLock(); } if (return_distance) { return(dist); } else { return(item_id); } }