Commit e42820ac authored by Eric Schewe's avatar Eric Schewe
Browse files

Initial copy from https://phasmocalc.com/

parents
<html>
<head>
<title>Phasmophobia Calculator</title>
<meta name="description" content="Determines which ghosts are left, based on the evidence you've already found." />
<meta name="keywords" content="Phasmophobia, Ghost, Calculator, Calc" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html {background-color: black; color: white;}
@viewport
{
width: device-width;
zoom: 1.0;
}
@-ms-viewport
{
width: device-width;
}
body
{
background-color: black;
font-family: 'Arial';
font-size: 1em;
}
p
{
color: white;
font-family: 'Arial';
font-size: 1em;
clear: both;
}
button
{
background-color: Transparent;
color: White;
background-repeat:no-repeat;
cursor:pointer;
overflow: hidden;
outline:none;
font-family: 'Arial';
font-size: 1em;
margin-right: 0.25em;
margin-bottom: 0.25em;
}
table, tr, td
{
cellspacing: 0em;
cellpadding: 0em;
border: none;
}
.num
{
color: darkgray;
font-family: 'Arial';
font-size: 1em;
}
.name
{
color: darkgray;
font-family: 'Arial';
font-size: 0.75em;
}
.left
{
float: left;
}
.history
{
float: left;
margin-right: 0.25em;
padding-left: 0.25em;
padding-right: 0.25em;
border: 1px dotted darkgrey;
text-align: center;
}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-N04P1R3HHT"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-N04P1R3HHT');
</script>
<script>
var ghostArray =
[
["Spirit", 2, 4, 5],
["Wraith", 3, 4, 5],
["Phantom", 0, 1, 3],
["Poltergeist", 1, 4, 5],
["Banshee", 0, 3, 5],
["Jinn", 0, 1, 4],
["Mare", 1, 3, 4],
["Revenant", 0, 2, 5],
["Shade", 0, 1, 2],
["Demon", 2, 3, 4],
["Yurei", 1, 2, 3],
["Oni", 0, 2, 4]
];
var buttonArray =
[
[0, "EMF 5"], // 0
[0, "Ghost Orbs"], // 1
[0, "Ghost Writing"], // 2
[0, "Freezing Temps"], // 3
[0, "Spirit Box"], // 4
[0, "Finger Prints"] // 5
];
var ghostsLeft;
function buttonReset(id)
{
if (ghostsLeft.length == 1)
{
Evidence = "gf_" + ghostsLeft[0][0];
Evidence = Evidence.replace(" ", "_");
gtag('event', Evidence);
var num = getCookie(ghostsLeft[0][0]);
num++;
setCookie(ghostsLeft[0][0], num);
document.getElementById(ghostsLeft[0][0]).innerHTML = num;
}
for (i = 0; i < buttonArray.length; i++)
{
buttonArray[i][0] = 0;
document.getElementById(i).style.background='#000000';
}
document.getElementById("Ghosts").innerHTML = "<br/>Please click / tap an evidence above.<br/><br/>Black = Unknown<br/>Green = I found this evidence<br/>Red = It's not this... (careful!)";
document.getElementById("reset").innerHTML = "Reset Evidence";
ghostsLeft = JSON.parse(JSON.stringify(ghostArray));
};
function init()
{
var num;
for (var i = 0; i < ghostArray.length; i++)
{
num = getCookie(ghostArray[i][0]);
document.getElementById(ghostArray[i][0]).innerHTML = num;
}
};
function clearHistory()
{
for (var i = 0; i < ghostArray.length; i++)
{
document.cookie = ghostArray[i][0] + "=0;expires=0";
document.getElementById(ghostArray[i][0]).innerHTML = 0;
}
};
function getCookie(cname)
{
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i <ca.length; i++)
{
var c = ca[i];
while (c.charAt(0) == ' ')
{
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "0";
};
function setCookie(cname, cvalue)
{
document.cookie = cname + "=" + cvalue + ";" + "expires=2147483647";
};
function buttonClick(id)
{
buttonArray[id][0]++;
if (buttonArray[id][0] == 0 || buttonArray[id][0] > 2)
{
buttonArray[id][0] = 0;
document.getElementById(id).style.background='#000000';
}
else if (buttonArray[id][0] == 1)
{
document.getElementById(id).style.background='#009900';
}
else
{
document.getElementById(id).style.background='#990000';
}
document.getElementById("Ghosts").innerHTML = "[debug] If you see any of these debug messages, please send a screenshot to Genzzry#9361 on Discord<br/><br/>";
var Evidence = "ev_" + buttonArray[id][1];
Evidence = Evidence.replace(" ", "_");
gtag('event', Evidence);
document.getElementById("Ghosts").innerHTML += "[debug] buttonArray[" + id + "] = " + buttonArray[id] + "<br/>";
ghostsLeft = JSON.parse(JSON.stringify(ghostArray));
document.getElementById("Ghosts").innerHTML += "[debug] array made <br/>";
document.getElementById("Ghosts").innerHTML += "[debug] &nbsp; &nbsp; " + ghostsLeft[0][0] + ", " + ghostsLeft[0][1] + ", " + ghostsLeft[0][2] + ", " + ghostsLeft[0][3] + "<br/>";
document.getElementById("Ghosts").innerHTML += "[debug] &nbsp; &nbsp; " + ghostsLeft[1][0] + ", " + ghostsLeft[1][1] + ", " + ghostsLeft[1][2] + ", " + ghostsLeft[1][3] + "<br/>";
document.getElementById("Ghosts").innerHTML += "[debug] &nbsp; &nbsp; " + ghostsLeft[2][0] + ", " + ghostsLeft[2][1] + ", " + ghostsLeft[2][2] + ", " + ghostsLeft[2][3] + "<br/>";
document.getElementById("Ghosts").innerHTML += "[debug] &nbsp; &nbsp; " + ghostsLeft[3][0] + ", " + ghostsLeft[3][1] + ", " + ghostsLeft[3][2] + ", " + ghostsLeft[3][3] + "<br/>";
var i;
for (i = 0; i < buttonArray.length; i++)
{
document.getElementById("Ghosts").innerHTML += "[debug] Loop i (" + i + "/" + buttonArray.length + ")<br/>";
for (var j = ghostsLeft.length - 1; j >= 0 ; j--)
{
document.getElementById("Ghosts").innerHTML += "[debug] &nbsp; &nbsp; Loop j (" + j + "/" + ghostsLeft.length + ")<br/>";
if (buttonArray[i][0] == 1 && ghostsLeft[j][1] != i && ghostsLeft[j][2] != i && ghostsLeft[j][3] != i)
{
// Ghost does not contain a needed evidence. Remove it!
document.getElementById("Ghosts").innerHTML += "[debug] Button " + i + " is green and " + ghostsLeft[j][0] + " does not contain it<br/>";
ghostsLeft.splice(j,1);
}
else if (buttonArray[i][0] == 2 && (ghostsLeft[j][1] == i || ghostsLeft[j][2] == i || ghostsLeft[j][3] == i))
{
document.getElementById("Ghosts").innerHTML += "[debug] Button " + i + " is red and " + ghostsLeft[j][0] + " contains it<br/>";
ghostsLeft.splice(j,1);
}
else
{
if (buttonArray[i][0] == 1 && ghostsLeft[j][1] == i) { ghostsLeft[j][1] = -1; }
if (buttonArray[i][0] == 1 && ghostsLeft[j][2] == i) { ghostsLeft[j][2] = -1; }
if (buttonArray[i][0] == 1 && ghostsLeft[j][3] == i) { ghostsLeft[j][3] = -1; }
}
}
}
document.getElementById("Ghosts").innerHTML += "[debug] pruned array <br/>";
if (ghostsLeft.length == ghostArray.length)
{
document.getElementById("Ghosts").innerHTML = "<br/>Please click / tap an evidence above.<br/><br/>Black = Unknown<br/>Green = I found this evidence<br/>Red = It's not this... (careful!)";
document.getElementById("reset").innerHTML = "Reset Evidence";
}
else
{
var outputList = "";
var needComma;
outputList += "<br/><table><tr><td><u>Remaining:</u></td><td></td></tr>";
if (ghostsLeft.length == 0)
{
outputList += "<tr><td>No ghosts found</td><td></td></tr>";
document.getElementById("reset").innerHTML = "Reset Evidence";
}
else
{
for (var k = 0; k < ghostsLeft.length; k++)
{
outputList += "<tr><td>" + ghostsLeft[k][0] + "</td>";
if (ghostsLeft.length > 1)
{
needComma = false;
outputList += "<td><span style=\"color: darkgray;\"> (";
if (ghostsLeft[k][1] >= 0 )
{
outputList += buttonArray[ghostsLeft[k][1]][1];
needComma = true;
}
if (ghostsLeft[k][2] >= 0 )
{
if (needComma == true) { outputList += ", "; }
outputList += buttonArray[ghostsLeft[k][2]][1];
needComma = true;
}
if (ghostsLeft[k][3] >= 0 )
{
if (needComma == true) { outputList += ", "; }
outputList += buttonArray[ghostsLeft[k][3]][1];
}
outputList += ")</span></td>";
document.getElementById("reset").innerHTML = "Reset Evidence";
}
else
{
document.getElementById("reset").innerHTML = "Capture " + ghostsLeft[0][0];
}
outputList += "</tr>";
}
}
outputList += "</table>";
document.getElementById("Ghosts").innerHTML = outputList;
}
};
</script>
</head>
<body onLoad="init();">
<div><button id="0" class="left" onClick="buttonClick(0)">EMF 5</button>
<button id="1" class="left" onClick="buttonClick(1)">Ghost Orbs</button>
<button id="2" class="left" onClick="buttonClick(2)">Ghost Writing</button>
<button id="3" class="left" onClick="buttonClick(3)">Freezing Temps</button>
<button id="4" class="left" onClick="buttonClick(4)">Spirit Box</button>
<button id="5" class="left" onClick="buttonClick(5)">Finger Prints</button></div>
<div>
<p id="Ghosts">
<br/>Please click / tap an evidence above.<br/><br/>
Black = Unknown<br/>
Green = I found this evidence<br/>
Red = It's not this... (careful!)
</p>
</div>
<div style="clear: both;"><button id="reset" onClick="buttonReset()">Reset Evidence</button></div>
<div class="name" style="clear: both; margin-top: 2.5em;">Ecto-Containment Unit:</div>
<div style="clear: both;">
<div class="history"><span id="Spirit" class="num">0</span><span class="name"><br/>Spirit</span></div>
<div class="history"><span id="Wraith" class="num">0</span><span class="name"><br/>Wraith</span></div>
<div class="history"><span id="Phantom" class="num">0</span><span class="name"><br/>Phantom</span></div>
<div class="history"><span id="Poltergeist" class="num">0</span><span class="name"><br/>Poltergeist</span></div>
<div class="history"><span id="Banshee" class="num">0</span><span class="name"><br/>Banshee</span></div>
<div class="history"><span id="Jinn" class="num">0</span><span class="name"><br/>Jinn</span></div>
<div class="history"><span id="Mare" class="num">0</span><span class="name"><br/>Mare</span></div>
<div class="history"><span id="Revenant" class="num">0</span><span class="name"><br/>Revenant</span></div>
<div class="history"><span id="Shade" class="num">0</span><span class="name"><br/>Shade</span></div>
<div class="history"><span id="Demon" class="num">0</span><span class="name"><br/>Demon</span></div>
<div class="history"><span id="Yurei" class="num">0</span><span class="name"><br/>Yurei</span></div>
<div class="history"><span id="Oni" class="num">0</span><span class="name"><br/>Oni</span></div>
</div>
<div style="clear: both;"><button class="name" style="margin-top: 0.5em;" onClick="clearHistory()">Release Ghosts</button></div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment