private void LoadItemToBuy() { List <Item> items = m.GetItemsAvailable; for (int i = 0; i < items.Count; i++) { Item item = items[i]; ToolTip toolTip = new ToolTip(); ItemInformations UCItem = new ItemInformations(); UCItem.Top = i * 55; UCItem.ItemName = items[i].GetName; UCItem.ItemQuantity = "1"; UCItem.ItemQuantityInventVisible = false; UCItem.ItemPrice = items[i].GetValue - (int)Math.Round(countReduce() * item.GetValue) + " PO"; string infoItem = items[i].GetName + " " + "(" + items[i].Type + ")" + Environment.NewLine + items[i].GetDescription + Environment.NewLine + "Valeur : " + items[i].GetValue + Environment.NewLine + "Poids : " + items[i].GetWeight; if (items[i].GetRequired.Count != 0) { infoItem += Environment.NewLine + "Requis :"; foreach (string requi in items[i].GetRequired.Keys) { infoItem += Environment.NewLine + items[i].GetRequired[requi] + " " + requi; } } if (items[i].GetStats.Count != 0) { infoItem += Environment.NewLine + "Bonus :"; foreach (string bonus in items[i].GetStats.Keys) { infoItem += Environment.NewLine + items[i].GetStats[bonus] + " " + bonus; } } UCItem.ItemTag = item; toolTip.InitialDelay = 500; toolTip.ReshowDelay = 500; toolTip.ShowAlways = true; toolTip.SetToolTip(UCItem, infoItem); toolTip.SetToolTip(UCItem.ItemNameLabel, infoItem); PageBuy.Controls.Add(UCItem); UCItem.ItemActionName = "Acheter"; UCItem.ItemAction(new EventHandler(Buy_Click)); LGold.Text = _invent.GetGold.ToString() + " PO"; } }
internal void LoadItemToSell() { Dictionary <Item, int> items = _invent.Inventory; int j = 0; PageSell.Controls.Clear(); foreach (Item i in items.Keys) { Item item = i; ToolTip toolTip = new ToolTip(); ItemInformations UCItem = new ItemInformations(); UCItem.Top = j * (3 + UCItem.Height); UCItem.ItemName = item.GetName; UCItem.ItemQuantity = "1"; UCItem.ItemQuantityInvent = "x " + items[i].ToString(); UCItem.ItemQuantityInventVisible = true; UCItem.ItemPrice = (int)Math.Round(item.GetValue * 0.8) + (int)Math.Round(countReduce() * 0.8 * item.GetValue) + " PO"; string infoItem = i.GetName + " " + "(" + i.Type + ")" + Environment.NewLine + i.GetDescription + Environment.NewLine + "Valeur : " + i.GetValue + Environment.NewLine + "Poids : " + i.GetWeight; if (i.GetRequired.Count != 0) { infoItem += Environment.NewLine + "Requis :"; foreach (string requi in i.GetRequired.Keys) { infoItem += Environment.NewLine + i.GetRequired[requi] + " " + requi; } } if (i.GetStats.Count != 0) { infoItem += Environment.NewLine + "Bonus :"; foreach (string bonus in i.GetStats.Keys) { infoItem += Environment.NewLine + i.GetStats[bonus] + " " + bonus; } } UCItem.ItemTag = item; UCItem.ItemMaximumQuantity = _invent.Inventory[i]; toolTip.InitialDelay = 500; toolTip.ReshowDelay = 500; toolTip.ShowAlways = true; toolTip.SetToolTip(UCItem, infoItem); toolTip.SetToolTip(UCItem.ItemNameLabel, infoItem); PageSell.Controls.Add(UCItem); UCItem.ItemActionName = "Vendre"; UCItem.ItemAction(new EventHandler(Sell_Click)); LGold.Text = _invent.GetGold.ToString() + " PO"; j++; } }