Code:
// ==UserScript==
// @name Plip Coin Paidverts
// @namespace http://a2s.in/
// @version 0.1
// @description Paidvert Plip Coin Gambling martingle method
// @match http://www.paidverts.com/member/games/coin_flip.html
// @copyright 2014+, Mukhadie@a2s
// ==/UserScript==
var scriptStop = true,
plip = {
timeLeft:0,
coin:'heads',
total_win:0,
total_lose:0,
session_lose: 0,
minBet:10,
maxBet: 5000,
want: 200,
lose: 10000,
nextWait: 0,
nextLose: 0,
curBet: 0,
curBalance: 0,
lastBalance: 0,
startBalance: 0,
last_bet: 0,
total_payout: 0,
curSessionTime: '',
save_bap: 5,
timeDelay: 1,
multiple: 2,
isStopped: false,
isToogle: false,
isToogleOnWin: false,
elmBalance: '.selectedBalance b',
url: 'http://www.paidverts.com/member/games/coin_flip/play',
init: function(){
var self = this;
self.appendElapsedScript();
if(typeof(Storage) !== "undefined") {
self.minBet = (!isNaN(parseInt(localStorage.getItem("plip_minBet")))) ? parseInt(localStorage.getItem("plip_minBet")) : self.minBet;
self.curBet = (!isNaN(parseInt(localStorage.getItem("plip_curBet")))) ? parseInt(localStorage.getItem("plip_curBet")) : self.curBet;
self.want = (!isNaN(parseInt(localStorage.getItem("plip_want")))) ? parseInt(localStorage.getItem("plip_want")) : self.want ;
self.lose = (!isNaN(parseInt(localStorage.getItem("plip_lose")))) ? parseInt(localStorage.getItem("plip_lose")) : self.lose;
self.save_bap = (!isNaN(parseInt(localStorage.getItem("plip_save")))) ? parseInt(localStorage.getItem("plip_save")) : self.save_bap;
self.timeDelay = (!isNaN(parseInt(localStorage.getItem("plip_delay")))) ? parseInt(localStorage.getItem("plip_delay")) : self.timeDelay;
self.multiple = (!isNaN(parseInt(localStorage.getItem("plip_multiple")))) ? parseInt(localStorage.getItem("plip_multiple")) : self.multiple;
}
self.curBalance = (self.curBalance > 0)?self.curBalance:parseInt($(self.elmBalance).text());
self.nextWait = (self.curBalance + self.want);
self.curBet = (self.curBet > 0) ? self.curBet: self.minBet;
self.nextLose = (parseInt(self.curBalance) - parseInt(self.lose));
self.startBalance = self.curBalance;
self.displayContainer();
//self.run();
},
appendElapsedScript: function(){
var self = this;
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = "http://www.labs.mimmin.com/countdown/remaining.js";
$("head").append( script );
},
displayContainer: function(){
var self = this;
$('#plip-id').remove();
var html = '<div id="plip-mask" style="z-index:2;display: block;position: fixed;left:0;top:0;background:#000;opacity:0.5;width: 100%;height: 100%;"> </div><div id="plip-id" style="z-index: 3;text-align: left;width:700px; background-color: #f4f4f4; border: 4px solid #ccc;padding: 10px;position: fixed; margin-left: -300px; left: 50%;top: 20px;">'+
'<div style="float: left;width:50%;margin-right: 10px;"><a href="#" id="plip-close" style="color: red;">Close</a>'+
'<div id="plip-content"></div>'+
'<span id="plip-loading" style="text-align:center;">Press button bellow to begin</span>'+
'<p><button style="display: block; width: 100%;" id="plip-stop" class="button_green_sans3">Play</button></p>'+
"<div align='center' id='plip-ads'>"+
self.displayAds()+
"</div>"+
'</div><div style="float:right;width:45%;"><fieldset><legend>Settings</legend>'+
'<p><label>Your bet : </label><input type="text" id="plip-bet" style="padding:2px;width:97%;" value="'+self.curBet+'" /></p>'+
'<p><label><input type="radio" value="heads" checked="checked" name="side" /> Heads</label> <label><input type="radio" value="tails" name="side" /> Tails</label> <input name="side" type="radio" value="toogle" /> Toggle</label> <input name="side" type="radio" value="toogle_on_win" /> Toggle on win</label></p>'+
'<p><label>Time between bet : </label> | <label>Multiple bet on lose : </label><br /><input id="adpacks_number" class="number" type="number" name="plip-second" min="1" step="1" value="'+self.timeDelay+'"> second <input id="adpacks_number" class="number" type="number" name="plip-multiple" min="1" step="1" value="'+self.multiple+'"> x</p>'+
'<p><label>Stop on profit : </label><input type="text" id="plip-want" style="padding:2px;width:97%;" value="'+self.want+'" /></p>'+
'<p><label>Stop on lose : </label><input type="text" id="plip-lose" style="padding:2px;width:97%;" value="'+self.lose+'" /></p>'+
'<p><label>Save BAP : </label><input type="text" id="plip-save" style="padding:2px;width:97%;" value="'+self.save_bap+'" /></p>'+
'</fieldset><p>Elapsed time : <span id="plip-elapsedtime">0 hour 0 minute 0 second</span></p></div></div>';
$('body').append(html);
self.display();
$('#plip-id').delegate('#plip-close','click', function(){
$('#plip-id, #plip-mask').remove();
});
$('#plip-id').delegate('#plip-stop','click', function(){
//console.log('Stopped...');
$('#plip-stop').attr('disabled', 'disabled');
if( scriptStop ){
scriptStop = false;
self.startBalance = self.curBalance;
var dcoin = $('input[name=side]:checked').val();
if( dcoin == 'toogle' ){
self.isToogle = true;
}else if( dcoin == 'toogle_on_win' ){
self.isToogle = false;
self.isToogleOnWin = true;
}else{
self.coin = dcoin;
self.isToogle = false;
self.isToogleOnWin = false;
}
self.minBet = parseInt( $('#plip-bet').val() );
self.curBet = parseInt( $('#plip-bet').val() );
self.want = parseInt( $('#plip-want').val() );
self.lose = parseInt( $('#plip-lose').val() );
self.nextWait = (parseInt(self.curBalance) + parseInt(self.want));
self.nextLose = (parseInt(self.curBalance) - parseInt(self.lose));
self.save_bap = parseInt($('#plip-save').val());
self.timeDelay = parseInt($('input[name=plip-second]').val());
self.multiple = parseInt($('input[name=plip-multiple]').val());
if(typeof(Storage) !== "undefined") {
localStorage.setItem("plip_minBet", self.minBet);
localStorage.setItem("plip_curBet", self.curBet);
localStorage.setItem("plip_want", self.want);
localStorage.setItem("plip_lose", self.lose);
localStorage.setItem("plip_save", self.save_bap);
localStorage.setItem("plip_delay", self.time_delay);
localStorage.setItem("plip_multiple", self.multiple);
}
$('#plip-want').attr('disabled','disabled');
$('#plip-lose').attr('disabled','disabled');
$('#plip-save').attr('disabled','disabled');
$('#plip-bet').attr('disabled','disabled');
$('input[name=plip-second]').attr('disabled','disabled');
$('input[name=plip-multiple]').attr('disabled','disabled');
var curTime = new Date(),
cm = curTime.getMonth()+1,
cd = curTime.getDate(),
cy = curTime.getFullYear(),
h = curTime.getHours(),
m = curTime.getMinutes(),
s = curTime.getSeconds(),
curDate = cy + '-' + cm + '-' + cd + ' ' + h + ':' + m + ':' + s;
self.curSessionTime = curDate;
self.display();
self.runTimer();
$('#plip-loading').text('Playing');
self.run();
}else{
$('#plip-loading').text('Trying to stop...');
scriptStop = true;
}
});
var randomnumber = Math.floor(Math.random() * 10000);
setInterval(function() {
try{
$('#plip-ads').html(self.displayAds);
}catch(err){
}
}, 60000 + randomnumber);
},
displayAds: function(){
var html = "<iframe data-aa='38022' src='//ad.a-ads.com/38022?size=120x60&background_color=f4f4f4&title_color=32c75f&link_color=32c75f&title_hover_color=32c75f&link_hover_color=32c75f&text_color=444444' scrolling='no' style='width:120px; height:60px; margin-right: 20px;border:0px; padding:0;overflow:hidden' allowtransparency='true'></iframe>"+
"<iframe data-aa='38022' src='//ad.a-ads.com/38022?size=120x60&background_color=f4f4f4&title_color=32c75f&link_color=32c75f&title_hover_color=32c75f&link_hover_color=32c75f&text_color=444444' scrolling='no' style='width:120px; height:60px; border:0px; padding:0;overflow:hidden' allowtransparency='true'></iframe><p></p><p></p><iframe data-aa='38162' src='//ad.a-ads.com/38162?size=320x50&background_color=f4f4f4&title_color=32c75f&link_color=32c75f&title_hover_color=32c75f&link_hover_color=32c75f&text_color=444444' scrolling='no' style='width:320px; height:50px; border:0px; padding:0;overflow:hidden' allowtransparency='true'></iframe>";
return html;
},
display: function(){
var self = this,
dBalance = ( self.lastBalance == 0 )?self.curBalance:self.lastBalance;
//self.startBalance
var html = '<p><b>Balance : </b>' + dBalance + '/<font color="green">' + self.nextWait + '</font>/<font color="red">' + self.nextLose + '</font> BAP ( '+ self.startBalance +' BAP )</p>'+
'<p><b>W/L/P : </b>' + self.total_win + '/' + self.total_lose + '/' + ( self.total_win + self.total_lose ) + '</p>'+
'<p><b>Last Bet : </b>' + self.last_bet + 'BAP</p>'+
'<p><b>Total payout : </b>' + self.total_payout + 'BAP</p>';
$('#plip-content').empty().html(html);
},
toggle_coin: function(){
var self = this;
switch(self.coin){
case "heads":
self.coin = 'tails';
break;
case "tails":
self.coin = 'heads';
break;
};
},
run: function(){
var self = this;
if( scriptStop ){
$('#plip-loading').text('Stopped');
$('#plip-stop').text('Play');
$('#plip-stop').removeAttr('disabled');
$('#plip-want').removeAttr('disabled');
$('#plip-save').removeAttr('disabled');
$('#plip-bet').removeAttr('disabled');
$('#plip-lose').removeAttr('disabled');
$('input[name=plip-second]').removeAttr('disabled');
$('input[name=plip-multiple]').removeAttr('disabled');
return;
}else{
$('#plip-stop').text('Stop');
$('#plip-stop').removeAttr('disabled');
}
/*
if( self.session_lose >= 3 ){
self.toggle_coin();
self.session_lose = 0;
}
*/
if( self.isToogle )
self.toggle_coin();
$.ajax({
url: self.url,
type: 'POST',
dataType: 'json',
data: { bet:self.curBet, guess:''+self.coin+'' },
beforeSend: function(){
$('#plip-loading').text('Please wait...');
},
success: function(res){
if( isNaN(res.payout) ){
self.log(res);
self.delay(0);
return;
}
$('.selectedBalance b').text(res.accountBalance);
$('.gamesContentRight').html(res.right);
self.lastBalance = res.accountBalance;
self.last_bet = self.curBet,
last_side = self.coin;
if( res.payout > 0 ){
if( self.nextLose >= self.startBalance ){
if( parseInt( self.curBet ) > parseInt(self.save_bap) )
{
self.nextLose += parseInt( self.curBet ) - parseInt( self.save_bap );
}else{
self.nextLose += parseInt( self.curBet );
}
}else{
self.nextLose += parseInt( self.save_bap );
}
self.curBet = self.minBet;
if(self.isToogleOnWin){
self.toggle_coin();
}
if( self.session_lose > 0 )
self.session_lose -= 1;
self.total_win += 1;
}else{
if( parseInt(self.curBet) == parseInt(self.maxBet) )
{
self.curBet = self.minBet;
self.last_bet = self.minBet;
}else{
self.curBet = self.getBetAmount(self.curBet, 0);
self.curBet = (self.curBet > self.maxBet)?self.maxBet:self.curBet;
}
if( self.nextLose >= self.startBalance )
self.nextLose -= parseInt( self.minBet );
self.session_lose += 1;
self.total_lose += 1;
}
self.total_payout += ( res.payout - self.last_bet );
self.display();
if( res.payout > 0 ){
$('#plip-loading').text(res.resultHTML);
}else{
$('#plip-loading').html('<font color="red">'+res.resultHTML+'</font>');
}
if( res.accountBalance >= self.nextWait ){
self.display();
self.curBalance = res.accountBalance;
self.nextWait = parseInt(res.accountBalance) + parseInt(self.want);
self.nextLose = parseInt(res.accountBalance) - parseInt( self.lose );
scriptStop = true;
self.total_payout = 0;
self.session_lose = 0;
self.total_lose = 0;
self.total_win = 0;
self.run();
//self.log( 'Restart script...' );
//self.delay(10000);
return;
//return self.log('Stopped...');
}
if( self.curBet > res.accountBalance || ( res.accountBalance - self.curBet ) <= self.nextLose || res.accountBalance <= self.nextLose ){
self.display();
self.total_payout = 0;
self.curBet = self.minBet;
self.curBalance = res.accountBalance;
self.nextWait = parseInt(res.accountBalance) + parseInt(self.want);
self.nextLose = parseInt(self.curBalance) - parseInt(self.lose);
self.session_lose = 0;
self.total_lose = 0;
self.total_win = 0;
scriptStop = true;
self.run();
return;
}
//self.log('');
self.delay(0);
},
error: function(){
self.delay(0);
}
});
},
delay: function(addt){
var self = this;
window.setTimeout( function(){
self.run();
}, ( Math.round(Math.random() * (self.timeDelay * 1000) )+(self.timeDelay * 1000) ) + addt );
},
log: function(txt){
console.log(txt);
},
runTimer: function(){
var self = this;
if( scriptStop )
return;
$('#plip-elapsedtime').text( remaining.getString(-remaining.getSeconds(self.curSessionTime), null, false) + ' ago' );
window.setTimeout(function(){
self.runTimer();
},1000);
},
getBetAmount: function(lastBet, nextBet){
var self = this,
multipleBet = parseInt(lastBet * self.multiple) + nextBet,
resMultipleBet = parseInt( multipleBet * 1.97 ),
selisih = (resMultipleBet - lastBet) - multipleBet;
if( selisih >= lastBet ){
return multipleBet;
}else{
return self.getBetAmount(lastBet, nextBet+1);
}
}
};
function run_game(){
return plip.init();
}
if (window.addEventListener) {
// Standard
window.addEventListener('load', run_game, false);
}
else if (window.attachEvent) {
// Microsoft
window.attachEvent('onload', run_game);
}
Bookmarks