private void InitInventory(UnitWrapper2 unit, ItemPanel itemPanel) { itemPanel.Controls.Clear(); try { CharacterInventoryType inv = unit.CharacterWrapper.CharacterInventory.GetInventoryById((int)INVENTORYTYPE); if (inv == null) { return; } foreach (CharacterItems item in inv.Items) { //Unit.StatBlock.Stat atat = item.Stats.GetStatById((int)ItemValueNames.applied_affix); itemPanel.IsMale = _isMale; InventoryItem iItem = new InventoryItem(item); iItem.InitButton(_displayNamesAndQuantity); itemPanel.AddItem(iItem, true); } } catch (Exception ex) { MessageBox.Show(ex.Message, "InitInventory: " + unit.Name); } }
private void b_transfer_Click(object sender, EventArgs e) { try { if (_characterUnit1 != null && _characterUnit2 != null) { if (l_selectedItem.Tag != null) { InventoryItem item = (InventoryItem)l_selectedItem.Tag; CharacterInventoryType char1 = _characterUnit1.CharacterWrapper.CharacterInventory.GetInventoryById((int)INVENTORYTYPE); CharacterInventoryType char2 = _characterUnit2.CharacterWrapper.CharacterInventory.GetInventoryById((int)INVENTORYTYPE); if (_eventSender == _characterItemPanel1) { if (_characterItemPanel2.AddItem(item, false)) { char2.Items.Add(item.Item); char1.Items.Remove(item.Item); _characterItemPanel1.RemoveItem(item); } else { MessageBox.Show("There is not enough free space!"); } l_selectedItem.ResetText(); l_selectedItem.Tag = null; } else { if (_characterItemPanel1.AddItem(item, false)) { char1.Items.Add(item.Item); char2.Items.Remove(item.Item); _characterItemPanel2.RemoveItem(item); } else { MessageBox.Show("There is not enough free space!"); } l_selectedItem.ResetText(); l_selectedItem.Tag = null; } _characterUnit1.CharacterWrapper.CharacterInventory.Apply(); _characterUnit2.CharacterWrapper.CharacterInventory.Apply(); RequiresUserVerification(); } } else { MessageBox.Show("You have to load two characters to transfere items!"); } } catch (Exception) { EmergencyAbort(); } }
private void InitInventory(UnitWrapper2 unit, ItemPanel itemPanel) { itemPanel.Controls.Clear(); try { CharacterInventoryType inv = unit.CharacterWrapper.CharacterInventory.GetInventoryById((int)INVENTORYTYPE); if (inv == null) return; foreach (CharacterItems item in inv.Items) { //Unit.StatBlock.Stat atat = item.Stats.GetStatById((int)ItemValueNames.applied_affix); itemPanel.IsMale = _isMale; InventoryItem iItem = new InventoryItem(item); iItem.InitButton(_displayNamesAndQuantity); itemPanel.AddItem(iItem, true); } } catch (Exception ex) { MessageBox.Show(ex.Message, "InitInventory: " + unit.Name); } }