Ejemplo n.º 1
0
    def Apostar(self, _mod, _apuesta, _dado1=0, _dado2=0):
        self.dado1 = rnd.randint(1, 7, 1)
        self.dado2 = rnd.randint(1, 7, 1)
        self.dinGanado = 0

        #Recibo parametros
        self.ActualizarSaldo()
        if self.saldo <= _apuesta:
            return False
        else:
            if _mod == 1:
                self.dinGanado = self.Mod1(_apuesta, self.dado1, self.dado2)
            elif _mod == 2:
                self.dinGanado = self.Mod2(_apuesta, self.dado1, self.dado2)
            elif _mod == 3:
                self.dinGanado = self.Mod3(_apuesta, self.dado1, self.dado2)
            elif _mod == 4:
                self.dinGanado = self.Mod4(_apuesta)
            elif _mod == 5:
                self.dinGanado = self.Mod5(_apuesta, self.dado1, self.dado2,
                                           _dado1, _dado2)
            else:
                print("MODALIDAD INCORRECTA")

            self.transaccion = self.dinGanado - _apuesta
            self.saldo += self.transaccion
            bd.insertarDatos(self.saldo, self.transaccion)
            return True
    def Play(self,tier, costo, dinero):
        self.dinero -= costo
        self.ganancia = 0
        self.CAoro = 20
        self.CAplata = 4

        self.profitOro = costo * self.CAoro
        self.profitPlata = costo * self.CAplata
        self.ResetUi()
        for i in range(tier):
          self.shot = rnd.rand()
          print(str(self.shot))
          if  self.shot <= 0.05:
            self.ganancia += self.profitOro
            self.triunfo = "Ganaste el premio de oro!"
            self.ShowResultLbl(i+1,self.triunfo)
          elif self.shot <= 0.25:
            self.ganancia += self.profitPlata
            self.triunfo = "Ganaste el premio de plata!"
            self.ShowResultLbl(i+1,self.triunfo)
          else:
            self.ganancia += 0
            self.triunfo = "Ganaste el premio de bronce!"
            self.ShowResultLbl(i+1,self.triuCAoronfo)

        self.dinero += self.ganancia
        self._txtg.setText(str(self.ganancia))
        self.saldoTotal.setText(str(self.dinero))
        bd.insertarDatos(self.dinero,self.ganancia)
    def Play(self, tier, costo, dinero):
        self.dinero -= costo
        self.lootBox = np.array([1, 2, 2, 3, 3, 3])
        self.ganancia = 0
        self.CAoro = 6
        self.CAplata = 3

        self.profitOro = costo * self.CAoro
        self.profitPlata = costo * self.CAplata
        self.ResetUi()
        for i in range(tier):
            self.shot = rnd.randint(0, 6)
            if self.lootBox[self.shot] == 1:
                self.ganancia += self.profitOro
                self.triunfo = "Ganaste el premio de oro!"
                self.ShowResultLbl(i + 1, self.triunfo)
            elif self.lootBox[self.shot] == 2:
                self.ganancia += self.profitPlata
                self.triunfo = "Ganaste el premio de plata!"
                self.ShowResultLbl(i + 1, self.triunfo)
            elif self.lootBox[self.shot] == 3:
                self.ganancia += 0
                self.triunfo = "Ganaste el premio de bronce!"
                self.ShowResultLbl(i + 1, self.triunfo)

        self.dinero += self.ganancia
        self._txtg.setText(str(self.ganancia))
        self.saldoTotal.setText(str(self.dinero))
        bd.insertarDatos(self.dinero, self.ganancia)
Ejemplo n.º 4
0
 def ActualizarDinero(self, dineroNuevo, cambioDinero):
     if (dineroNuevo < 0):
         self.dineroBase = 0
         self.SaldoLabel.setText(str(self.dineroBase))
         bd.insertarDatos(self.dineroBase, cambioDinero)
     else:
         self.dineroBase = dineroNuevo
         bd.insertarDatos(self.dineroBase, cambioDinero)
