Ejemplo n.º 1
0
        public static void OnBankCardSelected(Player player, Inventory inv)
        {
            BankAccount bankAccount = null;

            try
            {
                bankAccount          = BankRepository.GetAccountByCardNumber(long.Parse(inv.Value));
                player.AccessingBank = bankAccount.Id;
            }
            catch { API.shared.SendErrorNotification(player.Client, "That card is not associated with any bank account."); return; }

            if (bankAccount.Locked)
            {
                API.shared.SendErrorNotification(player.Client, String.Format("This bank account is locked due to repeated failed PIN attempts.", 4));
                API.shared.SendWarningNotification(player.Client, String.Format("Select a valid drivers license with the name matching the on the account.", 10));

                player.AccessingBank = bankAccount.Id;
                player.AwaitingInventorySelection = InventoryType.DriversLicense;
                return;
            }

            InventoryManager.HidePlayerInventory(player, true);
            API.shared.triggerClientEvent(player.Client, "playerEnterPinBank", 1);
        }
Ejemplo n.º 2
0
        private void OnClientEventTrigger(Client sender, string eventName, params object[] arguments)
        {
            if (eventName == "OnFuelRefill")
            {
                GrandTheftMultiplayer.Server.Elements.Vehicle closest = Globals.GetClosestVehicle(sender, 3);
                if (closest != null)
                {
                    Vehicle veh = Vehicle.VehicleData[closest];
                    if (veh.Fuel + veh.RefillDiesel + veh.RefillPetrol < 100)
                    {
                        Player p = Player.PlayerData[sender];
                        if (p.SelectedCash == null && p.SelectedCardAccount == null)
                        {
                            return;
                        }

                        int gs = GasStation.GasStations.IndexOf(GasStation.GasStations.Single(g => g.Id == p.HasEnteredGasStation));
                        if ((p.FuelTypeSelected == FuelType.Petrol && GasStation.GasStations[gs].CurrentPetrol == 0) ||
                            (p.FuelTypeSelected == FuelType.Diesel && GasStation.GasStations[gs].CurrentDiesel == 0))
                        {
                            return;
                        }
                        long availableMoney = 0;

                        if (p.SelectedCash != null)
                        {
                            availableMoney = long.Parse(p.SelectedCash.Value);
                        }
                        else if (p.SelectedCardAccount != null)
                        {
                            availableMoney = p.SelectedCardAccount.Balance;
                        }

                        if (availableMoney >= (p.FuelTypeSelected == FuelType.Petrol ? GasStation.GasStations[gs].PetrolPrice : GasStation.GasStations[gs].DieselPrice))
                        {
                            availableMoney -= p.FuelTypeSelected == FuelType.Petrol ? GasStation.GasStations[gs].PetrolPrice : GasStation.GasStations[gs].DieselPrice;
                        }
                        else
                        {
                            API.SendErrorNotification(sender, "Insufficient funds", 7);
                            p.SelectedCash        = null;
                            p.SelectedCardAccount = null;
                        }

                        if (p.FuelTypeSelected == FuelType.Petrol)
                        {
                            GasStation.GasStations[gs].CurrentPetrol--;
                            veh.RefillPetrol++;
                        }
                        else
                        {
                            GasStation.GasStations[gs].CurrentDiesel--;
                            veh.RefillDiesel++;
                        }

                        if (p.SelectedCash != null)
                        {
                            p.SelectedCash.Value = availableMoney.ToString();
                        }
                        else if (p.SelectedCardAccount != null)
                        {
                            p.SelectedCardAccount.Balance = availableMoney;
                        }
                    }
                }
            }
            else if (eventName == "GasStationSelectFuelType")
            {
                Player p = Player.PlayerData[sender];
                p.InEvent = PlayerEvent.RefillingVehicle;

                p.AwaitingInventorySelection = InventoryType.Money;

                InventoryManager.UpdatePlayerInventory(p);
                API.SendInfoNotification(sender, "Please select your payment method.", 10);
                p.FuelTypeSelected = (int)arguments[0] == 0 ? FuelType.Petrol : FuelType.Diesel;
            }
            else if (eventName == "OnPaymentPinEntered")
            {
                Player p = Player.PlayerData[sender];
                if (p.InEvent != PlayerEvent.RefillingVehicle)
                {
                    return;
                }
                if (p.SelectedCardAccount.Pin == arguments[0].ToString())
                {
                    API.triggerClientEvent(sender, "closePaymentUI");
                    API.triggerClientEvent(p.Client, "OnExitVehicleGasStation");
                }
                else
                {
                    p.SelectedCardAccount.FailedPinAttempts = 3 - (int)arguments[1];

                    if (p.SelectedCardAccount.FailedPinAttempts == 3)
                    {
                        p.SelectedCardAccount.Locked     = true;
                        p.SelectedCardAccount.LockedType = BankAccountLockedType.FailedPin;
                    }
                    BankRepository.UpdateAsync(p.SelectedCardAccount);
                }
            }
        }
