private static void Pb_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if ((sender as PictureBox).Image != null) { Bitmap bmp = new Bitmap((sender as PictureBox).Image); sourceBox = (sender as PictureBox); if ((sender as PictureBox).DoDragDrop(bmp, DragDropEffects.Move) == DragDropEffects.Move && isValid) { isValid = false; return; } else { ItemDataDisplay.LoadItemData(sender, (((sender as PictureBox).Parent as Panel).Parent as TabPage).Controls["itemStashStatDisplay"] as Panel, cData.PlayerChest.Panels, "InventoryGrid"); } } } else if (e.Button == MouseButtons.Right) { InventoryContextMenu.ShowContextMenu((sender as PictureBox), e.Location, cData.PlayerChest.Panels, "InventoryGrid"); } }
private static Image GetStashBitmap(int x, int y, int selectedPanel, PictureBox pb, InventoryGrid iGrid) { string itemName = ""; string itemLocation = null; string stackSize = null; int itemRarity = 0; pb.Size = new Size(50, 50); pb.MaximumSize = new Size(50, 50); if (iGrid == null) { return(null); } if (iGrid.Armor != null) { itemName = iGrid.Armor.Name; itemRarity = iGrid.Rarity; if (ItemDataDisplay.ParseItemNameForType(itemName) == "Amulet" || ItemDataDisplay.ParseItemNameForType(itemName) == "Ring") { pb.Size = new Size(50, 50); pb.MaximumSize = new Size(50, 50); } else { if (iGrid.ItemType != "Belt") { pb.MaximumSize = new Size(50, 100); pb.Size = new Size(50, 100); } } } if (iGrid.Weapon != null) { itemName = iGrid.Weapon.Name; itemRarity = iGrid.Rarity; pb.MaximumSize = new Size(50, 100); pb.Size = new Size(50, 100); } if (iGrid.Potion != null) { itemName = iGrid.Potion.Name; itemRarity = iGrid.Rarity; } if (iGrid.Gem != null) { itemName = iGrid.Gem.Name; itemRarity = iGrid.Rarity; if (iGrid.Gem.StackSize > 0) { stackSize = iGrid.Gem.StackSize.ToString(); } } if (iGrid.Reagent != null) { itemName = iGrid.Reagent.Name; itemRarity = iGrid.Rarity; pb.MaximumSize = new Size(50, 50); pb.Size = new Size(50, 50); if (iGrid.Reagent.StackSize > 0) { stackSize = iGrid.Reagent.StackSize.ToString(); } } if (iGrid.NPC2Consumable != null) { itemName = iGrid.NPC2Consumable.Name; itemRarity = iGrid.Rarity; pb.MaximumSize = new Size(50, 50); pb.Size = new Size(50, 50); } if (iGrid.Enneract != null) { itemName = iGrid.Enneract.Name; itemRarity = iGrid.Rarity; string[] enneractData; WolcenStaticData.ItemEnneract.TryGetValue(itemName, out enneractData); itemLocation = enneractData[1]; pb.MaximumSize = new Size(50, 50); pb.Size = new Size(50, 50); } if (itemLocation == null) { WolcenStaticData.ItemLocations.TryGetValue(itemName, out itemLocation); } if (iGrid.MagicEffects != null) { if (iGrid.MagicEffects.RolledAffixes != null) { foreach (var effect in iGrid.MagicEffects.RolledAffixes) { string effectId = effect.EffectId; if (effect.Parameters != null) { int effectParamCount = effect.Parameters.Count(); List <string> aSem = new List <string>(); for (int z = 0; z < effect.Parameters.Count(); z++) { aSem.Add(effect.Parameters[z].semantic); } string[] actualSemantics = aSem.ToArray(); if (actualSemantics != null) { string[] semantics = null; WolcenStaticData.Semantics.TryGetValue(effectId, out semantics); if (semantics != null) { if (semantics.Count() != actualSemantics.Count()) { LogMe.WriteLog("Error: Wrong Semantic count (" + semantics.Count() + ")->(" + actualSemantics.Count() + ")"); for (int z = 0; z < actualSemantics.Count(); z++) { LogMe.WriteLog("Error-Cont: Actual Parameters for EffectId: " + effectId + "(" + actualSemantics[z] + ")"); } } else if (semantics.Count() == actualSemantics.Count()) { for (int z = 0; z < actualSemantics.Count(); z++) { if (semantics[z] != actualSemantics[z]) { LogMe.WriteLog("Error: semantic miss-match " + effectId + "(" + semantics[z] + ")->(" + actualSemantics[z] + ")"); } } } } else { for (int z = 0; z < actualSemantics.Count(); z++) { LogMe.WriteLog("Error: Semantic doesn't exist for EffectID: " + effectId + "(" + actualSemantics[z] + ")"); } } } } } } if (iGrid.MagicEffects.Default != null) { foreach (var effect in iGrid.MagicEffects.Default) { string effectId = effect.EffectId; if (effect.Parameters != null) { int effectParamCount = effect.Parameters.Count(); List <string> aSem = new List <string>(); for (int z = 0; z < effect.Parameters.Count(); z++) { aSem.Add(effect.Parameters[z].semantic); } string[] actualSemantics = aSem.ToArray(); if (actualSemantics != null) { string[] semantics = null; WolcenStaticData.Semantics.TryGetValue(effectId, out semantics); if (semantics != null) { if (semantics.Count() != actualSemantics.Count()) { LogMe.WriteLog("Error: Wrong Semantic count (" + semantics.Count() + ")->(" + actualSemantics.Count() + ")"); for (int z = 0; z < actualSemantics.Count(); z++) { LogMe.WriteLog("Error-Cont: Actual Parameters for EffectId: " + effectId + "(" + actualSemantics[z] + ")"); } } else if (semantics.Count() == actualSemantics.Count()) { for (int z = 0; z < actualSemantics.Count(); z++) { if (semantics[z] != actualSemantics[z]) { LogMe.WriteLog("Error: semantic miss-match " + effectId + "(" + semantics[z] + ")->(" + actualSemantics[z] + ")"); } } } } else { for (int z = 0; z < actualSemantics.Count(); z++) { LogMe.WriteLog("Error: Semantic doesn't exist for EffectID: " + effectId + "(" + actualSemantics[z] + ")"); } } } } } } } if (File.Exists(Directory.GetCurrentDirectory() + itemLocation)) { return(InventoryManager.CombineGridBitmaps(Directory.GetCurrentDirectory() + itemLocation, itemRarity, iGrid.ItemType, pb, stackSize)); } else { if (iGrid.Armor != null) { return(new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + "\\UIResources\\Items\\unknown_armor.png"))); } if (iGrid.Weapon != null) { return(new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + "\\UIResources\\Items\\unknown_weapon.png"))); } } return(null); }