HouseofForbiddenShadow
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Coven Forum
 
HomeLatest imagesSearchRegisterLog in

 

 Gambat's House

Go down 
2 posters
AuthorMessage
Aleyia
Lady of the House
Lady of the House
Aleyia


Posts : 166
Join date : 2009-08-31

Gambat's House Empty
PostSubject: Gambat's House   Gambat's House I_icon_minitimeTue Nov 10, 2009 9:29 am

Difficulty: Easy (might take a while) ~~~ Prize: ??

-Start Quest

-Win 3x In A Row On Roulette
*You Can Use Any Number To Do This Quest*
Back to top Go down
https://hofscoven.forumotion.com
shhac
Circle Ancient
Circle Ancient
shhac


Posts : 17
Join date : 2009-11-10

Gambat's House Empty
PostSubject: Re: Gambat's House   Gambat's House I_icon_minitimeTue Nov 10, 2009 1:12 pm

Automagic way:
Start the quest then go to the roulette table and inject the following javascript code (via firebug or something).
Warning: It will not stop till you either win or are out of money, and chance of winning 3x in a row is (1/10)^3 = 1/1000 so have around $5,000 in your hand so you don't lose everything in a worst case scenario (of you never winning in 1k attempts).
Code:
/*
Basic Ajax Framework by Shhac, 19/06/2009.

Example usage:
loadData('http://google.com', function(idx){alert(XHRArray[idx].responseText);});
OR
loadData('http://google.com', function(idx){alert(XHRArray[idx].responseText);},'searchstring=blahblah');

Optional:
overload the function "XHRError" with 3 arguements (idx, statusCode, statusText)
*/

var XHRArray  = [], // This will hold the actual XMLHttpObjs.
    XHRState  = [], // This will hold 0 = null, 1 = in use, 2 = finished.
    XHRActions = []; // This will hold functions to be called when finished.

function getXMLHttpObj(){
   if(window.XMLHttpRequest){
      return new XMLHttpRequest();
   }else if(window.ActiveXObject){
    return new ActiveXObject('Microsoft.XMLHTTP');
  }else{
    alert('Your browser does not support XMLhttpObjects.');
    return null;
  }
}

function flushXHRs(){
  for(i=0;i<XHRState.length;i++){
    XHRState[i] = null;
  }
  for(i=0;i<XHRArray.length;i++){
    XHRArray[i] = null;
  }
  for(i=0;i<XHRActions.length;i++){
    XHRActions[i] = null;
  }
  XHRState = [];
  XHRArray = [];
  XHRActions = [];
}

function clearXHR(idx){
  XHRState[idx] = 0;
  XHRArray[idx] = null;
  XHRActions[idx] = null;
}

function clearFinishedXHRs(){
  if((XHRArray.length == XHRState.length) && (XHRState.length == XHRActions.length)){
    for(i=0;i<XHRState.length;i++){
      if(XHRState[i]==2){
        XHRState[i] = 0;
        XHRArray[i] = null;
        XHRActions[i] = null;
      }
    }
  }else{
    alert('(XHRArray.length == XHRState.length) &&\n(XHRState.length == XHRActions.length)\nis false');
  }
}

function newXHR(){
  if((XHRArray.length == XHRState.length) && (XHRState.length == XHRActions.length)){
    for(i=0;i<XHRState.length;i++){
      if(XHRState[i]===0){
        XHRState[i] = 1;
        XHRArray[i] = getXMLHttpObj();
        XHRActions[i] = null;
        return i;
      }
    }
    var idx = XHRState.length;
    XHRState[idx] = 1;
    XHRArray[idx] = getXMLHttpObj();
    XHRActions[idx] = null;
    return idx;
  }else{
    alert('(XHRArray.length == XHRState.length) &&\n(XHRState.length == XHRActions.length)\nis false');
  }
}

function XHRError(idx, statusCode, statusText){
  alert("Error - Status: " + statusCode + " " + statusText);
}

function XHRStateChange(idx) {
  if(XHRArray[idx].readyState == 4){
    XHRState[idx] = 2;
    if(XHRArray[idx].status == 200){
      XHRActions[idx](idx);
      clearXHR(idx);
      return true;
    }else{
      XHRError(idx, XHRArray[idx].status, XHRArray[idx].statusText);
      clearXHR(idx);
      return false;
    }
  }
}

function getUrl(url){
  var idx = newXHR();
  XHRArray[idx].onreadystatechange = function(){XHRStateChange(idx);};
  XHRArray[idx].open('GET',url,true);
  XHRArray[idx].send(null);
  return idx;
}

function postUrl(url, postdata){
  var idx = newXHR();
  XHRArray[idx].onreadystatechange = function(){XHRStateChange(idx);};
  XHRArray[idx].open('POST',url,true);
  XHRArray[idx].setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  XHRArray[idx].setRequestHeader('Content-length', postdata.length);
  XHRArray[idx].send(postdata);
  return idx;
}

function loadData(url, onCompleteFunction, postData){
  if(typeof(onCompleteFunction)=='function' && onCompleteFunction.length == 1){
    if(typeof(postData)=='undefined'){
      XHRActions[getUrl(url)] = onCompleteFunction;
    }else{
      XHRActions[postUrl(url, postData)] = onCompleteFunction;
    }
  }else{
    alert('onCompleteFunction should have one arguement, namely idx.\nIt should refer to the XMLhttpObj as XHRArray[idx].');
  }
}

//-------MISSION START-------------------------------------
var wins_in_row = 0,
    getter = 'arcade.php?step=p1&n=',
    a = 0;

function look(txt, num){
  var l = txt.indexOf('Money:</b>') + 28,
      money = txt.substring(l, txt.indexOf('<', l));
  if(txt.indexOf('Congrats. You won $')!=-1){
    wins_in_row++;
  }else{
    wins_in_row = 0;
  }
  document.body.innerHTML = 'Attempt: ' + ++a + '<br>Money: ' + money + '<br>Current Guess: ' + num + '<br>Wins in a row: ' + wins_in_row;
  if(wins_in_row == 3){
    document.body.innerHTML += '<br>FINISHED';
  }else if(money == '0'){
    document.body.innerHTML += '<br>ERROR - No More Cash!';
  }else{
    setTimeout(get,500);
  }
}

function get(){
  var num = Math.floor(Math.random()*10) + 1;
  loadData(getter + num, function(idx){look(XHRArray[idx].responseText, num);})
}

get(0);
Back to top Go down
 
Gambat's House
Back to top 
Page 1 of 1
 Similar topics
-
» Puzzler's House

Permissions in this forum:You cannot reply to topics in this forum
HouseofForbiddenShadow :: Quest List 2-
Jump to: