From 7cb21e8d6d8d17d130543b2bea82341888867232 Mon Sep 17 00:00:00 2001 From: amelia Date: Thu, 23 Jun 2022 18:25:56 -0500 Subject: scheduled (not really) update --- index.html | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'index.html') diff --git a/index.html b/index.html index cdd6ad9..0457f47 100644 --- a/index.html +++ b/index.html @@ -174,7 +174,7 @@ transform:scale(0.7); } else { craft+="dirty" } - let ne = {"color": hex, "rarity": craft + "\(crafted)\", "value": v} + let ne = {"color": hex, "rarity": craft + "\(crafted)\", "value": v, "att":r,"def":g,"spd":b,"level":0,"xp":0} //if(data!=index && inv[data].color != inv[data].color){ var inv = getCookie('inv'); @@ -291,27 +291,51 @@ transform:scale(0.7); x[0].hidden = !x[0].hidden } - async function fight() { + function randomColor() { + var letters = '0123456789ABCDEF'; + var color = '#'; + for (var i = 0; i < 6; i++) { + color += letters[Math.floor(Math.random() * 16)]; + } + return ({ + color: color, + att: hexToRgb(color).r, + def: hexToRgb(color).g, + spd: hexToRgb(color).b + }) + } + function fight() { var inv = getCookie('inv'); inv = JSON.parse(inv) var storage = getCookie('storage'); storage = JSON.parse(storage) let team = [inv[0], inv[1], inv[2], inv[3], inv[4]] - let opp = [roll(0,true), roll(0,true), roll(0,true), roll(0,true), roll(0,true)] - - + let opp = [randomColor(), randomColor(), randomColor(), randomColor(), randomColor()] + document.write("
") + let po = 75 + let le = 40 + for(let t of team){ + document.write("
") + po+=90 + le+= 15 + } + po = 75 + le = 600 + for(let t of opp){ + document.write("
") + po+=90 + le+= 15 + } + document.write("
") } - function roll(item, opp=false) { + function roll(item) { fetch(file) .then(response => { return response.json(); }) .then(data => { - if(!opp){ var bank = getCookie('bank'); - } else { - var bank = 999999999999999999 - } + var inv = getCookie('inv'); var arr = JSON.parse(inv); if (data.crates[item].price <= bank) { @@ -331,15 +355,20 @@ transform:scale(0.7); } x.style.background = (data.crates[item].contents[select].color) - if(!opp){ + createCookie('bank', bank - data.crates[item].price); console.log(chance) data.crates[item].contents[select]['storage'] = false data.crates[item].contents[select]['s'] = shiny + data.crates[item].contents[select]['att'] = hexToRgb(data.crates[item].contents[select].color).r + data.crates[item].contents[select]['def'] = hexToRgb(data.crates[item].contents[select].color).g + data.crates[item].contents[select]['spd'] = hexToRgb(data.crates[item].contents[select].color).b + data.crates[item].contents[select]['level'] = 0 + data.crates[item].contents[select]['xp'] = 0 arr.push(data.crates[item].contents[select]) createCookie('inv', JSON.stringify(arr)); - } + setTimeout(function () {document.getElementById("popup").style.display = "none";}, 500); -- cgit v1.2.3