예제 #1
0
        public async Task RE_MenuCompanyRetirar(Client player, string cant)
        {
            int cantidad = Convert.ToInt32(cant);

            if (!player.HasData("USER_CLASS"))
            {
                return;
            }
            Data.Entities.User user = player.GetData("USER_CLASS");
            //var user = player.GetExternalData<Data.Entities.User>(0);
            if (user.companyInterior.owner == user.idpj)
            {
                if (user.companyInterior.safeBox <= cantidad)
                {
                    user.companyInterior.safeBox = user.companyInterior.safeBox - cantidad;
                    await DbFunctions.UpdateCompanySafebox(user.companyInterior.id, (int)user.companyInterior.safeBox);

                    Utilities.Notifications.SendNotificationOK(player, $"Has retirado ${cantidad} de la caja fuerte de tu empresa");
                }
                else
                {
                    Utilities.Notifications.SendNotificationERROR(player, "No tienes suficiente dinero en la caja fuerte");
                }
            }
        }
예제 #2
0
        public async Task RE_MenuCompanyIngresar(Player player, string cant)
        {
            int cantidad = Convert.ToInt32(cant);

            if (!player.HasData("USER_CLASS"))
            {
                return;
            }
            Data.Entities.User user = player.GetData <Data.Entities.User>("USER_CLASS");
            //var user = player.GetExternalData<Data.Entities.User>(0);
            if (user.companyInterior.owner == user.idpj)
            {
                if (await Game.Money.MoneyModel.SubMoney(player, (double)cantidad))
                {
                    user.companyInterior.safeBox = user.companyInterior.safeBox + cantidad;
                    await DbFunctions.UpdateCompanySafebox(user.companyInterior.id, (int)user.companyInterior.safeBox);

                    Utilities.Notifications.SendNotificationOK(player, $"Has ingresado ${cantidad} a la caja fuerte de tu empresa");
                }
                else
                {
                    Utilities.Notifications.SendNotificationERROR(player, "No tienes suficiente dinero");
                }
            }
        }