This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Araldia/index.html

1112 lines
36 KiB
HTML
Raw Normal View History

2021-04-04 23:55:21 +02:00
<!DOCTYPE html>
<html>
<title>Araldia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=New+Tegomin&display=swap" rel="stylesheet">
<link href="https://unpkg.com/nes.css@2.3.0/css/nes.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="https://csshake.surge.sh/csshake.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<style>
#levels {
font-size: 27px;
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
}
header {
position: fixed;
left: 0;
top: 0;
width: 100%;
text-align: center;
}
body {
background-color: black;
/*cursor: url('data:image/x-icon;base64,AAACAAEAICAAAAoAAQCoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/eBJN/6Yfbv/EMYf/x0SQ/8dEkP/EMYf/ph9u/3gSTf8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP94Ek3/ph9u/8Qxh//HRJD/xDGH/6Yfbv94Ek3/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/3gSTf+mH27/xDGH/8Qxh/+mH27/eBJN/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
*/
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
2021-04-04 23:55:21 +02:00
}
*{
2021-04-04 23:55:21 +02:00
background-color: black;
color: white;
/*
font-family: 'New Tegomin', serif;
*/
font-family: 'Press Start 2P', cursive;
}
button {
background-color: white;
color: black;
border: 2px solid #5555;
}
button:hover {
background-color: #5555;
color: white;
}
@keyframes slideleft {
from {
background-position: 0%;
}
to {
background-position: 90000%;
}
}
@-webkit-keyframes slideleft {
from {
background-position: 0%;
}
to {
background-position: 90000%;
}
}
.mtW {
width: 500px;
}
#masthead {
background-image: url('https://wallpx.com/image/2020/11/synthwave-cityscape-neon-8-bit.jpg');
background-repeat: repeat-x;
animation: slideleft 6000s infinite linear;
-webkit-animation: slideleft 6000s infinite linear;
width: 900px;
height: 500px;
}
.mc {
width: 18em;
height: 8em;
margin: 1em auto;
overflow: hidden;
background: white;
position: relative;
box-sizing: border-box;
}
.marquee {
top: 6em;
position: relative;
box-sizing: border-box;
animation: marquee 15s linear infinite;
}
#error{
position:absolute;
top:100px;
left:90px;
width:800px;
height:500px;
background-color:red;
display:none;
z-index:99;
}
2021-04-04 23:55:21 +02:00
#beginSect {
display: none;
}
#tooTpk {
position: absolute;
z-index: 9;
display:none;
}
#splash{
position: absolute;
top:0;
bottom:0;
z-index: 99999;
height:100vh;
width:100vw;
}
#splashImg{
display:none;
}
</style>
2021-04-04 23:55:21 +02:00
<body>
<div id="splash">
<center>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<h1 id="clicktobeg">Clicca per iniziare</h1>
<img src="mdglogo.png" id="splashImg" />
</center>
</div>
<div class="nes-container is-rounded is-dark" id="tooTpk" >
<p id="tooltT">Good morning. Thou hast had a good night's sleep, I hope.</p>
</div>
<div class="nes-container with-title is-centered" id="error">
<p class="title" style="background-color: black;">Errore!</p>
<p id="errorData"></p>
<button type="button" class="nes-btn " onclick="error();">Chiudi</button><br />
<i>Controlla la console per più informazioni</i>
</div>
<script>
function error(){
$(this).parent().hide();
if(deadlyError){
location.reload();
}
}
</script>
2021-04-04 23:55:21 +02:00
<header>
<h1>Araldia</h1>
<i>Presidente, abbiamo bisogno del suo aiuto!</i>
<center>
<div id="levels"></div>
</center>
</header>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div id="content">
<center>
<div id="mainMenu">
<div id="masthead"></div>
<br />
<input type="text" placeholder="Nome" id="username" class="nes-input is-dark" style="width:300px"><br />
<button id="begin" class="nes-btn">All'ufficio</button>
</div>
<div id="beginSect">
<br />
<marquee width="60%" direction="up" height="400px;" scrolldelay="400" id="mq">
</marquee>
</div>
<div id="gameField">
</div>
2021-04-04 23:55:21 +02:00
</center>
</div>
<footer>
<h5><span style="display:inline-block;transform: rotate(180deg);">&copy;</span> 2021, Mattia Mascarello, Diego
Scanavino, Giacomo Roggero</h5>
</footer>
</body>
</html>
<script>
var gameVars = {};
var audio = null;
2021-04-04 23:55:21 +02:00
var bool = false;
addEventListener("click", function () {
$("#clicktobeg").hide();
2021-04-04 23:55:21 +02:00
document.getElementsByTagName("body")[0].requestFullscreen();
if (bool) return false;
if (!bool) bool = true;
$("#splashImg").show();
initSplash(0,function ok() {
audio = new Audio('music/beepintro.mp3');
audio.play();
setTimeout(function () {
$("#splash").fadeOut();
audio.src= 'music/Rolemusic - The Black Kitty.mp3';
audio.loop=true;
audio.play();
}, 3000);
});
2021-04-04 23:55:21 +02:00
});
function deAudio(time = 10) {
try {
console.log(audio.volume);
if (audio.volume > 0) {
audio.volume -= 0.01;
setTimeout(deAudio, 10 * time);
}
} catch (error) {
audio.volume = 0;
}
}
var text, parser, xmlDoc;
text = `<?xml version="1.0" encoding="utf-8"?>
<Araldia>
2021-04-04 23:55:21 +02:00
<values>
<value>
<name>health</name>
<title>Salute</title>
<description>Il livello di salute della popolazione. Un indicatore importante</description>
<min>0</min>
<max>100</max>
<default>100</default>
<colorZones>
<colorZone>
<min>0</min>
<max>30</max>
<color>red</color>
<description>Beh, che dire...</description>
</colorZone>
<colorZone>
<min>31</min>
<max>50</max>
<color>orange</color>
<description>Dai...</description>
</colorZone>
<colorZone>
<min>51</min>
<max>60</max>
<color>yellow</color>
<description>Non male</description>
</colorZone>
<colorZone>
<min>61</min>
<max>100</max>
<color>green</color>
<description>Ok</description>
</colorZone>
</colorZones>
<triggers>
<if is="0">
<goto scene="healthGameOver" />
</if>
</triggers>
</value>
<value>
<name>school</name>
<title>Scuola</title>
<description>Il tuo consenso da parte della popolazione. Un indicatore importante</description>
<min>0</min>
<max>100</max>
<default>100</default>
<colorZones>
<colorZone>
<min>0</min>
<max>30</max>
<color>red</color>
<description>Beh, che dire...</description>
</colorZone>
<colorZone>
<min>31</min>
<max>50</max>
<color>orange</color>
<description>Dai...</description>
</colorZone>
<colorZone>
<min>51</min>
<max>60</max>
<color>yellow</color>
<description>Non male</description>
</colorZone>
<colorZone>
<min>61</min>
<max>100</max>
<color>green</color>
<description>Ok</description>
</colorZone>
</colorZones>
<triggers>
<if is="0">
<goto scene="consensusGameOver" />
2021-04-04 23:55:21 +02:00
</if>
</triggers>
</value>
<value>
<name>consensus</name>
<title>Consenso</title>
<description>Il tuo consenso da parte della popolazione. Un indicatore importante</description>
<min>0</min>
<max>100</max>
<default>100</default>
<colorZones>
<colorZone>
<min>0</min>
<max>30</max>
<color>red</color>
<description>Beh, che dire...</description>
</colorZone>
<colorZone>
<min>31</min>
<max>50</max>
<color>orange</color>
<description>Dai...</description>
</colorZone>
<colorZone>
<min>51</min>
<max>60</max>
<color>yellow</color>
<description>Non male</description>
</colorZone>
<colorZone>
<min>61</min>
<max>100</max>
<color>green</color>
<description>Ok</description>
</colorZone>
</colorZones>
<triggers>
<if is="0">
<goto scene="consensusGameOver" />
</if>
<if lessThan="50">
<goto scene="consensusWarn" />
</if>
</triggers>
</value>
</values>
<sections>
<events>
<event frames="3" chance="10">
<!--
Ogni 3 schermate sorteggia, chance è la percentuale di probabilità che questo evento accada
-->
<if who="checkpoints" what="virusDeveloped" is="true" />
<name>new_variant</name>
<title>Nuova variante</title>
<description>
Il corriere della Pera annuncia l'arrivo di una nuova variante di
<print who="virus" what="name" />
2021-04-04 23:55:21 +02:00
. La nuova variante è
<sectionGroup atLeastOne="true" chance="100">
<!--
uno e uno soltanto di questi eventi avverrà sicuramente
-->
<section chance="10">
più letale del 10%
<set who="virus" what="lethal" delta="+10" />
</section>
<section chance="10">
meno letale del 10%
<set who="virus" what="lethal" delta="-10" />
</section>
</sectionGroup>
</description>
<set who="checkpoints" what="virusMutated" to="true" />
<choices>
<choice>
<title>Ho capito</title>
<effects>
<goto question="next" />
</effects>
</choice>
</choices>
</event>
<event frames="20" chance="45">
<if who="levels" what="consensus" lessThan="25" />
<name>crisi_di_governo</name>
<title>Crisi di governo</title>
<description>
<sectionGroup atLeastOne="true" chance="100">
<section chance="40">
A causa del
<print what="virusName" />
, il partito
<print who="parties" what="rand" />
ha deciso di innescare una crisi di governo.
Per fortuna i tuoi alleati ti sostengono e ne esci quasi illeso.
<set who="levels" what="consensus" delta="-5" />
</section>
<section chance="50">
A causa del
<print what="virusName" />
, il partito
<print who="parties" what="rand" />
ha deciso di innescare una crisi di governo.
Il tuo governo subisce un reimpasto.
<set who="levels" what="consensus" delta="-10" />
</section>
<section chance="10">
A causa della tua gestione del
<print what="virusName" />
, l'esercito tenta un colpo di stato.
<goto scene="coup" />
</section>
</sectionGroup>
</description>
<choices>
<choice>
<title>Ok</title>
<effects>
<goto question="next" />
</effects>
</choice>
</choices>
</event>
</events>
<scenes>
<scene>
<name>fondi_europei_scuola_yesno</name>
<title>Detto fatto</title>
<description>
<if who="checkpoints" what="consensus" lessThan="50">
I tuoi alleati di governo ti guardano con disappunto.
<set who="levels" what="school" delta="+5" />
<set who="levels" what="consensus" delta="-5" />
</if>
<else>
I docenti di tutte le scuole ti sorridono.
<set who="levels" what="school" delta="+10" />
<set who="levels" what="consensus" delta="+10" />
</else>
</description>
<set who="checkpoints" what="virusMutated" to="true" />
<choices>
<choice>
<title>Ok</title>
<effects>
<goto question="next" />
</effects>
</choice>
</choices>
</scene>
<scene>
<name>coup</name>
<title>Fuoco alle polveri</title>
<description>
Mentre vieni bersagliato dall'artiglieria ti rinchiudi nel tuo ufficio.
Dopo esserti barricato per alcuni minuti, una coltre di fumo di odore pungente riempie l'ufficio.
</description>
<gameOver />
</scene>
</scenes>
<questions>
<question>
<if who="checkpoints" what="virusDeveloped" is="false" />
2021-04-04 23:55:21 +02:00
<name>fondi_europei_scuola</name>
<title>Fondi Europei per la scuola</title>
<description>
L'unione Europea offre dei fondi per la scuola a patto di integrare i programmi scolastici con quelli degli altri stati
<if who="levels" what="consensus" lessThan="50">
I tuoi alleati di governo ti guardano con disappunto.
</if>
</description>
<set who="checkpoints" what="virusMutated" to="true" />
<choices>
<choice>
<title>Certo</title>
<effects>
2021-04-04 23:55:21 +02:00
<goto scene="fondi_europei_scuola_yesno" />
</effects>
2021-04-04 23:55:21 +02:00
</choice>
<choice>
<title>Per niente!</title>
<effects>
<goto scene="fondi_europei_scuola_yesno" />
</effects>
</choice>
</choices>
</question>
</questions>
</sections>
<viruses>
<virus>
<name>eys</name>
<title>eys-1</title>
<description>Descrizione</description>
<stats>
<transmissionSpeed>1</transmissionSpeed>
<lethality>1</lethality>
<hospitalizationRate>1</hospitalizationRate>
</stats>
<infoboxes>
<infobox>
<title>Infobox1</title>
<description>Testo</description>
</infobox>
</infoboxes>
</virus>
</viruses>
<parties>
<party>
<name>partito_giallo</name>
<title>Partito Giallo</title>
<secretary>Domenico Sansovino</secretary>
<description>Un partito di centro moderato</description>
<motto>Viva la libertàaaaa iaaaaaaaa</motto>
</party>
<party>
<name>no_al_5g</name>
<title>No al 5G</title>
<secretary>Giovanna Vogheri</secretary>
<description>Un partito il cui interesse esclusivo è bandire il 5G, quale emissario di Satana,</description>
<motto>Uniti nella nostra APERTURA MENTALE</motto>
</party>
<party>
<name>partito_anarchico</name>
<title>Partito anarchico</title>
<secretary>Carlo Massimo</secretary>
<description>Fanno quello che vogliono</description>
<motto>Siamo anarchici ma non quando votiamo</motto>
</party>
<party>
<name>il_popolo_delle_mamme</name>
<title>Il popolo delle mamme</title>
<secretary>Silvia Pavesini</secretary>
<description>Anche questi fanno quello che vogliono </description>
<motto>I bambiniiiiiiiii</motto>
</party>
<party>
<name>laser</name>
<title>Laser a cinqui euri</title>
<secretary>Aieie Brasorx</secretary>
<description>Usano i laser in parlamento per accecare l'opposizione</description>
<motto>Solo a cinqui euri, beli i laser</motto>
</party>
<party>
<name>totocalcio</name>
<title>Totocalcio</title>
<secretary>Toto Rinaldi</secretary>
<description>Scommettono sulla loro vittoria, per ora hanno solo perso</description>
<motto>Scommetti sul tuo futuro (nel frattempo organizziamo i brogli)</motto>
</party>
<party>
<name>forza_vecchia</name>
<title>Forza Vecchia</title>
<secretary>Federico VII di Salerno</secretary>
<description>Medievisti puri</description>
<motto>Si stava meglio quando si stava peggio</motto>
</party>
<party>
<name>Ikea</name>
<title>Sveglia dell' IKEA</title>
<secretary>Äntligen Färgglad</secretary>
<description>Nessuno capisce quello che dicono</description>
<motto>När är det bäst att besöka oss?</motto>
</party>
<party>
<name>sedia girevole</name>
<title>Sedia Girevole</title>
<secretary>Francesco Eppson</secretary>
<description>Girano tutto il giorno in parlamento sulle poltrone</description>
<motto>Uiiiiiiiii haha</motto>
</party>
<party>
<name>basta_powerpoint</name>
<title>Basta PowePoint</title>
<secretary>Stefano Mansioni</secretary>
<description>Odiano PowePoint</description>
<motto>BASTA POWERPOINT BASTAAAAAAAAAA: Usate Prezi por favor</motto>
</party>
</parties>
<misc>
<welcomeMessage scrollDelay="400" duration="10" direction="up">
Testo di prova
2021-04-04 23:55:21 +02:00
</welcomeMessage>
</misc>
</Araldia>
`;
var deadlyError=false;
function chunkString(str, length) {
return str.match(new RegExp('.{1,' + length + '}', 'g'));
}
function brLine(lines){
lines=lines.trim().replace("\n");
var g=lines;
try{
lines= chunkString(lines,80).join("<br />");
}
catch(e){
lines=g;
}
return lines;
}
function gvRead(who, what) {
try {
return gameVars[who][what];
}
catch (e) {
return false;
}
}
function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
2021-04-04 23:55:21 +02:00
function print(who, what) {
return gvRead(who, what) ? gvRead(who, what) : "";
2021-04-04 23:55:21 +02:00
}
function set(who, what, delta = null, to = null) {
if (gameVars[who] == undefined) gameVars[who] = {};
2021-04-04 23:55:21 +02:00
if (delta != null) {
if (gameVars[who][what] == undefined) gameVars[who][what] = 0;
gameVars[who][what] += parseInt(delta);
2021-04-04 23:55:21 +02:00
}
else {
gameVars[who][what] = to;
}
if(who=="levels"){
if(parseInt(gvRead(who,what))>100){
gameVars[who][what] = 100;
}
else if(parseInt(gvRead(who,what))<0){
gameVars[who][what] = 100;
}
}
else if(who=="virus" && what=="letality" || what=="hospitalizationRate" || what=="transmissionSpeed"){
if(parseInt(gvRead(who,what))>100){
gameVars[who][what] = 100;
}
else if(parseInt(gvRead(who,what))<0){
gameVars[who][what] = 100;
}
}
2021-04-04 23:55:21 +02:00
}
function createXPathFromElement(elm) {
var allNodes = document.getElementsByTagName('*');
for (var segs = []; elm && elm.nodeType == 1; elm = elm.parentNode) {
if (elm.hasAttribute('id')) {
var uniqueIdCount = 0;
for (var n = 0; n < allNodes.length; n++) {
if (allNodes[n].hasAttribute('id') && allNodes[n].id == elm.id) uniqueIdCount++;
if (uniqueIdCount > 1) break;
};
if (uniqueIdCount == 1) {
segs.unshift('id("' + elm.getAttribute('id') + '")');
return segs.join('/');
} else {
segs.unshift(elm.localName.toLowerCase() + '[@id="' + elm.getAttribute('id') + '"]');
}
} else if (elm.hasAttribute('class')) {
segs.unshift(elm.localName.toLowerCase() + '[@class="' + elm.getAttribute('class') + '"]');
} else {
for (i = 1, sib = elm.previousSibling; sib; sib = sib.previousSibling) {
if (sib.localName == elm.localName) i++;
};
segs.unshift(elm.localName.toLowerCase() + '[' + i + ']');
};
};
return segs.length ? '/' + segs.join('/') : null;
};
2021-04-04 23:55:21 +02:00
function cTagRecursive(tag, iteration = (-1)) {
iteration++;
if (iteration == 0) {
/*cleanup*/
var l = tag.getElementsByTagName("sectionGroup");
for (var it = 0; it < l.length; it++) {
l[it].made=false;
}
}
html = "";
var currentTag = null, quitDo = false;
for (var i = 0; tag.childNodes.length; i++) {
2021-04-04 23:55:21 +02:00
currentTag = tag.childNodes[i];
if (currentTag == undefined) return html;
if (currentTag.nodeName == "#comment") continue;
2021-04-04 23:55:21 +02:00
if (currentTag.nodeName == "#text") {
var p = currentTag.parentNode;
while (p != null && p.nodeName != "description" && p.nodeName != "title" && p.nodeName != "section") {
p = p.parentNode;
}
if (p == null) continue;
switch (p.nodeName) {
case "description":
html += brLine(currentTag.textContent)+"<br />";
break;
case "title":
if (p.parentNode.nodeName=="choice") continue;
html += "<h3>" + currentTag.textContent + "</h3><br />";
break;
case "section":
html += currentTag.textContent+"<br />";
break;
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.nodeName == "if" || currentTag.nodeName == "elseif") {
if (currentTag.parentNode.nodeName == "event" || currentTag.parentNode.nodeName == "question" || currentTag.parentNode.nodeName == "scene"&& currentTag.childNodes.length == 0) {
quitDo = true;
}
else if (currentTag.parentNode.nodeName == "triggers") {
currentTag.setAttribute("who", "levels");
currentTag.setAttribute("what", currentTag.parentNode.parentNode.getElementsByTagName("name")[0].textContent);
}
2021-04-04 23:55:21 +02:00
if (currentTag.hasAttribute("is")) {
if (currentTag.attributes["is"].value == gvRead(currentTag.attributes["who"].value, currentTag.attributes["what"].value)) {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
else if (quitDo) {
return false;
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.hasAttribute("lessThan")) {
if (currentTag.attributes["lessThan"].value < gvRead(currentTag.attributes["who"].value, currentTag.attributes["what"].value)) {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
else if (quitDo) {
return false;
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.hasAttribute("moreThan")) {
if (currentTag.attributes["moreThan"].value > gvRead(currentTag.attributes["who"].value, currentTag.attributes["what"].value)) {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
else if (quitDo) {
return false;
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.hasAttribute("lessOrEqual")) {
if (currentTag.attributes["lessOrEqual"].value <= gvRead(currentTag.attributes["who"].value, currentTag.attributes["what"].value)) {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
else if (quitDo) {
return false;
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.hasAttribute("moreOrEqual")) {
if (currentTag.attributes["moreOrEqual"].value >= gvRead(currentTag.attributes["who"].value, currentTag.attributes["what"].value)) {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
else if (quitDo) {
return false;
}
}
else if (quitDo) {
return false;
2021-04-04 23:55:21 +02:00
}
}
else if (currentTag.nodeName == "section") {
if (currentTag.parentNode.made) continue;
var doForce = false;
if (currentTag.parentNode.nodeName == "sectionGroup" && currentTag.parentNode.attributes["atLeastOne"].value == "true") {
var c = currentTag.nextSibling;
while (c != null && c.nodeName != "section") {
c = c.nextSibling;
}
if (c == null) {
doForce = true;
}
}
if (currentTag.attributes["chance"].value < randomInteger(0, 99) || doForce) {
currentTag.parentNode.made = true;
html += cTagRecursive(currentTag, iteration);
}
}
else if (currentTag.nodeName == "sectionGroup") {
if (currentTag.hasAttribute("chance") || currentTag.attributes["chance"].value < randomInteger(0, 99)) {
html += cTagRecursive(currentTag, iteration);
}
}
else if (currentTag.nodeName == "set") {
if (currentTag.hasAttribute("delta")) set(currentTag.attributes["who"].value, currentTag.attributes["what"].value, currentTag.attributes["delta"].value, null);
else set(currentTag.attributes["who"].value, currentTag.attributes["what"].value, null, currentTag.attributes["to"].value);
}
else if (currentTag.nodeName == "print") {
html += print(currentTag.attributes["who"].value, currentTag.attributes["what"].value);
}
else if (currentTag.nodeName == "goto") {
if (currentTag.hasAttribute("scene")) {
if (currentTag.parentNode.nodeName == "effects") {
var v= "&arr;";
2021-04-04 23:55:21 +02:00
try{
var t=currentTag.parentNode.parentNode.getElementsByTagName("title")[0];
v=t.textContent;
}
catch(e){
}
html += "&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"nes-btn is-primary\" onclick=\"goto('scene','" + currentTag.attributes["scene"].value + "');\">"+v+"</button>";
continue;
}
var child = window.cats.getElementsByTagName("scenes")[0].children;
for (var i = 0; i < child.length; i++) {
if (child[i].getElementsByTagName("name")[0].textContent == currentTag.attributes["scene"].value) {
console.log(child[i]);
html += cTagRecursive(child[i], iteration);
break;
}
}
2021-04-04 23:55:21 +02:00
}
else if (currentTag.hasAttribute("question")) {
if (currentTag.parentNode.nodeName == "effects") {
var v= "&arr;";
try{
var t=currentTag.parentNode.parentNode.getElementsByTagName("title")[0];
v=t.textContent;
}
catch(e){
}
html += "&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"nes-btn is-primary\" onclick=\"goto('question','" + currentTag.attributes["question"].value + "');\">"+v+"</button>";
continue;
}
var child = window.cats.getElementsByTagName("questions")[0].childNodes;
for (var i = 0; i < child.length; i++) {
if (child[i].getElementsByTagName("name") == currentTag.attributes["question"].value) {
html = "";
html += cTagRecursive(child[i], iteration);
break;
}
}
}
else if (currentTag.hasAttribute("event")) {
if (currentTag.hasAttribute("scene")) {
if (currentTag.parentNode.nodeName == "effects") {
var v= "&arr;";
try{
var t=currentTag.parentNode.parentNode.getElementsByTagName("title")[0];
v=t.textContent;
}
catch(e){
}
html += "&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"nes-btn is-primary\" onclick=\"goto('event','" + currentTag.attributes["event"].value + "');\">"+v+"</button>";
continue;
}
var child = window.cats.getElementsByTagName("events")[0].childNodes;
for (var i = 0; i < child.length; i++) {
if (child[i].getElementsByTagName("name") == currentTag.attributes["event"].value) {
html = "";
html += cTagRecursive(child[i], iteration);
break;
}
}
}
}
}
else {
html += cTagRecursive(currentTag, iteration);
2021-04-04 23:55:21 +02:00
}
}
2021-04-04 23:55:21 +02:00
return html;
}
var i = 0, childrenEl = null, tHtml = "";
parser = new DOMParser();
xmlDoc = parser.parseFromString(text, "text/xml");
var cats = xmlDoc.children[0];
var values = cats.getElementsByTagName("values")[0];
tHtml = `
<table>
`;
for (i = 0; i < values.childElementCount; i++) {
childrenEl = values.children[i];
console.log(childrenEl);
tHtml += `<tr id="` + childrenEl.getElementsByTagName("name")[0].textContent + `" onmouseover="ttvy(this)" onmouseout="ttvn(this)" data-desc="` + childrenEl.getElementsByTagName("description")[0].textContent + `"><td>` + childrenEl.getElementsByTagName("title")[0].textContent + `</td><td class="mtW">&nbsp;&nbsp;&nbsp;<progress class="nes-progress is-success" style=" width:400px;" min="` + childrenEl.getElementsByTagName("min")[0].textContent + `" max="` + childrenEl.getElementsByTagName("max")[0].textContent + `" value="` + childrenEl.getElementsByTagName("default")[0].textContent + `" ></progress></td><td>` + childrenEl.getElementsByTagName("default")[0].textContent + `/` + childrenEl.getElementsByTagName("max")[0].textContent + `</td></tr>`;
2021-04-04 23:55:21 +02:00
}
console.log(tHtml);
tHtml += "</table>";
$("#levels").hide();
document.getElementById("levels").innerHTML = tHtml;
$("#begin").click(function () {
if ($("#username").val().length == 0) return false;
setTimeout(function () { deAudio(6); }, 100);
$("#mainMenu").fadeOut();
$("#beginSect").fadeIn();
$("#mq").attr("scrolldelay",cats.getElementsByTagName("misc")[0].getElementsByTagName("welcomeMessage")[0].attributes["scrollDelay"].value);
$("#mq").attr("direction",cats.getElementsByTagName("misc")[0].getElementsByTagName("welcomeMessage")[0].attributes["direction"].value);
$("#mq").html(cats.getElementsByTagName("misc")[0].getElementsByTagName("welcomeMessage")[0].textContent);
setTimeout(function(){
$("#beginSect").fadeOut();
$("#levels").fadeIn();
Q();
audio.src="music/Rolemusic - The White Frame.mp3";
setTimeout(function(){
for(var i=0;i<1;i+=0.001){
audio.volume=i;
}
audio.volume=1;
audio.play();
},6000)
},cats.getElementsByTagName("misc")[0].getElementsByTagName("welcomeMessage")[0].attributes["duration"].value*1000);
})
function randEl(category){
return cats.getElementsByTagName(category)[0].children[randomInteger(0,cats.getElementsByTagName(category)[0].childElementCount-1)];
}
function getEl(category,name){
if(category=="questions" && name=="next") return Q();
var ets= cats.getElementsByTagName(category)[0].getElementsByTagName("name");
for(var i=0;i<ets.length;i++){
if(ets[i].textContent==name){
return setField(ets[i].parentNode);
}
}
}
function setField(h){
var res=cTagRecursive(h);
deadlyError=true;
if(res===false) throw "No available resources";
var tml="<br /><br /><br /><br />"+res;
$("#gameField").hide();
$("#gameField").html(tml);
$("#gameField").show();
}
function Q(){
var h=randEl("questions");
setField(h);
}
window.onerror = function(message, source, lineno, colno, error) {
$("#errorData").html(`
<div class="nes-table-responsive">
<table class="nes-table is-bordered is-centered" style="height:300px;width:700px;">
<tr>
<td>Message</td>
<td>`+message+`</td>
</tr>
<tr>
<td>Source</td>
<td>`+source+`</td>
</tr>
<tr>
<td>Line and column</td>
<td>`+lineno+`:`+colno+`</td>
</tr>
2021-04-04 23:55:21 +02:00
<tr>
<td>Error</td>
<td>`+error+`</td>
</tr>
2021-04-04 23:55:21 +02:00
</table>
</div>
`);
$("#error").show();
}
2021-04-04 23:55:21 +02:00
function dragElement(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
if (document.getElementById(elmnt.id + "header")) {
// if present, the header is where you move the DIV from:
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
// otherwise, move the DIV from anywhere inside the DIV:
elmnt.onmousedown = dragMouseDown;
}
2021-04-04 23:55:21 +02:00
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}
2021-04-04 23:55:21 +02:00
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
}
}
dragElement(document.getElementById("error"));
function goto(cat,name){
getEl(cat+"s",name);
}
var tooltipvisible=false,text="Mayor Tom, There is something wrong!";
function ttvy(a){
tooltipvisible=true;
text=a.attributes["data-desc"].value;
}
function ttvn(a){
tooltipvisible=false;
}
//Make the DIV element draggagle:
tooltipel(document.getElementById("tooTpk"));
function tooltipel(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
document.onmousemove = elementDrag;
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
elmnt.style.display=tooltipvisible?"block":"none";
document.getElementById("tooltT").innerHTML=text;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (pos4) + "px";
elmnt.style.left = (pos3) + "px";
}
}
function initSplash(i=0,callback){
if(i<80){
setTimeout(function(){
$("#splashImg").css("width",i+"%");
initSplash(i+1,callback);
},100);
}
else{
callback();
}
}
2021-04-04 23:55:21 +02:00
</script>