Ejemplo n.º 5
0
 def Apostar(self, _mod, _r):
     
     self.resultado = rnd.randint(1, 7, self.n)
     self.mod = _mod
     self.r = _r
     self.cuota = 0
     self.dinGanado = 0
     self.saldo = bd.traerValor()
     
     if self.mod == 1:
         self.cuota = 2
         if self.saldo >= self.cuota:
             for i in range(self.n):
                 if self.r == self.resultado[i]:
                     self.dinGanado = self.cuota * self.multiplicador
         else:
             self.cuota = 0
     elif self.mod == 2:
         self.cuota = 3
         if self.saldo >= self.cuota:
             self.arreglo = np.unique(self.resultado)
             if len(self.arreglo)  < 3:
                 self.dinGanado = self.cuota * self.multiplicador
         else:
             self.cuota = 0
     elif self.mod == 3:
         self.cuota = 36
         if self.saldo >= self.cuota:
             self.contador = 0
             for i in range(self.n):
                 if self.r == self.resultado[i]:
                     self.contador += 1
             if self.contador >= 2:
                 self.dinGanado = self.cuota * self.multiplicador
         else:
             self.couta = 0
     elif self.mod == 4:
         self.cuota = 36
         if self.saldo >= self.cuota:
             self.arreglo = np.unique(self.resultado)
             if len(self.arreglo) == 1:
                 self.dinGanado = self.cuota * self.multiplicador
         else:
             self.couta = 0
     elif self.mod == 5:
         self.cuota = 216
         if self.saldo >= self.cuota:
             self.arreglo = np.array([self.r, self.r, self.r])
             if (self.arreglo == self.resultado).all():
                 self.dinGanado = self.cuota * self.multiplicador
         else:
             self.cuota = 0
             
     self.saldo += self.dinGanado - self.cuota
     bd.insertarDatos(self.saldo, self.dinGanado - self.cuota)
Ejemplo n.º 6
0
 def Lanzar(self,index,value,plata):
    self.PlataJugar = plata
    if index == 0:
       self.Modo1(value)
    if index == 1:
       self.Modo2(value)
    if index == 2:
       self.Modo3()
    if index == 3:
       self. Modo4()
    if index == 4:
       self.Modo5(value)
    self.Saldo += self.transaccion
    bd.insertarDatos(self.Saldo,self.transaccion)
    self.ActualizarSaldo()
    def jugarui(self):
        if(self.isInputANumber() == True and self.HasBalota() == True):
            pass
        else:
            return

        t = self.lineEdit2.text()
        m = self.comboBox.currentIndex()
        k = float(self.label2_5.text())
        j = True
        
        
        if((m == 0 and len(t)<3) or (m == 1 and len(t)<9 and len(t)>4) or (m == 2 and len(t)<15 and len(t)>8) or (m == 3 and len(t)<24 and len(t)>14) or (m == 4 and len(t)<30 and len(t)>18)):
            j = True
            self.label2_4.setText("     ¡Formato Correcto!")
            self.label2_4.setStyleSheet("color: rgb(226, 240, 57);")
        else:
            self.label2_4.setText("     ¡Formato Invalido!")
            self.label2_4.setStyleSheet("color: rgb(255, 0, 4);")
            j= False
        if(float(self.lineEdit.text()) < 10000):
            self.label4.setText("Mínimo 10.000")
            j = False
            
        if(k < float(self.lineEdit.text())):
            self.label4.setText("¡Sin Saldo!")
            self.label4.setStyleSheet("color: rgb(255, 0, 4);")
            j = False
            
        if j == True:
            texto = jugar(self.comboBox.currentIndex(),self.lineEdit2.text(),self.lineEdit.text())
            ver = "$"
            ver += str(texto)
            self.label2_3.setText(ver)
            
            if(texto==0):
              self.label4.setText("    ¡Perdiste!")
              self.label4.setStyleSheet("color: rgb(255, 0, 4);")
              ver += str(texto)*2
              self.label2_3.setText(ver)
              bd.insertarDatos(float(self.label2_5.text())-float(self.lineEdit.text()),-1*float(self.lineEdit.text()))
              self.label2_5.setText("%s"%bd.traerValor())
            else:
              self.label4.setText("    ¡Ganaste!")
              self.label4.setStyleSheet("color: rgb(226, 240, 57);")
              bd.insertarDatos(float(self.label2_5.text())+texto,float(self.lineEdit.text()))
              self.label2_5.setText("%s"%bd.traerValor())
