ruzli
8/14/2018 - 12:09 PM

Most of safest scripts i have ever made

Most of safest scripts i have ever made

const baseBet = 1
const baseTarget = 1.5
const maximumBet = 500
const multiplierBet = 3
const minimalToRunScript = 300

let losses = 1
let bet = 1
let engine = this
let tbet = bet

while(true){
if (this.balance / 100 < minimalToRunScript){
    this.log('Minimal balance is reached, stopping script')
break
}
    if (bet * losses >= maximumBet){losses = 1}
    tbet = Math.floor(toSatoshi(bet))
    const { multiplier} = await this.bet(toSatoshi(toBits(tbet) * Math.floor(toSatoshi(toBits(losses)))), baseTarget)
    this.log(`Current balance ${toBits(this.balance)}`)

    if (multiplier < baseTarget){     /*   [LOSS]   */
        gong()
        await generateSeed()
        //bet = (losses * baseBet)
        if (baseBet * losses >= maximumBet){
            //losses--
        }else{
        losses = losses * multiplierBet +Math.floor(multiplierBet/0.7)
        }
    }else{                               /*    [WIN]   */
        collectSound()
      
        losses = Math.round(losses / multiplierBet)
          if (losses <= baseBet){
              losses = 1
          }
         // bet = baseBet - bet
        }  
}
    
  function gong() {
    const audio = new Audio("https://bustadice.com/5bb187b7ef764e76fb519939f77288c1.mp3")
    audio.play()
    return new Promise(resolve => audio.onended = resolve)
  }
  function collectSound(){
    let pathStr = "http://kz-developer.ru/sounds/chipsHandle" + getRandomInt(6,7) + ".wav"

      
      const audio = new Audio (pathStr)
      audio.play()
      return new Promise(resolve => audio.onended = resolve)
  }
 
  async function generateSeed(){
      const { server_seed_hash } = await engine.newSeedPair()
      engine.log(`Server seed: ${server_seed_hash}`)
      try {
          const clientSeed = randomSeed()
          await engine.setClientSeed(clientSeed)
          engine.log(`Seed was set to: ${clientSeed}`)
      }
      catch(e){
          engine.log(`Client seed already was reset and not used`)
      }
  }
  
  function randomSeed(){
      const words = ['Alegra ','Bravon ','Charlik ','Delago ','Zecho ','Forextromb ','Hotelka ','Gnomus ','Addicted ','Aurelia ','Zigalo ','Wiverma ',
      'Mariner ','Octoberfest ','Nascar ','Papaja ','Alberts ','Gomus ','Fierra ','GTO ','Unicorn ','Vicantus ','Siski ','Xavier ','Poiuplet ','Antutulika ']
  
      return words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())] + words[Math.floor(words.length * Math.random())]
  }
  
  function getRandomInt(min, max){
      return Math.floor(Math.random() * (max - min)) + min;
  }
  function toBits(satoshi){
    return satoshi / 100
  }
  function toSatoshi(bits){
    return bits * 100
  }