Ejemplo n.º 3
0
        private void OnClientEventTrigger(Client sender, string eventName, params object[] arguments)
        {
            if (eventName == "ActivateATM")
            {
                foreach (Vector3 atm in PlayerPositionAtATM.Keys)
                {
                    if (sender.position.DistanceTo(atm) < 1.5f)
                    {
                        List <Vector3> offsets = PlayerPositionAtATM[atm];
                        sender.position = atm;
                        sender.rotation = offsets[0];

                        API.triggerClientEvent(sender, "onExecuteATM", offsets[1], offsets[2]);

                        Player.PlayerData[sender].InEvent = PlayerEvent.UsingATM;
                        API.playPlayerScenario(sender, "PROP_HUMAN_ATM");
                        return;
                    }
                }
            }
            else if (eventName == "chooseBankCard")
            {
                Player p = Player.PlayerData[sender];
                p.AccessingBank   = -1;
                p.TransactionType = -1;

                p.AwaitingInventorySelection = InventoryType.BankCard;
                InventoryManager.UpdatePlayerInventory(p);
            }
            else if (eventName == "closeATM")
            {
                try
                {
                    Player p = Player.PlayerData[sender];
                    p.AccessingBank   = -1;
                    p.TransactionType = -1;

                    p.InEvent = PlayerEvent.None;
                    API.stopPlayerAnimation(sender);
                }
                catch
                {
                    // ignored
                }
            }
            else if (eventName == "ATMCardSelected")
            {
                Player p = Player.PlayerData[sender];
                try
                {
                    BankAccount bankAccount = BankRepository.GetAccountByCardNumber(long.Parse(p.Inventory.First(i => i.Id == (int)arguments[0]).Value));

                    p.AccessingBank   = bankAccount.Id;
                    p.TransactionType = -1;

                    API.triggerClientEvent(sender, "enterATMPin");
                    InventoryManager.HidePlayerInventory(p, true);
                }
                catch
                {
                    API.triggerClientEvent(sender, "invalidCardATM");
                }
            }
            else if (eventName == "atmValidatePin")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);

                Player bankOwner = PlayerRepository.GetPlayerDataById(bankAccount.RegisterOwnerId);
                if ((string)arguments[0] == bankAccount.Pin)
                {
                    API.triggerClientEvent(sender, "atmCorrectPin", bankOwner.Username.Roleplay(), bankAccount.CardNumber.ToString());
                }
                else
                {
                    API.sendChatMessageToPlayer(sender, "Booo");
                }
            }
            else if (eventName == "atmRequestBalance")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);

                API.triggerClientEvent(sender, "atmBalanceReturn", bankAccount.Balance.ToString("C0"));
            }
            else if (eventName == "atmWithdrawMoney")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);
                long        value       = long.Parse(arguments[0].ToString());
                if (value <= bankAccount.Balance)
                {
                    if (value <= 1000 && value > 0)
                    {
                        Inventory cashItem = Inventory.CreateCashInventoryItem(value);
                        cashItem.OwnerType = InventoryOwnerType.Player;
                        cashItem.OwnerId   = p.Id;
                        if (!cashItem.AddToPlayer(p, true))
                        {
                            API.SendErrorNotification(sender, "You don't have enough space to withdraw this amount of cash.", 7);
                            return;
                        }

                        InventoryRepository.AddNewInventoryItem(cashItem);
                        p.Inventory.Add(cashItem);
                        bankAccount.Balance -= value;

                        CashLogRepository.AddNew(new CashLog(bankAccount.Id, p.Id, value, MoneyTransferMethod.ATMWithdraw));
                        BankRepository.UpdateAsync(bankAccount);

                        API.triggerClientEvent(sender, "atmWithdrawComplete", bankAccount.Balance);
                    }
                    else
                    {
                        API.triggerClientEvent(sender, "atmWithdrawError", 3, "<span id='withdrawErrorMsg' style='color:#f00'>EXCEEDED DAILY LIMIT</span>");
                    }
                }
                else
                {
                    API.triggerClientEvent(sender, "atmWithdrawError", 2, "<span style='color:#f00'>Insufficient funds</span>");
                }
            }
            else if (eventName == "atmChangePin")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);

                int value = int.Parse(arguments[0].ToString());
                if (value > 999 && value < 10000)
                {
                    string encPin = value.ToString();
                    bankAccount.Pin = encPin;

                    p.AccessingBank   = -1;
                    p.TransactionType = -1;

                    BankRepository.UpdateAsync(bankAccount);

                    IEnumerable <Inventory> bankCards = p.Inventory.Where(e => e.Type == InventoryType.BankCard);
                    API.triggerClientEvent(sender, "showATMMenu", string.Join(",", bankCards.Select(e => e.Id).ToList()),
                                           string.Join(",", bankCards.Select(e => e.Name).ToList()), string.Join(".", bankCards.Select(e => Inventory.GetInventoryImage[e.Type]).ToList()),
                                           string.Join(",", bankCards.Select(e => e.Quantity).ToList()));
                }
            }
        }
