Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string SelectedItem     = "rawr";
            int    SelectedItemMisc = 0;

            for (int i = 0; i < StoreListView.Items.Count; i++)
            {
                // is i the index of the row I selected?
                if (StoreListView.Items[i].Selected == true)
                {
                    SelectedItem     = StoreListView.Items[i].Text;
                    SelectedItemMisc = i;
                    break;
                }
            }

            if (BuyingWeapons == true)
            {
                if (SelectedItem == Guns.WeaponButterKnife.Name)
                {
                    if (Guns.WeaponButterKnife.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponButterKnife.Name)
                        {
                            Stupid.Money -= Guns.WeaponButterKnife.Price;
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponButterKnife.Power, Guns.WeaponButterKnife.Accuracy, Guns.WeaponButterKnife.NumberOfShotsFired, Guns.WeaponButterKnife.Name, Guns.WeaponButterKnife.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponButterKnife.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponSlingShot.Name)
                {
                    if (Guns.WeaponSlingShot.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponSlingShot.Name)
                        {
                            Stupid.Money -= Guns.WeaponSlingShot.Price;
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponSlingShot.Power, Guns.WeaponSlingShot.Accuracy, Guns.WeaponSlingShot.NumberOfShotsFired, Guns.WeaponSlingShot.Name, Guns.WeaponSlingShot.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponSlingShot.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponHuntingKnife.Name)
                {
                    if (Guns.WeaponHuntingKnife.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponHuntingKnife.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponHuntingKnife.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponHuntingKnife.Power, Guns.WeaponHuntingKnife.Accuracy, Guns.WeaponHuntingKnife.NumberOfShotsFired, Guns.WeaponHuntingKnife.Name, Guns.WeaponHuntingKnife.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponHuntingKnife.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponHandGun.Name)
                {
                    if (Guns.WeaponHandGun.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponHandGun.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponHandGun.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponHandGun.Power, Guns.WeaponHandGun.Accuracy, Guns.WeaponHandGun.NumberOfShotsFired, Guns.WeaponHandGun.Name, Guns.WeaponHandGun.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponHandGun.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponSMG.Name)
                {
                    if (Guns.WeaponSMG.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponSMG.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponSMG.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponSMG.Power, Guns.WeaponSMG.Accuracy, Guns.WeaponSMG.NumberOfShotsFired, Guns.WeaponSMG.Name, Guns.WeaponSMG.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponSMG.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponGrenade.Name)
                {
                    if (Guns.WeaponGrenade.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponGrenade.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponGrenade.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponGrenade.Power, Guns.WeaponGrenade.Accuracy, Guns.WeaponGrenade.NumberOfShotsFired, Guns.WeaponGrenade.Name, Guns.WeaponGrenade.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponGrenade.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponBazooka.Name)
                {
                    if (Guns.WeaponBazooka.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponBazooka.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponBazooka.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponBazooka.Power, Guns.WeaponBazooka.Accuracy, Guns.WeaponBazooka.NumberOfShotsFired, Guns.WeaponBazooka.Name, Guns.WeaponBazooka.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponBazooka.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponSniper.Name)
                {
                    if (Guns.WeaponSniper.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponSniper.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponSniper.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponSniper.Power, Guns.WeaponSniper.Accuracy, Guns.WeaponSniper.NumberOfShotsFired, Guns.WeaponSniper.Name, Guns.WeaponSniper.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponSniper.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }

                if (SelectedItem == Guns.WeaponPlasmaRifle.Name)
                {
                    if (Guns.WeaponPlasmaRifle.Price <= Stupid.Money)
                    {
                        if (Stupid.PlayerWeapon.Name != Guns.WeaponPlasmaRifle.Name)
                        {
                            Stupid.Money += Stupid.PlayerWeapon.Price;
                            Stupid.Money -= Guns.WeaponPlasmaRifle.Price;
                            Stupid.PlayerWeapon.setWeapon(Guns.WeaponPlasmaRifle.Power, Guns.WeaponPlasmaRifle.Accuracy, Guns.WeaponPlasmaRifle.NumberOfShotsFired, Guns.WeaponPlasmaRifle.Name, Guns.WeaponPlasmaRifle.Price);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label5.Text           = Guns.WeaponPlasmaRifle.Name;
                            OriglWeaponLabel.Text = label5.Text;
                        }
                    }
                }
            }

            //------------------vehicles
            if (BuyingVehicles == true)
            {
                if (SelectedItem == Vehicles.VehicleRollerblades.Name)
                {
                    if (Vehicles.VehicleRollerblades.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleRollerblades.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleRollerblades.Prices;
                            Stupid.setVehicle(Vehicles.VehicleRollerblades);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;
                            OrigItem.Text       =

                                label6.Text       = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }
                if (SelectedItem == Vehicles.VehicleHorse.Name)
                {
                    if (Vehicles.VehicleHorse.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleHorse.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleHorse.Prices;
                            Stupid.setVehicle(Vehicles.VehicleHorse);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }

                if (SelectedItem == Vehicles.VehicleVan.Name)
                {
                    if (Vehicles.VehicleVan.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleVan.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleVan.Prices;
                            Stupid.setVehicle(Vehicles.VehicleVan);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }

                if (SelectedItem == Vehicles.VehicleGarbage.Name)
                {
                    if (Vehicles.VehicleGarbage.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleGarbage.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleGarbage.Prices;
                            Stupid.setVehicle(Vehicles.VehicleGarbage);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }

                if (SelectedItem == Vehicles.VehicleBoat.Name)
                {
                    if (Vehicles.VehicleBoat.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleBoat.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleBoat.Prices;
                            Stupid.setVehicle(Vehicles.VehicleBoat);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }

                if (SelectedItem == Vehicles.VehicleSportsCar.Name)
                {
                    if (Vehicles.VehicleSportsCar.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehicleSportsCar.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehicleSportsCar.Prices;
                            Stupid.setVehicle(Vehicles.VehicleSportsCar);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }
                if (SelectedItem == Vehicles.VehiclePortalGun.Name)
                {
                    if (Vehicles.VehiclePortalGun.Prices <= Stupid.Money)
                    {
                        if (Stupid.PlayerVehicle.Name != Vehicles.VehiclePortalGun.Name)
                        {
                            Stupid.Money += Stupid.PlayerVehicle.Prices;
                            Stupid.Money -= Vehicles.VehiclePortalGun.Prices;
                            Stupid.setVehicle(Vehicles.VehiclePortalGun);

                            label2.Text         = formatStringToCurrency(Stupid.Money);
                            OrigMoneyLabel.Text = label2.Text;

                            label6.Text           = Stupid.PlayerVehicle.Name;
                            OrigVehicleLabel.Text = label6.Text;
                        }
                    }
                }
            }
            //-------------------------misc
            if (BuyingMisc == true)
            {
                Item[] ItemList = new Item[11];
                ItemList[0] = ItemItem.TrenchCoat;
                ItemList[1] = ItemItem.BackPack;
                ItemList[2] = ItemItem.CargoPants;
                ItemList[3] = ItemItem.BodyArmor;
                ItemList[4] = ItemItem.Helmet;
                ItemList[5] = ItemItem.Kneepads;
                ItemList[6] = ItemItem.SwatShield;
                ItemList[7] = ItemItem.Calculator;

                if (ItemList[SelectedItemMisc].Price <= Stupid.Money)
                {
                    if (Stupid.getOwned(SelectedItemMisc) == false)
                    {
                        if (SelectedItemMisc == 0)
                        {
                            Stupid.addTrenchCoat();
                        }
                        if (SelectedItemMisc == 1)
                        {
                            Stupid.addBackPack();
                        }
                        if (SelectedItemMisc == 2)
                        {
                            Stupid.addCargoPants();
                        }
                        if (SelectedItemMisc == 3)
                        {
                            Stupid.addBodyArmor();
                        }
                        if (SelectedItemMisc == 4)
                        {
                            Stupid.addHelmet();
                        }
                        if (SelectedItemMisc == 5)
                        {
                            Stupid.addKneepads();
                        }
                        if (SelectedItemMisc == 6)
                        {
                            Stupid.addSwatShield();
                        }
                        if (SelectedItemMisc == 7)
                        {
                            Stupid.addCalculator();
                        }

                        label2.Text         = formatStringToCurrency(Stupid.Money);
                        OrigMoneyLabel.Text = label2.Text;

                        label6.Text           = Stupid.PlayerVehicle.Name;
                        OrigVehicleLabel.Text = label6.Text;

                        OrigItem.Text   = Stupid.Inventory.ToString() + " /kgkg " + Stupid.MaxInventory.ToString();
                        OrigHealth.Text = Stupid.Health + " / " + Stupid.MaxHealth;
                    }
                    else
                    {
                        YouAlreadyOwnThiscs Dummy = new YouAlreadyOwnThiscs();
                        Dummy.StartPosition = FormStartPosition.CenterParent;
                        Dummy.ShowDialog(this);
                    }
                }
            }

            OrigHealth.Text = Stupid.Health + " / " + Stupid.MaxHealth;
            OrigItem.Text   = Stupid.Inventory.ToString() + " / " + Stupid.MaxInventory.ToString();
        }