1STdewGmztvThailand

Untitled

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