Ejemplo n.º 8
0
# -*- coding: utf-8 -*-
#lineas necesarias para usar el fichero
import sys, re
from PyQt5 import uic, QtWidgets
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtSql import QSqlDatabase, QSqlQuery, QSqlTableModel
import ctypes
from bd import insertarDatos
#fin lineas necesarias para el uso del fichero

#insercion de datos a la bd
total_transaccion = 1200
detalle_transacion = 1200
valores = insertarDatos(total_transaccion, detalle_transacion)
#self.botonganancia.clicked.connect(insertarDatos)
Ejemplo n.º 9
0
    def Jugar(self,cb1A, cb1B, cb1C, cb2A, cb2B, cb3A, cb3B, cb4A, cb4B, apuesta):
        self.actualizarSaldo()
        if self.Validar([cb1A, cb1B, cb1C, cb2A, cb2B, cb3A, cb3B, cb4A, cb4B]) != True:
            return
        self.selectedLines = self.Contar([cb1A, cb1B, cb1C, cb2A, cb2B, cb3A, cb3B, cb4A, cb4B])
        
        self.ganancia = 0
        self.posibles=759375
        self.simbolos = np.array(["A", "B", "C", "D"])
        try:
            if( apuesta%self.selectedLines != 0):
                self._msgbox("Error","La Cantidad de creditos a jugar no es multiplo de las lineas seleccionadas")
                return 0
        except:
            return 0

        if (apuesta*1000) < 10000:
            self._msgbox("Error","La cantidad a apostar debe ser mayor a 10000 pesos")
            return 0
        
        
        apuesta = apuesta/self.selectedLines
        self.Disco1 = self.GirarRuleta()
        self.Disco2 = self.GirarRuleta()
        self.Disco3 = self.GirarRuleta()
        self.Disco4 = self.GirarRuleta()
        self.Disco5 = self.GirarRuleta()
        
        self.win = False
        for x in self.simbolos:
            if cb1A and self.Disco1[0] == x and self.Disco2[0] == x and self.Disco3[0] == x and self.Disco4[0] == x and self.Disco5[0] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb1B and self.Disco1[1] == x and self.Disco2[1] == x and self.Disco3[1] == x and self.Disco4[1] == x and self.Disco5[1] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb1C and self.Disco1[2] == x and self.Disco2[2] == x and self.Disco3[2] == x and self.Disco4[2] == x and self.Disco5[2] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb2A and self.Disco1[2] == x and self.Disco2[1] == x and self.Disco3[1] == x and self.Disco4[1] == x and self.Disco5[0] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb2B and self.Disco1[0] == x and self.Disco2[1] == x and self.Disco3[1] == x and self.Disco4[1] == x and self.Disco5[2] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb3A and self.Disco1[2] == x and self.Disco2[1] == x and self.Disco3[2] == x and self.Disco4[1] == x and self.Disco5[2] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb3B and self.Disco1[0] == x and self.Disco2[1] == x and self.Disco3[0] == x and self.Disco4[1] == x and self.Disco5[0] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb4A and self.Disco1[0] == x and self.Disco2[1] == x and self.Disco3[2] == x and self.Disco4[1] == x and self.Disco5[0] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
            if cb4B and self.Disco1[2] == x and self.Disco2[1] == x and self.Disco3[0] == x and self.Disco4[1] == x and self.Disco5[2] == x:
                self.AddvalorGanancia(x,apuesta,self.posibles,self.selectedLines)
                self.win = True
        
        if cb1B and self.Disco1[1] == "E" and self.Disco2[1] == "E" and self.Disco3[1] == "E" and self.Disco4[1] == "E" and self.Disco5[1] == "E":
            self.ganancia += apuesta * self.posibles
            self.AAA =("¡JACKPOT!")
            self.win=True
        if self.win == False:
            self.AAA =("Usted ha perdido :c ")
            self.ganancia = apuesta*self.selectedLines*-1
        
        self.ganancia *= 1000
        
        self.Saldo += self.ganancia
        bd.insertarDatos(self.Saldo,self.ganancia)