private void btnAddItems_Click(object sender, EventArgs e) { if (prntForm.shopsList.Count > 0) { try { Item it = prntForm.itemsList[cmbItems.SelectedIndex]; ItemRefs newIR = prntForm.createItemRefsFromItem(it); prntForm.shopsList[selectedLbxIndex].shopItemRefs.Add(newIR); } catch { } } refreshLbxItems(); refreshListBox(); }
private void btnAddItems_Click(object sender, EventArgs e) { try { Item it = cte_itemsList[cmbItems.SelectedIndex]; //ItemRefs newItemRefs = new ItemRefs(); ItemRefs newIR = prntForm.createItemRefsFromItem(it); //newItemRefs.name = it.name; //newItemRefs.resref = it.resref; //newItemRefs.canNotBeUnequipped = it.canNotBeUnequipped; //newItemRefs.tag = it.tag + "_" + prntForm.mod.nextIdNumber; //newItemRefs.quantity = it.quantity; cte_container.containerItemRefs.Add(newIR); //string newItemTag = cte_itemsList[cmbItems.SelectedIndex].tag; //cte_container.containerItemTags.Add(newItemTag); refreshLbxItems(); } catch { } }
public Encounter DeepCopy() { Encounter copy = new Encounter(); copy = (Encounter)this.MemberwiseClone(); copy.encounterTiles = new List <TileEnc>(); foreach (TileEnc s in this.encounterTiles) { TileEnc newTileEnc = new TileEnc(); newTileEnc.Layer1Filename = s.Layer1Filename; newTileEnc.Layer2Filename = s.Layer2Filename; newTileEnc.Layer3Filename = s.Layer3Filename; newTileEnc.LoSBlocked = s.LoSBlocked; newTileEnc.Walkable = s.Walkable; copy.encounterTiles.Add(newTileEnc); } copy.encounterCreatureRefsList = new List <CreatureRefs>(); foreach (CreatureRefs s in this.encounterCreatureRefsList) { CreatureRefs newCrtRef = new CreatureRefs(); newCrtRef.creatureResRef = s.creatureResRef; newCrtRef.creatureTag = s.creatureTag; newCrtRef.creatureStartLocationX = s.creatureStartLocationX; newCrtRef.creatureStartLocationY = s.creatureStartLocationY; copy.encounterCreatureRefsList.Add(newCrtRef); } copy.encounterCreatureList = new List <string>(); foreach (string s in this.encounterCreatureList) { copy.encounterCreatureList.Add(s); } copy.Triggers = new List <Trigger>(); foreach (Trigger t in this.Triggers) { copy.Triggers.Add(t); } copy.propsList = new List <Prop>(); foreach (Prop p in this.propsList) { copy.propsList.Add(p); } copy.encounterInventoryRefsList = new List <ItemRefs>(); foreach (ItemRefs s in this.encounterInventoryRefsList) { ItemRefs newItRef = new ItemRefs(); newItRef = s.DeepCopy(); copy.encounterInventoryRefsList.Add(newItRef); } copy.encounterPcStartLocations = new List <Coordinate>(); foreach (Coordinate s in this.encounterPcStartLocations) { Coordinate newCoor = new Coordinate(); newCoor.X = s.X; newCoor.Y = s.Y; copy.encounterPcStartLocations.Add(newCoor); } return(copy); }
public ItemRefs createItemRefsFromItem(Item it) { ItemRefs newIR = new ItemRefs(); newIR.tag = it.tag + "_" + mod.nextIdNumber; newIR.name = it.name; newIR.resref = it.resref; newIR.quantity = it.quantity; newIR.canNotBeUnequipped = it.canNotBeUnequipped; return newIR; }
public Encounter DeepCopy() { Encounter copy = new Encounter(); copy = (Encounter)this.MemberwiseClone(); copy.encounterTiles = new List<TileEnc>(); foreach (TileEnc s in this.encounterTiles) { TileEnc newTileEnc = new TileEnc(); newTileEnc.Layer1Filename = s.Layer1Filename; newTileEnc.Layer2Filename = s.Layer2Filename; newTileEnc.LoSBlocked = s.LoSBlocked; newTileEnc.Walkable = s.Walkable; copy.encounterTiles.Add(newTileEnc); } copy.encounterCreatureRefsList = new List<CreatureRefs>(); foreach (CreatureRefs s in this.encounterCreatureRefsList) { CreatureRefs newCrtRef = new CreatureRefs(); newCrtRef.creatureResRef = s.creatureResRef; newCrtRef.creatureTag = s.creatureTag; newCrtRef.creatureStartLocationX = s.creatureStartLocationX; newCrtRef.creatureStartLocationY = s.creatureStartLocationY; copy.encounterCreatureRefsList.Add(newCrtRef); } copy.encounterCreatureList = new List<string>(); foreach (string s in this.encounterCreatureList) { copy.encounterCreatureList.Add(s); } copy.encounterInventoryRefsList = new List<ItemRefs>(); foreach (ItemRefs s in this.encounterInventoryRefsList) { ItemRefs newItRef = new ItemRefs(); newItRef = s.DeepCopy(); copy.encounterInventoryRefsList.Add(newItRef); } copy.encounterPcStartLocations = new List<Coordinate>(); foreach (Coordinate s in this.encounterPcStartLocations) { Coordinate newCoor = new Coordinate(); newCoor.X = s.X; newCoor.Y = s.Y; copy.encounterPcStartLocations.Add(newCoor); } return copy; }