Ejemplo n.º 4
0
        public void DisconnectPlayer(Client player)
        {
            Player user = null;

            try
            {
                user = Player.PlayerData[player];
            }
            catch
            {
                user = Player.PlayerData.Values.FirstOrDefault(i => i.Username.Roleplay() == player.name);
            }

            if (user != null)
            {
                if (user.IsLogged)
                {
                    user.IsLogged     = false;
                    user.LastPosition = player.position;
                    user.LastRotation = player.rotation;
                    user.Health       = player.health;
                    user.Armour       = player.armor;
                    user.Dimension    = player.dimension;

                    user.ChatIndicatorLabel.text = "";
                    API.deleteEntity(user.ChatIndicatorLabel);

                    user.WeaponSkillData = string.Join(",", user.WeaponSkill.Values);

                    user.SavePlayerVehicles();

                    if (user.InEvent == PlayerEvent.VehicleDealership)
                    {
                        user.LastPosition = new Vector3(-257.5197 + (new Random().Next(-50, 50) / 20), 6211.149 + (new Random().Next(-50, 50) / 20), z: 31.48923);
                        user.LastRotZ     = 121.6988;
                    }
                    Vehicle ve = Vehicle.VehicleData.Values.FirstOrDefault(v => v.IsDealerVehicle && v.OwnerId == user.Id);

                    if (ve != null)
                    {
                        API.deleteEntity(ve.DealershipEmployee);
                        ve.Entity.Delete();
                    }

                    if (user.SelectedCash != null)
                    {
                        InventoryRepository.UpdateAsync(user.SelectedCash);
                    }
                    if (user.SelectedCardAccount != null)
                    {
                        BankRepository.UpdateAsync(user.SelectedCardAccount);
                    }

                    user.MasterAccount.ActiveConnectionLog.DisconnectTime = Server.Date;
                    ConnectionLogRepository.UpdateAsync(user.MasterAccount.ActiveConnectionLog);
                    WeaponRepository.UpdateAllAsync(user.Weapons);
                    PlayerRepository.UpdateAsync(user);
                    Player.PlayerData.Remove(user.Client);
                }
                else
                {
                    Player.PlayerData.Remove(user.Client);
                }
                Master.MasterData.Remove(user.MasterAccount);
            }
            player.FadeIn(0);
            API.triggerClientEvent(player, "onPlayerDisconnect");
        }
Ejemplo n.º 5
0
        public static void ShopPaymentCard(Player p, Inventory inv)
        {
            p.SelectedCardAccount = BankRepository.GetAccountByCardNumber(long.Parse(inv.Value));

            API.shared.triggerClientEvent(p.Client, "PaymentEnterPin", 3 - p.SelectedCardAccount.FailedPinAttempts);
        }
