Roblox Tix Trader


SUBMITTED BY: Zeldamaster501

DATE: April 3, 2016, 5:11 a.m.

FORMAT: Text only

SIZE: 11.1 kB

HITS: 8534

  1. /* Buttons */ // (DELETE THIS ONCE U USE) AND THE //, Instructions: scroll down to Trading_robux and trading_tix make that the number of tix and robux u have.
  2. var start_trade_class = "TradeCurrencyModalBtn";
  3. var cancel_trade_class = "btn-negative";
  4. /* Input */
  5. var limit_order_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_LimitOrderRadioButton";
  6. var give_currency_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_HaveCurrencyDropDownList";
  7. var receive_currency_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_WantCurrencyDropDownList";
  8. var give_box_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_HaveAmountTextBoxRestyle";
  9. var receive_box_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_WantAmountTextBox";
  10. var submit_trade_id = "ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_SubmitTradeButton";
  11. /* Info */
  12. var quote_panel_class = "CurrencyQuote";
  13. var my_robux = "RobuxAlertCaption";
  14. var my_tix = "TicketsAlertCaption";
  15. /* History */ // Dp not touch these values. Or anything for that matter. Go away
  16. var Previous_Tix_Traded = 0;
  17. var Previous_Robux_Traded = 0;
  18. var Current_Tix_Gained = 0; // "Current" variables are the ones that hold the values of the maximum to trade. They will not trade more money than you have gained.
  19. var Current_Robux_Gained = 0;
  20. var Trading_Robux = 0; // CHANGE NUMBER TO THE NUMBER OF ROBUX YOU CURRENTLY HAVE/ARE WILLING TO USE
  21. var Trading_Tix = 60;
  22. var Previous_Bux_Rate = 0;
  23. var Previous_Tix_Rate = 0;
  24. var Current_Trading = "bux" // We start trading bux first
  25. var InTrade = 0;
  26. var Loading = 0;
  27. var total_profit = 0;
  28. var pending_profit = 0;
  29. /* others */
  30. var framedoc;
  31. var tcinterval;
  32. var currenttrading_element;
  33. var expecting_element;
  34. var giving_element;
  35. var totalprofit_element;
  36. // Multiply R$ by the right
  37. // Divide TIX by the left
  38. // Round only final value
  39. function FetchExternalData(){
  40. var d = "";
  41. $.get("http://www.roblox.com/My/Money.aspx#/#TradeCurrency_tab", function(data){
  42. d = data;
  43. //console.log( $("#" + my_robux, data).text() );
  44. });
  45. return d;
  46. }
  47. /*
  48. function getPos(ele){
  49. var x=0;
  50. var y=0;
  51. while(true){
  52. x += ele.offsetLeft;
  53. y += ele.offsetTop;
  54. if(ele.offsetParent === null){
  55. break;
  56. }
  57. ele = ele.offsetParent;
  58. }
  59. return [x, y];
  60. }
  61. console.log( getPos( document.getElementById("frame1").contentDocument.getElementById("ctl00_ctl00_cphRoblox_cphMyRobloxContent_ctl00_SubmitTradeButton") ))*/
  62. function GetBuxRate(Rates){ // What to multiply bux by
  63. var tes = Rates.match(/(.*)\/(.*)/);
  64. return tes[2];
  65. }
  66. function GetTixRate(Rates){ // What to divide tix by
  67. var tes = Rates.match(/(.*)\/(.*)/);
  68. return tes[1];
  69. }
  70. function GetSpread(){ // Get spread
  71. var Spread = framedoc.getElementsByClassName("column")[0].childNodes[5]
  72. console.log(Spread);
  73. return Spread.innerHTML;
  74. }
  75. function Click(String, isClass, d){
  76. if (isClass == true){
  77. $("." + String, d)[0].click();
  78. }else{
  79. $("#" + String, d).click()
  80. }
  81. }
  82. function OpenTradeWindow(d){
  83. Click(start_trade_class, true, d);
  84. Click(limit_order_id, false, d);
  85. }
  86. function SetTradeTo(currency, d){
  87. if (currency === "tix"){
  88. $("#" + give_currency_id, d).val("Tickets");
  89. $("#" + receive_currency_id, d).val("Robux");
  90. }else if(currency === "bux"){
  91. $("#" + give_currency_id, d).val("Robux");
  92. $("#" + receive_currency_id, d).val("Tickets");
  93. }
  94. }
  95. function MakeIFrame(){
  96. var f = document.createElement("iframe");
  97. f.width = window.innerWidth;
  98. f.height = 350
  99. f.style.position = "absolute"
  100. f.style.top = "0px";
  101. f.style.left = "0px";
  102. f.style.zIndex = 100001;
  103. f.setAttribute("src", "http://www.roblox.com/My/Money.aspx#/#TradeCurrency_tab");
  104. f.id = "frame1";
  105. document.body.outerHTML = "";
  106. document.body.appendChild(f);
  107. currenttrading_element = document.createElement("span");
  108. currenttrading_element.style.display = "block";
  109. currenttrading_element.style.width = "400px"
  110. currenttrading_element.style.backgroundColor = "rgb(200,200,200)";
  111. currenttrading_element.style.position = "absolute";
  112. currenttrading_element.style.top = "360px";
  113. currenttrading_element.style.left = "10px";
  114. currenttrading_element.style.fontSize = "25px";
  115. currenttrading_element.style.textAlign = "center";
  116. currenttrading_element.style.borderRadius = "5px";
  117. currenttrading_element.innerHTML = "Currently exchanging: R$";
  118. document.body.appendChild(currenttrading_element);
  119. giving_element = document.createElement("span");
  120. giving_element.style.display = "block";
  121. giving_element.style.borderRadius = "5px";
  122. giving_element.style.width = "400px"
  123. giving_element.style.backgroundColor = "rgb(200,200,200)";
  124. giving_element.style.position = "absolute";
  125. giving_element.style.top = "400px";
  126. giving_element.style.left = "10px";
  127. giving_element.style.fontSize = "25px";
  128. giving_element.style.textAlign = "center";
  129. document.body.appendChild(giving_element);
  130. expected_element = document.createElement("span");
  131. expected_element.style.display = "block";
  132. expected_element.style.borderRadius = "5px";
  133. expected_element.style.width = "400px"
  134. expected_element.style.backgroundColor = "rgb(200,200,200)";
  135. expected_element.style.position = "absolute";
  136. expected_element.style.top = "440px";
  137. expected_element.style.left = "10px";
  138. expected_element.style.fontSize = "25px";
  139. expected_element.style.textAlign = "center";
  140. document.body.appendChild(expected_element);
  141. totalprofit_element = document.createElement("span");
  142. totalprofit_element.style.display = "block";
  143. totalprofit_element.style.borderRadius = "5px";
  144. totalprofit_element.style.width = "400px"
  145. totalprofit_element.style.backgroundColor = "rgb(200,200,200)";
  146. totalprofit_element.style.position = "absolute";
  147. totalprofit_element.style.top = "360px";
  148. totalprofit_element.style.right = "10px";
  149. totalprofit_element.style.fontSize = "25px";
  150. totalprofit_element.style.textAlign = "center";
  151. totalprofit_element.innerHTML = "Total Profit: 0 R$";
  152. document.body.appendChild(totalprofit_element);
  153. }
  154. function simulatedClick(target, options) {
  155. var event = target.ownerDocument.createEvent('MouseEvents'),
  156. options = options || {};
  157. //Set your default options to the right of ||
  158. var opts = {
  159. type: options.type || 'click',
  160. canBubble:options.canBubble || true,
  161. cancelable:options.cancelable || true,
  162. view:options.view || target.ownerDocument.defaultView,
  163. detail:options.detail || 1,
  164. screenX:options.screenX || 0, //The coordinates within the entire page
  165. screenY:options.screenY || 0,
  166. clientX:options.clientX || 0, //The coordinates within the viewport
  167. clientY:options.clientY || 0,
  168. ctrlKey:options.ctrlKey || false,
  169. altKey:options.altKey || false,
  170. shiftKey:options.shiftKey || false,
  171. metaKey:options.metaKey || false, //I *think* 'meta' is 'Cmd/Apple' on Mac, and 'Windows key' on Win. Not sure, though!
  172. button:options.button || 0, //0 = left, 1 = middle, 2 = right
  173. relatedTarget:options.relatedTarget || null,
  174. }
  175. //Pass in the options
  176. event.initMouseEvent(
  177. opts.type,
  178. opts.canBubble,
  179. opts.cancelable,
  180. opts.view,
  181. opts.detail,
  182. opts.screenX,
  183. opts.screenY,
  184. opts.clientX,
  185. opts.clientY,
  186. opts.ctrlKey,
  187. opts.altKey,
  188. opts.shiftKey,
  189. opts.metaKey,
  190. opts.button,
  191. opts.relatedTarget
  192. );
  193. //Fire the event
  194. target.dispatchEvent(event);
  195. }
  196. MakeIFrame();
  197. console.log("Giving 5 seconds for page to load.");
  198. setTimeout(function(){
  199. tcinterval = setInterval(function(){
  200. $d = $("#frame1").contents()
  201. console.log("===================== NEW TRANSACTION ======================");
  202. if ((InTrade == 0) && (Loading == 0) && ($("." + start_trade_class, $d)[0]) ){
  203. Loading = 1;
  204. $.get("http://www.roblox.com/My/Money.aspx#/#TradeCurrency_tab", function(data){
  205. Loading = 0;
  206. $my_robux = $("#" + my_robux, data).text();
  207. $my_tix = $("#" + my_tix, data).text();
  208. $tix_rate = Number(GetTixRate($("." + quote_panel_class, data)[0].childNodes[3].childNodes[2].innerHTML));
  209. $bux_rate = Number(GetBuxRate($("." + quote_panel_class, data)[0].childNodes[3].childNodes[2].innerHTML));
  210. $spread = Number($(".column", data)[0].childNodes[5].innerHTML);
  211. // check if any offers or bids are pending (bids = tix, offers = bux)
  212. $offers = $('.offer', data).length/2;
  213. $bids = $('.bid', data).length/2;
  214. $offerspending = $offers + $bids
  215. console.log( $offerspending + " offers pending.");
  216. if ( ($offerspending) < 1){
  217. total_profit = (total_profit + pending_profit);
  218. pending_profit = 0;
  219. totalprofit_element.innerHTML = "Total Profit: " + total_profit + " R$";
  220. $expected_bux = Math.round(Trading_Tix/$tix_rate);
  221. $bux_profit = ($expected_bux - Trading_Robux);
  222. $expected_tix = Math.round(Trading_Robux*$bux_rate);
  223. $tix_profit = ($expected_tix - Trading_Tix);
  224. console.log($tix_profit);
  225. if ((Math.abs($spread) < 550) && ($spread < 0) && ($bux_profit > 0) && (Current_Trading === "tix")){
  226. console.log("Profit to be made on TIX to R$: " + $spread + " - Rate: " + $tix_rate);
  227. InTrade = 1;
  228. console.log("Expected to profit " + $bux_profit + " R$ from this trade.");
  229. OpenTradeWindow($d);
  230. //SetTradeTo("tix", $d);
  231. $("#"+give_box_id, $d).val(Trading_Tix);
  232. $("#"+receive_box_id, $d).val($expected_bux);
  233. Trading_Robux = $expected_bux;
  234. Current_Trading = "bux"
  235. currenttrading_element.innerHTML = "Currently exchanging: R$";
  236. giving_element.innerHTML = "Gave: " + Trading_Tix + " TIX";
  237. expected_element.innerHTML = "Expecting: " + $expected_bux + " R$";
  238. pending_profit = $bux_profit;
  239. setTimeout(function(){
  240. simulatedClick( document.getElementById("frame1").contentDocument.getElementById(submit_trade_id) )
  241. //simulatedClick($("#"+submit_trade_id, $d));
  242. //$("#"+submit_trade_id, $d).trigger('click');
  243. InTrade = 0;
  244. }, 1500
  245. );
  246. }else if((Math.abs($spread) < 550) && ($bux_profit < 0) && (Current_Trading === "tix")){
  247. console.log("Will lose profit on TIX to R$. Not trading.");
  248. }else if ((Math.abs($spread) < 550) && ($spread > 0) && ($tix_profit > 20) && (Current_Trading === "bux")){
  249. console.log("Good spread to trade R$ to TIX: " + $spread + " - Rate: " + $bux_rate);
  250. InTrade = 1;
  251. console.log("Expected to profit " + $tix_profit + " TIX from this trade.");
  252. OpenTradeWindow($d);
  253. SetTradeTo("bux", $d);
  254. $("#"+give_box_id, $d).val(Trading_Robux);
  255. $("#"+receive_box_id, $d).val($expected_tix);
  256. Trading_Tix = $expected_tix;
  257. Current_Trading = "tix"
  258. currenttrading_element.innerHTML = "Currently exchanging: TIX";
  259. giving_element.innerHTML = "Gave: " + Trading_Robux + " R$";
  260. expected_element.innerHTML = "Expecting: " + $expected_tix + " TIX";
  261. setTimeout(function(){
  262. simulatedClick( document.getElementById("frame1").contentDocument.getElementById(submit_trade_id) )
  263. //simulatedClick($("#"+submit_trade_id, $d));
  264. //$("#"+submit_trade_id, $d).trigger('click');
  265. InTrade = 0;
  266. }, 1500
  267. );
  268. }else if ((Math.abs($spread) < 550) && ($tix_profit < 20) && (Current_Trading === "bux")){
  269. console.log("Will lose profit on R$ to TIX. Not trading.");
  270. }else{
  271. console.log("Bad spread. Not trading: " + $spread + " - Currently trying to exchange: " + Current_Trading);
  272. }
  273. }else{
  274. console.log("Waiting for current offer to finish...");
  275. }
  276. });
  277. }else{
  278. console.log("Currently in trade or loading page. Waiting...");
  279. }
  280. }, 5000);
  281. }, 1000);

comments powered by Disqus