Jump to content
AleksandarZ

[$800] PD Weekly Heroes Wk43

Recommended Posts

89.78

118,936,527,867 (https://primedice.com/?iid=house%3A118936527867&modal=bet)

89.76

118,936,552,872 (https://primedice.com/?iid=house%3A118936552872&modal=bet)

This one's easy enough to do with the browser, but why not use a script too? Either way, this challenge is quick and straightforward to hunt!

// ==========================================
// Copy from here...

let stopContinousBetting = false;

function placeBet(rollUntilStop, betVariables){
	let token = localStorage["session"].replaceAll("\"", "");
	let query = {
		"operationName":"PrimediceRoll",
		"variables": betVariables,
		"query":"mutation PrimediceRoll($amount: Float!, $target: Float!, $condition: CasinoGamePrimediceConditionEnum!, $currency: CurrencyEnum!) {\n  primediceRoll(amount: $amount, target: $target, condition: $condition, currency: $currency) {\n    ...CasinoBetFragment\n    state {\n      ...PrimediceStateFragment\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment CasinoBetFragment on CasinoBet {\n  id\n  active\n  payoutMultiplier\n  amountMultiplier\n  amount\n  payout\n  updatedAt\n  currency\n  game\n  user {\n    id\n    name\n    __typename\n  }\n  __typename\n}\n\nfragment PrimediceStateFragment on CasinoGamePrimedice {\n  result\n  target\n  condition\n  __typename\n}\n"
	};

	fetch("https://primedice.com/_api/graphql", {
		method: "POST",
		headers: {
			"x-access-token": token,
			"x-language": "en",
			"x-lockdown-token": "",
			"content-type": "application/json",
			"content-length": query.length
		}, 
		body: JSON.stringify(query)
	}).then(response => {
		if (response.ok){
			return response.json();
		}
		else{
			console.log("Request failed!", response);
		}
	}).then((jsonBody) => {
		if (jsonBody.data.primediceRoll){
			let roll = jsonBody.data.primediceRoll;
			let condition = roll.state.condition;
			let target = roll.state.target;
			let rollNumber = +roll.state.result.toFixed(2);
			let won = condition === "above"
				? rollNumber > target
				: rollNumber < target;

			console.log (
				won ? "Win" : "Loss",
				rollNumber);

			if (rollUntilStop && !shouldStopBetting(won, rollNumber)){
				placeBet(rollUntilStop, betVariables);
			}
		}
		else{
			console.log("No roll returned!", jsonBody);
		}
	});
}

function shouldStopBetting(won, rollNumber){
	if (stopContinousBetting){
		console.log("Betting manually stopped!");
		stopContinousBetting = false;
		return true;
	}

	if (won
		&& rollNumber >= 88.99
		&& rollNumber <= 89.99) {
		console.log("Stop condition met!");
		return true;
	}
	return false;
}

function stopBetting(){
	stopContinousBetting = true;
}

// ...To here.
// ==========================================


// Run this only after you've input the exact bet parameters you want
placeBet(
	true,
	{
		"currency":"ltc",
		"amount":0.00033570,
		"target":88.99,
		"condition":"above"
	});


// Run this if you want to interrupt betting
stopBetting();

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×