forked from SliverTVBotDEVs/SliverTV-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sliverBotLite.js
279 lines (243 loc) · 8.25 KB
/
sliverBotLite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
// ==UserScript==
// @name Sliver-Bot by NickPablo
// @namespace http://NickPablo.de/
// @version 0.1.0
// @description Sliver.tv Bot
// @author NickPablo
// @include https://www.sliver.tv/win/fortnite
// @include https://www.sliver.tv/win/pubg
// @include https://www.sliver.tv/win/lol
// @include https://www.sliver.tv/win/csgo
// @include https://www.sliver.tv/win/hearthstone
// @include https://www.sliver.tv/win/sliverspotlight
// @include https://www.sliver.tv/win/theta
// @include https://www.sliver.tv/win/wow
// @include https://www.sliver.tv/win/cod
// @include https://www.sliver.tv/account/inventory
// @match https://www.sliver.tv/win/fortnite
// @match https://www.sliver.tv/win/pubg
// @match https://www.sliver.tv/win/lol
// @match https://www.sliver.tv/win/csgo
// @match https://www.sliver.tv/win/hearthstone
// @match https://www.sliver.tv/win/sliverspotlight
// @match https://www.sliver.tv/win/theta
// @match https://www.sliver.tv/win/wow
// @match https://www.sliver.tv/win/cod
// @match https://www.sliver.tv/account/inventory
// @grant none
// ==/UserScript==
(function() {
////////////////////////////////////////////////////////////////////////////
// Settings
//
var ClaimAllInvCoins = false; // ---
var OpenAllInvCrates = false; // (Only on https://www.sliver.tv/account/inventory)
var WatchAndWinBet = false; // (Only A in donator A-B and Random)
//
//////////////////////////////////////////////////////////////////////////////
var contentPanel = getEBCN('content-panel')[0];
var miniGamePanel = getEBCN('mini-game-panel')[0];
var rafflePrizes = getEBCN('prize-container');
var fixedWallet = getEBCN('fixed-wallet')[0];
var betCards = getEBCN('waw-prediction-card');
var raffleContainer = getEBCN('grand-raffle-container');
var chatContainer = getEBCN('footer-content-container');
var open = getEBCN('action-button');
var openCrate = getEBCN('open-crate-button');
var cont = getEBCN('continue-button');
function getEBCN(className)
{
return document.getElementsByClassName(className);
}
function getBetTitle(betCard)
{
return getCards()[betCard].firstChild.innerHTML;
}
function getBetSelectedS(betCard)
{
return getCards()[betCard].children[1].children[0].children[0].children[0].innerHTML;
}
function getBetSelectedL(betCard)
{
return getCards()[betCard].children[1].children[0].children[1].innerHTML;
}
function getAnswer(betCard, ans)
{
return getCards()[betCard].children[1].children[0].children[ans];
}
function getCards()
{
return getEBCN('waw-prediction-card');
}
function getRaffleContainer()
{
return getEBCN('grand-raffle-container');
}
//###########################################
function isPlaced(betCard)
{
return getCards()[betCard].children[1].children[0].classList.contains("waw-prediction-choice--selected");
}
function isWon(betCard)
{
return getCards()[betCard].children[1].children[0].classList.contains("waw-user-result-message__win");
}
function isFail(betCard)
{
return getCards()[betCard].children[1].children[0].classList.contains("waw-user-result-message__lose");
}
function isRafflePlaced(conId,raffleID,pos)
{
return getRaffleContainer()[conId].children[pos].children[raffleID].children[2].classList.contains("grand-raffle-action--is-completed");
}
function isOnlyUSRaffle(raffleID)
{
var isUsRaffle = false;
if(getRaffleContainer()[raffleID].children[1].innerHTML.includes("(US)")) {
isUsRaffle = true;
}
if (!takeUsRaffle) {
isUsRaffle = false;
}
return isUsRaffle;
}
function whatIsSelected(betCard)
{
var selected = "none";
var sel = false;
if (isWon(betCard) == true && isFail(betCard) == true) {
selected = "winfail";
sel = true;
}
if(isPlaced(betCard))
{
selected = "selected";
sel = true;
}
if (sel)
{
return parseInt(selected);
}
else
{
return selected;
}
}
//###########################################
function print()
{
for (let i = 0; i < getCards().length; i++)
{
console.log("--------- " + getBetTitle(i));
if (whatIsSelected(i) == "none")
{
console.log("--- Keine selected");
}
else if (whatIsSelected(i) == "winfail") {
console.log("--- Gewonnen oder Fail");
}
else
{
console.log("-- Your answer: " + getBetSelectedS(i) + " (" + getBetSelectedL(i) + ")");
}
console.log('\n');
}
}
function betCardsOne(opt)
{
var option = -1;
var optionArray = Array(0,1);
switch (opt)
{
case "A":
option = 0;
break;
case "B":
option = 0;
break;
case "Y":
option = 0;
break;
default:
option = 0;
}
for (let i = 0; i < getCards().length; i++)
{
if (option == 2) {
option = optionArray[Math.floor(Math.random()*optionArray.length)];
}
if (isWon(i) == false && isFail(i) == false) {
if (!isPlaced(i)) {
if (getCards()[i].children[1].children.length < 2) {
console.log("#--# Bei " + getBetTitle(i) + " gibt es nur A! #--#");
option = 0;
}
getCards()[i].children[1].children[option].children[1].click();
console.log("#--# Alle Wetten gesetzt #--# Antwort:" + String(option));
}
}
}
}
function style()
{
contentPanel.innerHTML = "";
fixedWallet.innerHTML = "";
miniGamePanel.style.flexBasis = "100%";
for (let i = 0; i < betCards.length; i++)
{
centerize(betCards[i]);
}
for (let i = 0; i < rafflePrizes.length; i++)
{
centerize(rafflePrizes[i]);
}
}
function centerize(array)
{
array.classList.add("center");
}
function openCratesFromInv()
{
var crateInterval = setInterval(function()
{
if (getEBCN('continue-button').length == 0 && getEBCN('crate-inventory-type').length > 0)
{
for (let i = 0 ; i < getEBCN('crate-inventory-type').length; i++)
{
getEBCN('crate-inventory-type')[0].children[4].click();
setTimeout(function() {getEBCN('open-crate-button')[0].click();}, 3000);
setTimeout(function() {getEBCN('continue-button')[0].click();}, 18000);
}
}
else
{
clearInterval(crateInterval);
}
}, 25000);
}
function claimAllCoins()
{
var length = getEBCN('coins-inventory-type').length;
for(let i = 0; i < length; i++)
{
setTimeout(function()
{
getEBCN('coins-inventory-type')[i].children[4].children[0].click();
}, 3000);
}
console.log(length + " coin(s) opened.");
}
setInterval(function()
{
if (ClaimAllInvCoins) {
claimAllCoins();
}
if (OpenAllInvCrates) {
openCratesFromInv();
}
if (WatchAndWinBet) {
betCardsOne("A");
}
}, 2000);
//##########################################################################
})();