Skip to content

Commit

Permalink
V0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hateofhades committed Apr 29, 2018
2 parents ad7d634 + 66cc0cf commit 6e0c832
Show file tree
Hide file tree
Showing 12 changed files with 473 additions and 38 deletions.
34 changes: 31 additions & 3 deletions Transaction Bot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added htdocs/audio/slot_win.wav
Binary file not shown.
Binary file added htdocs/audio/spin.mp3
Binary file not shown.
144 changes: 144 additions & 0 deletions htdocs/dices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<html>
<head>
<?php include('src/head.php'); ?>
<script>
var animateVar = 0, setRollBackTimeout, rolling = 0;

function doubleDices() {
var currValue = $("#dicesInput").val();
currValue = currValue * 2;
$("#dicesInput").val(currValue);

var value = $("#multiplier").val();

$("#profit").text((currValue * value).toFixed(3));
}

function rollDices() {
var bet = $("#dicesInput").val();
var under = $("#rollUnder").val();

if(!rolling) {
rolling = 1;
$.getJSON( "../src/dices.php?bet=" + bet + "&under=" + under, function( data ) {
console.log(data);
if(data['status'] == 'success') {
clearTimeout(setRollBackTimeout);
animateVar = 0;
animate(data['pick'], data['win'], data['balance']);
} else {
rolling = 0;
}
});
}
}

function animate(pick, win, bal) {
animateVar++;
picker = Math.floor(Math.random() * 10000);
$("#rollButton").text(picker);
if(animateVar <= 30)
setTimeout(function () { animate(pick, win, bal) }, 100);
else {
rolling = 0;
$("#rollButton").text(pick);

if(win)
$("#rollButton").css("color", "green");
else
$("#rollButton").css("color", "red");

setRollBackTimeout = setTimeout(function () { setRollBack(bal) }, 5000);
}
}

function setRollBack (bal) {
$("#rollButton").text("ROLL!");
$("#rollButton").css("color", "white");
$("#balance").text("Balance: " + bal + " SBD");
}

function halfDices() {
var currValue = $("#dicesInput").val();
currValue = currValue / 2;

if(currValue < 0.001)
currValue = 0.001;

$("#dicesInput").val(currValue);

var value = $("#multiplier").val();

$("#profit").text((currValue * value).toFixed(3));
}

//If value is under min or over max we change it and if we detect a change in Roll Under or Multiplier (done by player) we are updating the other one to correspond.
$(document).ready(function() {
$('#rollUnder').on('input', function() {
var value = $("#rollUnder").val();
//value.toFixed(0);

if(value < 10)
$("#rollUnder").val(10);
else if(value > 9400)
$("#rollUnder").val(9400);

$("#multiplier").val((9500/value).toFixed(2));

var bet = $("#dicesInput").val();

$("#profit").text((bet * (9500/value)).toFixed(3));
});

$('#multiplier').on('input', function() {
var value = $("#multiplier").val();
//value.toFixed(2);

if(value < 1)
$("#multiplier").val(1);
else if(value > 9500)
$("#multiplier").val(9500);

$("#rollUnder").val((9500/value).toFixed(0));

var bet = $("#dicesInput").val();

$("#profit").text((bet * value).toFixed(3));
});

$('#dicesInput').on('input', function() {
var bet = $("#dicesInput").val();

if(bet < 0.001) {
bet = 0.001;
$("#dicesInput").val(bet);
}

var value = $("#multiplier").val();

$("#profit").text((bet * value).toFixed(3));
});
});
</script>
</head>
<body>
<?php include('navbar.php'); ?>
<div id="dicesBody">
<center><h1 style="margin-bot:0">Dices</h1></center>
<div id="dicesGame">
<b style="float:left;margin-left:10px;margin-top:10px;">Bet Amount</b>
<b style="float:right;margin-right:10px;margin-top:10px;">Profit On Win</b><br><br>
<input id="dicesInput" style="margin-left:10px;" type="number" step=".001" min="0.001" value="1.000" pattern="\d+(\.\d{2})?" name="bet">
<button class="dicesButton" id="dicesx2" onClick="doubleDices();">x2</button>
<button class="dicesButton" id="dices12" onClick="halfDices();">1/2</button>
<b style="float:right;margin-right:10px;font-size:40px;color:white" id="profit">2.000</b><br><br>
<b style="margin-left:10px;">Roll </b><b style="color:#00c74d">under</b>
<b style="margin-left:14%">Multiplier</b><br><br>
<input style="margin-left:10px;" type="number" class="dicesChances" id="rollUnder" value="4750" min="10" max="9400">
<input style="margin-left:10px;" type="number" class="dicesChances" id="multiplier" value="2.00" min="1" max="9500"><br><br>
<button class="rollButton" id="rollButton" onclick="rollDices();">ROLL!</button>
</div>
</div>
<?php include('src/footer.php'); ?>
</body>
</html>
3 changes: 3 additions & 0 deletions htdocs/games.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<div>
<a href="slots.php"><img height="20%" src="img/slots.png"></a>
</div>
<div>
<a href="dices.php"><img height="20%" src="img/dices.png"></a>
</div>
</div><br>
<a href="howtoplay.php">How to play?</a>
</center>
Expand Down
Binary file added htdocs/img/dices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions htdocs/js/roulette.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var HOST = "localhost:3000";
var socket = null;
var progress;
var state;
var spin;

function connect() {
if(!socket) {
Expand Down
13 changes: 13 additions & 0 deletions htdocs/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@
$history = "
<h4 style=\"display:inline\">Slots | </h4> ".$win." | <h4 style=\"display:inline\">".$date."</h4><br>
".$history;
} else if($row['transType'] == 10) {
$date = date("F j, Y, g:i a T", $row['timestamp']);
if($row['win'] == 1)
$win = "
<h4 style=\"display:inline;color:green\">+".$row['reward']." SBD</h4>
";
else
$win = "
<h4 style=\"display:inline;color:red\">-".$row['amount']." SBD</h4>
";
$history = "
<h4 style=\"display:inline\">Dices | </h4> ".$win." | <h4 style=\"display:inline\">".$date."</h4><br>
".$history;
}
}

Expand Down
Loading

0 comments on commit 6e0c832

Please sign in to comment.