private void listView1_SelectedIndexChanged(object sender, EventArgs e) { Buying = true; button10.Text = "Buy"; int Selected = 0; for (int i = 0; i < listView1.Items.Count; i++) { // is i the index of the row I selected? if (listView1.Items[i].Selected == true) { Selected = i; break; } } int CurrentLocation = MyPlayer.Location; Drug[] DrugList = new Drug[11]; DrugList[0] = BuyDrugs[CurrentLocation].Acid; DrugList[1] = BuyDrugs[CurrentLocation].Cocaine; DrugList[2] = BuyDrugs[CurrentLocation].Crack; DrugList[3] = BuyDrugs[CurrentLocation].CrystalMeth; DrugList[4] = BuyDrugs[CurrentLocation].Ecstasy; DrugList[5] = BuyDrugs[CurrentLocation].Hash; DrugList[6] = BuyDrugs[CurrentLocation].Heroin; DrugList[7] = BuyDrugs[CurrentLocation].Mescaline; DrugList[8] = BuyDrugs[CurrentLocation].Morphine; DrugList[9] = BuyDrugs[CurrentLocation].Mushrooms; DrugList[10] = BuyDrugs[CurrentLocation].Weed; int NumericValue = MyPlayer.Money / (DrugList[Selected].Price); if (NumericValue > DrugList[Selected].Quantity) { NumericValue = DrugList[Selected].Quantity; } if (NumericValue + MyPlayer.Inventory > MyPlayer.MaxInventory) { NumericValue = MyPlayer.MaxInventory - MyPlayer.Inventory; } numericUpDown1.Value = NumericValue; }
private void specialEventAdd() { int Counter = 1; while (Counter <= 5) { if (EventLocation[Counter] == true) { bool Liars = random.Next() % 2 == 0 ? true : false;; if (Liars == false) { Drug[] DrugList = new Drug[11]; DrugList[0] = BuyDrugs[Counter].Acid; DrugList[1] = BuyDrugs[Counter].Cocaine; DrugList[2] = BuyDrugs[Counter].Crack; DrugList[3] = BuyDrugs[Counter].CrystalMeth; DrugList[4] = BuyDrugs[Counter].Ecstasy; DrugList[5] = BuyDrugs[Counter].Hash; DrugList[6] = BuyDrugs[Counter].Heroin; DrugList[7] = BuyDrugs[Counter].Mescaline; DrugList[8] = BuyDrugs[Counter].Morphine; DrugList[9] = BuyDrugs[Counter].Mushrooms; DrugList[10] = BuyDrugs[Counter].Weed; if (PriceRise[Counter] == true) { int Multiplier = random.Next(5, 11); DrugList[ChosenDrug[Counter]].Price = DrugList[ChosenDrug[Counter]].Price * Multiplier; } else { int Dividing = random.Next(5, 11); DrugList[ChosenDrug[Counter]].Price = DrugList[ChosenDrug[Counter]].Price / Dividing; } } } Counter++; } }
private void showPictures() { int WhereAt = MyPlayer.Location; Drug[] DrugList = new Drug[11]; DrugList[0] = BuyDrugs[WhereAt].Acid; DrugList[1] = BuyDrugs[WhereAt].Cocaine; DrugList[2] = BuyDrugs[WhereAt].Crack; DrugList[3] = BuyDrugs[WhereAt].CrystalMeth; DrugList[4] = BuyDrugs[WhereAt].Ecstasy; DrugList[5] = BuyDrugs[WhereAt].Hash; DrugList[6] = BuyDrugs[WhereAt].Heroin; DrugList[7] = BuyDrugs[WhereAt].Mescaline; DrugList[8] = BuyDrugs[WhereAt].Morphine; DrugList[9] = BuyDrugs[WhereAt].Mushrooms; DrugList[10] = BuyDrugs[WhereAt].Weed; if (PriceGreen[0] > DrugList[0].Price) { pictureBox1.Show(); } else { pictureBox12.Show(); } if (PriceGreen[1] > DrugList[1].Price) { pictureBox2.Show(); } else { pictureBox13.Show(); } if (PriceGreen[2] > DrugList[2].Price) { pictureBox3.Show(); } else { pictureBox14.Show(); } if (PriceGreen[3] > DrugList[3].Price) { pictureBox4.Show(); } else { pictureBox15.Show(); } if (PriceGreen[4] > DrugList[4].Price) { pictureBox5.Show(); } else { pictureBox16.Show(); } if (PriceGreen[5] > DrugList[5].Price) { pictureBox6.Show(); } else { pictureBox17.Show(); } if (PriceGreen[6] > DrugList[6].Price) { pictureBox7.Show(); } else { pictureBox18.Show(); } if (PriceGreen[7] > DrugList[7].Price) { pictureBox8.Show(); } else { pictureBox19.Show(); } if (PriceGreen[8] > DrugList[8].Price) { pictureBox9.Show(); } else { pictureBox20.Show(); } if (PriceGreen[9] > DrugList[9].Price) { pictureBox10.Show(); } else { pictureBox21.Show(); } if (PriceGreen[10] > DrugList[10].Price) { pictureBox11.Show(); } else { pictureBox22.Show(); } }
private void numericUpDown1_ValueChanged_1(object sender, EventArgs e) { if (Buying == true) { int Selected = 0; for (int i = 0; i < listView1.Items.Count; i++) { // is i the index of the row I selected? if (listView1.Items[i].Selected == true) { Selected = i; break; } } int CurrentLocation = MyPlayer.Location; Drug[] DrugList = new Drug[11]; DrugList[0] = MyPlayer.SellDrugs.Acid; DrugList[1] = MyPlayer.SellDrugs.Cocaine; DrugList[2] = MyPlayer.SellDrugs.Crack; DrugList[3] = MyPlayer.SellDrugs.CrystalMeth; DrugList[4] = MyPlayer.SellDrugs.Ecstasy; DrugList[5] = MyPlayer.SellDrugs.Hash; DrugList[6] = MyPlayer.SellDrugs.Heroin; DrugList[7] = MyPlayer.SellDrugs.Mescaline; DrugList[8] = MyPlayer.SellDrugs.Morphine; DrugList[9] = MyPlayer.SellDrugs.Mushrooms; DrugList[10] = MyPlayer.SellDrugs.Weed; int NumericValue = (int)numericUpDown1.Value; // if (NumericValue > DrugList[Selected].Quantity) //NumericValue = DrugList[Selected].Quantity; if (NumericValue + MyPlayer.Inventory > MyPlayer.MaxInventory) { NumericValue = MyPlayer.MaxInventory - MyPlayer.Inventory; } numericUpDown1.Value = NumericValue; } else if (Buying == false) { int Selected = 0; for (int i = 0; i < listView2.Items.Count; i++) { // is i the index of the row I selected? if (listView2.Items[i].Selected == true) { Selected = i; break; } } int CurrentLocation = MyPlayer.Location; Drug[] DrugList = new Drug[11]; DrugList[0] = MyPlayer.SellDrugs.Acid; DrugList[1] = MyPlayer.SellDrugs.Cocaine; DrugList[2] = MyPlayer.SellDrugs.Crack; DrugList[3] = MyPlayer.SellDrugs.CrystalMeth; DrugList[4] = MyPlayer.SellDrugs.Ecstasy; DrugList[5] = MyPlayer.SellDrugs.Hash; DrugList[6] = MyPlayer.SellDrugs.Heroin; DrugList[7] = MyPlayer.SellDrugs.Mescaline; DrugList[8] = MyPlayer.SellDrugs.Morphine; DrugList[9] = MyPlayer.SellDrugs.Mushrooms; DrugList[10] = MyPlayer.SellDrugs.Weed; if (numericUpDown1.Value > DrugList[Selected].Quantity) { numericUpDown1.Value = DrugList[Selected].Quantity; } } }
private void button10_Click(object sender, EventArgs e) { int Selected = 0; if (Buying == true) { for (int i = 0; i < listView1.Items.Count; i++) { // is i the index of the row I selected? if (listView1.Items[i].Selected == true) { Selected = i; break; } } } else { for (int i = 0; i < listView2.Items.Count; i++) { // is i the index of the row I selected? if (listView2.Items[i].Selected == true) { Selected = i; break; } } } int CurrentLocation = MyPlayer.Location; Drug[] DrugList = new Drug[11]; DrugList[0] = BuyDrugs[CurrentLocation].Acid; DrugList[1] = BuyDrugs[CurrentLocation].Cocaine; DrugList[2] = BuyDrugs[CurrentLocation].Crack; DrugList[3] = BuyDrugs[CurrentLocation].CrystalMeth; DrugList[4] = BuyDrugs[CurrentLocation].Ecstasy; DrugList[5] = BuyDrugs[CurrentLocation].Hash; DrugList[6] = BuyDrugs[CurrentLocation].Heroin; DrugList[7] = BuyDrugs[CurrentLocation].Mescaline; DrugList[8] = BuyDrugs[CurrentLocation].Morphine; DrugList[9] = BuyDrugs[CurrentLocation].Mushrooms; DrugList[10] = BuyDrugs[CurrentLocation].Weed; Drug[] SellList = new Drug[11]; SellList[0] = MyPlayer.SellDrugs.Acid; SellList[1] = MyPlayer.SellDrugs.Cocaine; SellList[2] = MyPlayer.SellDrugs.Crack; SellList[3] = MyPlayer.SellDrugs.CrystalMeth; SellList[4] = MyPlayer.SellDrugs.Ecstasy; SellList[5] = MyPlayer.SellDrugs.Hash; SellList[6] = MyPlayer.SellDrugs.Heroin; SellList[7] = MyPlayer.SellDrugs.Mescaline; SellList[8] = MyPlayer.SellDrugs.Morphine; SellList[9] = MyPlayer.SellDrugs.Mushrooms; SellList[10] = MyPlayer.SellDrugs.Weed; if (Buying == true) { int NumericValue = (int)numericUpDown1.Value; if (NumericValue > DrugList[Selected].Quantity) { NumericValue = DrugList[Selected].Quantity; } if (NumericValue + MyPlayer.Inventory > MyPlayer.MaxInventory) { NumericValue = MyPlayer.MaxInventory - MyPlayer.Inventory; } if (numericUpDown1.Value != 0) { int QuantityTotal = NumericValue + SellList[Selected].Quantity; int PriceOfSell = (SellList[Selected].PurchasePrice * SellList[Selected].Quantity); int PriceOfBuy = (DrugList[Selected].Price * NumericValue); int FinalPrice = (PriceOfSell + PriceOfBuy) / QuantityTotal; SellList[Selected].PurchasePrice = FinalPrice; } MyPlayer.Money -= NumericValue * DrugList[Selected].Price; MyPlayer.Inventory += NumericValue; DrugList[Selected].Quantity -= NumericValue; SellList[Selected].Quantity += NumericValue; label2.Text = formatStringToCurrency(MyPlayer.Money); label19.Text = MyPlayer.Inventory + " / " + MyPlayer.MaxInventory; } else if (Buying == false) { int NumericValue = (int)numericUpDown1.Value; if (NumericValue > SellList[Selected].Quantity) { NumericValue = SellList[Selected].Quantity; } MyPlayer.Money += NumericValue * DrugList[Selected].Price; MyPlayer.Inventory -= NumericValue; DrugList[Selected].Quantity += NumericValue; SellList[Selected].Quantity -= NumericValue; if (SellList[Selected].Quantity <= 0) { SellList[Selected].PurchasePrice = 0; } label2.Text = formatStringToCurrency(MyPlayer.Money); label19.Text = MyPlayer.Inventory + " / " + MyPlayer.MaxInventory; } repopulateSellList(); repopulateBuyList(); }
private void generateSpecialEvent() { int WhereAt = random.Next(1, 5); while (EventLocation[WhereAt] == true) { if (EventLocation[1] == false) { WhereAt = 1; } else if (EventLocation[2] == false) { WhereAt = 2; } else if (EventLocation[3] == false) { WhereAt = 3; } else if (EventLocation[4] == false) { WhereAt = 4; } else if (EventLocation[5] == false) { WhereAt = 0; } } Drug[] DrugList = new Drug[11]; DrugList[0] = BuyDrugs[WhereAt].Acid; DrugList[1] = BuyDrugs[WhereAt].Cocaine; DrugList[2] = BuyDrugs[WhereAt].Crack; DrugList[3] = BuyDrugs[WhereAt].CrystalMeth; DrugList[4] = BuyDrugs[WhereAt].Ecstasy; DrugList[5] = BuyDrugs[WhereAt].Hash; DrugList[6] = BuyDrugs[WhereAt].Heroin; DrugList[7] = BuyDrugs[WhereAt].Mescaline; DrugList[8] = BuyDrugs[WhereAt].Morphine; DrugList[9] = BuyDrugs[WhereAt].Mushrooms; DrugList[10] = BuyDrugs[WhereAt].Weed; int DrugToModify = random.Next(0, 10); PriceRise[WhereAt] = random.Next() % 2 == 0 ? true : false; EventLocation[WhereAt] = true; ChosenDrug[WhereAt] = DrugToModify; Location = "Rawr"; if (WhereAt == New_York.BRONX) { Location = "Bronx"; } if (WhereAt == New_York.BROOKLYN) { Location = "Brooklyn"; } if (WhereAt == New_York.MANHATTAN) { Location = "Manhattan"; } if (WhereAt == New_York.STATEN_ISLAND) { Location = "Staten Island"; } if (WhereAt == New_York.QUEENS) { Location = "Queens"; } if (WhereAt == 0) { Location = "Some crazy guy just ran up to you yelling, 'DANGER! DANGER WILL ROBINSON!'"; } if (PriceRise[WhereAt] == true) { if (WhereAt != 0) { richTextBox1.Text = "Word on the street is that the price of " + DrugList[DrugToModify].Name + " is going to drastically increase in " + Location + " tomorrow."; } else if (WhereAt != 0) { richTextBox1.Text = "Word on the street is that the price of " + DrugList[DrugToModify].Name + " is going to drastically decrease in " + Location + " tomorrow."; } } if (WhereAt == 0) { richTextBox1.Text = Location; PriceRise[WhereAt] = false; EventLocation[WhereAt] = false; ChosenDrug[WhereAt] = 0; } }