Ejemplo n.º 6
0
        private async void OnClientEventTrigger(Client sender, string eventName, params object[] arguments)
        {
            if (eventName == "ActivateBank")
            {
                Player p = Player.PlayerData[sender];
                sender.position = new Vector3(-113.4233, 6469.712, 31.62671);
                sender.rotation = new Vector3(0, 0, -20);

                API.sendNativeToPlayer(sender, Hash.TASK_PAUSE, sender, 240000000);

                API.triggerClientEvent(sender, "onExecuteBank");
                p.InEvent = PlayerEvent.UsingBank;

                API.triggerClientEvent(sender, "showBankOptions");
            }
            if (eventName == "accessAccount")
            {
                Player p = Player.PlayerData[sender];
                p.AccessingBank   = -1;
                p.TransactionType = -1;

                p.AwaitingInventorySelection = InventoryType.BankCard;

                InventoryManager.UpdatePlayerInventory(p);
            }
            else if (eventName == "newBankAccountChoice")
            {
                Player p = Player.PlayerData[sender];
                p.AccessingBank   = -1;
                p.TransactionType = -1;

                if ((BankAccountType)arguments[0] == BankAccountType.Savings)
                {
                    API.ShowPopupMessage(sender, "Opening Savings Account", "In order to open a new savings account, you will need to make an intial minimum cash deposit of $5,000.", true);

                    p.AwaitingInventorySelection = InventoryType.Money;

                    InventoryManager.UpdatePlayerInventory(p);
                    return;
                }
                else
                {
                    await CreateNewAccountByType(p, BankAccountType.Current, 0, "");
                }
            }
            else if (eventName == "createAccountPinConfirmed")
            {
                Player p = Player.PlayerData[sender];
                p.CreatingAccount.Pin = arguments[0].ToString();

                if (p.CreatingAccount != null)
                {
                    BankRepository.AddNewBankAccount(p.CreatingAccount);
                }
                if (p.CreatingAccountCard != null)
                {
                    p.CreatingAccountCard.AddToPlayer(p, true);
                    InventoryRepository.AddNewInventoryItem(p.CreatingAccountCard);
                }

                p.Inventory.Add(p.CreatingAccountCard);

                API.SendInfoNotification(sender, String.Format("You have successfully created a new {0}", p.CreatingAccount.Type == BankAccountType.Current ? "Current Account" : "Savings Account"), 6);

                p.CreatingAccount     = null;
                p.CreatingAccountCard = null;
            }
            else if (eventName == "validatePin")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);

                if ((string)arguments[0] == bankAccount.Pin)
                {
                    API.triggerClientEvent(sender, "correctPinEntered");
                }
                else
                {
                    API.SendErrorNotification(sender, "You have entered the incorrect PIN. Attempts remaining: " + (3 - ++bankAccount.FailedPinAttempts).ToString());
                    if (bankAccount.FailedPinAttempts == 3)
                    {
                        bankAccount.Locked     = true;
                        bankAccount.LockedType = BankAccountLockedType.FailedPin;
                    }
                    BankRepository.UpdateAsync(bankAccount);
                }
            }
            else if (eventName == "bankInputAction")
            {
                string      title       = "";
                string      message     = "";
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);
                p.TransactionType = (int)arguments[0];

                string last4Digits = bankAccount.CardNumber.ToString();
                last4Digits = last4Digits.Substring(last4Digits.Length - 4);

                switch (p.TransactionType)
                {
                case 0:
                    API.ShowPopupMessage(sender, "Bank Balance", String.Format("Your balance is: {0}", bankAccount.Balance.ToString("C0")), true);
                    return;

                case 1:
                    p.SelectedCardAccount        = null;
                    p.SelectedCash               = null;
                    p.AwaitingInventorySelection = InventoryType.Money;
                    API.SendInfoNotification(sender, "Select the cash you wish to deposit into the account ending in " + last4Digits, 10);

                    InventoryManager.UpdatePlayerInventory(p);
                    return;

                case 2:
                    title   = "Withdraw funds";
                    message = String.Format("Please enter the amount you wish to withdraw from account ending in {0}:", last4Digits);
                    break;

                case 3:
                    title   = "Transfer funds";
                    message = "Please enter the account number you wish to transfer funds to:";
                    break;

                case 4:
                    title   = "Change PIN number";
                    message = "Please enter the 4 digit pin you wish to change to below:";
                    break;

                case 5:
                    API.ShowPopupPrompt(sender, "confirmReplacementCard", "Replacement Bank Card", "Are you sure you want to receive a replacement bank card?", "", "", true);
                    return;
                }

                API.ShowInputPrompt(sender, "transactionInputReceived", title, message, "", "", true);
            }
            else if (eventName == "transactionInputReceived")
            {
                Player      p           = Player.PlayerData[sender];
                BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);
                if ((int)arguments[0] == 1)
                {
                    long value = 0;
                    try
                    {
                        value = long.Parse(arguments[1].ToString());
                    }
                    catch
                    {
                        var message = $"<span style='color:#f00'>Error: Value is invalid.</span><br />{arguments[3]}";
                        API.ShowInputPrompt(sender, "transactionInputReceived", arguments[2].ToString(), message, "", "", true);
                        return;
                    }


                    switch (p.TransactionType)
                    {
                    case 2:
                        if (bankAccount.Balance >= value && value > 0 && value <= 150001)
                        {
                            Inventory cashItem = Inventory.CreateCashInventoryItem(value);
                            cashItem.OwnerType = InventoryOwnerType.Player;
                            cashItem.OwnerId   = p.Id;
                            if (!cashItem.AddToPlayer(p, true))
                            {
                                API.SendErrorNotification(sender, "You don't have enough space to withdraw this amount of cash.", 7);
                                return;
                            }

                            InventoryRepository.AddNewInventoryItem(cashItem);
                            p.Inventory.Add(cashItem);
                            CashLogRepository.AddNew(new CashLog(bankAccount.Id, p.Id, value, MoneyTransferMethod.BankWithdraw));
                            bankAccount.Balance -= value;

                            API.SendInfoNotification(p.Client, $"Your new bank balance is {bankAccount.Balance}", 10);
                        }
                        else
                        {
                            API.ShowInputPrompt(sender, "transactionInputReceived", arguments[2].ToString(), "<span style='color:#f00'>Error: Insufficient funds.</span><br />Please enter the amount you wish to withdraw from this account:", "", "", true);
                        }
                        break;

                    case 3:
                        if ((int)arguments[0] == 1)
                        {
                            try
                            {
                                BankAccount targetAccount = BankRepository.GetAccountByCardNumber(long.Parse(arguments[1].ToString()));
                                string      last4Digits   = arguments[1].ToString();
                                last4Digits = last4Digits.Substring(last4Digits.Length - 4);

                                p.TransactionType = targetAccount.Id;
                                API.ShowInputPrompt(sender, "transferAmountToAccount", "Transfer funds to account",
                                                    $"Please enter the amount you wish to transfer to the account ending in {last4Digits}", "", "", true);
                            }
                            catch
                            {
                                API.ShowInputPrompt(sender, "transactionInputReceived", arguments[2].ToString(), "<span style='color:#f00'>Error: Invalid card number</span><br/>Please enter the account number you wish to transfer funds to:", "", "", true);
                            }
                        }
                        break;

                    case 4:
                        if (value > 999 && value < 10000)
                        {
                            string encPin = value.ToString();
                            bankAccount.Pin = encPin;

                            API.SendInfoNotification(sender, "Your new PIN is " + value, 8);
                        }
                        break;
                    }
                    API.triggerClientEvent(sender, "reenableCursor");
                    BankRepository.UpdateAsync(bankAccount);
                    PlayerRepository.UpdateAsync(p);
                }
                else
                {
                    API.triggerClientEvent(sender, "reenableCursor");
                }
            }
            else if (eventName == "confirmReplacementCard")
            {
                if ((int)arguments[0] == 1)
                {
                    bool        uniqueNumber = false;
                    Player      p            = Player.PlayerData[sender];
                    BankAccount bankAccount  = BankRepository.GetAccountById(p.AccessingBank);

                    while (!uniqueNumber)
                    {
                        string newCardNumber = await CreateCardNumber(16);

                        Inventory inv = InventoryRepository.GetInventoryItemOfTypeByValue(InventoryType.BankCard, newCardNumber);
                        if (inv == null)
                        {
                            Inventory newCard = new Inventory()
                            {
                                OwnerId  = p.Id,
                                Value    = newCardNumber,
                                Type     = InventoryType.BankCard,
                                Name     = "PaletoCard",
                                Quantity = 1
                            };
                            InventoryRepository.AddNewInventoryItem(newCard);
                            p.Inventory.Add(newCard);
                            uniqueNumber = true;
                        }
                    }

                    API.SendInfoNotification(sender, "You have been given a new bank card.");
                    API.triggerClientEvent(sender, "reenableCursor");
                    // Ask if they want the old card destroyed?
                }
            }
            else if (eventName == "transferAmountToAccount")
            {
                Player p = Player.PlayerData[sender];

                BankAccount bankAccount   = BankRepository.GetAccountById(p.AccessingBank);
                BankAccount targetAccount = BankRepository.GetAccountById(p.TransactionType);
                long        value         = 0;

                try { value = long.Parse(arguments[1].ToString()); } catch {
                    var message = $"<span style='color:#f00'>Error: Value is invalid.</span><br />{arguments[3]}";
                    API.triggerClientEvent(sender, "confirmInput", "transactionInputReceived", arguments[2], message);
                    return;
                }

                if (bankAccount.Balance <= value)
                {
                    return;
                }
                bankAccount.Balance   -= value;
                targetAccount.Balance += value;

                API.sendChatMessageToPlayer(sender, "Your new balance is " + bankAccount.Balance);

                API.triggerClientEvent(sender, "reenableCursor");

                BankRepository.UpdateAsync(bankAccount);
                BankRepository.UpdateAsync(targetAccount);
            }
            else if (eventName == "validateIDGiven")
            {
                if ((int)arguments[0] == 1)
                {
                }
            }
            else if (eventName == "onBankLeave")
            {
                Player p = Player.PlayerData[sender];
                p.InEvent = PlayerEvent.None;

                if (p.AwaitingInventorySelection == InventoryType.BankCard)
                {
                    p.AwaitingInventorySelection = null;
                }

                API.sendNativeToPlayer(sender, Hash.TASK_PAUSE, sender, -1);
                API.triggerClientEvent(sender, "onEnterBankCol", ((char)p.MasterAccount.KeyInteract).ToString(), p.MasterAccount.KeyInteract);
            }
        }
