private void subLootAddItem_Click(object sender, EventArgs e) { SHLootItem item = new SHLootItem(); item.min = 0; item.max = 1; item.rate = 20; item.id = 0; if (lvLootList.Tag != null && lvLootList.Tag.GetType() == typeof(SHLoot)) { item.Compile(); item.Build(xmlCore); ((SHLoot)lvLootList.Tag).Add(item); ListViewItem lvi = new ListViewItem(); ProcessLootItem(lvi, item); lvLootList.Items.Add(lvi); SHListViewUtil.SelectIndex(lvLootList, lvi.Index); m_ListViewController.SetListText(pgLoot.Tag as ListViewItem, lvLootList.Tag as SHLoot); } Global._VelixianForms.FindForm("LOOTING").Touch(); }
private void LootableDetail_ValueChanged(ListViewItem lvi) { if (lvi != null) { if (lvi.Tag.GetType() == typeof(SHLootSilver)) { SHLootSilver silver = (SHLootSilver)lvi.Tag; silver.Compile(); silver.Build(xmlCore); ProcessLootSilver(lvi, silver); } else if (lvi.Tag.GetType() == typeof(SHLootItem)) { SHLootItem item = (SHLootItem)lvi.Tag; item.Compile(); item.Build(xmlCore); ProcessLootItem(lvi, item); } else if (lvi.Tag.GetType() == typeof(SHLootSoul)) { SHLootSoul soul = (SHLootSoul)lvi.Tag; soul.Compile(); soul.Build(xmlCore); ProcessLootSoul(lvi, soul); } } Global._VelixianForms.FindForm("LOOTING").Touch(); }
private void ProcessLootItem(ListViewItem lvi, SHLootItem item) { if (lvi == null || item == null) { return; } lvi.SubItems.Clear(); lvi.Text = (xmlCore.Items.IsValid(item.id) && xmlCore.Items[item.id].Passed) ? xmlCore.GetSafeString(xmlCore.Items[item.id].name) : "Item does not exist (ID:" + item.id.ToString() + ")"; lvi.SubItems.AddRange(new String[] { item.rate.ToString() + "%", (item.minSpecified) ? item.min.ToString() : "(Undefined)", (item.maxSpecified) ? item.max.ToString() : "(Undefined)" }); lvi.Tag = item; lvi.ImageIndex = 10; lvi.ForeColor = (item.Passed) ? Color.Black : Color.Red; lvi.BackColor = (item.Passed) ? Color.White : Color.Yellow; if (item.Passed && (!xmlCore.Items.IsValid(item.id) || !xmlCore.Items[item.id].Passed)) { lvi.ForeColor = Color.Gray; } }