// ==UserScript==
// @name Novicane - SPNATI Cheat
// @namespace https://www.github.com/anonfoxer
// @version 0.1.0
// @description Collection of cheats for the browser game SPNATI, put into a large userscript for ease of use
// @author anonfoxer
// @match https://spnati.net/
// @grant none
// ==/UserScript==
/* Making the buttons and appending them all
just underneath the name bubble of each character.
Kinda roundabout but eh. */
//cheat name button because flair is important.
var cheatNameDummy = document.createElement("button");
cheatNameDummy.innerHTML = "Novicane v0.1.0";
var gameVers = document.getElementById("title-version-button");
gameVers.appendChild(cheatNameDummy);
//Goal is to have these become instant lose buttons rather than just the loss of a hand, so the game can be played quicker. Same is to eventually happen to the Win Hand button.
/*
var playerOneLoseButton = document.createElement("button");
playerOneLoseButton.innerHTML = "Lose Hand";
var playerOneBubbble = document.getElementById("game-bubble-1");
playerOneBubbble.appendChild(playerOneLoseButton);
var playerTwoLoseButton = document.createElement("button");
playerTwoLoseButton.innerHTML = "Lose Hand";
var playerTwoBubble = document.getElementById("game-bubble-2");
playerTwoBubble.appendChild(playerTwoLoseButton);
var playerThreeLoseButton = document.createElement("button");
playerThreeLoseButton.innerHTML = "Lose Hand";
var playerThreeBubble = document.getElementById("game-bubble-3");
playerThreeBubble.appendChild(playerThreeLoseButton);
var playerFourLoseButton = document.createElement("button");
playerFourLoseButton.innerHTML = "Lose Hand";
var playerFourBubble = document.getElementById("game-bubble-4");
playerFourBubble.appendChild(playerFourLoseButton);
*/
var enableDebugButton = document.createElement("button");
enableDebugButton.innerHTML = "Enable Debug mode";
var body = document.getElementById("player-name-label-minimal");
document.body.appendChild(enableDebugButton);
//win hand button
var winHandButton = document.createElement("button");
winHandButton.innerHTML = "Win Hand";
document.body.appendChild(winHandButton);
//debug Listener
enableDebugButton.addEventListener ("click", function() {
try{
console.log("Attempting to enable debug mode...")
DEBUG = true;
updateDebugState(true);
console.log("Debug mode enabled.");
}
catch (e) {
console.log("An error occured when trying to enable debug mode: " + e);
alert("Failed to enable debug mode. Check console for details!");
}
});
//win hand listener
winHandButton.addEventListener ("click", function() {
players[0].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(0 - 1, n); });
});
/*
function loseHand(player){
console.log("Button clicked");
players.forEach(function(p, i) {
if (i == player) {
players[i].hand.cards = [ 7, 5, 4, 3, 2 ].map(function(n, i) { return new Card(i - 1, n); });
console.log(i + 'win');
} else {
players[i].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(i - 1, n); });
console.log(i + 'lose');
};
});
};
*/
//each player Lose listener. These will ideally be cleaned up later.
//p1
/*
playerOneLoseButton.addEventListener ("click", () => {
console.log("Player 1 will lose this hand.");
players.forEach(function(p, i) {
if (i == 1) {
players[i].hand.cards = [ 7, 5, 4, 3, 2 ].map(function(n, i) { return new Card(i - 1, n); });
console.log(i + 'lose');
} else {
players[i].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(i - 1, n); });
console.log(i + 'win');
};
});
});
//p2
playerTwoLoseButton.addEventListener ("click", () => {
console.log("Player 2 will lose this hand.");
players.forEach(function(p, i) {
if (i == 2) {
players[i].hand.cards = [ 7, 5, 4, 3, 2 ].map(function(n, i) { return new Card(i - 1, n); });
console.log(i + 'lose');
} else {
players[i].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(i - 1, n); });
console.log(i + 'win');
};
});
});
//p3
playerThreeLoseButton.addEventListener ("click", () => {
console.log("Player 3 will lose this hand.");
players.forEach(function(p, i) {
if (i == 3) {
players[i].hand.cards = [ 7, 5, 4, 3, 2 ].map(function(n, i) { return new Card(i - 1, n); });
console.log(i + 'lose');
} else {
players[i].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(i - 1, n); });
console.log(i + 'win');
};
});
});
//p4
playerFourLoseButton.addEventListener ("click", () => {
console.log("Player 4 will lose this hand.");
players.forEach(function(p, i) {
if (i == 4) {
players[i].hand.cards = [ 7, 5, 4, 3, 2 ].map(function(n, i) { return new Card(i - 1, n); });
console.log(i + 'lose');
} else {
players[i].hand.cards = [ 14, 13, 12, 11, 10 ].map(function(n) { return new Card(i - 1, n); });
console.log(i + 'win');
};
});
}); */