mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 00:34:00 -06:00
This error is patched in the game now, so no need for the bandaid
This commit is contained in:
-103
@@ -1,103 +0,0 @@
|
|||||||
<h1>Tonsil Inoculator</h1>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
|
|
||||||
localStorage.roster_bak = localStorage.roster;
|
|
||||||
let roster = JSON.parse(localStorage.roster);
|
|
||||||
for (let char in roster) {
|
|
||||||
document.body.innerHTML += '<h3>Patching ' + char;
|
|
||||||
function patch(from, to) {
|
|
||||||
function count(spell) {
|
|
||||||
let t = roster[char].Spells.filter(a => a[0] == spell);
|
|
||||||
return t.length == 1 ? toArabic(t[0][1]) : 0;
|
|
||||||
}
|
|
||||||
let tf = count(from);
|
|
||||||
if (!tf) return;
|
|
||||||
let tt = count(to);
|
|
||||||
let total = tf + tt;
|
|
||||||
document.body.innerHTML += '<p>Patching ' + from + ' to ' + to;
|
|
||||||
roster[char].Spells = roster[char].Spells.filter(a => a[0] != to);
|
|
||||||
for (let spell of roster[char].Spells) {
|
|
||||||
if (spell[0] == from) {
|
|
||||||
spell[0] = to;
|
|
||||||
spell[1] = toRoman(total);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
patch('Innoculate', 'Inoculate');
|
|
||||||
patch('Tonsilectomy', 'Tonsillectomy');
|
|
||||||
}
|
|
||||||
localStorage.roster = JSON.stringify(roster);
|
|
||||||
document.body.innerHTML += '<h3>Done';
|
|
||||||
|
|
||||||
function Starts(s, pre) {
|
|
||||||
return 0 === s.indexOf(pre);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toRoman(n) {
|
|
||||||
if (!n) return "N";
|
|
||||||
var s = "";
|
|
||||||
function _rome(dn,ds) {
|
|
||||||
if (n >= dn) {
|
|
||||||
n -= dn;
|
|
||||||
s += ds;
|
|
||||||
return true;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
if (n < 0) {
|
|
||||||
s = "-";
|
|
||||||
n = -n;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (_rome(10000,"T")) {0;}
|
|
||||||
_rome(9000,"MT");
|
|
||||||
_rome(5000,"A");
|
|
||||||
_rome(4000,"MA");
|
|
||||||
while (_rome(1000,"M")) {0;}
|
|
||||||
_rome(900,"CM");
|
|
||||||
_rome(500,"D");
|
|
||||||
_rome(400,"CD");
|
|
||||||
while (_rome(100,"C")) {0;}
|
|
||||||
_rome(90,"XC");
|
|
||||||
_rome(50,"L");
|
|
||||||
_rome(40,"XL");
|
|
||||||
while (_rome(10,"X")) {0;}
|
|
||||||
_rome(9,"IX");
|
|
||||||
_rome(5,"V");
|
|
||||||
_rome(4,"IV");
|
|
||||||
while (_rome(1,"I")) {0;}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toArabic(s) {
|
|
||||||
n = 0;
|
|
||||||
s = s.toUpperCase();
|
|
||||||
function _arab(ds,dn) {
|
|
||||||
if (!Starts(s, ds)) return false;
|
|
||||||
s = s.substr(ds.length);
|
|
||||||
n += dn;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
while (_arab("T",10000)) {0;}
|
|
||||||
_arab("MT",9000);
|
|
||||||
_arab("A",5000);
|
|
||||||
_arab("MA",4000);
|
|
||||||
while (_arab("M",1000)) {0;}
|
|
||||||
_arab("CM",900);
|
|
||||||
_arab("D",500);
|
|
||||||
_arab("CD",400);
|
|
||||||
while (_arab("C",100)) {0;}
|
|
||||||
_arab("XC",90);
|
|
||||||
_arab("L",50);
|
|
||||||
_arab("XL",40);
|
|
||||||
while (_arab("X",10)) {0;}
|
|
||||||
_arab("IX",9);
|
|
||||||
_arab("V",5);
|
|
||||||
_arab("IV",4);
|
|
||||||
while (_arab("I",1)) {0;}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
Reference in New Issue
Block a user