-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSGOEmpire
More file actions
174 lines (153 loc) · 7.12 KB
/
CSGOEmpire
File metadata and controls
174 lines (153 loc) · 7.12 KB
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
let stepToPerform = 0; // Initial step
let token = 0; // Token for betting logic
let startBet = 0.05; // Sets the startbet
let lastBet = startBet; // Keeps track of the last bet amount
let activeBet = false; // Track if a bet is active
let doubleCount = 0; // Tracks how many times the bet has been doubled
let lastButtonClicked = null; // Keeps track of the last button that was clicked
let lastOutcome = null; // Stores the outcome of the last round
let hasPerformedSteps = false; // Flag to indicate if steps have been performed
let streakCT = 0; // Track the consecutive count of CT
let streakT = 0; // Track the consecutive count of T
let betPlacedInCurrentRound = false; // Track if a bet was placed this round
let roundProcessed = false; // Flag to ensure betting happens once per round
// Main function to control the betting steps
function performBettingSteps() {
// Get the countdown element
const spinningWheelCountdown = document.querySelector('.text-2xl.font-bold.font-numeric');
// Check if the countdown element is available and retrieve its value
if (spinningWheelCountdown) {
const countdownValue = parseFloat(spinningWheelCountdown.textContent.replace(',', '.'));
// When countdown goes below 6.00, execute step 0 and move to step 1
if (countdownValue < 6.00 && stepToPerform === 0 && !roundProcessed) {
console.log("Step 0 - Countdown below 6, preparing for betting phase");
stepToPerform = 1; // Proceed to check if betting should occur
}
// Step 1 - Check if it should bet
if (countdownValue < 6.00 && stepToPerform === 1 && !betPlacedInCurrentRound) {
console.log("Step 1 - Checking if it should bet");
const token2 = CheckIfIShouldBet();
// If there is a betting opportunity
if (token2 > 0) {
token = token2;
stepToPerform = 3; // Proceed to Step 3 to place a bet
} else {
console.log("Step 2 - No betting opportunity, resetting for next round.");
stepToPerform = 0; // Reset for the next round
roundProcessed = true; // Mark the round as processed to prevent repeated checks
}
}
// Step 3 - Place bet immediately if allowed
if (countdownValue < 6.00 && stepToPerform === 3 && !betPlacedInCurrentRound) {
console.log("Step 3 - Placing the bet");
PlaceBet();
betPlacedInCurrentRound = true; // Mark that a bet was placed this round
activeBet = true;
stepToPerform = 4; // Prepare to check results after the next round
roundProcessed = true; // Mark the round as processed
}
// Step 4 - Check the result of the bet when countdown is past 14.00
if (countdownValue > 14.00 && activeBet && stepToPerform === 4) {
console.log("Step 4 - Checking last round's result");
const lastOutcome = CheckLastResult();
if (lastButtonClicked && lastOutcome === lastButtonClicked) {
console.log("Bet won! Resetting bet amount.");
ResetBetAfterWin();
streakCT = 0;
streakT = 0;
} else {
console.log("Bet lost! Doubling the bet amount.");
DoubleBetAmount();
}
activeBet = false;
betPlacedInCurrentRound = false; // Reset for the next round
stepToPerform = 0; // Reset for the next betting opportunity
}
// Check if the round has passed and reset roundProcessed when countdown is above 14.00
if (countdownValue > 14.00 && roundProcessed) {
console.log("Resetting roundProcessed for the new round.");
roundProcessed = false; // Ready for the next round to process
}
}
// Check countdown and betting steps every second
setTimeout(performBettingSteps, 1000);
}
// Function to check if the bot should place a bet (returns a token)
function CheckIfIShouldBet() {
// Check the outcome of the last round
const lastOutcome = CheckLastResult();
// Update streaks based on the outcome
if (lastOutcome === "bet-button-ct") {
streakCT++;
streakT = 0; // Reset T streak if outcome is CT
} else if (lastOutcome === "bet-button-t") {
streakT++;
streakCT = 0; // Reset CT streak if outcome is T
} else if (lastOutcome === "bet-button-bonus") {
// If it's a bonus result, reset both streaks
console.log("Bonus outcome detected. Resetting both streaks.");
streakCT = 0;
streakT = 0;
}
// Print current streaks
console.log(`Current streak - CT: ${streakCT}, T: ${streakT}`);
// If there are two consecutive CT or T outcomes, place a bet on the opposite outcome
if (streakCT >= 3) {
console.log("Detected 3 consecutive CT outcomes. Placing bet on T.");
return 1; // Token for betting on "T"
} else if (streakT >= 3) {
console.log("Detected 3 consecutive T outcomes. Placing bet on CT.");
return 2; // Token for betting on "CT"
}
// Return 0 if no bet should be placed (never bet on Bonus)
return 0;
}
// Function to place a bet
function PlaceBet() {
let buttonToClick = null;
if (token === 1) {
buttonToClick = document.querySelector('[data-testid="bet-button-t"]');
} else if (token === 2) {
buttonToClick = document.querySelector('[data-testid="bet-button-ct"]');
}
if (buttonToClick && !buttonToClick.classList.contains('bet-btn--disabled')) {
buttonToClick.click();
lastButtonClicked = buttonToClick.getAttribute('data-testid'); // Track which button was clicked
console.log('Bet placed on: ' + lastButtonClicked);
}
}
// Function to check the outcome of the last round
function CheckLastResult() {
const latestNumber = document.getElementsByClassName('flex relative h-24')[0].children[9].innerHTML;
if (latestNumber.includes("coin-bonus")) {
return "bet-button-bonus";
} else if (latestNumber.includes("coin-t")) {
return "bet-button-t";
} else if (latestNumber.includes("coin-ct")) {
return "bet-button-ct";
}
return null;
}
// Function to double the bet amount after a loss
function DoubleBetAmount() {
const doubleBetButton = document.querySelector('[data-testid="roulette-bet-input-x2"]');
if (doubleBetButton) {
doubleBetButton.click();
doubleCount++;
console.log('Bet doubled');
}
}
// Function to reset the bet after a win
function ResetBetAfterWin() {
for (let i = 0; i < doubleCount; i++) {
const halfBetButton = document.querySelector('[data-testid="roulette-bet-input-1/2"]');
if (halfBetButton) {
halfBetButton.click();
console.log('Bet reset');
}
}
doubleCount = 0; // Reset the double count after the bet is reset
lastBet = startBet; // Reset the bet amount
}
// Start the betting process
performBettingSteps();