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