Ejemplo n.º 7
0
        private static async Task <string> CreateCardNumber(int length)
        {
            return(await Task.Run(() =>
            {
                string[] prefixs = { "51", "52", "53", "54", "58", "37", "46", "49" };
                string ccnumber = prefixs[new Random().Next(0, prefixs.Length - 1)];
                bool unique = false;

                while (!unique)
                {
                    while (ccnumber.Length < (length - 1))
                    {
                        double rnd = (new Random().NextDouble() * 1.0f - 0f);

                        ccnumber += Math.Floor(rnd * 10);

                        Thread.Sleep(20);
                    }


                    var reversedCCnumberstring = ccnumber.ToCharArray().Reverse();

                    var reversedCCnumberList = reversedCCnumberstring.Select(c => Convert.ToInt32(c.ToString()));

                    int sum = 0;
                    int pos = 0;
                    int[] reversedCCnumber = reversedCCnumberList.ToArray();

                    while (pos < length - 1)
                    {
                        int odd = reversedCCnumber[pos] * 2;

                        if (odd > 9)
                        {
                            odd -= 9;
                        }

                        sum += odd;

                        if (pos != (length - 2))
                        {
                            sum += reversedCCnumber[pos + 1];
                        }

                        pos += 2;
                    }

                    // calculate check digit
                    int checkdigit =
                        Convert.ToInt32((Math.Floor((decimal)sum / 10) + 1) * 10 - sum) % 10;



                    ccnumber += checkdigit;

                    if (BankRepository.GetAccountByCardNumber(long.Parse(ccnumber)) == null)
                    {
                        unique = true;
                    }
                }
                return ccnumber;
            }));
        }
Ejemplo n.º 8
0
        public static void OnLicenseSelected(Player p, Inventory inv)
        {
            BankAccount bankAccount = BankRepository.GetAccountById(p.AccessingBank);

            //Do license stuff
        }